@operato/app 1.0.0-alpha.9 → 1.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/@types/global/index.d.ts +2 -0
- package/CHANGELOG.md +335 -17
- package/demo/data-grist-test.html +15 -10
- package/demo/index.html +1 -10
- package/dist/src/{grist → grist-editor}/index.d.ts +0 -0
- package/dist/src/grist-editor/index.js +28 -0
- package/dist/src/grist-editor/index.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-code.d.ts +7 -0
- package/dist/src/grist-editor/ox-grist-editor-code.js +53 -0
- package/dist/src/grist-editor/ox-grist-editor-code.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-crontab.d.ts +8 -0
- package/dist/src/grist-editor/ox-grist-editor-crontab.js +50 -0
- package/dist/src/grist-editor/ox-grist-editor-crontab.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-json.d.ts +7 -0
- package/dist/src/grist-editor/ox-grist-editor-json.js +54 -0
- package/dist/src/grist-editor/ox-grist-editor-json.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-parameters.d.ts +12 -0
- package/dist/src/{grist/parameters-editor.js → grist-editor/ox-grist-editor-parameters.js} +16 -37
- package/dist/src/grist-editor/ox-grist-editor-parameters.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-partition-keys.d.ts +11 -0
- package/dist/src/grist-editor/ox-grist-editor-partition-keys.js +74 -0
- package/dist/src/grist-editor/ox-grist-editor-partition-keys.js.map +1 -0
- package/dist/src/{grist/code-editor.d.ts → grist-editor/ox-grist-editor-resource-code.d.ts} +2 -2
- package/dist/src/{grist/code-editor.js → grist-editor/ox-grist-editor-resource-code.js} +10 -5
- package/dist/src/grist-editor/ox-grist-editor-resource-code.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-resource-id.d.ts +9 -0
- package/dist/src/grist-editor/ox-grist-editor-resource-id.js +72 -0
- package/dist/src/grist-editor/ox-grist-editor-resource-id.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-resource-object.d.ts +11 -0
- package/dist/src/{grist/object-editor.js → grist-editor/ox-grist-editor-resource-object.js} +30 -78
- package/dist/src/grist-editor/ox-grist-editor-resource-object.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-value-map.d.ts +11 -0
- package/dist/src/grist-editor/ox-grist-editor-value-map.js +74 -0
- package/dist/src/grist-editor/ox-grist-editor-value-map.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-renderer-crontab.d.ts +2 -0
- package/dist/src/grist-editor/ox-grist-renderer-crontab.js +26 -0
- package/dist/src/grist-editor/ox-grist-renderer-crontab.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-id.d.ts +2 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-id.js +9 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-id.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-object.d.ts +2 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-object.js +22 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-object.js.map +1 -0
- package/dist/src/{grist/parameters-editor-builder.d.ts → grist-editor/ox-parameters-builder.d.ts} +1 -1
- package/dist/src/{grist/parameters-editor-builder.js → grist-editor/ox-parameters-builder.js} +10 -11
- package/dist/src/grist-editor/ox-parameters-builder.js.map +1 -0
- package/dist/src/grist-editor/ox-popup-code-input.d.ts +12 -0
- package/dist/src/grist-editor/ox-popup-code-input.js +71 -0
- package/dist/src/grist-editor/ox-popup-code-input.js.map +1 -0
- package/dist/src/grist-editor/ox-popup-crontab-input.d.ts +11 -0
- package/dist/src/grist-editor/ox-popup-crontab-input.js +74 -0
- package/dist/src/grist-editor/ox-popup-crontab-input.js.map +1 -0
- package/dist/src/{grist/parameters-editor-popup.d.ts → grist-editor/ox-popup-parameters-builder.d.ts} +1 -1
- package/dist/src/{grist/parameters-editor-popup.js → grist-editor/ox-popup-parameters-builder.js} +15 -15
- package/dist/src/grist-editor/ox-popup-parameters-builder.js.map +1 -0
- package/dist/src/grist-editor/ox-popup-partition-keys-input.d.ts +12 -0
- package/dist/src/grist-editor/ox-popup-partition-keys-input.js +98 -0
- package/dist/src/grist-editor/ox-popup-partition-keys-input.js.map +1 -0
- package/dist/src/grist-editor/ox-popup-value-map-input.d.ts +12 -0
- package/dist/src/grist-editor/ox-popup-value-map-input.js +104 -0
- package/dist/src/grist-editor/ox-popup-value-map-input.js.map +1 -0
- package/dist/src/{grist/id-selector.d.ts → grist-editor/ox-selector-resource-id.d.ts} +4 -3
- package/dist/src/{grist/id-selector.js → grist-editor/ox-selector-resource-id.js} +23 -18
- package/dist/src/grist-editor/ox-selector-resource-id.js.map +1 -0
- package/dist/src/{grist/object-selector.d.ts → grist-editor/ox-selector-resource-object.d.ts} +4 -3
- package/dist/src/{grist/object-selector.js → grist-editor/ox-selector-resource-object.js} +30 -25
- package/dist/src/grist-editor/ox-selector-resource-object.js.map +1 -0
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.js +3 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/input/index.d.ts +3 -0
- package/dist/src/input/index.js +4 -0
- package/dist/src/input/index.js.map +1 -0
- package/dist/src/input/ox-input-background-pattern.d.ts +1 -1
- package/dist/src/input/ox-input-background-pattern.js +6 -3
- package/dist/src/input/ox-input-background-pattern.js.map +1 -1
- package/dist/src/input/ox-input-fill-style.d.ts +2 -3
- package/dist/src/input/ox-input-fill-style.js +2 -2
- package/dist/src/input/ox-input-fill-style.js.map +1 -1
- package/dist/src/input/ox-input-graphql.d.ts +36 -0
- package/dist/src/input/ox-input-graphql.js +161 -0
- package/dist/src/input/ox-input-graphql.js.map +1 -0
- package/dist/src/property-editor/index.d.ts +24 -0
- package/dist/src/property-editor/index.js +58 -0
- package/dist/src/property-editor/index.js.map +1 -0
- package/dist/src/property-editor/ox-property-editor-graphql.d.ts +5 -0
- package/dist/src/property-editor/ox-property-editor-graphql.js +15 -0
- package/dist/src/property-editor/ox-property-editor-graphql.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -22
- package/src/grist-editor/index.ts +30 -0
- package/src/grist-editor/ox-grist-editor-code.ts +62 -0
- package/src/grist-editor/ox-grist-editor-crontab.ts +62 -0
- package/src/grist-editor/ox-grist-editor-json.ts +62 -0
- package/src/{grist/parameters-editor.ts → grist-editor/ox-grist-editor-parameters.ts} +13 -26
- package/src/grist-editor/ox-grist-editor-partition-keys.ts +86 -0
- package/src/{grist/code-editor.ts → grist-editor/ox-grist-editor-resource-code.ts} +4 -5
- package/src/grist-editor/ox-grist-editor-resource-id.ts +85 -0
- package/src/{grist/object-editor.ts → grist-editor/ox-grist-editor-resource-object.ts} +28 -63
- package/src/grist-editor/ox-grist-editor-value-map.ts +86 -0
- package/src/grist-editor/ox-grist-renderer-crontab.ts +30 -0
- package/src/{grist/id-renderer.ts → grist-editor/ox-grist-renderer-resource-id.ts} +4 -3
- package/src/grist-editor/ox-grist-renderer-resource-object.ts +26 -0
- package/src/{grist/parameters-editor-builder.ts → grist-editor/ox-parameters-builder.ts} +4 -6
- package/src/grist-editor/ox-popup-code-input.ts +65 -0
- package/src/grist-editor/ox-popup-crontab-input.ts +74 -0
- package/src/{grist/parameters-editor-popup.ts → grist-editor/ox-popup-parameters-builder.ts} +5 -5
- package/src/grist-editor/ox-popup-partition-keys-input.ts +95 -0
- package/src/grist-editor/ox-popup-value-map-input.ts +101 -0
- package/src/{grist/id-selector.ts → grist-editor/ox-selector-resource-id.ts} +12 -6
- package/src/{grist/object-selector.ts → grist-editor/ox-selector-resource-object.ts} +15 -9
- package/src/index.ts +3 -1
- package/src/input/index.ts +3 -0
- package/src/input/ox-input-background-pattern.ts +6 -3
- package/src/input/ox-input-fill-style.ts +3 -4
- package/src/input/ox-input-graphql.ts +169 -0
- package/src/property-editor/index.ts +59 -0
- package/src/property-editor/ox-property-editor-graphql.ts +12 -0
- package/themes/app-theme.css +142 -0
- package/themes/grist-theme.css +194 -0
- package/themes/oops-theme.css +26 -0
- package/themes/report-theme.css +47 -0
- package/dist/src/grist/code-editor.js.map +0 -1
- package/dist/src/grist/id-input.d.ts +0 -19
- package/dist/src/grist/id-input.js +0 -119
- package/dist/src/grist/id-input.js.map +0 -1
- package/dist/src/grist/id-renderer.d.ts +0 -2
- package/dist/src/grist/id-renderer.js +0 -9
- package/dist/src/grist/id-renderer.js.map +0 -1
- package/dist/src/grist/id-selector.js.map +0 -1
- package/dist/src/grist/index.js +0 -11
- package/dist/src/grist/index.js.map +0 -1
- package/dist/src/grist/object-editor.d.ts +0 -18
- package/dist/src/grist/object-editor.js.map +0 -1
- package/dist/src/grist/object-selector.js.map +0 -1
- package/dist/src/grist/parameters-editor-builder.js.map +0 -1
- package/dist/src/grist/parameters-editor-popup.js.map +0 -1
- package/dist/src/grist/parameters-editor.d.ts +0 -19
- package/dist/src/grist/parameters-editor.js.map +0 -1
- package/dist/src/input/ox-input-color-gradient.d.ts +0 -25
- package/dist/src/input/ox-input-color-gradient.js +0 -318
- package/dist/src/input/ox-input-color-gradient.js.map +0 -1
- package/src/grist/id-input.ts +0 -135
- package/src/grist/index.ts +0 -13
- package/src/input/ox-input-color-gradient.ts +0 -341
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import '@operato/input/ox-input-value-map.js'
|
|
2
|
+
|
|
3
|
+
import { LitElement, css, html } from 'lit'
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
7
|
+
import { i18next } from '@operato/i18n'
|
|
8
|
+
|
|
9
|
+
@customElement('ox-popup-value-map-input')
|
|
10
|
+
export class OxPopupValueMapInput extends LitElement {
|
|
11
|
+
static styles = [
|
|
12
|
+
ScrollbarStyles,
|
|
13
|
+
css`
|
|
14
|
+
:host {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
|
|
18
|
+
background-color: #fff;
|
|
19
|
+
|
|
20
|
+
width: var(--overlay-center-normal-width, 50%);
|
|
21
|
+
height: var(--overlay-center-normal-height, 50%);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
ox-input-value-map {
|
|
25
|
+
flex: 1;
|
|
26
|
+
overflow-y: auto;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
span {
|
|
30
|
+
flex: 1;
|
|
31
|
+
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
|
|
36
|
+
color: var(--primary-color);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.button-container {
|
|
40
|
+
display: flex;
|
|
41
|
+
margin-left: auto;
|
|
42
|
+
}
|
|
43
|
+
`
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
@property({ type: Object }) value: any
|
|
47
|
+
@property({ type: String }) valuetype: string = 'string'
|
|
48
|
+
@property({ type: Object }) confirmCallback!: (newval: any) => void
|
|
49
|
+
|
|
50
|
+
render() {
|
|
51
|
+
return html`
|
|
52
|
+
<ox-input-value-map
|
|
53
|
+
.value=${this.value}
|
|
54
|
+
keytype="string"
|
|
55
|
+
.valuetype=${this.valuetype}
|
|
56
|
+
@change=${this.onChange.bind(this)}
|
|
57
|
+
>
|
|
58
|
+
</ox-input-value-map>
|
|
59
|
+
|
|
60
|
+
<div class="button-container">
|
|
61
|
+
<mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
62
|
+
<mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
63
|
+
</div>
|
|
64
|
+
`
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private onChange(e: CustomEvent) {
|
|
68
|
+
e.stopPropagation()
|
|
69
|
+
|
|
70
|
+
/*
|
|
71
|
+
주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
|
|
72
|
+
layout의 구성에 변화가 발생하면, 다시 render된다.
|
|
73
|
+
이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
|
|
74
|
+
이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
|
|
75
|
+
만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
|
|
76
|
+
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
77
|
+
(이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)
|
|
78
|
+
=>
|
|
79
|
+
이런 이유로, Object.assign(...)을 사용하였다.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
if (!this.value) {
|
|
83
|
+
this.value = {}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
for (let key in this.value) {
|
|
87
|
+
delete this.value[key]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
Object.assign(this.value, e.detail)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private onCancel(e: Event) {
|
|
94
|
+
history.back()
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private onConfirm(e: Event) {
|
|
98
|
+
this.confirmCallback && this.confirmCallback(this.value)
|
|
99
|
+
history.back()
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import '@operato/data-grist'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { css, html, LitElement } from 'lit'
|
|
5
5
|
import { customElement, property, query } from 'lit/decorators.js'
|
|
6
6
|
|
|
7
|
+
import { DataGrist, FetchOption, GristData, GristRecord, ZERO_DATA } from '@operato/data-grist'
|
|
7
8
|
import { client } from '@operato/graphql'
|
|
8
|
-
import gql from 'graphql-tag'
|
|
9
9
|
import { i18next } from '@operato/i18n'
|
|
10
10
|
import { isMobileDevice } from '@operato/utils'
|
|
11
11
|
|
|
12
|
-
@customElement('ox-id
|
|
13
|
-
export class
|
|
12
|
+
@customElement('ox-selector-resource-id')
|
|
13
|
+
export class OxSelectorResourceId extends LitElement {
|
|
14
14
|
static styles = css`
|
|
15
15
|
:host {
|
|
16
16
|
display: flex;
|
|
@@ -47,7 +47,7 @@ export class IdSelector extends LitElement {
|
|
|
47
47
|
@property({ type: Object }) data: GristData = ZERO_DATA
|
|
48
48
|
@property({ type: String }) queryName!: string
|
|
49
49
|
@property({ type: Object }) basicArgs: any
|
|
50
|
-
@property({ type: Object }) confirmCallback?: (record
|
|
50
|
+
@property({ type: Object }) confirmCallback?: (record?: GristRecord) => void
|
|
51
51
|
@property({ type: Array }) selectedRecords: GristRecord[] = []
|
|
52
52
|
|
|
53
53
|
@query('ox-grist') grist!: DataGrist
|
|
@@ -66,12 +66,18 @@ export class IdSelector extends LitElement {
|
|
|
66
66
|
</ox-grist>
|
|
67
67
|
|
|
68
68
|
<div class="button-container">
|
|
69
|
+
<mwc-button @click=${this.onempty.bind(this)}>${i18next.t('button.empty')}</mwc-button>
|
|
69
70
|
<mwc-button @click=${this.oncancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
70
71
|
<mwc-button @click=${this.onconfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
71
72
|
</div>
|
|
72
73
|
`
|
|
73
74
|
}
|
|
74
75
|
|
|
76
|
+
onempty() {
|
|
77
|
+
this.confirmCallback && this.confirmCallback()
|
|
78
|
+
history.back()
|
|
79
|
+
}
|
|
80
|
+
|
|
75
81
|
oncancel() {
|
|
76
82
|
history.back()
|
|
77
83
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import '@operato/data-grist'
|
|
2
2
|
import '@operato/form/ox-search-form.js'
|
|
3
3
|
|
|
4
|
+
import gql from 'graphql-tag'
|
|
5
|
+
import { css, html, LitElement } from 'lit'
|
|
6
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
|
7
|
+
|
|
4
8
|
import {
|
|
5
9
|
ColumnConfig,
|
|
6
10
|
DataGrist,
|
|
@@ -11,17 +15,13 @@ import {
|
|
|
11
15
|
GristRecord,
|
|
12
16
|
ZERO_DATA
|
|
13
17
|
} from '@operato/data-grist'
|
|
14
|
-
import { LitElement, css, html } from 'lit'
|
|
15
18
|
import { MultiColumnFormStyles, SearchForm } from '@operato/form'
|
|
16
19
|
import { buildArgs, client, gqlContext } from '@operato/graphql'
|
|
17
|
-
import { customElement, property, query } from 'lit/decorators.js'
|
|
18
|
-
|
|
19
|
-
import gql from 'graphql-tag'
|
|
20
20
|
import { i18next } from '@operato/i18n'
|
|
21
21
|
import { isMobileDevice } from '@operato/utils'
|
|
22
22
|
|
|
23
|
-
@customElement('ox-object
|
|
24
|
-
export class
|
|
23
|
+
@customElement('ox-selector-resource-object')
|
|
24
|
+
export class OxSelectorResourceObject extends LitElement {
|
|
25
25
|
static styles = [
|
|
26
26
|
MultiColumnFormStyles,
|
|
27
27
|
css`
|
|
@@ -32,7 +32,7 @@ export class ObjectSelector extends LitElement {
|
|
|
32
32
|
background-color: #fff;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
ox-grist {
|
|
36
36
|
flex: 1;
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -57,7 +57,7 @@ export class ObjectSelector extends LitElement {
|
|
|
57
57
|
@property({ type: Object }) data: GristData = ZERO_DATA
|
|
58
58
|
@property({ type: String }) queryName!: string
|
|
59
59
|
@property({ type: Object }) basicArgs: any
|
|
60
|
-
@property({ type: Object }) confirmCallback?: (record
|
|
60
|
+
@property({ type: Object }) confirmCallback?: (record?: GristRecord | null) => void
|
|
61
61
|
@property({ type: Array }) selectedRecords: GristRecord[] = []
|
|
62
62
|
|
|
63
63
|
@property({ type: Array }) searchFields: any
|
|
@@ -82,7 +82,7 @@ export class ObjectSelector extends LitElement {
|
|
|
82
82
|
<ox-search-form
|
|
83
83
|
id="search-form"
|
|
84
84
|
@keypress=${(e: KeyboardEvent) => {
|
|
85
|
-
if (e.
|
|
85
|
+
if (e.key === 'Enter') {
|
|
86
86
|
this.grist.fetch()
|
|
87
87
|
}
|
|
88
88
|
}}
|
|
@@ -99,12 +99,18 @@ export class ObjectSelector extends LitElement {
|
|
|
99
99
|
></ox-grist>
|
|
100
100
|
|
|
101
101
|
<div class="button-container">
|
|
102
|
+
<mwc-button @click=${this.onempty.bind(this)}>${i18next.t('button.empty')}</mwc-button>
|
|
102
103
|
<mwc-button @click=${this.oncancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
103
104
|
<mwc-button @click=${this.onconfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
104
105
|
</div>
|
|
105
106
|
`
|
|
106
107
|
}
|
|
107
108
|
|
|
109
|
+
onempty() {
|
|
110
|
+
this.confirmCallback && this.confirmCallback()
|
|
111
|
+
history.back()
|
|
112
|
+
}
|
|
113
|
+
|
|
108
114
|
oncancel() {
|
|
109
115
|
history.back()
|
|
110
116
|
}
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import '@operato/i18n/ox-i18n.js'
|
|
6
|
-
import '@operato/attachment/ox-attachment-
|
|
6
|
+
import '@operato/attachment/ox-attachment-selector.js'
|
|
7
7
|
|
|
8
8
|
import { css, html } from 'lit'
|
|
9
9
|
import { customElement, property } from 'lit/decorators.js'
|
|
@@ -99,11 +99,14 @@ export class OxInputBackgroundPattern extends OxFormField {
|
|
|
99
99
|
return html`
|
|
100
100
|
<label> <ox-i18n msgid="label.image" auto="">image</ox-i18n> </label>
|
|
101
101
|
|
|
102
|
-
<ox-
|
|
102
|
+
<ox-attachment-selector
|
|
103
103
|
value-key="image"
|
|
104
104
|
.value=${value.image || ''}
|
|
105
|
+
.properties=${{
|
|
106
|
+
category: 'image'
|
|
107
|
+
}}
|
|
105
108
|
custom-editor
|
|
106
|
-
></ox-
|
|
109
|
+
></ox-attachment-selector>
|
|
107
110
|
|
|
108
111
|
<label> <ox-i18n msgid="label.align" auto="">align</ox-i18n> </label>
|
|
109
112
|
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
import '@operato/i18n/ox-i18n.js'
|
|
6
6
|
import '@operato/input/ox-input-color.js'
|
|
7
7
|
import '@operato/input/ox-input-color-stops.js'
|
|
8
|
-
import '
|
|
8
|
+
import '@operato/input/ox-input-color-gradient.js'
|
|
9
9
|
import './ox-input-background-pattern.js'
|
|
10
10
|
|
|
11
11
|
import { BackgroundPatternOption, OxInputBackgroundPattern } from './ox-input-background-pattern.js'
|
|
12
|
-
import { ColorStop, OxFormField } from '@operato/input'
|
|
13
|
-
import { GradientOption, OxInputColorGradient } from './ox-input-color-gradient.js'
|
|
12
|
+
import { ColorStop, GradientOption, OxFormField, OxInputColorGradient } from '@operato/input'
|
|
14
13
|
import { PropertyValues, css, html } from 'lit'
|
|
15
14
|
import { customElement, property, query } from 'lit/decorators.js'
|
|
16
15
|
|
|
@@ -32,7 +31,7 @@ export type FillStyle =
|
|
|
32
31
|
| 'no'
|
|
33
32
|
| string
|
|
34
33
|
|
|
35
|
-
@customElement('ox-input-
|
|
34
|
+
@customElement('ox-input-fill-style')
|
|
36
35
|
export class OxInputColorStyle extends OxFormField {
|
|
37
36
|
static styles = css`
|
|
38
37
|
:host {
|
|
@@ -0,0 +1,169 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import '@operato/property-editor/ox-property-editor-legend.js'
|
|
2
|
+
import '@operato/property-editor/ox-property-editor-number.js'
|
|
3
|
+
import '@operato/property-editor/ox-property-editor-password.js'
|
|
4
|
+
import '@operato/property-editor/ox-property-editor-angle.js'
|
|
5
|
+
import '@operato/property-editor/ox-property-editor-string.js'
|
|
6
|
+
import '@operato/property-editor/ox-property-editor-data.js'
|
|
7
|
+
import '@operato/property-editor/ox-property-editor-date.js'
|
|
8
|
+
import '@operato/property-editor/ox-property-editor-checkbox.js'
|
|
9
|
+
import '@operato/property-editor/ox-property-editor-options.js'
|
|
10
|
+
import '@operato/property-editor/ox-property-editor-select.js'
|
|
11
|
+
import '@operato/property-editor/ox-property-editor-scene-component-id.js'
|
|
12
|
+
import '@operato/property-editor/ox-property-editor-color.js'
|
|
13
|
+
import '@operato/property-editor/ox-property-editor-multiple-colors.js'
|
|
14
|
+
import '@operato/property-editor/ox-property-editor-solid-colorstops.js'
|
|
15
|
+
import '@operato/property-editor/ox-property-editor-gradient-colorstops.js'
|
|
16
|
+
import '@operato/property-editor/ox-property-editor-gradient-colorstops.js'
|
|
17
|
+
import '@operato/property-editor/ox-property-editor-textarea.js'
|
|
18
|
+
import '@operato/property-editor/ox-property-editor-table.js'
|
|
19
|
+
import '@operato/property-editor/ox-property-editor-value-map.js'
|
|
20
|
+
import '@operato/property-editor/ox-property-editor-value-ranges.js'
|
|
21
|
+
import '@operato/attachment/ox-property-editor-attachment-selector.js'
|
|
22
|
+
import '@operato/attachment/ox-property-editor-image-selector.js'
|
|
23
|
+
import '@operato/font/ox-property-editor-font-selector.js'
|
|
24
|
+
import './ox-property-editor-graphql.js'
|
|
25
|
+
|
|
26
|
+
import { OxPropertyEditor } from '@operato/property-editor'
|
|
27
|
+
|
|
28
|
+
OxPropertyEditor.register({
|
|
29
|
+
legend: 'ox-property-editor-legend',
|
|
30
|
+
number: 'ox-property-editor-number',
|
|
31
|
+
slider: 'ox-property-editor-range',
|
|
32
|
+
password: 'ox-property-editor-password',
|
|
33
|
+
angle: 'ox-property-editor-angle',
|
|
34
|
+
string: 'ox-property-editor-string',
|
|
35
|
+
textarea: 'ox-property-editor-textarea',
|
|
36
|
+
javascript: 'ox-property-editor-textarea',
|
|
37
|
+
checkbox: 'ox-property-editor-checkbox',
|
|
38
|
+
boolean: 'ox-property-editor-checkbox',
|
|
39
|
+
select: 'ox-property-editor-select',
|
|
40
|
+
date: 'ox-property-editor-date',
|
|
41
|
+
options: 'ox-property-editor-options',
|
|
42
|
+
data: 'ox-property-editor-data',
|
|
43
|
+
file: 'ox-property-editor-file',
|
|
44
|
+
image: 'ox-property-editor-image',
|
|
45
|
+
'range-input': 'ox-property-editor-range',
|
|
46
|
+
'attachment-selector': 'ox-property-editor-attachment-selector',
|
|
47
|
+
'gltf-selector': 'ox-property-editor-attachment-selector',
|
|
48
|
+
'image-selector': 'ox-property-editor-image-selector',
|
|
49
|
+
color: 'ox-property-editor-color',
|
|
50
|
+
'solid-color-stops': 'ox-property-editor-solid-colorstops',
|
|
51
|
+
'gradient-color-stops': 'ox-property-editor-gradient-colorstops',
|
|
52
|
+
'multiple-color': 'ox-property-editor-multiple-colors',
|
|
53
|
+
map: 'ox-property-editor-value-map',
|
|
54
|
+
range: 'ox-property-editor-value-ranges',
|
|
55
|
+
graphql: 'ox-property-editor-graphql',
|
|
56
|
+
'editor-table': 'ox-property-editor-table',
|
|
57
|
+
'id-input': 'ox-property-editor-scene-component-id',
|
|
58
|
+
'font-selector': 'ox-property-editor-font-selector'
|
|
59
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import '../input/ox-input-graphql.js'
|
|
2
|
+
|
|
3
|
+
import { OxPropertyEditor } from '@operato/property-editor'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
import { html } from 'lit'
|
|
6
|
+
|
|
7
|
+
@customElement('ox-property-editor-graphql')
|
|
8
|
+
export class OxPropertyEditorGraphQL extends OxPropertyEditor {
|
|
9
|
+
editorTemplate() {
|
|
10
|
+
return html` <ox-input-graphql id="editor" .value=${this.value} fullwidth> </ox-input-graphql> `
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
body {
|
|
2
|
+
/* theme color */
|
|
3
|
+
--primary-color-rgb: 130, 105, 96;
|
|
4
|
+
--primary-color: rgb(var(--primary-color-rgb));
|
|
5
|
+
--secondary-color-rgb: 78, 78, 90;
|
|
6
|
+
--secondary-color: rgb(var(--secondary-color-rgb));
|
|
7
|
+
--focus-color: var(--theme-white-color);
|
|
8
|
+
--primary-background-color: var(--secondary-color);
|
|
9
|
+
--secondary-background-color: #283644;
|
|
10
|
+
--main-section-background-color: #f5f2ee;
|
|
11
|
+
--theme-white-color: #fff;
|
|
12
|
+
--theme-black-color: rgba(0, 0, 0, 0.9);
|
|
13
|
+
|
|
14
|
+
--focus-background-color: var(--primary-color);
|
|
15
|
+
--primary-text-color: #3c3938;
|
|
16
|
+
--secondary-text-color: var(--primary-color);
|
|
17
|
+
|
|
18
|
+
--opacity-dark-color: rgba(0, 0, 0, 0.4);
|
|
19
|
+
--opacity-light-color: rgba(255, 255, 255, 0.8);
|
|
20
|
+
|
|
21
|
+
/* status color */
|
|
22
|
+
--status-success-color: #35a24a;
|
|
23
|
+
--status-warning-color: #ee8d03;
|
|
24
|
+
--status-danger-color: #d14946;
|
|
25
|
+
--status-info-color: #398ace;
|
|
26
|
+
|
|
27
|
+
/* common style */
|
|
28
|
+
--border-radius: 4px;
|
|
29
|
+
--border-dark-color: 1px solid rgba(0, 0, 0, 0.15);
|
|
30
|
+
--border-light-color: 1px solid rgba(255, 255, 255, 0.3);
|
|
31
|
+
|
|
32
|
+
--box-shadow: 2px 2px 3px 0px rgba(0, 0, 0, 0.1);
|
|
33
|
+
|
|
34
|
+
--theme-font: 'Noto', Helvetica;
|
|
35
|
+
|
|
36
|
+
--margin-default: 9px;
|
|
37
|
+
--margin-narrow: 4px;
|
|
38
|
+
--margin-wide: 15px;
|
|
39
|
+
--padding-default: var(--margin-default);
|
|
40
|
+
--padding-narrow: var(--margin-narrow);
|
|
41
|
+
--padding-wide: var(--margin-wide);
|
|
42
|
+
|
|
43
|
+
--scrollbar-thumb-color: rgba(57, 78, 100, 0.5);
|
|
44
|
+
--scrollbar-thumb-hover-color: var(--primary-color);
|
|
45
|
+
|
|
46
|
+
--fontsize-default: 14px;
|
|
47
|
+
--fontsize-small: 13px;
|
|
48
|
+
--fontsize-large: 16px;
|
|
49
|
+
|
|
50
|
+
/* app layout style */
|
|
51
|
+
--app-grid-template-area: 'header header header' 'nav main aside' 'nav footer aside';
|
|
52
|
+
|
|
53
|
+
/* title & description style */
|
|
54
|
+
--title-margin: var(--margin-narrow) 0;
|
|
55
|
+
--title-font: bold 24px var(--theme-font);
|
|
56
|
+
--title-text-color: var(--secondary-color);
|
|
57
|
+
--title-font-mobile: bold 20px var(--theme-font);
|
|
58
|
+
|
|
59
|
+
--page-description-margin: var(--margin-narrow) 0 var(--margin-wide) 0;
|
|
60
|
+
--page-description-font: normal var(--fontsize-default) / 1.2rem var(--theme-font);
|
|
61
|
+
--page-description-color: var(--secondary-text-color);
|
|
62
|
+
|
|
63
|
+
--subtitle-padding: 12px 5px 3px 5px;
|
|
64
|
+
--subtitle-font: bold 18px var(--theme-font);
|
|
65
|
+
--subtitle-text-color: var(--primary-color);
|
|
66
|
+
--subtitle-border-bottom: 1px solid var(--primary-color);
|
|
67
|
+
|
|
68
|
+
/* icon style */
|
|
69
|
+
--icon-tiny-size: 24px;
|
|
70
|
+
--icon-default-size: 36px;
|
|
71
|
+
--icon-big-size: 48px;
|
|
72
|
+
--icon-default-color: var(--theme-white-color);
|
|
73
|
+
|
|
74
|
+
/* material design component themes */
|
|
75
|
+
--mdc-theme-on-primary: var(--theme-white-color);
|
|
76
|
+
--mdc-theme-primary: var(--secondary-text-color);
|
|
77
|
+
--mdc-theme-on-secondary: var(--theme-white-color);
|
|
78
|
+
--mdc-theme-secondary: var(--primary-color);
|
|
79
|
+
--mdc-button-outline-color: var(--primary-color);
|
|
80
|
+
--mdc-danger-button-primary-color: var(--status-danger-color);
|
|
81
|
+
--mdc-danger-button-outline-color: var(--status-danger-color);
|
|
82
|
+
--mdc-button-outline-width: 1px;
|
|
83
|
+
--mdc-button-horizontal-padding: 16px;
|
|
84
|
+
|
|
85
|
+
/* button style */
|
|
86
|
+
--button-background-color: #fafbfc;
|
|
87
|
+
--button-background-focus-color: var(--primary-color);
|
|
88
|
+
--button-border: var(--border-dark-color);
|
|
89
|
+
--button-border-radius: var(--border-radius);
|
|
90
|
+
--button-margin: var(--margin-default) var(--margin-default) var(--margin-default) 0;
|
|
91
|
+
--button-padding: var(--padding-default);
|
|
92
|
+
--button-color: var(--secondary-color);
|
|
93
|
+
--button-font: normal 15px var(--theme-font);
|
|
94
|
+
--button-text-transform: capitalize;
|
|
95
|
+
--button-active-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);
|
|
96
|
+
--button-activ-border: 1px solid var(--primary-color);
|
|
97
|
+
|
|
98
|
+
--button-primary-background-color: var(--primary-color);
|
|
99
|
+
--button-primary-active-background-color: var(--status-success-color);
|
|
100
|
+
--button-primary-padding: var(--margin-default) var(--margin-wide);
|
|
101
|
+
--button-primary-color: var(--theme-white-color);
|
|
102
|
+
--button-primary-font: bold 16px var(--theme-font);
|
|
103
|
+
|
|
104
|
+
/* table style */
|
|
105
|
+
--th-padding: var(--padding-default) 0 var(--padding-default) var(--padding-default);
|
|
106
|
+
--th-border-top: 2px solid var(--secondary-color);
|
|
107
|
+
--th-text-transform: capitalize;
|
|
108
|
+
--th-font: bold var(--fontsize-small) var(--theme-font);
|
|
109
|
+
--th-color: rgba(var(--secondary-color-rgb), 0.8);
|
|
110
|
+
|
|
111
|
+
--tr-background-color: var(--theme-white-color);
|
|
112
|
+
--tr-background-odd-color: rgba(255, 255, 255, 0.4);
|
|
113
|
+
--tr-background-hover-color: #e1f5fe;
|
|
114
|
+
--td-border-bottom: 1px solid rgba(0, 0, 0, 0.09);
|
|
115
|
+
--td-padding: var(--padding-default);
|
|
116
|
+
--td-font: normal 13px var(--theme-font);
|
|
117
|
+
--td-color: var(--secondary-color);
|
|
118
|
+
|
|
119
|
+
/* form style */
|
|
120
|
+
--label-font: normal var(--fontsize-default) var(--theme-font);
|
|
121
|
+
--label-color: var(--secondary-color);
|
|
122
|
+
--label-text-transform: capitalize;
|
|
123
|
+
--input-margin: var(--margin-narrow) 0;
|
|
124
|
+
--input-padding: var(--padding-default);
|
|
125
|
+
--input-min-width: 200px;
|
|
126
|
+
--input-font: normal var(--fontsize-default) var(--theme-font);
|
|
127
|
+
--input-hint-font: normal var(--fontsize-small) var(--theme-font);
|
|
128
|
+
--input-hint-color: #666;
|
|
129
|
+
--input-container-max-width: 900px;
|
|
130
|
+
--fieldset-margin: var(--padding-wide) 0;
|
|
131
|
+
--fieldset-padding: 0 var(--padding-wide) var(--padding-wide) var(--padding-wide);
|
|
132
|
+
--legend-padding: var(--padding-default) 0;
|
|
133
|
+
--legend-color: var(--secondary-text-color);
|
|
134
|
+
--legend-font: bold 16px var(--theme-font);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@media only screen and (max-width: 460px) {
|
|
138
|
+
body {
|
|
139
|
+
/* subtitle style */
|
|
140
|
+
--subtitle-margin: 0;
|
|
141
|
+
}
|
|
142
|
+
}
|