@operato/app 1.0.0-alpha.6 → 1.0.0-beta.0

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.
Files changed (140) hide show
  1. package/@types/global/index.d.ts +2 -0
  2. package/CHANGELOG.md +339 -13
  3. package/demo/data-grist-test.html +15 -10
  4. package/demo/index.html +1 -10
  5. package/dist/src/{grist → grist-editor}/index.d.ts +0 -0
  6. package/dist/src/grist-editor/index.js +28 -0
  7. package/dist/src/grist-editor/index.js.map +1 -0
  8. package/dist/src/grist-editor/ox-grist-editor-code.d.ts +7 -0
  9. package/dist/src/grist-editor/ox-grist-editor-code.js +56 -0
  10. package/dist/src/grist-editor/ox-grist-editor-code.js.map +1 -0
  11. package/dist/src/grist-editor/ox-grist-editor-crontab.d.ts +8 -0
  12. package/dist/src/grist-editor/ox-grist-editor-crontab.js +50 -0
  13. package/dist/src/grist-editor/ox-grist-editor-crontab.js.map +1 -0
  14. package/dist/src/grist-editor/ox-grist-editor-json.d.ts +7 -0
  15. package/dist/src/grist-editor/ox-grist-editor-json.js +54 -0
  16. package/dist/src/grist-editor/ox-grist-editor-json.js.map +1 -0
  17. package/dist/src/grist-editor/ox-grist-editor-parameters.d.ts +12 -0
  18. package/dist/src/{grist/parameters-editor.js → grist-editor/ox-grist-editor-parameters.js} +16 -37
  19. package/dist/src/grist-editor/ox-grist-editor-parameters.js.map +1 -0
  20. package/dist/src/grist-editor/ox-grist-editor-partition-keys.d.ts +11 -0
  21. package/dist/src/grist-editor/ox-grist-editor-partition-keys.js +74 -0
  22. package/dist/src/grist-editor/ox-grist-editor-partition-keys.js.map +1 -0
  23. package/dist/src/{grist/code-editor.d.ts → grist-editor/ox-grist-editor-resource-code.d.ts} +2 -2
  24. package/dist/src/{grist/code-editor.js → grist-editor/ox-grist-editor-resource-code.js} +10 -5
  25. package/dist/src/grist-editor/ox-grist-editor-resource-code.js.map +1 -0
  26. package/dist/src/grist-editor/ox-grist-editor-resource-id.d.ts +10 -0
  27. package/dist/src/{grist/id-input.js → grist-editor/ox-grist-editor-resource-id.js} +18 -67
  28. package/dist/src/grist-editor/ox-grist-editor-resource-id.js.map +1 -0
  29. package/dist/src/grist-editor/ox-grist-editor-resource-object.d.ts +11 -0
  30. package/dist/src/{grist/object-editor.js → grist-editor/ox-grist-editor-resource-object.js} +14 -64
  31. package/dist/src/grist-editor/ox-grist-editor-resource-object.js.map +1 -0
  32. package/dist/src/grist-editor/ox-grist-editor-value-map.d.ts +11 -0
  33. package/dist/src/grist-editor/ox-grist-editor-value-map.js +74 -0
  34. package/dist/src/grist-editor/ox-grist-editor-value-map.js.map +1 -0
  35. package/dist/src/grist-editor/ox-grist-renderer-crontab.d.ts +2 -0
  36. package/dist/src/grist-editor/ox-grist-renderer-crontab.js +26 -0
  37. package/dist/src/grist-editor/ox-grist-renderer-crontab.js.map +1 -0
  38. package/dist/src/grist-editor/ox-grist-renderer-resource-id.d.ts +2 -0
  39. package/dist/src/grist-editor/ox-grist-renderer-resource-id.js +9 -0
  40. package/dist/src/grist-editor/ox-grist-renderer-resource-id.js.map +1 -0
  41. package/dist/src/grist-editor/ox-grist-renderer-resource-object.d.ts +2 -0
  42. package/dist/src/grist-editor/ox-grist-renderer-resource-object.js +22 -0
  43. package/dist/src/grist-editor/ox-grist-renderer-resource-object.js.map +1 -0
  44. package/dist/src/{grist/parameters-editor-builder.d.ts → grist-editor/ox-parameters-builder.d.ts} +1 -1
  45. package/dist/src/{grist/parameters-editor-builder.js → grist-editor/ox-parameters-builder.js} +10 -11
  46. package/dist/src/grist-editor/ox-parameters-builder.js.map +1 -0
  47. package/dist/src/grist-editor/ox-popup-code-input.d.ts +12 -0
  48. package/dist/src/grist-editor/ox-popup-code-input.js +71 -0
  49. package/dist/src/grist-editor/ox-popup-code-input.js.map +1 -0
  50. package/dist/src/grist-editor/ox-popup-crontab-input.d.ts +11 -0
  51. package/dist/src/grist-editor/ox-popup-crontab-input.js +74 -0
  52. package/dist/src/grist-editor/ox-popup-crontab-input.js.map +1 -0
  53. package/dist/src/{grist/parameters-editor-popup.d.ts → grist-editor/ox-popup-parameters-builder.d.ts} +1 -1
  54. package/dist/src/{grist/parameters-editor-popup.js → grist-editor/ox-popup-parameters-builder.js} +15 -15
  55. package/dist/src/grist-editor/ox-popup-parameters-builder.js.map +1 -0
  56. package/dist/src/grist-editor/ox-popup-partition-keys-input.d.ts +12 -0
  57. package/dist/src/grist-editor/ox-popup-partition-keys-input.js +98 -0
  58. package/dist/src/grist-editor/ox-popup-partition-keys-input.js.map +1 -0
  59. package/dist/src/grist-editor/ox-popup-value-map-input.d.ts +12 -0
  60. package/dist/src/grist-editor/ox-popup-value-map-input.js +104 -0
  61. package/dist/src/grist-editor/ox-popup-value-map-input.js.map +1 -0
  62. package/dist/src/{grist/id-selector.d.ts → grist-editor/ox-selector-resource-id.d.ts} +1 -1
  63. package/dist/src/{grist/id-selector.js → grist-editor/ox-selector-resource-id.js} +15 -15
  64. package/dist/src/grist-editor/ox-selector-resource-id.js.map +1 -0
  65. package/dist/src/{grist/object-selector.d.ts → grist-editor/ox-selector-resource-object.d.ts} +1 -1
  66. package/dist/src/{grist/object-selector.js → grist-editor/ox-selector-resource-object.js} +22 -22
  67. package/dist/src/grist-editor/ox-selector-resource-object.js.map +1 -0
  68. package/dist/src/index.d.ts +3 -1
  69. package/dist/src/index.js +3 -1
  70. package/dist/src/index.js.map +1 -1
  71. package/dist/src/input/index.d.ts +3 -0
  72. package/dist/src/input/index.js +4 -0
  73. package/dist/src/input/index.js.map +1 -0
  74. package/dist/src/input/ox-input-background-pattern.d.ts +31 -0
  75. package/dist/src/input/ox-input-background-pattern.js +150 -0
  76. package/dist/src/input/ox-input-background-pattern.js.map +1 -0
  77. package/dist/src/input/ox-input-fill-style.d.ts +41 -0
  78. package/dist/src/input/ox-input-fill-style.js +325 -0
  79. package/dist/src/input/ox-input-fill-style.js.map +1 -0
  80. package/dist/src/input/ox-input-graphql.d.ts +36 -0
  81. package/dist/src/input/ox-input-graphql.js +161 -0
  82. package/dist/src/input/ox-input-graphql.js.map +1 -0
  83. package/dist/src/property-editor/index.d.ts +24 -0
  84. package/dist/src/property-editor/index.js +58 -0
  85. package/dist/src/property-editor/index.js.map +1 -0
  86. package/dist/src/property-editor/ox-property-editor-graphql.d.ts +5 -0
  87. package/dist/src/property-editor/ox-property-editor-graphql.js +15 -0
  88. package/dist/src/property-editor/ox-property-editor-graphql.js.map +1 -0
  89. package/dist/tsconfig.tsbuildinfo +1 -1
  90. package/package.json +45 -18
  91. package/src/grist-editor/index.ts +30 -0
  92. package/src/grist-editor/ox-grist-editor-code.ts +64 -0
  93. package/src/grist-editor/ox-grist-editor-crontab.ts +62 -0
  94. package/src/grist-editor/ox-grist-editor-json.ts +62 -0
  95. package/src/{grist/parameters-editor.ts → grist-editor/ox-grist-editor-parameters.ts} +13 -26
  96. package/src/grist-editor/ox-grist-editor-partition-keys.ts +86 -0
  97. package/src/{grist/code-editor.ts → grist-editor/ox-grist-editor-resource-code.ts} +4 -5
  98. package/src/grist-editor/ox-grist-editor-resource-id.ts +83 -0
  99. package/src/{grist/object-editor.ts → grist-editor/ox-grist-editor-resource-object.ts} +11 -48
  100. package/src/grist-editor/ox-grist-editor-value-map.ts +86 -0
  101. package/src/grist-editor/ox-grist-renderer-crontab.ts +30 -0
  102. package/src/{grist/id-renderer.ts → grist-editor/ox-grist-renderer-resource-id.ts} +4 -3
  103. package/src/grist-editor/ox-grist-renderer-resource-object.ts +26 -0
  104. package/src/{grist/parameters-editor-builder.ts → grist-editor/ox-parameters-builder.ts} +4 -6
  105. package/src/grist-editor/ox-popup-code-input.ts +65 -0
  106. package/src/grist-editor/ox-popup-crontab-input.ts +74 -0
  107. package/src/{grist/parameters-editor-popup.ts → grist-editor/ox-popup-parameters-builder.ts} +5 -5
  108. package/src/grist-editor/ox-popup-partition-keys-input.ts +95 -0
  109. package/src/grist-editor/ox-popup-value-map-input.ts +101 -0
  110. package/src/{grist/id-selector.ts → grist-editor/ox-selector-resource-id.ts} +2 -2
  111. package/src/{grist/object-selector.ts → grist-editor/ox-selector-resource-object.ts} +4 -4
  112. package/src/index.ts +3 -1
  113. package/src/input/index.ts +3 -0
  114. package/src/input/ox-input-background-pattern.ts +166 -0
  115. package/src/input/ox-input-fill-style.ts +359 -0
  116. package/src/input/ox-input-graphql.ts +169 -0
  117. package/src/property-editor/index.ts +59 -0
  118. package/src/property-editor/ox-property-editor-graphql.ts +12 -0
  119. package/themes/app-theme.css +142 -0
  120. package/themes/grist-theme.css +194 -0
  121. package/themes/oops-theme.css +26 -0
  122. package/themes/report-theme.css +47 -0
  123. package/dist/src/grist/code-editor.js.map +0 -1
  124. package/dist/src/grist/id-input.d.ts +0 -19
  125. package/dist/src/grist/id-input.js.map +0 -1
  126. package/dist/src/grist/id-renderer.d.ts +0 -2
  127. package/dist/src/grist/id-renderer.js +0 -9
  128. package/dist/src/grist/id-renderer.js.map +0 -1
  129. package/dist/src/grist/id-selector.js.map +0 -1
  130. package/dist/src/grist/index.js +0 -11
  131. package/dist/src/grist/index.js.map +0 -1
  132. package/dist/src/grist/object-editor.d.ts +0 -18
  133. package/dist/src/grist/object-editor.js.map +0 -1
  134. package/dist/src/grist/object-selector.js.map +0 -1
  135. package/dist/src/grist/parameters-editor-builder.js.map +0 -1
  136. package/dist/src/grist/parameters-editor-popup.js.map +0 -1
  137. package/dist/src/grist/parameters-editor.d.ts +0 -19
  138. package/dist/src/grist/parameters-editor.js.map +0 -1
  139. package/src/grist/id-input.ts +0 -135
  140. package/src/grist/index.ts +0 -13
