@operato/app 1.0.0-alpha.8 → 1.0.0-beta.1

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 +333 -15
  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
@@ -0,0 +1,86 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import './ox-popup-value-map-input.js'
6
+
7
+ import { ColumnConfig, GristRecord, OxGristEditor } from '@operato/data-grist'
8
+ import { PopupHandle, openPopup } from '@operato/layout'
9
+ import { css, html } from 'lit'
10
+ import { customElement, property } from 'lit/decorators.js'
11
+
12
+ import { cloneDeep } from 'lodash-es'
13
+ import { i18next } from '@operato/i18n'
14
+
15
+ @customElement('ox-grist-editor-value-map')
16
+ export class OxGristEditorValueMap extends 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,30 @@
1
+ import { FieldRenderer } from '@operato/data-grist'
2
+ import cronstrue from 'cronstrue/i18n'
3
+ import { detectOverflow } from '@operato/utils'
4
+ import { html } from 'lit'
5
+ import i18next from 'i18next'
6
+
7
+ function onmouseover(e: Event) {
8
+ const element = e.target as HTMLSpanElement
9
+ if (detectOverflow(element)) {
10
+ element.setAttribute('data-tooltip', element.textContent!)
11
+ }
12
+ }
13
+
14
+ function onmouseout(e: Event) {
15
+ const element = e.target as HTMLSpanElement
16
+ element.removeAttribute('data-tooltip')
17
+ }
18
+
19
+ export const OxGristRendererCrontab: FieldRenderer = (value, column, record, rowIndex, field) => {
20
+ let text = ''
21
+
22
+ try {
23
+ const language = (i18next.language || 'en').substring(0, 2)
24
+ text = value === undefined ? '' : cronstrue.toString(value, { locale: language || 'en' })
25
+ } catch (e) {
26
+ console.error(e)
27
+ }
28
+
29
+ return html`<span @mouseover=${onmouseover} @mouseout=${onmouseout}>${text}</span>`
30
+ }
@@ -1,12 +1,13 @@
1
- import { FieldRenderer } from '@operato/data-grist'
2
1
  import { html } from 'lit'
3
2
 
