@operato/app 1.0.0-alpha.21 → 1.0.0-alpha.24
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 +28 -90
- package/dist/src/{grist → grist-editor}/index.d.ts +0 -0
- package/dist/src/grist-editor/index.js +21 -0
- package/dist/src/grist-editor/index.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/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} +6 -6
- 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} +11 -62
- 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/parameters-editor-builder.d.ts → grist-editor/ox-parameters-builder.d.ts} +0 -0
- package/dist/src/{grist/parameters-editor-builder.js → grist-editor/ox-parameters-builder.js} +10 -10
- 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 +81 -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-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} +20 -20
- 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/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -23
- package/src/grist-editor/index.ts +23 -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/code-editor.ts → grist-editor/ox-grist-editor-resource-code.ts} +2 -2
- 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} +7 -46
- 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/parameters-editor-builder.ts → grist-editor/ox-parameters-builder.ts} +4 -4
- package/src/grist-editor/ox-popup-code-input.ts +75 -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-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} +2 -2
- package/src/index.ts +3 -1
- package/src/input/index.ts +3 -0
- package/yarn-error.log +1 -1
- 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 -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/src/grist/id-input.ts +0 -135
- package/src/grist/index.ts +0 -13
package/package.json
CHANGED
|
@@ -3,23 +3,28 @@
|
|
|
3
3
|
"description": "WebApplication production supporting components following open-wc recommendations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "heartyoh",
|
|
6
|
-
"version": "1.0.0-alpha.
|
|
6
|
+
"version": "1.0.0-alpha.24",
|
|
7
7
|
"main": "dist/src/index.js",
|
|
8
8
|
"module": "dist/src/index.js",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": "./dist/src/index.js",
|
|
11
|
-
"./
|
|
12
|
-
"./grist/id-input.js": "./dist/src/grist/id-input.js",
|
|
13
|
-
"./grist/id-selector.js": "./dist/src/grist/id-selector.js",
|
|
14
|
-
"./grist/id-renderer.js": "./dist/src/grist/id-renderer.js",
|
|
15
|
-
"./grist/object-selector.js": "./dist/src/grist/object-selector.js",
|
|
16
|
-
"./grist/object-editor.js": "./dist/src/grist/object-editor.js",
|
|
17
|
-
"./grist/code-editor.js": "./dist/src/grist/code-editor.js",
|
|
18
|
-
"./grist/parameters-editor.js": "./dist/src/grist/parameters-editor.js",
|
|
11
|
+
"./input.js": "./dist/src/input/index.js",
|
|
19
12
|
"./input/ox-input-graphql.js": "./dist/src/input/ox-input-graphql.js",
|
|
20
13
|
"./input/ox-input-background-pattern.js": "./dist/src/input/ox-input-background-pattern.js",
|
|
21
14
|
"./input/ox-input-fill-style.js": "./dist/src/input/ox-input-fill-style.js",
|
|
22
|
-
"./property-editor
|
|
15
|
+
"./property-editor.js": "./dist/src/property-editor/index.js",
|
|
16
|
+
"./property-editor/ox-property-editor-graphql.js": "./dist/src/property-editor/ox-property-editor-graphql.js",
|
|
17
|
+
"./grist-editor.js": "./dist/src/grist-editor/index.js",
|
|
18
|
+
"./grist-editor/ox-grist-editor-resource-id.js": "./dist/src/grist-editor/ox-grist-editor-resource-id.js",
|
|
19
|
+
"./grist-editor/ox-selector-resource-id.js": "./dist/src/grist-editor/ox-selector-resource-id.js",
|
|
20
|
+
"./grist-editor/ox-renderer-resource-id.js": "./dist/src/grist-editor/ox-renderer-resource-id.js",
|
|
21
|
+
"./grist-editor/ox-selector-resource-object.js": "./dist/src/grist-editor/ox-selector-resource-object.js",
|
|
22
|
+
"./grist-editor/ox-grist-editor-crontab.js": "./dist/src/grist-editor/ox-grist-editor-crontab.js",
|
|
23
|
+
"./grist-editor/ox-grist-editor-json.js": "./dist/src/grist-editor/ox-grist-editor-json.js",
|
|
24
|
+
"./grist-editor/ox-grist-editor-resource-object.js": "./dist/src/grist-editor/ox-grist-editor-resource-object.js",
|
|
25
|
+
"./grist-editor/ox-grist-editor-resource-code.js": "./dist/src/grist-editor/ox-grist-editor-resource-code.js",
|
|
26
|
+
"./grist-editor/ox-grist-editor-parameters.js": "./dist/src/grist-editor/ox-grist-editor-parameters.js",
|
|
27
|
+
"./grist-editor/ox-grist-editor-value-map.js": "./dist/src/grist-editor/ox-grist-editor-value-map.js"
|
|
23
28
|
},
|
|
24
29
|
"publishConfig": {
|
|
25
30
|
"access": "public",
|
|
@@ -49,18 +54,18 @@
|
|
|
49
54
|
"@material/mwc-button": "^0.25.3",
|
|
50
55
|
"@material/mwc-icon": "^0.25.3",
|
|
51
56
|
"@material/mwc-icon-button": "^0.25.3",
|
|
52
|
-
"@operato/attachment": "^1.0.0-alpha.
|
|
53
|
-
"@operato/data-grist": "^1.0.0-alpha.
|
|
54
|
-
"@operato/font": "^1.0.0-alpha.
|
|
55
|
-
"@operato/form": "^1.0.0-alpha.
|
|
56
|
-
"@operato/graphql": "^1.0.0-alpha.
|
|
57
|
-
"@operato/i18n": "^1.0.0-alpha.
|
|
58
|
-
"@operato/input": "^1.0.0-alpha.
|
|
59
|
-
"@operato/layout": "^1.0.0-alpha.
|
|
60
|
-
"@operato/property-editor": "^1.0.0-alpha.
|
|
61
|
-
"@operato/shell": "^1.0.0-alpha.
|
|
62
|
-
"@operato/styles": "^1.0.0-alpha.
|
|
63
|
-
"@operato/utils": "^1.0.0-alpha.
|
|
57
|
+
"@operato/attachment": "^1.0.0-alpha.24",
|
|
58
|
+
"@operato/data-grist": "^1.0.0-alpha.24",
|
|
59
|
+
"@operato/font": "^1.0.0-alpha.24",
|
|
60
|
+
"@operato/form": "^1.0.0-alpha.24",
|
|
61
|
+
"@operato/graphql": "^1.0.0-alpha.24",
|
|
62
|
+
"@operato/i18n": "^1.0.0-alpha.24",
|
|
63
|
+
"@operato/input": "^1.0.0-alpha.24",
|
|
64
|
+
"@operato/layout": "^1.0.0-alpha.24",
|
|
65
|
+
"@operato/property-editor": "^1.0.0-alpha.24",
|
|
66
|
+
"@operato/shell": "^1.0.0-alpha.24",
|
|
67
|
+
"@operato/styles": "^1.0.0-alpha.24",
|
|
68
|
+
"@operato/utils": "^1.0.0-alpha.24",
|
|
64
69
|
"codemirror": "^5.59.1",
|
|
65
70
|
"codemirror-graphql": "^0.15.2",
|
|
66
71
|
"cross-fetch": "^3.1.5",
|
|
@@ -100,5 +105,5 @@
|
|
|
100
105
|
"prettier --write"
|
|
101
106
|
]
|
|
102
107
|
},
|
|
103
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "83b1479e80639e5bc365f3dc8ad4b119a84dc31e"
|
|
104
109
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Json5Renderer, registerEditor, registerRenderer } from '@operato/data-grist'
|
|
2
|
+
|
|
3
|
+
import { OxGristEditorCrontab } from './ox-grist-editor-crontab.js'
|
|
4
|
+
import { OxGristEditorJson } from './ox-grist-editor-json.js'
|
|
5
|
+
import { OxGristEditorParameters } from './ox-grist-editor-parameters.js'
|
|
6
|
+
import { OxGristEditorResourceCode } from './ox-grist-editor-resource-code.js'
|
|
7
|
+
import { OxGristEditorResourceId } from './ox-grist-editor-resource-id.js'
|
|
8
|
+
import { OxGristEditorResourceObject } from './ox-grist-editor-resource-object.js'
|
|
9
|
+
import { OxGristEditorValueMap } from './ox-grist-editor-value-map.js'
|
|
10
|
+
import { OxGristRendererResourceId } from './ox-grist-renderer-resource-id.js'
|
|
11
|
+
|
|
12
|
+
/* register grist renderer/editor for id */
|
|
13
|
+
registerEditor('resource-id', OxGristEditorResourceId)
|
|
14
|
+
registerEditor('resource-object', OxGristEditorResourceObject)
|
|
15
|
+
registerEditor('resource-code', OxGristEditorResourceCode)
|
|
16
|
+
registerEditor('parameters', OxGristEditorParameters)
|
|
17
|
+
registerEditor('value-map', OxGristEditorValueMap)
|
|
18
|
+
registerEditor('crontab', OxGristEditorCrontab)
|
|
19
|
+
registerEditor('json', OxGristEditorJson)
|
|
20
|
+
|
|
21
|
+
registerRenderer('resource-id', OxGristRendererResourceId)
|
|
22
|
+
registerRenderer('parameters', Json5Renderer)
|
|
23
|
+
registerRenderer('value-map', Json5Renderer)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import './ox-popup-crontab-input.js'
|
|
2
|
+
|
|
3
|
+
import { PopupHandle, openPopup } from '@operato/layout'
|
|
4
|
+
|
|
5
|
+
import { InputEditor } from '@operato/data-grist'
|
|
6
|
+
import { customElement } from 'lit/decorators.js'
|
|
7
|
+
import { html } from 'lit'
|
|
8
|
+
import { i18next } from '@operato/i18n'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-grist-editor-crontab')
|
|
11
|
+
export class OxGristEditorCrontab extends InputEditor {
|
|
12
|
+
private popup?: PopupHandle
|
|
13
|
+
|
|
14
|
+
get editorTemplate() {
|
|
15
|
+
return html` <input type="text" .value=${this.value || ''} /> `
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async firstUpdated() {
|
|
19
|
+
await this.updateComplete
|
|
20
|
+
|
|
21
|
+
this.renderRoot.addEventListener('click', e => {
|
|
22
|
+
e.stopPropagation()
|
|
23
|
+
|
|
24
|
+
this.showEditorPopup()
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
this.showEditorPopup()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
showEditorPopup() {
|
|
31
|
+
if (this.popup) {
|
|
32
|
+
delete this.popup
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const confirmCallback = (newval: any) => {
|
|
36
|
+
this.dispatchEvent(
|
|
37
|
+
new CustomEvent('field-change', {
|
|
38
|
+
bubbles: true,
|
|
39
|
+
composed: true,
|
|
40
|
+
detail: {
|
|
41
|
+
before: this.value,
|
|
42
|
+
after: newval,
|
|
43
|
+
record: this.record,
|
|
44
|
+
column: this.column,
|
|
45
|
+
row: this.row
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
this.popup = openPopup(
|
|
52
|
+
html`
|
|
53
|
+
<ox-popup-crontab-input .value=${this.value} .confirmCallback=${confirmCallback}></ox-popup-crontab-input>
|
|
54
|
+
`,
|
|
55
|
+
{
|
|
56
|
+
backdrop: true,
|
|
57
|
+
title: i18next.t('title.setting schedule'),
|
|
58
|
+
help: 'data-grist/grist-editor/crontab'
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import './ox-popup-code-input.js'
|
|
2
|
+
|
|
3
|
+
import { InputEditor } from '@operato/data-grist'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
import { html } from 'lit'
|
|
6
|
+
import { i18next } from '@operato/i18n'
|
|
7
|
+
import { openPopup } from '@operato/layout'
|
|
8
|
+
|
|
9
|
+
@customElement('ox-grist-editor-json')
|
|
10
|
+
export class OxGristEditorJson extends InputEditor {
|
|
11
|
+
get editorTemplate() {
|
|
12
|
+
return html` <input type="text" .value=${this.value || ''} /> `
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async firstUpdated() {
|
|
16
|
+
await this.updateComplete
|
|
17
|
+
|
|
18
|
+
this.renderRoot.addEventListener('click', e => {
|
|
19
|
+
e.stopPropagation()
|
|
20
|
+
|
|
21
|
+
this.showEditorPopup()
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
this.showEditorPopup()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
showEditorPopup() {
|
|
28
|
+
var change = (value: string) => {
|
|
29
|
+
this.dispatchEvent(
|
|
30
|
+
new CustomEvent('change', {
|
|
31
|
+
bubbles: true,
|
|
32
|
+
composed: true,
|
|
33
|
+
detail: {
|
|
34
|
+
before: this.value,
|
|
35
|
+
after: value,
|
|
36
|
+
column: this.column,
|
|
37
|
+
record: this.record,
|
|
38
|
+
row: this.row
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var popup = openPopup(
|
|
45
|
+
html`
|
|
46
|
+
<ox-popup-code-input
|
|
47
|
+
.value=${this.value}
|
|
48
|
+
mode="javascript"
|
|
49
|
+
@change=${(e: CustomEvent) => {
|
|
50
|
+
change(e.detail.value)
|
|
51
|
+
popup.close()
|
|
52
|
+
}}
|
|
53
|
+
></ox-popup-code-input>
|
|
54
|
+
`,
|
|
55
|
+
{
|
|
56
|
+
backdrop: true,
|
|
57
|
+
title: i18next.t('title.setting schedule'),
|
|
58
|
+
help: 'data-grist/grist-editor/code'
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -2,36 +2,22 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import './parameters-
|
|
6
|
-
import './parameters-
|
|
5
|
+
import './ox-parameters-builder.js'
|
|
6
|
+
import './ox-popup-parameters-builder.js'
|
|
7
7
|
|
|
8
|
-
import { ColumnConfig, GristRecord } from '@operato/data-grist'
|
|
9
|
-
import { LitElement, css, html } from 'lit'
|
|
8
|
+
import { ColumnConfig, GristRecord, InputEditor } from '@operato/data-grist'
|
|
10
9
|
import { PopupHandle, openPopup } from '@operato/layout'
|
|
11
|
-
import {
|
|
10
|
+
import { css, html } from 'lit'
|
|
12
11
|
|
|
12
|
+
import { cloneDeep } from 'lodash-es'
|
|
13
|
+
import { customElement } from 'lit/decorators.js'
|
|
13
14
|
import { i18next } from '@operato/i18n'
|
|
14
15
|
|
|
15
|
-
@customElement('ox-
|
|
16
|
-
export class
|
|
17
|
-
static styles = css`
|
|
18
|
-
:host {
|
|
19
|
-
color: black;
|
|
20
|
-
|
|
21
|
-
overflow: hidden;
|
|
22
|
-
text-overflow: ellipsis;
|
|
23
|
-
}
|
|
24
|
-
`
|
|
25
|
-
|
|
26
|
-
@property({ type: Object }) value: any
|
|
27
|
-
@property({ type: Object }) column!: ColumnConfig
|
|
28
|
-
@property({ type: Object }) record!: GristRecord
|
|
29
|
-
@property({ type: Number }) row!: number
|
|
30
|
-
@property({ type: Object }) field!: any
|
|
31
|
-
|
|
16
|
+
@customElement('ox-grist-editor-parameters')
|
|
17
|
+
export class OxGristEditorParameters extends InputEditor {
|
|
32
18
|
private popup?: PopupHandle
|
|
33
19
|
|
|
34
|
-
|
|
20
|
+
get editorTemplate() {
|
|
35
21
|
const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value
|
|
36
22
|
return html` ${value || ''} `
|
|
37
23
|
}
|
|
@@ -78,7 +64,8 @@ export class ParametersEditor extends LitElement {
|
|
|
78
64
|
}
|
|
79
65
|
|
|
80
66
|
try {
|
|
81
|
-
var value: any =
|
|
67
|
+
var value: any =
|
|
68
|
+
!objectified && typeof this.value === 'string' ? JSON.parse(this.value) : cloneDeep(this.value || {})
|
|
82
69
|
} catch (e) {
|
|
83
70
|
var value: any = {}
|
|
84
71
|
}
|
|
@@ -92,14 +79,14 @@ export class ParametersEditor extends LitElement {
|
|
|
92
79
|
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
93
80
|
*/
|
|
94
81
|
var template = html`
|
|
95
|
-
<ox-parameters-
|
|
82
|
+
<ox-popup-parameters-builder
|
|
96
83
|
.value=${value}
|
|
97
84
|
.props=${spec}
|
|
98
85
|
.host=${this.record}
|
|
99
86
|
.context=${context}
|
|
100
87
|
.confirmCallback=${confirmCallback}
|
|
101
88
|
>
|
|
102
|
-
</ox-parameters-
|
|
89
|
+
</ox-popup-parameters-builder>
|
|
103
90
|
`
|
|
104
91
|
|
|
105
92
|
this.popup = openPopup(template, {
|
|
@@ -31,8 +31,8 @@ const FETCH_COMMON_CODE_GQL = (codeName: string) => gql`
|
|
|
31
31
|
}
|
|
32
32
|
`
|
|
33
33
|
|
|
34
|
-
@customElement('
|
|
35
|
-
export class
|
|
34
|
+
@customElement('ox-grist-editor-resource-code')
|
|
35
|
+
export class OxGristEditorResourceCode extends InputEditor {
|
|
36
36
|
async firstUpdated() {
|
|
37
37
|
super.firstUpdated()
|
|
38
38
|
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import '@material/mwc-icon'
|
|
2
|
+
import './ox-selector-resource-id.js'
|
|
3
|
+
|
|
4
|
+
import { GristRecord, InputEditor } from '@operato/data-grist'
|
|
5
|
+
import { PopupHandle, openPopup } from '@operato/layout'
|
|
6
|
+
import { TemplateResult, html } from 'lit'
|
|
7
|
+
|
|
8
|
+
import { customElement } from 'lit/decorators.js'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-input-resource-id')
|
|
11
|
+
export class OxGristEditorResourceId extends InputEditor {
|
|
12
|
+
private popup?: PopupHandle
|
|
13
|
+
|
|
14
|
+
render() {
|
|
15
|
+
var { nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}
|
|
16
|
+
var value = this.value
|
|
17
|
+
|
|
18
|
+
return html`
|
|
19
|
+
${!value ? html`` : html` <span>${value[nameField]} (${value[descriptionField]})</span> `}
|
|
20
|
+
<mwc-icon>arrow_drop_down</mwc-icon>
|
|
21
|
+
`
|
|
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
|
+
openSelector() {
|
|
37
|
+
if (this.popup) {
|
|
38
|
+
delete this.popup
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const confirmCallback: (record: GristRecord | undefined) => void = selected => {
|
|
42
|
+
if (!selected) {
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var { idField = 'id', nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}
|
|
47
|
+
|
|
48
|
+
this.dispatchEvent(
|
|
49
|
+
new CustomEvent('field-change', {
|
|
50
|
+
bubbles: true,
|
|
51
|
+
composed: true,
|
|
52
|
+
detail: {
|
|
53
|
+
before: this.value,
|
|
54
|
+
after: {
|
|
55
|
+
[idField]: selected[idField],
|
|
56
|
+
[nameField]: selected[nameField],
|
|
57
|
+
[descriptionField]: selected[descriptionField]
|
|
58
|
+
},
|
|
59
|
+
record: this.record,
|
|
60
|
+
column: this.column,
|
|
61
|
+
row: this.row
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var value = this.value || {}
|
|
68
|
+
var template = html`
|
|
69
|
+
<ox-selector-resource-id
|
|
70
|
+
.value=${value.id}
|
|
71
|
+
.confirmCallback=${confirmCallback.bind(this)}
|
|
72
|
+
.queryName=${this.column.record.options.queryName}
|
|
73
|
+
.basicArgs=${this.column.record.options.basicArgs}
|
|
74
|
+
></ox-selector-resource-id>
|
|
75
|
+
`
|
|
76
|
+
|
|
77
|
+
this.popup = openPopup(template, {
|
|
78
|
+
backdrop: true,
|
|
79
|
+
size: 'large',
|
|
80
|
+
title: 'select item'
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -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
|
|
@@ -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
|
}
|
|
@@ -14,12 +14,12 @@ import { store } from '@operato/shell'
|
|
|
14
14
|
|
|
15
15
|
Example:
|
|
16
16
|
|
|
17
|
-
<ox-parameters-
|
|
17
|
+
<ox-parameters-builder value="{{value}}">
|
|
18
18
|
<label>Center X</label>
|
|
19
19
|
<input type="number" .value="${value.cx}">
|
|
20
20
|
<label>Width</label>
|
|
21
21
|
<input type="number" .value="${value.width}">
|
|
22
|
-
</ox-parameters-
|
|
22
|
+
</ox-parameters-builder>
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
const DEFAULT_VALUE = {
|
|
@@ -43,8 +43,8 @@ const DEFAULT_VALUE = {
|
|
|
43
43
|
date: null
|
|
44
44
|
} as any
|
|
45
45
|
|
|
46
|
-
@customElement('ox-parameters-
|
|
47
|
-
class
|
|
46
|
+
@customElement('ox-parameters-builder')
|
|
47
|
+
class OxParametersBuilder extends connect(store)(LitElement) {
|
|
48
48
|
@property({ type: Object }) value: any
|
|
49
49
|
@property({ type: Array }) props?: PropertySpec[]
|
|
50
50
|
@property({ type: Object }) host: any
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
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 }) mode: string = 'javascript'
|
|
48
|
+
@property({ type: Object }) confirmCallback!: (newval: any) => void
|
|
49
|
+
|
|
50
|
+
render() {
|
|
51
|
+
return html`
|
|
52
|
+
<ox-input-code .value=${this.value} .mode=${this.mode} @change=${this.onChange.bind(this)}> </ox-input-code>
|
|
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
|
+
this.value = e.detail
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private onCancel(e: Event) {
|
|
68
|
+
history.back()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private onConfirm(e: Event) {
|
|
72
|
+
this.confirmCallback && this.confirmCallback(this.value)
|
|
73
|
+
history.back()
|
|
74
|
+
}
|
|
75
|
+
}
|