@operato/grist-editor 1.0.0-alpha.23 → 1.0.0-beta.40
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/.storybook/main.js +2 -2
- package/.storybook/server.mjs +4 -4
- package/CHANGELOG.md +4 -116
- package/LICENSE +2 -2
- package/README.md +29 -9
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +15 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-grist-editor-crontab.d.ts +8 -0
- package/dist/src/ox-grist-editor-crontab.js +50 -0
- package/dist/src/ox-grist-editor-crontab.js.map +1 -0
- package/dist/src/ox-grist-editor-duration.d.ts +8 -0
- package/dist/src/ox-grist-editor-duration.js +50 -0
- package/dist/src/ox-grist-editor-duration.js.map +1 -0
- package/dist/src/ox-grist-editor-parameters.d.ts +12 -0
- package/dist/src/{parameters/parameters-editor.js → ox-grist-editor-parameters.js} +17 -39
- package/dist/src/ox-grist-editor-parameters.js.map +1 -0
- package/dist/src/ox-grist-editor-partition-keys.d.ts +11 -0
- package/dist/src/ox-grist-editor-partition-keys.js +74 -0
- package/dist/src/ox-grist-editor-partition-keys.js.map +1 -0
- package/dist/src/ox-grist-editor-value-map.d.ts +11 -0
- package/dist/src/ox-grist-editor-value-map.js +74 -0
- package/dist/src/ox-grist-editor-value-map.js.map +1 -0
- package/dist/src/ox-grist-renderer-crontab.d.ts +2 -0
- package/dist/src/ox-grist-renderer-crontab.js +26 -0
- package/dist/src/ox-grist-renderer-crontab.js.map +1 -0
- package/dist/src/{parameters/parameters-editor-builder.d.ts → ox-parameters-builder.d.ts} +0 -0
- package/dist/src/{parameters/parameters-editor-builder.js → ox-parameters-builder.js} +12 -14
- package/dist/src/ox-parameters-builder.js.map +1 -0
- package/dist/src/ox-popup-crontab-input.d.ts +11 -0
- package/dist/src/ox-popup-crontab-input.js +75 -0
- package/dist/src/ox-popup-crontab-input.js.map +1 -0
- package/dist/src/ox-popup-duration-input.d.ts +11 -0
- package/dist/src/ox-popup-duration-input.js +75 -0
- package/dist/src/ox-popup-duration-input.js.map +1 -0
- package/dist/src/{parameters/parameters-editor-popup.d.ts → ox-popup-parameters-builder.d.ts} +1 -1
- package/dist/src/{parameters/parameters-editor-popup.js → ox-popup-parameters-builder.js} +20 -19
- package/dist/src/ox-popup-parameters-builder.js.map +1 -0
- package/dist/src/ox-popup-partition-keys-input.d.ts +12 -0
- package/dist/src/ox-popup-partition-keys-input.js +100 -0
- package/dist/src/ox-popup-partition-keys-input.js.map +1 -0
- package/dist/src/ox-popup-value-map-input.d.ts +12 -0
- package/dist/src/ox-popup-value-map-input.js +105 -0
- package/dist/src/ox-popup-value-map-input.js.map +1 -0
- package/dist/stories/ox-grist-editor-crontab.stories.d.ts +24 -0
- package/dist/stories/ox-grist-editor-crontab.stories.js +406 -0
- package/dist/stories/ox-grist-editor-crontab.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -24
- package/src/index.ts +18 -0
- package/src/ox-grist-editor-crontab.ts +62 -0
- package/src/ox-grist-editor-duration.ts +62 -0
- package/src/{parameters/parameters-editor.ts → ox-grist-editor-parameters.ts} +14 -27
- package/src/ox-grist-editor-partition-keys.ts +86 -0
- package/src/ox-grist-editor-value-map.ts +86 -0
- package/src/ox-grist-renderer-crontab.ts +31 -0
- package/src/{parameters/parameters-editor-builder.ts → ox-parameters-builder.ts} +6 -8
- package/src/ox-popup-crontab-input.ts +75 -0
- package/src/ox-popup-duration-input.ts +75 -0
- package/src/{parameters/parameters-editor-popup.ts → ox-popup-parameters-builder.ts} +10 -9
- package/src/ox-popup-partition-keys-input.ts +97 -0
- package/src/ox-popup-value-map-input.ts +102 -0
- package/stories/ox-grist-editor-crontab.stories.ts +429 -0
- package/themes/app-theme.css +142 -0
- package/themes/form-theme.css +75 -0
- package/themes/grist-theme.css +194 -0
- package/themes/oops-theme.css +26 -0
- package/themes/report-theme.css +47 -0
- package/translations/en.json +3 -0
- package/translations/ko.json +3 -0
- package/translations/ms.json +3 -0
- package/translations/zh.json +3 -0
- package/web-dev-server.config.mjs +9 -8
- package/web-test-runner.config.mjs +7 -19
- package/.editorconfig +0 -29
- package/demo/data-grist-test.html +0 -456
- package/demo/index.html +0 -33
- package/dist/src/code/code-editor.d.ts +0 -6
- package/dist/src/code/code-editor.js +0 -50
- package/dist/src/code/code-editor.js.map +0 -1
- package/dist/src/code/index.d.ts +0 -1
- package/dist/src/code/index.js +0 -5
- package/dist/src/code/index.js.map +0 -1
- package/dist/src/id/id-input.d.ts +0 -19
- package/dist/src/id/id-input.js +0 -119
- package/dist/src/id/id-input.js.map +0 -1
- package/dist/src/id/id-renderer.d.ts +0 -2
- package/dist/src/id/id-renderer.js +0 -9
- package/dist/src/id/id-renderer.js.map +0 -1
- package/dist/src/id/id-selector.d.ts +0 -23
- package/dist/src/id/id-selector.js +0 -197
- package/dist/src/id/id-selector.js.map +0 -1
- package/dist/src/id/index.d.ts +0 -1
- package/dist/src/id/index.js +0 -7
- package/dist/src/id/index.js.map +0 -1
- package/dist/src/object/index.d.ts +0 -1
- package/dist/src/object/index.js +0 -6
- package/dist/src/object/index.js.map +0 -1
- package/dist/src/object/object-editor.d.ts +0 -18
- package/dist/src/object/object-editor.js +0 -152
- package/dist/src/object/object-editor.js.map +0 -1
- package/dist/src/object/object-selector.d.ts +0 -38
- package/dist/src/object/object-selector.js +0 -338
- package/dist/src/object/object-selector.js.map +0 -1
- package/dist/src/parameters/index.d.ts +0 -1
- package/dist/src/parameters/index.js +0 -6
- package/dist/src/parameters/index.js.map +0 -1
- package/dist/src/parameters/parameters-editor-builder.js.map +0 -1
- package/dist/src/parameters/parameters-editor-popup.js.map +0 -1
- package/dist/src/parameters/parameters-editor.d.ts +0 -18
- package/dist/src/parameters/parameters-editor.js.map +0 -1
- package/src/code/code-editor.ts +0 -78
- package/src/code/index.ts +0 -6
- package/src/id/id-input.ts +0 -135
- package/src/id/id-renderer.ts +0 -12
- package/src/id/id-selector.ts +0 -189
- package/src/id/index.ts +0 -8
- package/src/object/index.ts +0 -8
- package/src/object/object-editor.ts +0 -162
- package/src/object/object-selector.ts +0 -346
- package/src/parameters/index.ts +0 -8
package/package.json
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/grist-editor",
|
|
3
|
+
"version": "1.0.0-beta.40",
|
|
3
4
|
"description": "Webcomponent for grist-editor following open-wc recommendations",
|
|
4
|
-
"license": "MIT",
|
|
5
5
|
"author": "heartyoh",
|
|
6
|
-
"
|
|
6
|
+
"license": "MIT",
|
|
7
7
|
"main": "dist/src/index.js",
|
|
8
8
|
"module": "dist/src/index.js",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": "./dist/src/index.js",
|
|
11
|
-
"./id/id-input.js": "./dist/src/id/id-input.js",
|
|
12
|
-
"./id/id-selector.js": "./dist/src/id/id-selector.js",
|
|
13
|
-
"./id/id-renderer.js": "./dist/src/id/id-renderer.js",
|
|
14
|
-
"./object/object-selector.js": "./dist/src/object/object-selector.js",
|
|
15
|
-
"./object/object-renderer.js": "./dist/src/object/object-renderer.js",
|
|
16
|
-
"./code/code-editor.js": "./dist/src/code/code-editor.js"
|
|
17
|
-
},
|
|
18
9
|
"publishConfig": {
|
|
19
10
|
"access": "public",
|
|
20
11
|
"@operato:registry": "https://registry.npmjs.org"
|
|
@@ -24,6 +15,19 @@
|
|
|
24
15
|
"url": "git+https://github.com/hatiolab/operato.git",
|
|
25
16
|
"directory": "webcomponents/grist-editor"
|
|
26
17
|
},
|
|
18
|
+
"exports": {
|
|
19
|
+
".": "./dist/src/index.js",
|
|
20
|
+
"./ox-grist-editor-duration.js": "./dist/src/ox-grist-editor-duration.js",
|
|
21
|
+
"./ox-grist-editor-crontab.js": "./dist/src/ox-grist-editor-crontab.js",
|
|
22
|
+
"./ox-grist-renderer-crontab.js": "./dist/src/ox-grist-renderer-crontab.js",
|
|
23
|
+
"./ox-grist-editor-json.js": "./dist/src/ox-grist-editor-json.js",
|
|
24
|
+
"./ox-grist-editor-code.js": "./dist/src/ox-grist-editor-code.js",
|
|
25
|
+
"./ox-grist-editor-resource-object.js": "./dist/src/ox-grist-editor-resource-object.js",
|
|
26
|
+
"./ox-grist-editor-resource-code.js": "./dist/src/ox-grist-editor-resource-code.js",
|
|
27
|
+
"./ox-grist-editor-parameters.js": "./dist/src/ox-grist-editor-parameters.js",
|
|
28
|
+
"./ox-grist-editor-value-map.js": "./dist/src/ox-grist-editor-value-map.js",
|
|
29
|
+
"./ox-grist-editor-partition-keys.js": "./dist/src/ox-grist-editor-partition-keys.js"
|
|
30
|
+
},
|
|
27
31
|
"scripts": {
|
|
28
32
|
"analyze": "cem analyze --litelement",
|
|
29
33
|
"start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
|
|
@@ -40,31 +44,39 @@
|
|
|
40
44
|
"@material/mwc-button": "^0.25.3",
|
|
41
45
|
"@material/mwc-icon": "^0.25.3",
|
|
42
46
|
"@material/mwc-icon-button": "^0.25.3",
|
|
43
|
-
"@operato/data-grist": "^1.0.0-
|
|
44
|
-
"@operato/
|
|
45
|
-
"@operato/
|
|
46
|
-
"@operato/
|
|
47
|
-
"@operato/
|
|
48
|
-
"@operato/property-editor": "^1.0.0-
|
|
49
|
-
"@operato/
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
47
|
+
"@operato/data-grist": "^1.0.0-beta.40",
|
|
48
|
+
"@operato/help": "^1.0.0-beta.40",
|
|
49
|
+
"@operato/i18n": "^1.0.0-beta.40",
|
|
50
|
+
"@operato/input": "^1.0.0-beta.40",
|
|
51
|
+
"@operato/popup": "^1.0.0-beta.40",
|
|
52
|
+
"@operato/property-editor": "^1.0.0-beta.40",
|
|
53
|
+
"@operato/styles": "^1.0.0-beta.40",
|
|
54
|
+
"codemirror": "^5.64.0",
|
|
55
|
+
"codemirror-graphql": "^0.15.2",
|
|
56
|
+
"cronstrue": "^2.2.0",
|
|
57
|
+
"cross-fetch": "^3.1.5",
|
|
58
|
+
"lit": "^2.2.1",
|
|
59
|
+
"lodash-es": "^4.17.21"
|
|
53
60
|
},
|
|
54
61
|
"devDependencies": {
|
|
55
62
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
56
63
|
"@hatiolab/prettier-config": "^1.0.0",
|
|
64
|
+
"@material/mwc-fab": "^0.25.3",
|
|
65
|
+
"@material/mwc-icon": "^0.25.3",
|
|
57
66
|
"@open-wc/eslint-config": "^4.3.0",
|
|
58
67
|
"@open-wc/testing": "^3.0.4",
|
|
68
|
+
"@types/bwip-js": "^2.1.1",
|
|
69
|
+
"@types/lodash-es": "^4.17.5",
|
|
70
|
+
"@types/w3c-web-usb": "^1.0.5",
|
|
59
71
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
60
72
|
"@typescript-eslint/parser": "^4.33.0",
|
|
61
73
|
"@web/dev-server": "^0.1.29",
|
|
62
|
-
"@web/dev-server-storybook": "
|
|
74
|
+
"@web/dev-server-storybook": "^0.5.0",
|
|
63
75
|
"@web/test-runner": "next",
|
|
64
76
|
"concurrently": "^5.3.0",
|
|
65
77
|
"eslint": "^7.32.0",
|
|
66
78
|
"eslint-config-prettier": "^8.3.0",
|
|
67
|
-
"husky": "^
|
|
79
|
+
"husky": "^7.0.2",
|
|
68
80
|
"lint-staged": "^10.5.4",
|
|
69
81
|
"prettier": "^2.4.1",
|
|
70
82
|
"tslib": "^2.3.1",
|
|
@@ -83,5 +95,5 @@
|
|
|
83
95
|
"prettier --write"
|
|
84
96
|
]
|
|
85
97
|
},
|
|
86
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "6f51f0b86e909ea850e6f185f737930daaec509e"
|
|
87
99
|
}
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist'
|
|
2
|
+
|
|
3
|
+
import { OxGristEditorCrontab } from './ox-grist-editor-crontab.js'
|
|
4
|
+
import { OxGristEditorDuration } from './ox-grist-editor-duration.js'
|
|
5
|
+
import { OxGristEditorParameters } from './ox-grist-editor-parameters.js'
|
|
6
|
+
import { OxGristEditorPartitionKeys } from './ox-grist-editor-partition-keys.js'
|
|
7
|
+
import { OxGristEditorValueMap } from './ox-grist-editor-value-map.js'
|
|
8
|
+
|
|
9
|
+
/* register grist renderer/editor for id */
|
|
10
|
+
registerEditor('parameters', OxGristEditorParameters)
|
|
11
|
+
registerEditor('value-map', OxGristEditorValueMap)
|
|
12
|
+
registerEditor('partition-keys', OxGristEditorPartitionKeys)
|
|
13
|
+
registerEditor('crontab', OxGristEditorCrontab)
|
|
14
|
+
registerEditor('duration', OxGristEditorDuration)
|
|
15
|
+
|
|
16
|
+
registerRenderer('parameters', OxGristRendererJson5)
|
|
17
|
+
registerRenderer('value-map', OxGristRendererJson5)
|
|
18
|
+
registerRenderer('partition-keys', OxGristRendererJson5)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import './ox-popup-crontab-input.js'
|
|
2
|
+
|
|
3
|
+
import { html } from 'lit'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { OxGristEditor } from '@operato/data-grist'
|
|
7
|
+
import { i18next } from '@operato/i18n'
|
|
8
|
+
import { openPopup, PopupHandle } from '@operato/popup'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-grist-editor-crontab')
|
|
11
|
+
export class OxGristEditorCrontab extends OxGristEditor {
|
|
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-duration-input.js'
|
|
2
|
+
|
|
3
|
+
import { html } from 'lit'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { OxGristEditor } from '@operato/data-grist'
|
|
7
|
+
import { i18next } from '@operato/i18n'
|
|
8
|
+
import { openPopup, PopupHandle } from '@operato/popup'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-grist-editor-duration')
|
|
11
|
+
export class OxGristEditorDuration extends OxGristEditor {
|
|
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-duration-input .value=${this.value} .confirmCallback=${confirmCallback}></ox-popup-duration-input>
|
|
54
|
+
`,
|
|
55
|
+
{
|
|
56
|
+
backdrop: true,
|
|
57
|
+
title: i18next.t('title.setting schedule'),
|
|
58
|
+
help: 'data-grist/grist-editor/duration'
|
|
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 {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
8
|
+
import { html } from 'lit'
|
|
9
|
+
import { customElement } from 'lit/decorators.js'
|
|
10
|
+
import { cloneDeep } from 'lodash-es'
|
|
12
11
|
|
|
12
|
+
import { OxGristEditor } from '@operato/data-grist'
|
|
13
13
|
import { i18next } from '@operato/i18n'
|
|
14
|
+
import { openPopup, PopupHandle } from '@operato/popup'
|
|
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 OxGristEditor {
|
|
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 InputEditor {
|
|
|
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 InputEditor {
|
|
|
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, {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import './ox-popup-partition-keys-input.js'
|
|
6
|
+
|
|
7
|
+
import { html } from 'lit'
|
|
8
|
+
import { customElement } from 'lit/decorators.js'
|
|
9
|
+
import { cloneDeep } from 'lodash-es'
|
|
10
|
+
|
|
11
|
+
import { OxGristEditor } from '@operato/data-grist'
|
|
12
|
+
import { i18next } from '@operato/i18n'
|
|
13
|
+
import { openPopup, PopupHandle } from '@operato/popup'
|
|
14
|
+
|
|
15
|
+
@customElement('ox-grist-editor-partition-keys')
|
|
16
|
+
export class OxGristEditorPartitionKeys extends OxGristEditor {
|
|
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, 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-partition-keys-input .value=${value} .confirmCallback=${confirmCallback}>
|
|
76
|
+
</ox-popup-partition-keys-input>
|
|
77
|
+
`
|
|
78
|
+
|
|
79
|
+
this.popup = openPopup(template, {
|
|
80
|
+
backdrop: true,
|
|
81
|
+
size: 'large',
|
|
82
|
+
title: `${name?.toUpperCase() || i18next.t('field.partition-keys')} `,
|
|
83
|
+
help
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -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 { html } from 'lit'
|
|
8
|
+
import { customElement } from 'lit/decorators.js'
|
|
9
|
+
import { cloneDeep } from 'lodash-es'
|
|
10
|
+
|
|
11
|
+
import { OxGristEditor } from '@operato/data-grist'
|
|
12
|
+
import { i18next } from '@operato/i18n'
|
|
13
|
+
import { openPopup, PopupHandle } from '@operato/popup'
|
|
14
|
+
|
|
15
|
+
@customElement('ox-grist-editor-value-map')
|
|
16
|
+
export class OxGristEditorValueMap extends OxGristEditor {
|
|
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
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import cronstrue from 'cronstrue/i18n'
|
|
2
|
+
import i18next from 'i18next'
|
|
3
|
+
import { html } from 'lit'
|
|
4
|
+
|
|
5
|
+
import { FieldRenderer } from '@operato/data-grist'
|
|
6
|
+
import { detectOverflow } from '@operato/utils'
|
|
7
|
+
|
|
8
|
+
function onmouseover(e: Event) {
|
|
9
|
+
const element = e.target as HTMLSpanElement
|
|
10
|
+
if (detectOverflow(element)) {
|
|
11
|
+
element.setAttribute('data-tooltip', element.textContent!)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function onmouseout(e: Event) {
|
|
16
|
+
const element = e.target as HTMLSpanElement
|
|
17
|
+
element.removeAttribute('data-tooltip')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const OxGristRendererCrontab: FieldRenderer = (value, column, record, rowIndex, field) => {
|
|
21
|
+
let text = ''
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const language = (i18next.language || 'en').substring(0, 2)
|
|
25
|
+
text = !value ? '' : cronstrue.toString(value, { locale: language || 'en' })
|
|
26
|
+
} catch (e) {
|
|
27
|
+
console.error(e)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return html`<span @mouseover=${onmouseover} @mouseout=${onmouseout}>${text}</span>`
|
|
31
|
+
}
|
|
@@ -2,24 +2,22 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { LitElement, PropertyValues
|
|
6
|
-
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
|
|
5
|
+
import { html, LitElement, PropertyValues } from 'lit'
|
|
7
6
|
import { customElement, property } from 'lit/decorators.js'
|
|
8
7
|
|
|
9
|
-
import {
|
|
10
|
-
import { store } from '@operato/shell'
|
|
8
|
+
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.
|
|
14
12
|
|
|
15
13
|
Example:
|
|
16
14
|
|
|
17
|
-
<ox-parameters-
|
|
15
|
+
<ox-parameters-builder value="{{value}}">
|
|
18
16
|
<label>Center X</label>
|
|
19
17
|
<input type="number" .value="${value.cx}">
|
|
20
18
|
<label>Width</label>
|
|
21
19
|
<input type="number" .value="${value.width}">
|
|
22
|
-
</ox-parameters-
|
|
20
|
+
</ox-parameters-builder>
|
|
23
21
|
*/
|
|
24
22
|
|
|
25
23
|
const DEFAULT_VALUE = {
|
|
@@ -43,8 +41,8 @@ const DEFAULT_VALUE = {
|
|
|
43
41
|
date: null
|
|
44
42
|
} as any
|
|
45
43
|
|
|
46
|
-
@customElement('ox-parameters-
|
|
47
|
-
class
|
|
44
|
+
@customElement('ox-parameters-builder')
|
|
45
|
+
class OxParametersBuilder extends LitElement {
|
|
48
46
|
@property({ type: Object }) value: any
|
|
49
47
|
@property({ type: Array }) props?: PropertySpec[]
|
|
50
48
|
@property({ type: Object }) host: any
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import '@operato/input/ox-input-crontab.js'
|
|
2
|
+
|
|
3
|
+
import { css, html, LitElement } from 'lit'
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { i18next } from '@operato/i18n'
|
|
7
|
+
import { closePopup } from '@operato/popup'
|
|
8
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-popup-crontab-input')
|
|
11
|
+
export class OxPopupCrontabInput extends LitElement {
|
|
12
|
+
static styles = [
|
|
13
|
+
ScrollbarStyles,
|
|
14
|
+
css`
|
|
15
|
+
:host {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
|
|
19
|
+
background-color: #fff;
|
|
20
|
+
|
|
21
|
+
width: var(--overlay-center-normal-width, 50%);
|
|
22
|
+
height: var(--overlay-center-normal-height, 50%);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ox-input-crontab {
|
|
26
|
+
flex: 1;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
span {
|
|
31
|
+
flex: 1;
|
|
32
|
+
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
|
|
37
|
+
color: var(--primary-color);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.button-container {
|
|
41
|
+
display: flex;
|
|
42
|
+
margin-left: auto;
|
|
43
|
+
}
|
|
44
|
+
`
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
@property({ type: Object }) value: any
|
|
48
|
+
@property({ type: Object }) confirmCallback!: (newval: any) => void
|
|
49
|
+
|
|
50
|
+
render() {
|
|
51
|
+
return html`
|
|
52
|
+
<ox-input-crontab .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-crontab>
|
|
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
|
+
closePopup(this)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private onConfirm(e: Event) {
|
|
72
|
+
this.confirmCallback && this.confirmCallback(this.value)
|
|
73
|
+
closePopup(this)
|
|
74
|
+
}
|
|
75
|
+
}
|