@operato/app 1.0.0-alpha.9 → 1.0.0-beta.10
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 +642 -15
- package/demo/data-grist-test.html +15 -10
- package/demo/index.html +1 -10
- package/dist/src/filter-renderer/filter-resource-select.d.ts +4 -0
- package/dist/src/filter-renderer/filter-resource-select.js +79 -0
- package/dist/src/filter-renderer/filter-resource-select.js.map +1 -0
- package/dist/src/{grist → filter-renderer}/index.d.ts +0 -0
- package/dist/src/filter-renderer/index.js +5 -0
- package/dist/src/filter-renderer/index.js.map +1 -0
- package/dist/src/grist-editor/index.d.ts +1 -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 +4 -1
- package/dist/src/index.js +4 -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/input/ox-input-resource.d.ts +36 -0
- package/dist/src/input/ox-input-resource.js +161 -0
- package/dist/src/input/ox-input-resource.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 +45 -22
- package/src/filter-renderer/filter-resource-select.ts +95 -0
- package/src/filter-renderer/index.ts +6 -0
- 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 +4 -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/input/ox-input-resource.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
package/package.json
CHANGED
|
@@ -3,21 +3,33 @@
|
|
|
3
3
|
"description": "WebApplication production supporting components following open-wc recommendations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "heartyoh",
|
|
6
|
-
"version": "1.0.0-
|
|
6
|
+
"version": "1.0.0-beta.10",
|
|
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
|
-
"./
|
|
13
|
-
"./grist/id-renderer.js": "./dist/src/grist/id-renderer.js",
|
|
14
|
-
"./grist/object-selector.js": "./dist/src/grist/object-selector.js",
|
|
15
|
-
"./grist/object-editor.js": "./dist/src/grist/object-editor.js",
|
|
16
|
-
"./grist/code-editor.js": "./dist/src/grist/code-editor.js",
|
|
17
|
-
"./grist/parameters-editor.js": "./dist/src/grist/parameters-editor.js",
|
|
11
|
+
"./input.js": "./dist/src/input/index.js",
|
|
12
|
+
"./input/ox-input-graphql.js": "./dist/src/input/ox-input-graphql.js",
|
|
18
13
|
"./input/ox-input-background-pattern.js": "./dist/src/input/ox-input-background-pattern.js",
|
|
19
|
-
"./input/ox-input-
|
|
20
|
-
"./
|
|
14
|
+
"./input/ox-input-fill-style.js": "./dist/src/input/ox-input-fill-style.js",
|
|
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-grist-renderer-resource-id.js": "./dist/src/grist-editor/ox-grist-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-renderer-resource-object.js": "./dist/src/grist-editor/ox-grist-renderer-resource-object.js",
|
|
23
|
+
"./grist-editor/ox-grist-editor-crontab.js": "./dist/src/grist-editor/ox-grist-editor-crontab.js",
|
|
24
|
+
"./grist-editor/ox-grist-renderer-crontab.js": "./dist/src/grist-editor/ox-grist-renderer-crontab.js",
|
|
25
|
+
"./grist-editor/ox-grist-editor-json.js": "./dist/src/grist-editor/ox-grist-editor-json.js",
|
|
26
|
+
"./grist-editor/ox-grist-editor-code.js": "./dist/src/grist-editor/ox-grist-editor-code.js",
|
|
27
|
+
"./grist-editor/ox-grist-editor-resource-object.js": "./dist/src/grist-editor/ox-grist-editor-resource-object.js",
|
|
28
|
+
"./grist-editor/ox-grist-editor-resource-code.js": "./dist/src/grist-editor/ox-grist-editor-resource-code.js",
|
|
29
|
+
"./grist-editor/ox-grist-editor-parameters.js": "./dist/src/grist-editor/ox-grist-editor-parameters.js",
|
|
30
|
+
"./grist-editor/ox-grist-editor-value-map.js": "./dist/src/grist-editor/ox-grist-editor-value-map.js",
|
|
31
|
+
"./grist-editor/ox-grist-editor-partition-keys.js": "./dist/src/grist-editor/ox-grist-editor-partition-keys.js",
|
|
32
|
+
"./filter-renderer.js": "./dist/src/filter-renderer/index.js"
|
|
21
33
|
},
|
|
22
34
|
"publishConfig": {
|
|
23
35
|
"access": "public",
|
|
@@ -41,20 +53,31 @@
|
|
|
41
53
|
"storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
|
|
42
54
|
},
|
|
43
55
|
"dependencies": {
|
|
56
|
+
"@graphql-tools/load": "^7.3.2",
|
|
57
|
+
"@graphql-tools/url-loader": "^7.2.0",
|
|
58
|
+
"@graphql-tools/wrap": "^8.1.1",
|
|
44
59
|
"@material/mwc-button": "^0.25.3",
|
|
45
60
|
"@material/mwc-icon": "^0.25.3",
|
|
46
61
|
"@material/mwc-icon-button": "^0.25.3",
|
|
47
|
-
"@operato/attachment": "^1.0.0-
|
|
48
|
-
"@operato/data-grist": "^1.0.0-
|
|
49
|
-
"@operato/
|
|
50
|
-
"@operato/
|
|
51
|
-
"@operato/
|
|
52
|
-
"@operato/
|
|
53
|
-
"@operato/
|
|
54
|
-
"@operato/
|
|
55
|
-
"@operato/
|
|
56
|
-
"@operato/
|
|
57
|
-
"
|
|
62
|
+
"@operato/attachment": "^1.0.0-beta.10",
|
|
63
|
+
"@operato/data-grist": "^1.0.0-beta.10",
|
|
64
|
+
"@operato/font": "^1.0.0-beta.10",
|
|
65
|
+
"@operato/form": "^1.0.0-beta.10",
|
|
66
|
+
"@operato/graphql": "^1.0.0-beta.10",
|
|
67
|
+
"@operato/i18n": "^1.0.0-beta.10",
|
|
68
|
+
"@operato/input": "^1.0.0-beta.10",
|
|
69
|
+
"@operato/layout": "^1.0.0-beta.10",
|
|
70
|
+
"@operato/property-editor": "^1.0.0-beta.10",
|
|
71
|
+
"@operato/shell": "^1.0.0-beta.10",
|
|
72
|
+
"@operato/styles": "^1.0.0-beta.10",
|
|
73
|
+
"@operato/utils": "^1.0.0-beta.10",
|
|
74
|
+
"codemirror": "^5.59.1",
|
|
75
|
+
"codemirror-graphql": "^0.15.2",
|
|
76
|
+
"cronstrue": "^2.2.0",
|
|
77
|
+
"cross-fetch": "^3.1.5",
|
|
78
|
+
"graphql": "^15.7.2",
|
|
79
|
+
"graphql-tag": "^2.12.6",
|
|
80
|
+
"lit": "^2.2.1"
|
|
58
81
|
},
|
|
59
82
|
"devDependencies": {
|
|
60
83
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
@@ -88,5 +111,5 @@
|
|
|
88
111
|
"prettier --write"
|
|
89
112
|
]
|
|
90
113
|
},
|
|
91
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "90fef9c72ab5a9fec0c03bbfb0f49d31408ecb24"
|
|
92
115
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import '@operato/input/ox-checkbox.js'
|
|
2
|
+
import '../grist-editor/ox-selector-resource-id'
|
|
3
|
+
|
|
4
|
+
import { html } from 'lit-html'
|
|
5
|
+
|
|
6
|
+
import { ColumnConfig, FilterConfigObject, FilterSelectRenderer } from '@operato/data-grist'
|
|
7
|
+
import { i18next } from '@operato/i18n'
|
|
8
|
+
import { openPopup } from '@operato/layout'
|
|
9
|
+
|
|
10
|
+
type SelectedCallback = (value: { id: string; name: string; description: string }) => void
|
|
11
|
+
|
|
12
|
+
function openResourceSelector(column: ColumnConfig, value: any, confirmCallback: SelectedCallback) {
|
|
13
|
+
const { queryName, select, list, basicArgs, valueField = 'id' } = column.record.options
|
|
14
|
+
|
|
15
|
+
var actualValue
|
|
16
|
+
if (typeof valueField === 'function') {
|
|
17
|
+
actualValue = valueField(value)
|
|
18
|
+
} else {
|
|
19
|
+
actualValue = value?.[valueField]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var template = html`
|
|
23
|
+
<ox-selector-resource-id
|
|
24
|
+
.value=${actualValue}
|
|
25
|
+
.confirmCallback=${confirmCallback}
|
|
26
|
+
.queryName=${queryName}
|
|
27
|
+
.select=${select}
|
|
28
|
+
.list=${list}
|
|
29
|
+
.basicArgs=${basicArgs}
|
|
30
|
+
.valueField=${valueField}
|
|
31
|
+
></ox-selector-resource-id>
|
|
32
|
+
`
|
|
33
|
+
|
|
34
|
+
const popup = openPopup(template, {
|
|
35
|
+
backdrop: true,
|
|
36
|
+
size: 'large',
|
|
37
|
+
title: i18next.t('title.select_item')
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const FilterResourceSelect: FilterSelectRenderer = (column, value, owner) => {
|
|
42
|
+
const filter = column.filter as FilterConfigObject
|
|
43
|
+
const { operator = 'like' } = filter
|
|
44
|
+
|
|
45
|
+
return operator === 'like'
|
|
46
|
+
? html` <input
|
|
47
|
+
type="text"
|
|
48
|
+
name=${column.name}
|
|
49
|
+
.value=${value}
|
|
50
|
+
@change=${(e: CustomEvent) => {
|
|
51
|
+
const input = e.target as HTMLInputElement
|
|
52
|
+
input.dispatchEvent(
|
|
53
|
+
new CustomEvent('filter-change', {
|
|
54
|
+
bubbles: true,
|
|
55
|
+
composed: true,
|
|
56
|
+
detail: {
|
|
57
|
+
name: column.name,
|
|
58
|
+
operator,
|
|
59
|
+
value: input.value
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
)
|
|
63
|
+
}}
|
|
64
|
+
/>`
|
|
65
|
+
: operator == 'in'
|
|
66
|
+
? html``
|
|
67
|
+
: operator === 'eq'
|
|
68
|
+
? html`
|
|
69
|
+
<input
|
|
70
|
+
style="min-width: 100px; min-height: 24px"
|
|
71
|
+
type="text"
|
|
72
|
+
name=${column.name}
|
|
73
|
+
.value=${value}
|
|
74
|
+
readonly
|
|
75
|
+
@click=${(e: Event) => {
|
|
76
|
+
e.stopPropagation()
|
|
77
|
+
|
|
78
|
+
const confirmCallback = (selected?: { [field: string]: any }) => {
|
|
79
|
+
var { idField = 'id', nameField = 'name', descriptionField = 'description' } = column.record.options || {}
|
|
80
|
+
|
|
81
|
+
owner.dispatchEvent(
|
|
82
|
+
new CustomEvent('filter-change', {
|
|
83
|
+
bubbles: true,
|
|
84
|
+
composed: true,
|
|
85
|
+
detail: selected ? selected[idField] : ''
|
|
86
|
+
})
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
openResourceSelector(column, value, confirmCallback)
|
|
91
|
+
}}
|
|
92
|
+
/>
|
|
93
|
+
`
|
|
94
|
+
: html``
|
|
95
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { OxGristRendererJson5, 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 { OxGristEditorPartitionKeys } from './ox-grist-editor-partition-keys.js'
|
|
7
|
+
import { OxGristEditorResourceCode } from './ox-grist-editor-resource-code.js'
|
|
8
|
+
import { OxGristEditorResourceId } from './ox-grist-editor-resource-id.js'
|
|
9
|
+
import { OxGristEditorResourceObject } from './ox-grist-editor-resource-object.js'
|
|
10
|
+
import { OxGristEditorValueMap } from './ox-grist-editor-value-map.js'
|
|
11
|
+
import { OxGristRendererCrontab } from './ox-grist-renderer-crontab.js'
|
|
12
|
+
import { OxGristRendererResourceId } from './ox-grist-renderer-resource-id.js'
|
|
13
|
+
import { OxGristRendererResourceObject } from './ox-grist-renderer-resource-object.js'
|
|
14
|
+
|
|
15
|
+
/* register grist renderer/editor for id */
|
|
16
|
+
registerEditor('resource-id', OxGristEditorResourceId)
|
|
17
|
+
registerEditor('resource-object', OxGristEditorResourceObject)
|
|
18
|
+
registerEditor('resource-code', OxGristEditorResourceCode)
|
|
19
|
+
registerEditor('parameters', OxGristEditorParameters)
|
|
20
|
+
registerEditor('value-map', OxGristEditorValueMap)
|
|
21
|
+
registerEditor('partition-keys', OxGristEditorPartitionKeys)
|
|
22
|
+
registerEditor('crontab', OxGristEditorCrontab)
|
|
23
|
+
registerEditor('json', OxGristEditorJson)
|
|
24
|
+
|
|
25
|
+
registerRenderer('resource-id', OxGristRendererResourceId)
|
|
26
|
+
registerRenderer('resource-object', OxGristRendererResourceObject)
|
|
27
|
+
registerRenderer('parameters', OxGristRendererJson5)
|
|
28
|
+
registerRenderer('value-map', OxGristRendererJson5)
|
|
29
|
+
registerRenderer('partition-keys', OxGristRendererJson5)
|
|
30
|
+
registerRenderer('crontab', OxGristRendererCrontab)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import './ox-popup-code-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 } from '@operato/layout'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-grist-editor-code')
|
|
11
|
+
export class OxGristEditorCode extends OxGristEditor {
|
|
12
|
+
get editorTemplate() {
|
|
13
|
+
return html` <input type="text" .value=${this.value || ''} /> `
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async firstUpdated() {
|
|
17
|
+
await this.updateComplete
|
|
18
|
+
|
|
19
|
+
this.renderRoot.addEventListener('click', e => {
|
|
20
|
+
e.stopPropagation()
|
|
21
|
+
|
|
22
|
+
this.showEditorPopup()
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
this.showEditorPopup()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
showEditorPopup() {
|
|
29
|
+
var { mode } = this.column.record?.options || {}
|
|
30
|
+
|
|
31
|
+
var change = (value: string) => {
|
|
32
|
+
this.dispatchEvent(
|
|
33
|
+
new CustomEvent('field-change', {
|
|
34
|
+
bubbles: true,
|
|
35
|
+
composed: true,
|
|
36
|
+
detail: {
|
|
37
|
+
before: this.value,
|
|
38
|
+
after: value,
|
|
39
|
+
column: this.column,
|
|
40
|
+
record: this.record,
|
|
41
|
+
row: this.row
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var popup = openPopup(
|
|
48
|
+
html`
|
|
49
|
+
<ox-popup-code-input
|
|
50
|
+
.value=${this.value}
|
|
51
|
+
mode=${mode}
|
|
52
|
+
.confirmCallback=${change.bind(this)}
|
|
53
|
+
></ox-popup-code-input>
|
|
54
|
+
`,
|
|
55
|
+
{
|
|
56
|
+
backdrop: true,
|
|
57
|
+
title: i18next.t('title.edit code'),
|
|
58
|
+
help: 'data-grist/grist-editor/code'
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -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/layout'
|
|
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-code-input.js'
|
|
2
|
+
|
|
3
|
+
import { OxGristEditor } 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 OxGristEditor {
|
|
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, OxGristEditor } 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 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 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, {
|
|
@@ -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/layout'
|
|
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
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import '@material/mwc-icon'
|
|
2
|
-
import {} from '@operato/shell'
|
|
3
2
|
|
|
4
|
-
import {
|
|
3
|
+
import { OxGristEditor, RecordConfig } from '@operato/data-grist'
|
|
5
4
|
import { client, gqlContext } from '@operato/graphql'
|
|
6
5
|
|
|
6
|
+
import { customElement } from 'lit/decorators.js'
|
|
7
7
|
import gql from 'graphql-tag'
|
|
8
8
|
import { html } from 'lit'
|
|
9
9
|
|
|
@@ -31,7 +31,8 @@ const FETCH_COMMON_CODE_GQL = (codeName: string) => gql`
|
|
|
31
31
|
}
|
|
32
32
|
`
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
@customElement('ox-grist-editor-resource-code')
|
|
35
|
+
export class OxGristEditorResourceCode extends OxGristEditor {
|
|
35
36
|
async firstUpdated() {
|
|
36
37
|
super.firstUpdated()
|
|
37
38
|
|
|
@@ -74,5 +75,3 @@ export class CodeEditor extends InputEditor {
|
|
|
74
75
|
`
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
-
customElements.define('code-editor', CodeEditor)
|