@operato/app 1.0.0-alpha.21 → 1.0.0-alpha.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/CHANGELOG.md +28 -90
  2. package/dist/src/{grist → grist-editor}/index.d.ts +0 -0
  3. package/dist/src/grist-editor/index.js +21 -0
  4. package/dist/src/grist-editor/index.js.map +1 -0
  5. package/dist/src/grist-editor/ox-grist-editor-crontab.d.ts +8 -0
  6. package/dist/src/grist-editor/ox-grist-editor-crontab.js +50 -0
  7. package/dist/src/grist-editor/ox-grist-editor-crontab.js.map +1 -0
  8. package/dist/src/grist-editor/ox-grist-editor-json.d.ts +7 -0
  9. package/dist/src/grist-editor/ox-grist-editor-json.js +54 -0
  10. package/dist/src/grist-editor/ox-grist-editor-json.js.map +1 -0
  11. package/dist/src/grist-editor/ox-grist-editor-parameters.d.ts +12 -0
  12. package/dist/src/{grist/parameters-editor.js → grist-editor/ox-grist-editor-parameters.js} +16 -37
  13. package/dist/src/grist-editor/ox-grist-editor-parameters.js.map +1 -0
  14. package/dist/src/{grist/code-editor.d.ts → grist-editor/ox-grist-editor-resource-code.d.ts} +1 -1
  15. package/dist/src/{grist/code-editor.js → grist-editor/ox-grist-editor-resource-code.js} +6 -6
  16. package/dist/src/grist-editor/ox-grist-editor-resource-code.js.map +1 -0
  17. package/dist/src/grist-editor/ox-grist-editor-resource-id.d.ts +10 -0
  18. package/dist/src/{grist/id-input.js → grist-editor/ox-grist-editor-resource-id.js} +17 -66
  19. package/dist/src/grist-editor/ox-grist-editor-resource-id.js.map +1 -0
  20. package/dist/src/grist-editor/ox-grist-editor-resource-object.d.ts +11 -0
  21. package/dist/src/{grist/object-editor.js → grist-editor/ox-grist-editor-resource-object.js} +11 -62
  22. package/dist/src/grist-editor/ox-grist-editor-resource-object.js.map +1 -0
  23. package/dist/src/grist-editor/ox-grist-editor-value-map.d.ts +11 -0
  24. package/dist/src/grist-editor/ox-grist-editor-value-map.js +74 -0
  25. package/dist/src/grist-editor/ox-grist-editor-value-map.js.map +1 -0
  26. package/dist/src/grist-editor/ox-grist-renderer-resource-id.d.ts +2 -0
  27. package/dist/src/{grist/id-renderer.js → grist-editor/ox-grist-renderer-resource-id.js} +2 -2
  28. package/dist/src/grist-editor/ox-grist-renderer-resource-id.js.map +1 -0
  29. package/dist/src/{grist/parameters-editor-builder.d.ts → grist-editor/ox-parameters-builder.d.ts} +0 -0
  30. package/dist/src/{grist/parameters-editor-builder.js → grist-editor/ox-parameters-builder.js} +10 -10
  31. package/dist/src/grist-editor/ox-parameters-builder.js.map +1 -0
  32. package/dist/src/grist-editor/ox-popup-code-input.d.ts +12 -0
  33. package/dist/src/grist-editor/ox-popup-code-input.js +81 -0
  34. package/dist/src/grist-editor/ox-popup-code-input.js.map +1 -0
  35. package/dist/src/grist-editor/ox-popup-crontab-input.d.ts +11 -0
  36. package/dist/src/grist-editor/ox-popup-crontab-input.js +74 -0
  37. package/dist/src/grist-editor/ox-popup-crontab-input.js.map +1 -0
  38. package/dist/src/{grist/parameters-editor-popup.d.ts → grist-editor/ox-popup-parameters-builder.d.ts} +1 -1
  39. package/dist/src/{grist/parameters-editor-popup.js → grist-editor/ox-popup-parameters-builder.js} +15 -15
  40. package/dist/src/grist-editor/ox-popup-parameters-builder.js.map +1 -0
  41. package/dist/src/grist-editor/ox-popup-value-map-input.d.ts +12 -0
  42. package/dist/src/grist-editor/ox-popup-value-map-input.js +104 -0
  43. package/dist/src/grist-editor/ox-popup-value-map-input.js.map +1 -0
  44. package/dist/src/{grist/id-selector.d.ts → grist-editor/ox-selector-resource-id.d.ts} +1 -1
  45. package/dist/src/{grist/id-selector.js → grist-editor/ox-selector-resource-id.js} +15 -15
  46. package/dist/src/grist-editor/ox-selector-resource-id.js.map +1 -0
  47. package/dist/src/{grist/object-selector.d.ts → grist-editor/ox-selector-resource-object.d.ts} +1 -1
  48. package/dist/src/{grist/object-selector.js → grist-editor/ox-selector-resource-object.js} +20 -20
  49. package/dist/src/grist-editor/ox-selector-resource-object.js.map +1 -0
  50. package/dist/src/index.d.ts +3 -1
  51. package/dist/src/index.js +3 -1
  52. package/dist/src/index.js.map +1 -1
  53. package/dist/src/input/index.d.ts +3 -0
  54. package/dist/src/input/index.js +4 -0
  55. package/dist/src/input/index.js.map +1 -0
  56. package/dist/tsconfig.tsbuildinfo +1 -1
  57. package/package.json +28 -23
  58. package/src/grist-editor/index.ts +23 -0
  59. package/src/grist-editor/ox-grist-editor-crontab.ts +62 -0
  60. package/src/grist-editor/ox-grist-editor-json.ts +62 -0
  61. package/src/{grist/parameters-editor.ts → grist-editor/ox-grist-editor-parameters.ts} +13 -26
  62. package/src/{grist/code-editor.ts → grist-editor/ox-grist-editor-resource-code.ts} +2 -2
  63. package/src/grist-editor/ox-grist-editor-resource-id.ts +83 -0
  64. package/src/{grist/object-editor.ts → grist-editor/ox-grist-editor-resource-object.ts} +7 -46
  65. package/src/grist-editor/ox-grist-editor-value-map.ts +86 -0
  66. package/src/{grist/id-renderer.ts → grist-editor/ox-grist-renderer-resource-id.ts} +1 -1
  67. package/src/{grist/parameters-editor-builder.ts → grist-editor/ox-parameters-builder.ts} +4 -4
  68. package/src/grist-editor/ox-popup-code-input.ts +75 -0
  69. package/src/grist-editor/ox-popup-crontab-input.ts +74 -0
  70. package/src/{grist/parameters-editor-popup.ts → grist-editor/ox-popup-parameters-builder.ts} +5 -5
  71. package/src/grist-editor/ox-popup-value-map-input.ts +101 -0
  72. package/src/{grist/id-selector.ts → grist-editor/ox-selector-resource-id.ts} +2 -2
  73. package/src/{grist/object-selector.ts → grist-editor/ox-selector-resource-object.ts} +2 -2
  74. package/src/index.ts +3 -1
  75. package/src/input/index.ts +3 -0
  76. package/yarn-error.log +1 -1
  77. package/dist/src/grist/code-editor.js.map +0 -1
  78. package/dist/src/grist/id-input.d.ts +0 -19
  79. package/dist/src/grist/id-input.js.map +0 -1
  80. package/dist/src/grist/id-renderer.d.ts +0 -2
  81. package/dist/src/grist/id-renderer.js.map +0 -1
  82. package/dist/src/grist/id-selector.js.map +0 -1
  83. package/dist/src/grist/index.js +0 -11
  84. package/dist/src/grist/index.js.map +0 -1
  85. package/dist/src/grist/object-editor.d.ts +0 -18
  86. package/dist/src/grist/object-editor.js.map +0 -1
  87. package/dist/src/grist/object-selector.js.map +0 -1
  88. package/dist/src/grist/parameters-editor-builder.js.map +0 -1
  89. package/dist/src/grist/parameters-editor-popup.js.map +0 -1
  90. package/dist/src/grist/parameters-editor.d.ts +0 -19
  91. package/dist/src/grist/parameters-editor.js.map +0 -1
  92. package/src/grist/id-input.ts +0 -135
  93. package/src/grist/index.ts +0 -13