package/package.json CHANGED
@@ -3,17 +3,32 @@
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",
6
+ "version": "1.0.0-beta.0",
7
7
  "main": "dist/src/index.js",
8
8
  "module": "dist/src/index.js",
9
9
  "exports": {
10
10
  ".": "./dist/src/index.js",
11
- "./grist/id-input.js": "./dist/src/grist/id-input.js",
12
- "./grist/id-selector.js": "./dist/src/grist/id-selector.js",
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-renderer.js": "./dist/src/grist/object-renderer.js",
16
- "./grist/code-editor.js": "./dist/src/grist/code-editor.js"
11
+ "./input.js": "./dist/src/input/index.js",
12
+ "./input/ox-input-graphql.js": "./dist/src/input/ox-input-graphql.js",
13
+ "./input/ox-input-background-pattern.js": "./dist/src/input/ox-input-background-pattern.js",
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"
17
32
  },
18
33
  "publishConfig": {
19
34
  "access": "public",
@@ -37,19 +52,31 @@
37
52
  "storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
38
53
  },
39
54
  "dependencies": {
55
+ "@graphql-tools/load": "^7.3.2",
56
+ "@graphql-tools/url-loader": "^7.2.0",
57
+ "@graphql-tools/wrap": "^8.1.1",
40
58
  "@material/mwc-button": "^0.25.3",
41
59
  "@material/mwc-icon": "^0.25.3",
42
60
  "@material/mwc-icon-button": "^0.25.3",
43
- "@operato/data-grist": "^1.0.0-alpha.6",
44
- "@operato/form": "^1.0.0-alpha.6",
45
- "@operato/graphql": "^1.0.0-alpha.6",
46
- "@operato/i18n": "^1.0.0-alpha.6",
47
- "@operato/layout": "^1.0.0-alpha.6",
48
- "@operato/property-editor": "^1.0.0-alpha.6",
49
- "@operato/shell": "^1.0.0-alpha.6",
50
- "@operato/styles": "^1.0.0-alpha.6",
51
- "@operato/utils": "^1.0.0-alpha.6",
52
- "lit": "^2.2.0"
61
+ "@operato/attachment": "^1.0.0-beta.0",
62
+ "@operato/data-grist": "^1.0.0-beta.0",
63
+ "@operato/font": "^1.0.0-beta.0",
64
+ "@operato/form": "^1.0.0-beta.0",
65
+ "@operato/graphql": "^1.0.0-beta.0",
66
+ "@operato/i18n": "^1.0.0-beta.0",
67
+ "@operato/input": "^1.0.0-beta.0",
68
+ "@operato/layout": "^1.0.0-beta.0",
69
+ "@operato/property-editor": "^1.0.0-beta.0",
70
+ "@operato/shell": "^1.0.0-beta.0",
71
+ "@operato/styles": "^1.0.0-beta.0",
72
+ "@operato/utils": "^1.0.0-beta.0",
73
+ "codemirror": "^5.59.1",
74
+ "codemirror-graphql": "^0.15.2",
75
+ "cronstrue": "^2.2.0",
76
+ "cross-fetch": "^3.1.5",
77
+ "graphql": "^15.7.2",
78
+ "graphql-tag": "^2.12.6",
79
+ "lit": "^2.2.1"
53
80
  },
