@operato/app 1.0.0-alpha.3 → 1.0.0-alpha.30
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 +159 -8
- package/demo/data-grist-test.html +456 -0
- package/dist/src/{grist → grist-editor}/index.d.ts +0 -0
- package/dist/src/grist-editor/index.js +24 -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 +56 -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-editor/ox-grist-editor-parameters.js +84 -0
- 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} +1 -1
- package/dist/src/{grist/code-editor.js → grist-editor/ox-grist-editor-resource-code.js} +9 -4
- 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 +10 -0
- package/dist/src/{grist/id-input.js → grist-editor/ox-grist-editor-resource-id.js} +17 -66
- 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} +14 -64
- 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-resource-id.d.ts +2 -0
- package/dist/src/{grist/id-renderer.js → grist-editor/ox-grist-renderer-resource-id.js} +2 -2
- package/dist/src/grist-editor/ox-grist-renderer-resource-id.js.map +1 -0
- package/dist/src/grist-editor/ox-parameters-builder.d.ts +4 -0
- package/dist/src/grist-editor/ox-parameters-builder.js +118 -0
- 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-editor/ox-popup-parameters-builder.d.ts +13 -0
- package/dist/src/grist-editor/ox-popup-parameters-builder.js +111 -0
- 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} +1 -1
- package/dist/src/{grist/id-selector.js → grist-editor/ox-selector-resource-id.js} +15 -15
- 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} +1 -1
- package/dist/src/{grist/object-selector.js → grist-editor/ox-selector-resource-object.js} +21 -21
- 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 +31 -0
- package/dist/src/input/ox-input-background-pattern.js +150 -0
- package/dist/src/input/ox-input-background-pattern.js.map +1 -0
- package/dist/src/input/ox-input-fill-style.d.ts +41 -0
- package/dist/src/input/ox-input-fill-style.js +325 -0
- package/dist/src/input/ox-input-fill-style.js.map +1 -0
- 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 +41 -16
- package/src/grist-editor/index.ts +26 -0
- package/src/grist-editor/ox-grist-editor-code.ts +64 -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-editor/ox-grist-editor-parameters.ts +99 -0
- 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} +3 -4
- package/src/grist-editor/ox-grist-editor-resource-id.ts +83 -0
- package/src/{grist/object-editor.ts → grist-editor/ox-grist-editor-resource-object.ts} +11 -48
- package/src/grist-editor/ox-grist-editor-value-map.ts +86 -0
- package/src/{grist/id-renderer.ts → grist-editor/ox-grist-renderer-resource-id.ts} +1 -1
- package/src/grist-editor/ox-parameters-builder.ts +128 -0
- 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-editor/ox-popup-parameters-builder.ts +106 -0
- 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} +2 -2
- package/src/{grist/object-selector.ts → grist-editor/ox-selector-resource-object.ts} +3 -3
- package/src/index.ts +3 -1
- package/src/input/index.ts +3 -0
- package/src/input/ox-input-background-pattern.ts +166 -0
- package/src/input/ox-input-fill-style.ts +359 -0
- 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/yarn-error.log +17112 -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.map +0 -1
- package/dist/src/grist/id-renderer.d.ts +0 -2
- 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 -9
- 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/src/grist/id-input.ts +0 -135
- package/src/grist/index.ts +0 -11
|
@@ -1,57 +1,19 @@
|
|
|
1
1
|
import '@material/mwc-icon'
|
|
2
|
-
import '
|
|
2
|
+
import './ox-selector-resource-object.js'
|
|
3
3
|
|
|
4
|
-
import { ColumnConfig, GristData, GristRecord, ZERO_COLUMN, ZERO_CONFIG, ZERO_RECORD } from '@operato/data-grist'
|
|
5
|
-
import { LitElement, TemplateResult, css, html } from 'lit'
|
|
6
4
|
import { PopupHandle, openPopup } from '@operato/layout'
|
|
7
|
-
import {
|
|
5
|
+
import { TemplateResult, css, html } from 'lit'
|
|
8
6
|
|
|
7
|
+
import { InputEditor } from '@operato/data-grist'
|
|
8
|
+
import { customElement } from 'lit/decorators.js'
|
|
9
9
|
import { i18next } from '@operato/i18n'
|
|
10
10
|
|
|
11
|
-
@customElement('ox-
|
|
12
|
-
export class
|
|
13
|
-
static styles = css`
|
|
14
|
-
:host {
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-flow: row nowrap;
|
|
17
|
-
|
|
18
|
-
padding: 7px 0px;
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: 100%;
|
|
23
|
-
|
|
24
|
-
border: 0;
|
|
25
|
-
background-color: transparent;
|
|
26
|
-
|
|
27
|
-
font: var(--grist-object-editor-font);
|
|
28
|
-
color: var(--grist-object-editor-color);
|
|
29
|
-
justify-content: inherit;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
span {
|
|
33
|
-
display: flex;
|
|
34
|
-
flex: auto;
|
|
35
|
-
|
|
36
|
-
justify-content: inherit;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
mwc-icon {
|
|
40
|
-
width: 20px;
|
|
41
|
-
font-size: 1.5em;
|
|
42
|
-
margin-left: auto;
|
|
43
|
-
}
|
|
44
|
-
`
|
|
45
|
-
|
|
46
|
-
@property({ type: Object }) value: { [prop: string]: any } = {}
|
|
47
|
-
@property({ type: Object }) column: ColumnConfig = ZERO_COLUMN
|
|
48
|
-
@property({ type: Object }) record: GristRecord = ZERO_RECORD
|
|
49
|
-
@property({ type: Number }) row?: number
|
|
50
|
-
|
|
11
|
+
@customElement('ox-grist-editor-resource-object')
|
|
12
|
+
export class OxGristEditorResourceObject extends InputEditor {
|
|
51
13
|
private popup?: PopupHandle
|
|
52
14
|
private template?: TemplateResult
|
|
53
15
|
|
|
54
|
-
|
|
16
|
+
get editorTemplate() {
|
|
55
17
|
var value = this.value || {}
|
|
56
18
|
|
|
57
19
|
var { nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}
|
|
@@ -75,7 +37,6 @@ export class ObjectEditor extends LitElement {
|
|
|
75
37
|
}
|
|
76
38
|
|
|
77
39
|
async firstUpdated() {
|
|
78
|
-
this.value = this.record[this.column.name]
|
|
79
40
|
this.template = ((this.column.record || {}).options || {}).template
|
|
80
41
|
|
|
81
42
|
await this.updateComplete
|
|
@@ -85,6 +46,8 @@ export class ObjectEditor extends LitElement {
|
|
|
85
46
|
|
|
86
47
|
this.openSelector()
|
|
87
48
|
})
|
|
49
|
+
|
|
50
|
+
this.openSelector()
|
|
88
51
|
}
|
|
89
52
|
|
|
90
53
|
openSelector() {
|
|
@@ -134,7 +97,7 @@ export class ObjectEditor extends LitElement {
|
|
|
134
97
|
var template =
|
|
135
98
|
this.template ||
|
|
136
99
|
html`
|
|
137
|
-
<
|
|
100
|
+
<ox-selector-resource-object
|
|
138
101
|
.value=${actualValue}
|
|
139
102
|
.confirmCallback=${confirmCallback.bind(this)}
|
|
140
103
|
.queryName=${this.column.record.options.queryName}
|
|
@@ -142,7 +105,7 @@ export class ObjectEditor extends LitElement {
|
|
|
142
105
|
.list=${this.column.record.options.list}
|
|
143
106
|
.basicArgs=${this.column.record.options.basicArgs}
|
|
144
107
|
.valueField=${this.column.record.options.valueField}
|
|
145
|
-
></
|
|
108
|
+
></ox-selector-resource-object>
|
|
146
109
|
`
|
|
147
110
|
|
|
148
111
|
this.popup = openPopup(template, {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import './ox-popup-value-map-input.js'
|
|
6
|
+
|
|
7
|
+
import { ColumnConfig, GristRecord, InputEditor } from '@operato/data-grist'
|
|
8
|
+
import { PopupHandle, openPopup } from '@operato/layout'
|
|
9
|
+
import { css, html } from 'lit'
|
|
10
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
11
|
+
|
|
12
|
+
import { cloneDeep } from 'lodash-es'
|
|
13
|
+
import { i18next } from '@operato/i18n'
|
|
14
|
+
|
|
15
|
+
@customElement('ox-grist-editor-value-map')
|
|
16
|
+
export class OxGristEditorValueMap extends InputEditor {
|
|
17
|
+
private popup?: PopupHandle
|
|
18
|
+
|
|
19
|
+
get editorTemplate() {
|
|
20
|
+
const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value
|
|
21
|
+
return html` ${value || ''} `
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async firstUpdated() {
|
|
25
|
+
await this.updateComplete
|
|
26
|
+
|
|
27
|
+
this.renderRoot.addEventListener('click', e => {
|
|
28
|
+
e.stopPropagation()
|
|
29
|
+
|
|
30
|
+
this.openSelector()
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
this.openSelector()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async openSelector() {
|
|
37
|
+
if (this.popup) {
|
|
38
|
+
delete this.popup
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const { name, help, valuetype = 'string', objectified = false } = this.column.record?.options || {}
|
|
42
|
+
|
|
43
|
+
const confirmCallback = (newval: any) => {
|
|
44
|
+
this.dispatchEvent(
|
|
45
|
+
new CustomEvent('field-change', {
|
|
46
|
+
bubbles: true,
|
|
47
|
+
composed: true,
|
|
48
|
+
detail: {
|
|
49
|
+
before: this.value,
|
|
50
|
+
after: !objectified ? JSON.stringify(newval) : newval,
|
|
51
|
+
record: this.record,
|
|
52
|
+
column: this.column,
|
|
53
|
+
row: this.row
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
var value: any =
|
|
61
|
+
!objectified && typeof this.value === 'string' ? JSON.parse(this.value) : cloneDeep(this.value || {})
|
|
62
|
+
} catch (e) {
|
|
63
|
+
var value: any = {}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
|
|
68
|
+
layout의 구성에 변화가 발생하면, 다시 render된다.
|
|
69
|
+
이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
|
|
70
|
+
이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
|
|
71
|
+
만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
|
|
72
|
+
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
73
|
+
*/
|
|
74
|
+
var template = html`
|
|
75
|
+
<ox-popup-value-map-input .value=${value} .valuetype=${valuetype} .confirmCallback=${confirmCallback}>
|
|
76
|
+
</ox-popup-value-map-input>
|
|
77
|
+
`
|
|
78
|
+
|
|
79
|
+
this.popup = openPopup(template, {
|
|
80
|
+
backdrop: true,
|
|
81
|
+
size: 'large',
|
|
82
|
+
title: `${name?.toUpperCase() || i18next.t('field.value-map')} `,
|
|
83
|
+
help
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FieldRenderer } from '@operato/data-grist'
|
|
2
2
|
import { html } from 'lit'
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const OxGristRendererResourceId: FieldRenderer = (value, column, record, rowIndex, field) => {
|
|
5
5
|
if (!value) {
|
|
6
6
|
return ''
|
|
7
7
|
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { LitElement, PropertyValues, html } from 'lit'
|
|
6
|
+
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
|
|
7
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
8
|
+
|
|
9
|
+
import { connect } from 'pwa-helpers/connect-mixin'
|
|
10
|
+
import { store } from '@operato/shell'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.
|
|
14
|
+
|
|
15
|
+
Example:
|
|
16
|
+
|
|
17
|
+
<ox-parameters-builder value="{{value}}">
|
|
18
|
+
<label>Center X</label>
|
|
19
|
+
<input type="number" .value="${value.cx}">
|
|
20
|
+
<label>Width</label>
|
|
21
|
+
<input type="number" .value="${value.width}">
|
|
22
|
+
</ox-parameters-builder>
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const DEFAULT_VALUE = {
|
|
26
|
+
legend: '',
|
|
27
|
+
number: 0,
|
|
28
|
+
angle: 0,
|
|
29
|
+
string: '',
|
|
30
|
+
text: '',
|
|
31
|
+
textarea: '',
|
|
32
|
+
checkbox: false,
|
|
33
|
+
select: '',
|
|
34
|
+
color: '#000000',
|
|
35
|
+
'solidcolor-stops': null,
|
|
36
|
+
'gradientcolor-stops': null,
|
|
37
|
+
'gltf-selector': '',
|
|
38
|
+
'image-selector': '',
|
|
39
|
+
multiplecolor: null,
|
|
40
|
+
editortable: null,
|
|
41
|
+
imageselector: '',
|
|
42
|
+
options: null,
|
|
43
|
+
date: null
|
|
44
|
+
} as any
|
|
45
|
+
|
|
46
|
+
@customElement('ox-parameters-builder')
|
|
47
|
+
class OxParametersBuilder extends connect(store)(LitElement) {
|
|
48
|
+
@property({ type: Object }) value: any
|
|
49
|
+
@property({ type: Array }) props?: PropertySpec[]
|
|
50
|
+
@property({ type: Object }) host: any
|
|
51
|
+
|
|
52
|
+
render() {
|
|
53
|
+
return html`<slot></slot>`
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
firstUpdated() {
|
|
57
|
+
this.addEventListener('change', this._onValueChanged.bind(this))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
updated(changes: PropertyValues<this>) {
|
|
61
|
+
changes.has('props') && this._onPropsChanged(this.props)
|
|
62
|
+
changes.has('value') && this._setValues()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_onPropsChanged(props: PropertySpec[] | undefined) {
|
|
66
|
+
this.textContent = ''
|
|
67
|
+
;(props || []).forEach(prop => {
|
|
68
|
+
let elementType = OxPropertyEditor.getEditor(prop.type)
|
|
69
|
+
if (!elementType) {
|
|
70
|
+
console.warn('Property Editor not defined', prop.type)
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
let element = document.createElement(elementType) as OxPropertyEditor
|
|
74
|
+
|
|
75
|
+
element.label = prop.label
|
|
76
|
+
element.type = prop.type
|
|
77
|
+
element.placeholder = prop.placeholder
|
|
78
|
+
element.host = this.host
|
|
79
|
+
// element.context = this.context
|
|
80
|
+
element.setAttribute('name', prop.name)
|
|
81
|
+
|
|
82
|
+
if (prop.observe) {
|
|
83
|
+
element.observe = prop.observe
|
|
84
|
+
}
|
|
85
|
+
element.property = prop.property
|
|
86
|
+
element.setAttribute('property-editor', '')
|
|
87
|
+
|
|
88
|
+
this.appendChild(element)
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
_setValues() {
|
|
93
|
+
var value = this.value || {}
|
|
94
|
+
Array.from(this.querySelectorAll('[name]')).forEach(propertyEditor => {
|
|
95
|
+
const editor = propertyEditor as OxPropertyEditor
|
|
96
|
+
let name = editor.getAttribute('name')
|
|
97
|
+
editor.value = value[name!] === undefined ? DEFAULT_VALUE[editor.type] : value[name!]
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
_getValues() {
|
|
102
|
+
var value = {} as any
|
|
103
|
+
Array.from(this.querySelectorAll('[name]')).forEach(propertyEditor => {
|
|
104
|
+
const editor = propertyEditor as OxPropertyEditor
|
|
105
|
+
let name = editor.getAttribute('name')
|
|
106
|
+
value[name!] = editor.value === undefined ? DEFAULT_VALUE[editor.type] : editor.value
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
return value
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
_onValueChanged(e: Event) {
|
|
113
|
+
e.stopPropagation()
|
|
114
|
+
var prop = e.target as HTMLElement
|
|
115
|
+
|
|
116
|
+
if (!prop || !prop.hasAttribute('property-editor')) {
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
this.dispatchEvent(
|
|
121
|
+
new CustomEvent('property-change', {
|
|
122
|
+
bubbles: true,
|
|
123
|
+
composed: true,
|
|
124
|
+
detail: this._getValues()
|
|
125
|
+
})
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import '@operato/input/ox-input-code.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-code-input')
|
|
10
|
+
export class OxPopupCodeInput 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-code {
|
|
25
|
+
flex: 1;
|
|
26
|
+
overflow-y: auto;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.button-container {
|
|
30
|
+
display: flex;
|
|
31
|
+
margin-left: auto;
|
|
32
|
+
}
|
|
33
|
+
`
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
@property({ type: Object }) value: any
|
|
37
|
+
@property({ type: String }) mode: string = 'javascript'
|
|
38
|
+
@property({ type: Object }) confirmCallback!: (newval: any) => void
|
|
39
|
+
|
|
40
|
+
render() {
|
|
41
|
+
return html`
|
|
42
|
+
<ox-input-code .value=${this.value} .mode=${this.mode} @change=${this.onChange.bind(this)}> </ox-input-code>
|
|
43
|
+
|
|
44
|
+
<div class="button-container">
|
|
45
|
+
<mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
46
|
+
<mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
47
|
+
</div>
|
|
48
|
+
`
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private onChange(e: CustomEvent) {
|
|
52
|
+
e.stopPropagation()
|
|
53
|
+
|
|
54
|
+
this.value = e.detail
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private onCancel(e: Event) {
|
|
58
|
+
history.back()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private onConfirm(e: Event) {
|
|
62
|
+
this.confirmCallback && this.confirmCallback(this.value)
|
|
63
|
+
history.back()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import '@operato/input/ox-input-crontab.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-crontab-input')
|
|
10
|
+
export class OxPopupCrontabInput 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-crontab {
|
|
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: Object }) confirmCallback!: (newval: any) => void
|
|
48
|
+
|
|
49
|
+
render() {
|
|
50
|
+
return html`
|
|
51
|
+
<ox-input-crontab .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-crontab>
|
|
52
|
+
|
|
53
|
+
<div class="button-container">
|
|
54
|
+
<mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
55
|
+
<mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
56
|
+
</div>
|
|
57
|
+
`
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private onChange(e: CustomEvent) {
|
|
61
|
+
e.stopPropagation()
|
|
62
|
+
|
|
63
|
+
this.value = e.detail
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private onCancel(e: Event) {
|
|
67
|
+
history.back()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private onConfirm(e: Event) {
|
|
71
|
+
this.confirmCallback && this.confirmCallback(this.value)
|
|
72
|
+
history.back()
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { LitElement, css, html } from 'lit'
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
3
|
+
|
|
4
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
5
|
+
import { i18next } from '@operato/i18n'
|
|
6
|
+
|
|
7
|
+
@customElement('ox-popup-parameters-builder')
|
|
8
|
+
export class OxPopupParametersBuilder extends LitElement {
|
|
9
|
+
static styles = [
|
|
10
|
+
ScrollbarStyles,
|
|
11
|
+
css`
|
|
12
|
+
:host {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
|
|
16
|
+
background-color: #fff;
|
|
17
|
+
|
|
18
|
+
width: var(--overlay-center-normal-width, 50%);
|
|
19
|
+
height: var(--overlay-center-normal-height, 50%);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
ox-parameters-builder {
|
|
23
|
+
flex: 1;
|
|
24
|
+
overflow-y: auto;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
span {
|
|
28
|
+
flex: 1;
|
|
29
|
+
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
|
|
34
|
+
color: var(--primary-color);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.button-container {
|
|
38
|
+
display: flex;
|
|
39
|
+
margin-left: auto;
|
|
40
|
+
}
|
|
41
|
+
`
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
@property({ type: Object }) value: any
|
|
45
|
+
@property({ type: Object }) props: any
|
|
46
|
+
@property({ type: Object }) host: any
|
|
47
|
+
@property({ type: Object }) context: any
|
|
48
|
+
@property({ type: Object }) confirmCallback!: (newval: any) => void
|
|
49
|
+
|
|
50
|
+
render() {
|
|
51
|
+
var props = this.props instanceof Array ? this.props : []
|
|
52
|
+
|
|
53
|
+
return html`
|
|
54
|
+
${props.length > 0
|
|
55
|
+
? html`
|
|
56
|
+
<ox-parameters-builder
|
|
57
|
+
.value=${this.value}
|
|
58
|
+
.props=${props}
|
|
59
|
+
.host=${this.host}
|
|
60
|
+
.context=${this.context}
|
|
61
|
+
@property-change=${this.onChange.bind(this)}
|
|
62
|
+
>
|
|
63
|
+
</ox-parameters-builder>
|
|
64
|
+
`
|
|
65
|
+
: html` <span><i18n-msg msgid="text.no properties to set"></i18n-msg></span> `}
|
|
66
|
+
|
|
67
|
+
<div class="button-container">
|
|
68
|
+
<mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
69
|
+
<mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
70
|
+
</div>
|
|
71
|
+
`
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private onChange(e: CustomEvent) {
|
|
75
|
+
e.stopPropagation()
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
|
|
79
|
+
layout의 구성에 변화가 발생하면, 다시 render된다.
|
|
80
|
+
이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
|
|
81
|
+
이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
|
|
82
|
+
만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
|
|
83
|
+
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
84
|
+
(이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)
|
|
85
|
+
=>
|
|
86
|
+
이런 이유로, Object.assign(...)을 사용하였다.
|
|
87
|
+
*/
|
|
88
|
+
if (!this.value) {
|
|
89
|
+
this.value = {}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
for (let key in this.value) {
|
|
93
|
+
delete this.value[key]
|
|
94
|
+
}
|
|
95
|
+
Object.assign(this.value, e.detail)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private onCancel(e: Event) {
|
|
99
|
+
history.back()
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private onConfirm(e: Event) {
|
|
103
|
+
this.confirmCallback && this.confirmCallback(this.value)
|
|
104
|
+
history.back()
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import '@operato/input/ox-input-partition-keys.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-partition-keys-input')
|
|
10
|
+
export class OxPopupPartitionKeysInput 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-partition-keys {
|
|
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-partition-keys .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-partition-keys>
|
|
53
|
+
|
|
54
|
+
<div class="button-container">
|
|
55
|
+
<mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
56
|
+
<mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
57
|
+
</div>
|
|
58
|
+
`
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private onChange(e: CustomEvent) {
|
|
62
|
+
e.stopPropagation()
|
|
63
|
+
|
|
64
|
+
/*
|
|
65
|
+
주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
|
|
66
|
+
layout의 구성에 변화가 발생하면, 다시 render된다.
|
|
67
|
+
이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
|
|
68
|
+
이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
|
|
69
|
+
만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
|
|
70
|
+
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
71
|
+
(이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)
|
|
72
|
+
=>
|
|
73
|
+
이런 이유로, Object.assign(...)을 사용하였다.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
if (!this.value) {
|
|
77
|
+
this.value = {}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
for (let key in this.value) {
|
|
81
|
+
delete this.value[key]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
Object.assign(this.value, e.detail)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private onCancel(e: Event) {
|
|
88
|
+
history.back()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private onConfirm(e: Event) {
|
|
92
|
+
this.confirmCallback && this.confirmCallback(this.value)
|
|
93
|
+
history.back()
|
|
94
|
+
}
|
|
95
|
+
}
|