@@ -1,135 +0,0 @@
1
- import '@material/mwc-icon'
2
- import './id-selector.js'
3
-
4
- import { ColumnConfig, GristRecord, InputEditor } from '@operato/data-grist'
5
- import { TemplateResult, css, html } from 'lit'
6
- import { customElement, property } from 'lit/decorators.js'
7
-
8
- import { openPopup } from '@operato/layout'
9
-
10
- @customElement('ox-id-input')
11
- export class IdInput extends InputEditor {
12
- static styles = css`
13
- :host {
14
- display: flex;
15
- flex-flow: row nowrap;
16
- align-items: center;
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
-
30
- justify-content: inherit;
31
- }
32
-
33
- span {
34
- display: flex;
35
- flex: auto;
36
-
37
- justify-content: inherit;
38
- }
39
-
40
- mwc-icon {
41
- width: 20px;
42
- font-size: 1.5em;
43
- margin-left: auto;
44
- }
45
- `
46
-
47
- @property({ type: Object }) value?: { id?: string; [propany: string]: any }
48
- @property({ type: Object }) column!: ColumnConfig
49
- @property({ type: Object }) record!: GristRecord
50
- @property({ type: Number }) row!: number
51
-
52
- private popup?: {
53
- name: string
54
- close: () => void
55
- closed: boolean
56
- onclosed?: (() => void) | undefined
57
- }
58
-
59
- private template?: TemplateResult
60
-
61
- render() {
62
- var { nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}
63
- var value = this.value
64
-
65
- return html`
66
- ${!value ? html`` : html` <span>${value[nameField]} (${value[descriptionField]})</span> `}
67
- <mwc-icon>arrow_drop_down</mwc-icon>
68
- `
69
- }
70
-
71
- async firstUpdated() {
72
- this.value = this.record[this.column.name]
73
- this.template = ((this.column.record || {}).options || {}).template
74
-
75
- await this.updateComplete
76
-
77
- this.renderRoot.addEventListener('click', e => {
78
- e.stopPropagation()
79
-
80
- this.openSelector()
81
- })
82
-
83
- this.openSelector()
84
- }
85
-
86
- openSelector() {
87
- if (this.popup) {
88
- delete this.popup
89
- }
90
-
91
- const confirmCallback: (record: GristRecord | undefined) => void = selected => {
92
- if (!selected) {
93
- return
94
- }
95
-
96
- var { idField = 'id', nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}
97
-
98
- this.dispatchEvent(
99
- new CustomEvent('field-change', {
100
- bubbles: true,
101
- composed: true,
102
- detail: {
103
- before: this.value,
104
- after: {
105
- [idField]: selected[idField],
106
- [nameField]: selected[nameField],
107
- [descriptionField]: selected[descriptionField]
108
- },
109
- record: this.record,
110
- column: this.column,
111
- row: this.row
112
- }
113
- })
114
- )
115
- }
116
-
117
- var value = this.value || {}
118
- var template =
119
- this.template ||
120
- html`
121
- <ox-id-selector
122
- .value=${value.id}
123
- .confirmCallback=${confirmCallback.bind(this)}
124
- .queryName=${this.column.record.options.queryName}
125
- .basicArgs=${this.column.record.options.basicArgs}
126
- ></ox-id-selector>
127
- `
128
-
129
- this.popup = openPopup(template, {
130
- backdrop: true,
131
- size: 'large',
132
- title: 'select item'
133
- })
134
- }
135
- }
@@ -1,13 +0,0 @@
1
- import { registerEditor, registerRenderer } from '@operato/data-grist'
2
-
3
- import { CodeEditor } from './code-editor'
4
- import { IdInput } from './id-input.js'
5
- import { IdRenderer } from './id-renderer.js'
6
- import { ObjectEditor } from './object-editor'
7
-
8
- /* register grist renderer/editor for id */
9
- registerEditor('id', IdInput)
10
- registerEditor('object', ObjectEditor as any)
11
- registerEditor('code', CodeEditor)
12
-
13
- registerRenderer('id', IdRenderer)