4
- export const IdRenderer: FieldRenderer = (value, column, record, rowIndex, field) => {
3
+ import { FieldRenderer } from '@operato/data-grist'
4
+
5
+ export const OxGristRendererResourceId: FieldRenderer = (value, column, record, rowIndex, field) => {
5
6
  if (!value) {
6
7
  return ''
7
8
  }
8
9
 
9
10
  var { nameField = 'name', descriptionField = 'description' } = column.record.options || {}
10
11
 
11
- return html` ${value[nameField] || ''}(${value[descriptionField] || ''}) `
12
+ return html`<span>${value[nameField] || ''}(${value[descriptionField] || ''})</span> `
12
13
  }
@@ -0,0 +1,26 @@
1
+ import { html } from 'lit-html'
2
+
3
+ import { FieldRenderer } from '@operato/data-grist'
4
+
5
+ export const OxGristRendererResourceObject: FieldRenderer = (value, column, record, rowIndex, field) => {
6
+ if (!value) {
7
+ return ''
8
+ }
9
+
10
+ var { nameField = 'name', descriptionField = 'description' } = column.record.options || {}
11
+ var name, description
12
+
13
+ if (typeof nameField === 'function') {
14
+ name = nameField(value)
15
+ } else {
16
+ name = value[nameField]
17
+ }
18
+
19
+ if (typeof descriptionField === 'function') {
20
+ description = descriptionField(value)
21
+ } else {
22
+ description = value[descriptionField] && `(${value[descriptionField]})`
23
+ }
24
+
25
+ return html`<span>${name || ''}${description || ''}</span> `
26
+ }
@@ -2,8 +2,6 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
 
5
- import '@things-factory/modeller-ui'
6
-
7
5
  import { LitElement, PropertyValues, html } from 'lit'
8
6
  import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
9
7
  import { customElement, property } from 'lit/decorators.js'
@@ -16,12 +14,12 @@ import { store } from '@operato/shell'
16
14
 
17
15
  Example:
18
16
 
19
- <ox-parameters-editor-builder value="{{value}}">
17
+ <ox-parameters-builder value="{{value}}">
20
18
  <label>Center X</label>
21
19
  <input type="number" .value="${value.cx}">
22
20
  <label>Width</label>
23
21
  <input type="number" .value="${value.width}">
24
- </ox-parameters-editor-builder>
22
+ </ox-parameters-builder>
25
23
  */
26
24
 
27
25
  const DEFAULT_VALUE = {
@@ -45,8 +43,8 @@ const DEFAULT_VALUE = {
45
43
  date: null
46
44
  } as any
47
45
 
48
- @customElement('ox-parameters-editor-builder')
49
- class ParametersEditorBuilder extends connect(store)(LitElement) {
46
+ @customElement('ox-parameters-builder')
47
+ class OxParametersBuilder extends connect(store)(LitElement) {
50
48
  @property({ type: Object }) value: any
51
49
  @property({ type: Array }) props?: PropertySpec[]
52
50
  @property({ type: Object }) host: any
@@ -0,0 +1,65 @@
1
+ import '@operato/input/ox-input-code.js'
2
+
3
+ import { LitElement, css, html } from 'lit'
4
+ import { customElement, property } from 'lit/decorators.js'
5
+
6
+ import { ScrollbarStyles } from '@operato/styles'
7
+ import { i18next } from '@operato/i18n'
8
+
9
+ @customElement('ox-popup-code-input')
10
+ export class OxPopupCodeInput extends LitElement {
11
+ static styles = [
12
+ ScrollbarStyles,
13
+ css`
14
+ :host {
15
+ display: flex;
16
+ flex-direction: column;
17
+
18
+ background-color: #fff;
19
+
20
+ width: var(--overlay-center-normal-width, 50%);
21
+ height: var(--overlay-center-normal-height, 50%);
22
+ }
23
+
24
+ ox-input-code {
25
+ flex: 1;
26
+ overflow-y: auto;
27
+ }
28
+
29
+ .button-container {
30
+ display: flex;
31
+ margin-left: auto;
32
+ }
33
+ `
34
+ ]
35
+
36
+ @property({ type: Object }) value: any
37
+ @property({ type: String }) mode: string = 'javascript'
38
+ @property({ type: Object }) confirmCallback!: (newval: any) => void
39
+
40
+ render() {
41
+ return html`
42
+ <ox-input-code .value=${this.value} .mode=${this.mode} @change=${this.onChange.bind(this)}> </ox-input-code>
43
+
44
+ <div class="button-container">
45
+ <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
46
+ <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
47
+ </div>
48
+ `
49
+ }
50
+
51
+ private onChange(e: CustomEvent) {
52
+ e.stopPropagation()
53
+
54
+ this.value = e.detail
55
+ }
56
+
57
+ private onCancel(e: Event) {
58
+ history.back()
59
+ }
60
+
61
+ private onConfirm(e: Event) {
62
+ this.confirmCallback && this.confirmCallback(this.value)
63
+ history.back()
64
+ }
65
+ }
@@ -0,0 +1,74 @@
1
+ import '@operato/input/ox-input-crontab.js'
2
+
3
+ import { LitElement, css, html } from 'lit'
4
+ import { customElement, property } from 'lit/decorators.js'
5
+
6
+ import { ScrollbarStyles } from '@operato/styles'
7
+ import { i18next } from '@operato/i18n'
8
+
9
+ @customElement('ox-popup-crontab-input')
10
+ export class OxPopupCrontabInput extends LitElement {
11
+ static styles = [
12
+ ScrollbarStyles,
13
+ css`
14
+ :host {
15
+ display: flex;
16
+ flex-direction: column;
17
+
18
+ background-color: #fff;
19
+
20
+ width: var(--overlay-center-normal-width, 50%);
21
+ height: var(--overlay-center-normal-height, 50%);
22
+ }
23
+
24
+ ox-input-crontab {
25
+ flex: 1;
26
+ overflow-y: auto;
27
+ }
28
+
29
+ span {
30
+ flex: 1;
31
+
32
+ display: flex;
33
+ align-items: center;
34
+ justify-content: center;
35
+
36
+ color: var(--primary-color);
37
+ }
38
+
39
+ .button-container {
40
+ display: flex;
41
+ margin-left: auto;
42
+ }
43
+ `
44
+ ]
45
+
46
+ @property({ type: Object }) value: any
47
+ @property({ type: Object }) confirmCallback!: (newval: any) => void
48
+
49
+ render() {
50
+ return html`
51
+ <ox-input-crontab .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-crontab>
52
+
53
+ <div class="button-container">
54
+ <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
55
+ <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
56
+ </div>
57
+ `
58
+ }
59
+
60
+ private onChange(e: CustomEvent) {
61
+ e.stopPropagation()
62
+
63
+ this.value = e.detail
64
+ }
65
+
66
+ private onCancel(e: Event) {
67
+ history.back()
68
+ }
69
+
70
+ private onConfirm(e: Event) {
71
+ this.confirmCallback && this.confirmCallback(this.value)
72
+ history.back()
73
+ }
74
+ }
@@ -4,8 +4,8 @@ import { customElement, property } from 'lit/decorators.js'
4
4
  import { ScrollbarStyles } from '@operato/styles'
5
5
  import { i18next } from '@operato/i18n'
6
6
 
7
- @customElement('ox-parameters-editor-popup')
8
- export class ParametersEditorPopup extends LitElement {
7
+ @customElement('ox-popup-parameters-builder')
8
+ export class OxPopupParametersBuilder extends LitElement {
9
9
  static styles = [
10
10
  ScrollbarStyles,
11
11
  css`
@@ -19,7 +19,7 @@ export class ParametersEditorPopup extends LitElement {
19
19
  height: var(--overlay-center-normal-height, 50%);
20
20
  }
21
21
 
22
- ox-parameters-editor-builder {
22
+ ox-parameters-builder {
23
23
  flex: 1;
24
24
  overflow-y: auto;
25
25
  }
@@ -53,14 +53,14 @@ export class ParametersEditorPopup extends LitElement {
53
53
  return html`
54
54
  ${props.length > 0
55
55
  ? html`
56
- <ox-parameters-editor-builder
56
+ <ox-parameters-builder
57
57
  .value=${this.value}
58
58
  .props=${props}
59
59
  .host=${this.host}
60
60
  .context=${this.context}
61
61
  @property-change=${this.onChange.bind(this)}
62
62
  >
63
- </ox-parameters-editor-builder>
63
+ </ox-parameters-builder>
64
64
  `
65
65
  : html` <span><i18n-msg msgid="text.no properties to set"></i18n-msg></span> `}
66
66
 
@@ -0,0 +1,95 @@
1
+ import '@operato/input/ox-input-partition-keys.js'
2
+
3
+ import { LitElement, css, html } from 'lit'
4
+ import { customElement, property } from 'lit/decorators.js'
5
+
6
+ import { ScrollbarStyles } from '@operato/styles'
7
+ import { i18next } from '@operato/i18n'
8
+
9
+ @customElement('ox-popup-partition-keys-input')
10
+ export class OxPopupPartitionKeysInput extends LitElement {
11
+ static styles = [
12
+ ScrollbarStyles,
13
+ css`
14
+ :host {
15
+ display: flex;
16
+ flex-direction: column;
17
+
18
+ background-color: #fff;
19
+
20
+ width: var(--overlay-center-normal-width, 50%);
21
+ height: var(--overlay-center-normal-height, 50%);
22
+ }
23
+
24
+ ox-input-partition-keys {
25
+ flex: 1;
26
+ overflow-y: auto;
27
+ }
28
+
29
+ span {
30
+ flex: 1;
31
+
32
+ display: flex;
33
+ align-items: center;
34
+ justify-content: center;
35
+
36
+ color: var(--primary-color);
37
+ }
38
+
39
+ .button-container {
40
+ display: flex;
41
+ margin-left: auto;
42
+ }
43
+ `
44
+ ]
45
+
46
+ @property({ type: Object }) value: any
47
+ @property({ type: String }) valuetype: string = 'string'
48
+ @property({ type: Object }) confirmCallback!: (newval: any) => void
49
+
50
+ render() {
51
+ return html`
52
+ <ox-input-partition-keys .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-partition-keys>
53
+
54
+ <div class="button-container">
55
+ <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
56
+ <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
57
+ </div>
58
+ `
59
+ }
60
+
61
+ private onChange(e: CustomEvent) {
62
+ e.stopPropagation()
63
+
64
+ /*
65
+ 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
66
+ layout의 구성에 변화가 발생하면, 다시 render된다.
67
+ 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
68
+ 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
69
+ 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
70
+ 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
71
+ (이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)
72
+ =>
73
+ 이런 이유로, Object.assign(...)을 사용하였다.
74
+ */
75
+
76
+ if (!this.value || typeof this.value !== 'object') {
77
+ this.value = {}
78
+ }
79
+
80
+ for (let key in this.value) {
81
+ delete this.value[key]
82
+ }
83
+
84
+ Object.assign(this.value, e.detail)
85
+ }
86
+
87
+ private onCancel(e: Event) {
88
+ history.back()
89
+ }
90
+
91
+ private onConfirm(e: Event) {
92
+ this.confirmCallback && this.confirmCallback(this.value)
93
+ history.back()
94
+ }
95
+ }
@@ -0,0 +1,101 @@
1
+ import '@operato/input/ox-input-value-map.js'
2
+
3
+ import { LitElement, css, html } from 'lit'
4
+ import { customElement, property } from 'lit/decorators.js'
5
+
6
+ import { ScrollbarStyles } from '@operato/styles'
7
+ import { i18next } from '@operato/i18n'
8
+
9
+ @customElement('ox-popup-value-map-input')
10
+ export class OxPopupValueMapInput extends LitElement {
11
+ static styles = [
12
+ ScrollbarStyles,
13
+ css`
14
+ :host {
15
+ display: flex;
16
+ flex-direction: column;
17
+
18
+ background-color: #fff;
19
+
20
+ width: var(--overlay-center-normal-width, 50%);
21
+ height: var(--overlay-center-normal-height, 50%);
22
+ }
23
+
24
+ ox-input-value-map {
25
+ flex: 1;
26
+ overflow-y: auto;
27
+ }
28
+
29
+ span {
30
+ flex: 1;
31
+
32
+ display: flex;
33
+ align-items: center;
34
+ justify-content: center;
35
+
36
+ color: var(--primary-color);
37
+ }
38
+
39
+ .button-container {
40
+ display: flex;
41
+ margin-left: auto;
42
+ }
43
+ `
44
+ ]
45
+
46
+ @property({ type: Object }) value: any
47
+ @property({ type: String }) valuetype: string = 'string'
48
+ @property({ type: Object }) confirmCallback!: (newval: any) => void
49
+
50
+ render() {
51
+ return html`
52
+ <ox-input-value-map
53
+ .value=${this.value}
54
+ keytype="string"
55
+ .valuetype=${this.valuetype}
56
+ @change=${this.onChange.bind(this)}
57
+ >
58
+ </ox-input-value-map>
59
+
60
+ <div class="button-container">
61
+ <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
62
+ <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
63
+ </div>
64
+ `
65
+ }
66
+
67
+ private onChange(e: CustomEvent) {
68
+ e.stopPropagation()
69
+
70
+ /*
71
+ 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
72
+ layout의 구성에 변화가 발생하면, 다시 render된다.
73
+ 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
74
+ 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
75
+ 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
76
+ 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
77
+ (이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)
78
+ =>
79
+ 이런 이유로, Object.assign(...)을 사용하였다.
80
+ */
81
+
82
+ if (!this.value) {
83
+ this.value = {}
84
+ }
85
+
86
+ for (let key in this.value) {
87
+ delete this.value[key]
88
+ }
89
+
90
+ Object.assign(this.value, e.detail)
91
+ }
92
+
93
+ private onCancel(e: Event) {
94
+ history.back()
95
+ }
96
+
97
+ private onConfirm(e: Event) {
98
+ this.confirmCallback && this.confirmCallback(this.value)
99
+ history.back()
100
+ }
101
+ }
@@ -9,8 +9,8 @@ import gql from 'graphql-tag'
9
9
  import { i18next } from '@operato/i18n'
10
10
  import { isMobileDevice } from '@operato/utils'
11
11
 
12
- @customElement('ox-id-selector')
13
- export class IdSelector extends LitElement {
12
+ @customElement('ox-selector-resource-id')
13
+ export class OxSelectorResourceId extends LitElement {
14
14
  static styles = css`
15
15
  :host {
16
16
  display: flex;
@@ -20,8 +20,8 @@ import gql from 'graphql-tag'
20
20
  import { i18next } from '@operato/i18n'
21
21
  import { isMobileDevice } from '@operato/utils'
22
22
 
23
- @customElement('ox-object-selector')
24
- export class ObjectSelector extends LitElement {
23
+ @customElement('ox-selector-resource-object')
24
+ export class OxSelectorResourceObject extends LitElement {
25
25
  static styles = [
26
26
  MultiColumnFormStyles,
27
27
  css`
@@ -32,7 +32,7 @@ export class ObjectSelector extends LitElement {
32
32
  background-color: #fff;
33
33
  }
34
34
 
35
- data-grist {
35
+ ox-grist {
36
36
  flex: 1;
37
37
  }
38
38
 
@@ -82,7 +82,7 @@ export class ObjectSelector extends LitElement {
82
82
  <ox-search-form
83
83
  id="search-form"
84
84
  @keypress=${(e: KeyboardEvent) => {
85
- if (e.keyCode === 13) {
85
+ if (e.key === 'Enter') {
86
86
  this.grist.fetch()
87
87
  }
88
88
  }}
package/src/index.ts CHANGED
@@ -1 +1,3 @@
1
- export * from './grist/index.js'
1
+ export * from './input/index.js'
2
+ export * from './property-editor'
3
+ export * from './grist-editor/index.js'
@@ -0,0 +1,3 @@
1
+ export * from './ox-input-background-pattern.js'
2
+ export * from './ox-input-fill-style.js'
3
+ export * from './ox-input-graphql.js'