54
81
  "devDependencies": {
55
82
  "@custom-elements-manifest/analyzer": "^0.4.17",
@@ -83,5 +110,5 @@
83
110
  "prettier --write"
84
111
  ]
85
112
  },
86
- "gitHead": "10e76a7dff381643b2f2ff3bb57d59f93f752a2b"
113
+ "gitHead": "06b7a224872643b4dfdd95efc83770ce96057bdf"
87
114
  }
@@ -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,64 @@
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-code')
10
+ export class OxGristEditorCode 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 { mode } = this.column.record?.options || {}
29
+
30
+ var change = (value: string) => {
31
+ this.dispatchEvent(
32
+ new CustomEvent('change', {
33
+ bubbles: true,
34
+ composed: true,
35
+ detail: {
36
+ before: this.value,
37
+ after: value,
38
+ column: this.column,
39
+ record: this.record,
40
+ row: this.row
41
+ }
42
+ })
43
+ )
44
+ }
45
+
46
+ var popup = openPopup(
47
+ html`
48
+ <ox-popup-code-input
49
+ .value=${this.value}
50
+ mode=${mode}
51
+ @change=${(e: CustomEvent) => {
52
+ change(e.detail.value)
53
+ popup.close()
54
+ }}
55
+ ></ox-popup-code-input>
56
+ `,
57
+ {
58
+ backdrop: true,
59
+ title: i18next.t('title.setting schedule'),
60
+ help: 'data-grist/grist-editor/code'
61
+ }
62
+ )
63
+ }
64
+ }
@@ -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-editor-builder.js'
6
- import './parameters-editor-popup.js'
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 { customElement, property } from 'lit/decorators.js'
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-parameters-editor')
16
- export class ParametersEditor extends LitElement {
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
- render() {
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 = !objectified && typeof this.value === 'string' ? JSON.parse(this.value) : this.value
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-editor-popup
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-editor-popup>
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 { PopupHandle, openPopup } from '@operato/layout'
8
+ import { customElement, property } from 'lit/decorators.js'
9
+
10
+ import { OxGristEditor } from '@operato/data-grist'
11
+ import { cloneDeep } from 'lodash-es'
12
+ import { html } from 'lit'
13
+ import { i18next } from '@operato/i18n'
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 { InputEditor, RecordConfig } from '@operato/data-grist'
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
- export class CodeEditor extends InputEditor {
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)
@@ -0,0 +1,83 @@
1
+ import '@material/mwc-icon'
2
+ import './ox-selector-resource-id.js'
3
+
4
+ import { GristRecord, OxGristEditor } 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 OxGristEditor {
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 '../../elements/object-selector'
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 { customElement, property } from 'lit/decorators.js'
5
+ import { TemplateResult, css, html } from 'lit'
8
6
 
7
+ import { OxGristEditor } from '@operato/data-grist'
8
+ import { customElement } from 'lit/decorators.js'
9
9
  import { i18next } from '@operato/i18n'
10
10
 
11
- @customElement('ox-object-editor')
12
- export class ObjectEditor extends LitElement {
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 OxGristEditor {
51
13
  private popup?: PopupHandle
52
14
  private template?: TemplateResult
53
15
 
54
- render() {
16
+ get editorTemplate() {
55
17
  var value = this.value || {}
56
18
 
57
19
  var { nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}
@@ -75,7 +37,6 @@ export class ObjectEditor extends LitElement {
75
37
  }
76
38
 
77
39
  async firstUpdated() {
78
- this.value = this.record[this.column.name]
79
40
  this.template = ((this.column.record || {}).options || {}).template
80
41
 
81
42
  await this.updateComplete
@@ -85,6 +46,8 @@ export class ObjectEditor extends LitElement {
85
46
 
86
47
  this.openSelector()
87
48
  })
49
+
50
+ this.openSelector()
88
51
  }
89
52
 
90
53
  openSelector() {
@@ -134,7 +97,7 @@ export class ObjectEditor extends LitElement {
134
97
  var template =
135
98
  this.template ||
136
99
  html`
137
- <object-selector
100
+ <ox-selector-resource-object
138
101
  .value=${actualValue}
139
102
  .confirmCallback=${confirmCallback.bind(this)}
140
103
  .queryName=${this.column.record.options.queryName}
@@ -142,7 +105,7 @@ export class ObjectEditor extends LitElement {
142
105
  .list=${this.column.record.options.list}
143
106
  .basicArgs=${this.column.record.options.basicArgs}
144
107
  .valueField=${this.column.record.options.valueField}
145
- ></object-selector>
108
+ ></ox-selector-resource-object>
146
109
  `
147
110
 
148
111
  this.popup = openPopup(template, {