@operato/app 1.0.0-alpha.9 → 1.0.0-beta.2

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 (145) hide show
  1. package/@types/global/index.d.ts +2 -0
  2. package/CHANGELOG.md +335 -17
  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 +53 -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 +9 -0
  27. package/dist/src/grist-editor/ox-grist-editor-resource-id.js +72 -0
  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} +30 -78
  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} +4 -3
  63. package/dist/src/{grist/id-selector.js → grist-editor/ox-selector-resource-id.js} +23 -18
  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} +4 -3
  66. package/dist/src/{grist/object-selector.js → grist-editor/ox-selector-resource-object.js} +30 -25
  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 +1 -1
  75. package/dist/src/input/ox-input-background-pattern.js +6 -3
  76. package/dist/src/input/ox-input-background-pattern.js.map +1 -1
  77. package/dist/src/input/ox-input-fill-style.d.ts +2 -3
  78. package/dist/src/input/ox-input-fill-style.js +2 -2
  79. package/dist/src/input/ox-input-fill-style.js.map +1 -1
  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 +44 -22
  91. package/src/grist-editor/index.ts +30 -0
  92. package/src/grist-editor/ox-grist-editor-code.ts +62 -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 +85 -0
  99. package/src/{grist/object-editor.ts → grist-editor/ox-grist-editor-resource-object.ts} +28 -63
  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} +12 -6
  111. package/src/{grist/object-selector.ts → grist-editor/ox-selector-resource-object.ts} +15 -9
  112. package/src/index.ts +3 -1
  113. package/src/input/index.ts +3 -0
  114. package/src/input/ox-input-background-pattern.ts +6 -3
  115. package/src/input/ox-input-fill-style.ts +3 -4
  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 +0 -119
  126. package/dist/src/grist/id-input.js.map +0 -1
  127. package/dist/src/grist/id-renderer.d.ts +0 -2
  128. package/dist/src/grist/id-renderer.js +0 -9
  129. package/dist/src/grist/id-renderer.js.map +0 -1
  130. package/dist/src/grist/id-selector.js.map +0 -1
  131. package/dist/src/grist/index.js +0 -11
  132. package/dist/src/grist/index.js.map +0 -1
  133. package/dist/src/grist/object-editor.d.ts +0 -18
  134. package/dist/src/grist/object-editor.js.map +0 -1
  135. package/dist/src/grist/object-selector.js.map +0 -1
  136. package/dist/src/grist/parameters-editor-builder.js.map +0 -1
  137. package/dist/src/grist/parameters-editor-popup.js.map +0 -1
  138. package/dist/src/grist/parameters-editor.d.ts +0 -19
  139. package/dist/src/grist/parameters-editor.js.map +0 -1
  140. package/dist/src/input/ox-input-color-gradient.d.ts +0 -25
  141. package/dist/src/input/ox-input-color-gradient.js +0 -318
  142. package/dist/src/input/ox-input-color-gradient.js.map +0 -1
  143. package/src/grist/id-input.ts +0 -135
  144. package/src/grist/index.ts +0 -13
  145. package/src/input/ox-input-color-gradient.ts +0 -341
@@ -0,0 +1,50 @@
1
+ import { __decorate } from "tslib";
2
+ import './ox-popup-crontab-input.js';
3
+ import { html } from 'lit';
4
+ import { customElement } from 'lit/decorators.js';
5
+ import { OxGristEditor } from '@operato/data-grist';
6
+ import { i18next } from '@operato/i18n';
7
+ import { openPopup } from '@operato/layout';
8
+ let OxGristEditorCrontab = class OxGristEditorCrontab extends OxGristEditor {
9
+ get editorTemplate() {
10
+ return html ` <input type="text" .value=${this.value || ''} /> `;
11
+ }
12
+ async firstUpdated() {
13
+ await this.updateComplete;
14
+ this.renderRoot.addEventListener('click', e => {
15
+ e.stopPropagation();
16
+ this.showEditorPopup();
17
+ });
18
+ this.showEditorPopup();
19
+ }
20
+ showEditorPopup() {
21
+ if (this.popup) {
22
+ delete this.popup;
23
+ }
24
+ const confirmCallback = (newval) => {
25
+ this.dispatchEvent(new CustomEvent('field-change', {
26
+ bubbles: true,
27
+ composed: true,
28
+ detail: {
29
+ before: this.value,
30
+ after: newval,
31
+ record: this.record,
32
+ column: this.column,
33
+ row: this.row
34
+ }
35
+ }));
36
+ };
37
+ this.popup = openPopup(html `
38
+ <ox-popup-crontab-input .value=${this.value} .confirmCallback=${confirmCallback}></ox-popup-crontab-input>
39
+ `, {
40
+ backdrop: true,
41
+ title: i18next.t('title.setting schedule'),
42
+ help: 'data-grist/grist-editor/crontab'
43
+ });
44
+ }
45
+ };
46
+ OxGristEditorCrontab = __decorate([
47
+ customElement('ox-grist-editor-crontab')
48
+ ], OxGristEditorCrontab);
49
+ export { OxGristEditorCrontab };
50
+ //# sourceMappingURL=ox-grist-editor-crontab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-grist-editor-crontab.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-editor-crontab.ts"],"names":[],"mappings":";AAAA,OAAO,6BAA6B,CAAA;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC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oB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAmDhC;SAnDY,oBAAoB","sourcesContent":["import './ox-popup-crontab-input.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxGristEditor } from '@operato/data-grist'\nimport { i18next } from '@operato/i18n'\nimport { openPopup, PopupHandle } from '@operato/layout'\n\n@customElement('ox-grist-editor-crontab')\nexport class OxGristEditorCrontab extends OxGristEditor {\n private popup?: PopupHandle\n\n get editorTemplate() {\n return html` <input type=\"text\" .value=${this.value || ''} /> `\n }\n\n async firstUpdated() {\n await this.updateComplete\n\n this.renderRoot.addEventListener('click', e => {\n e.stopPropagation()\n\n this.showEditorPopup()\n })\n\n this.showEditorPopup()\n }\n\n showEditorPopup() {\n if (this.popup) {\n delete this.popup\n }\n\n const confirmCallback = (newval: any) => {\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: this.value,\n after: newval,\n record: this.record,\n column: this.column,\n row: this.row\n }\n })\n )\n }\n\n this.popup = openPopup(\n html`\n <ox-popup-crontab-input .value=${this.value} .confirmCallback=${confirmCallback}></ox-popup-crontab-input>\n `,\n {\n backdrop: true,\n title: i18next.t('title.setting schedule'),\n help: 'data-grist/grist-editor/crontab'\n }\n )\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import './ox-popup-code-input.js';
2
+ import { OxGristEditor } from '@operato/data-grist';
3
+ export declare class OxGristEditorJson extends OxGristEditor {
4
+ get editorTemplate(): import("lit-html").TemplateResult<1>;
5
+ firstUpdated(): Promise<void>;
6
+ showEditorPopup(): void;
7
+ }
@@ -0,0 +1,54 @@
1
+ import { __decorate } from "tslib";
2
+ import './ox-popup-code-input.js';
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
+ let OxGristEditorJson = class OxGristEditorJson extends OxGristEditor {
9
+ get editorTemplate() {
10
+ return html ` <input type="text" .value=${this.value || ''} /> `;
11
+ }
12
+ async firstUpdated() {
13
+ await this.updateComplete;
14
+ this.renderRoot.addEventListener('click', e => {
15
+ e.stopPropagation();
16
+ this.showEditorPopup();
17
+ });
18
+ this.showEditorPopup();
19
+ }
20
+ showEditorPopup() {
21
+ var change = (value) => {
22
+ this.dispatchEvent(new CustomEvent('change', {
23
+ bubbles: true,
24
+ composed: true,
25
+ detail: {
26
+ before: this.value,
27
+ after: value,
28
+ column: this.column,
29
+ record: this.record,
30
+ row: this.row
31
+ }
32
+ }));
33
+ };
34
+ var popup = openPopup(html `
35
+ <ox-popup-code-input
36
+ .value=${this.value}
37
+ mode="javascript"
38
+ @change=${(e) => {
39
+ change(e.detail.value);
40
+ popup.close();
41
+ }}
42
+ ></ox-popup-code-input>
43
+ `, {
44
+ backdrop: true,
45
+ title: i18next.t('title.setting schedule'),
46
+ help: 'data-grist/grist-editor/code'
47
+ });
48
+ }
49
+ };
50
+ OxGristEditorJson = __decorate([
51
+ customElement('ox-grist-editor-json')
52
+ ], OxGristEditorJson);
53
+ export { OxGristEditorJson };
54
+ //# sourceMappingURL=ox-grist-editor-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-grist-editor-json.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-editor-json.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAG3C,IAAa,iBAAiB,GAA9B,MAAa,iBAAkB,SAAQ,aAAa;IAClD,IAAI,cAAc;QAChB,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":["import './ox-popup-code-input.js'\n\nimport { OxGristEditor } from '@operato/data-grist'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\nimport { i18next } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\n\n@customElement('ox-grist-editor-json')\nexport class OxGristEditorJson extends OxGristEditor {\n get editorTemplate() {\n return html` <input type=\"text\" .value=${this.value || ''} /> `\n }\n\n async firstUpdated() {\n await this.updateComplete\n\n this.renderRoot.addEventListener('click', e => {\n e.stopPropagation()\n\n this.showEditorPopup()\n })\n\n this.showEditorPopup()\n }\n\n showEditorPopup() {\n var change = (value: string) => {\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: {\n before: this.value,\n after: value,\n column: this.column,\n record: this.record,\n row: this.row\n }\n })\n )\n }\n\n var popup = openPopup(\n html`\n <ox-popup-code-input\n .value=${this.value}\n mode=\"javascript\"\n @change=${(e: CustomEvent) => {\n change(e.detail.value)\n popup.close()\n }}\n ></ox-popup-code-input>\n `,\n {\n backdrop: true,\n title: i18next.t('title.setting schedule'),\n help: 'data-grist/grist-editor/code'\n }\n )\n }\n}\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import './ox-parameters-builder.js';
5
+ import './ox-popup-parameters-builder.js';
6
+ import { OxGristEditor } from '@operato/data-grist';
7
+ export declare class OxGristEditorParameters extends OxGristEditor {
8
+ private popup?;
9
+ get editorTemplate(): import("lit-html").TemplateResult<1>;
10
+ firstUpdated(): Promise<void>;
11
+ openSelector(): Promise<void>;
12
+ }
@@ -2,14 +2,16 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
  import { __decorate } from "tslib";
5
- import './parameters-editor-builder.js';
6
- import './parameters-editor-popup.js';
7
- import { LitElement, css, html } from 'lit';
5
+ import './ox-parameters-builder.js';
6
+ import './ox-popup-parameters-builder.js';
7
+ import { OxGristEditor } from '@operato/data-grist';
8
8
  import { openPopup } from '@operato/layout';
9
- import { customElement, property } from 'lit/decorators.js';
9
+ import { html } from 'lit';
10
+ import { cloneDeep } from 'lodash-es';
11
+ import { customElement } from 'lit/decorators.js';
10
12
  import { i18next } from '@operato/i18n';
11
- let ParametersEditor = class ParametersEditor extends LitElement {
12
- render() {
13
+ let OxGristEditorParameters = class OxGristEditorParameters extends OxGristEditor {
14
+ get editorTemplate() {
13
15
  const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value;
14
16
  return html ` ${value || ''} `;
15
17
  }
@@ -44,7 +46,7 @@ let ParametersEditor = class ParametersEditor extends LitElement {
44
46
  }));
45
47
  };
46
48
  try {
47
- var value = !objectified && typeof this.value === 'string' ? JSON.parse(this.value) : this.value;
49
+ var value = !objectified && typeof this.value === 'string' ? JSON.parse(this.value) : cloneDeep(this.value || {});
48
50
  }
49
51
  catch (e) {
50
52
  var value = {};
@@ -58,14 +60,14 @@ let ParametersEditor = class ParametersEditor extends LitElement {
58
60
  따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
59
61
  */
60
62
  var template = html `
61
- <ox-parameters-editor-popup
63
+ <ox-popup-parameters-builder
62
64
  .value=${value}
63
65
  .props=${spec}
64
66
  .host=${this.record}
65
67
  .context=${context}
66
68
  .confirmCallback=${confirmCallback}
67
69
  >
68
- </ox-parameters-editor-popup>
70
+ </ox-popup-parameters-builder>
69
71
  `;
70
72
  this.popup = openPopup(template, {
71
73
  backdrop: true,
@@ -75,31 +77,8 @@ let ParametersEditor = class ParametersEditor extends LitElement {
75
77
  });
76
78
  }
77
79
  };
78
- ParametersEditor.styles = css `
79
- :host {
80
- color: black;
81
-
82
- overflow: hidden;
83
- text-overflow: ellipsis;
84
- }
85
- `;
86
- __decorate([
87
- property({ type: Object })
88
- ], ParametersEditor.prototype, "value", void 0);
89
- __decorate([
90
- property({ type: Object })
91
- ], ParametersEditor.prototype, "column", void 0);
92
- __decorate([
93
- property({ type: Object })
94
- ], ParametersEditor.prototype, "record", void 0);
95
- __decorate([
96
- property({ type: Number })
97
- ], ParametersEditor.prototype, "row", void 0);
98
- __decorate([
99
- property({ type: Object })
100
- ], ParametersEditor.prototype, "field", void 0);
101
- ParametersEditor = __decorate([
102
- customElement('ox-parameters-editor')
103
- ], ParametersEditor);
104
- export { ParametersEditor };
105
- //# sourceMappingURL=parameters-editor.js.map
80
+ OxGristEditorParameters = __decorate([
81
+ customElement('ox-grist-editor-parameters')
82
+ ], OxGristEditorParameters);
83
+ export { OxGristEditorParameters };
84
+ //# sourceMappingURL=ox-grist-editor-parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-grist-editor-parameters.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-editor-parameters.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AACnC,OAAO,kCAAkC,CAAA;AAEzC,OAAO,EAA6B,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAO,IAAI,EAAE,MAAM,KAAK,CAAA;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAGvC,IAAa,uBAAuB,GAApC,MAAa,uBAAwB,SAAQ,aAAa;IAGxD,IAAI,cAAc;QAChB,MAAM,KAAK,GAAG,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA;QACtF,OAAO,IAAI,CAAA,IAAI,KAAK,IAAI,EAAE,GAAG,CAAA;IAC/B,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,cAAc,CAAA;QAEz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I,KAAK,GACP,CAAC,WAAW,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;SACxG;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,KAAK,GAAQ,EAAE,CAAA;SACpB;QAED;;;;;;;UAOE;QACF,IAAI,QAAQ,GAAG,IAAI,CAAA;;iBAEN,KAAK;iBACL,IAAI;gBACL,IAAI,CAAC,MAAM;mBACR,OAAO;2BACC,eAAe;;;KAGrC,CAAA;QAED,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/B,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,EAAE,KAAI,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE;YAClE,IAAI;SACL,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAlFY,uBAAuB;IADnC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,uBAAuB,CAkFnC;SAlFY,uBAAuB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-parameters-builder.js'\nimport './ox-popup-parameters-builder.js'\n\nimport { ColumnConfig, GristRecord, OxGristEditor } from '@operato/data-grist'\nimport { PopupHandle, openPopup } from '@operato/layout'\nimport { css, html } from 'lit'\n\nimport { cloneDeep } from 'lodash-es'\nimport { customElement } from 'lit/decorators.js'\nimport { i18next } from '@operato/i18n'\n\n@customElement('ox-grist-editor-parameters')\nexport class OxGristEditorParameters extends OxGristEditor {\n private popup?: PopupHandle\n\n get editorTemplate() {\n const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value\n return html` ${value || ''} `\n }\n\n async firstUpdated() {\n await this.updateComplete\n\n this.renderRoot.addEventListener('click', e => {\n e.stopPropagation()\n\n this.openSelector()\n })\n\n this.openSelector()\n }\n\n async openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n var { options } = this.column.record\n\n if (typeof options === 'function') {\n options = await options.call(this, this.value, this.column, this.record, this.row, this.field)\n }\n\n const { name, help, spec, context, objectified = false } = options\n\n const confirmCallback = (newval: any) => {\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: this.value,\n after: !objectified ? JSON.stringify(newval) : newval,\n record: this.record,\n column: this.column,\n row: this.row\n }\n })\n )\n }\n\n try {\n var value: any =\n !objectified && typeof this.value === 'string' ? JSON.parse(this.value) : cloneDeep(this.value || {})\n } catch (e) {\n var value: any = {}\n }\n\n /* \n 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로, \n layout의 구성에 변화가 발생하면, 다시 render된다.\n 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)\n 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,\n 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.\n 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.\n */\n var template = html`\n <ox-popup-parameters-builder\n .value=${value}\n .props=${spec}\n .host=${this.record}\n .context=${context}\n .confirmCallback=${confirmCallback}\n >\n </ox-popup-parameters-builder>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: `${name?.toUpperCase() || ''} ${i18next.t('field.params')}`,\n help\n })\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import './ox-popup-partition-keys-input.js';
5
+ import { OxGristEditor } from '@operato/data-grist';
6
+ export declare class OxGristEditorPartitionKeys extends OxGristEditor {
7
+ private popup?;
8
+ get editorTemplate(): import("lit-html").TemplateResult<1>;
9
+ firstUpdated(): Promise<void>;
10
+ openSelector(): Promise<void>;
11
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import './ox-popup-partition-keys-input.js';
6
+ import { html } from 'lit';
7
+ import { customElement } from 'lit/decorators.js';
8
+ import { cloneDeep } from 'lodash-es';
9
+ import { OxGristEditor } from '@operato/data-grist';
10
+ import { i18next } from '@operato/i18n';
11
+ import { openPopup } from '@operato/layout';
12
+ let OxGristEditorPartitionKeys = class OxGristEditorPartitionKeys extends OxGristEditor {
13
+ get editorTemplate() {
14
+ const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value;
15
+ return html ` ${value || ''} `;
16
+ }
17
+ async firstUpdated() {
18
+ await this.updateComplete;
19
+ this.renderRoot.addEventListener('click', e => {
20
+ e.stopPropagation();
21
+ this.openSelector();
22
+ });
23
+ this.openSelector();
24
+ }
25
+ async openSelector() {
26
+ var _a;
27
+ if (this.popup) {
28
+ delete this.popup;
29
+ }
30
+ const { name, help, objectified = false } = ((_a = this.column.record) === null || _a === void 0 ? void 0 : _a.options) || {};
31
+ const confirmCallback = (newval) => {
32
+ this.dispatchEvent(new CustomEvent('field-change', {
33
+ bubbles: true,
34
+ composed: true,
35
+ detail: {
36
+ before: this.value,
37
+ after: !objectified ? JSON.stringify(newval) : newval,
38
+ record: this.record,
39
+ column: this.column,
40
+ row: this.row
41
+ }
42
+ }));
43
+ };
44
+ try {
45
+ var value = !objectified && typeof this.value === 'string' ? JSON.parse(this.value) : cloneDeep(this.value || {});
46
+ }
47
+ catch (e) {
48
+ var value = {};
49
+ }
50
+ /*
51
+ 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
52
+ layout의 구성에 변화가 발생하면, 다시 render된다.
53
+ 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
54
+ 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
55
+ 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
56
+ 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
57
+ */
58
+ var template = html `
59
+ <ox-popup-partition-keys-input .value=${value} .confirmCallback=${confirmCallback}>
60
+ </ox-popup-partition-keys-input>
61
+ `;
62
+ this.popup = openPopup(template, {
63
+ backdrop: true,
64
+ size: 'large',
65
+ title: `${(name === null || name === void 0 ? void 0 : name.toUpperCase()) || i18next.t('field.partition-keys')} `,
66
+ help
67
+ });
68
+ }
69
+ };
70
+ OxGristEditorPartitionKeys = __decorate([
71
+ customElement('ox-grist-editor-partition-keys')
72
+ ], OxGristEditorPartitionKeys);
73
+ export { OxGristEditorPartitionKeys };
74
+ //# sourceMappingURL=ox-grist-editor-partition-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-grist-editor-partition-keys.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-editor-partition-keys.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,oCAAoC,CAAA;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAe,MAAM,iBAAiB,CAAA;AAGxD,IAAa,0BAA0B,GAAvC,MAAa,0BAA2B,SAAQ,aAAa;IAG3D,IAAI,cAAc;QAChB,MAAM,KAAK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A;QAED,IAAI;YACF,IAAI,KAAK,GACP,CAAC,WAAW,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;SACxG;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,KAAK,GAAQ,EAAE,CAAA;SACpB;QAED;;;;;;;UAOE;QACF,IAAI,QAAQ,GAAG,IAAI,CAAA;8CACuB,KAAK,qBAAqB,eAAe;;KAElF,CAAA;QAED,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/B,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,EAAE,KAAI,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,GAAG;YACrE,IAAI;SACL,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAtEY,0BAA0B;IADtC,aAAa,CAAC,gCAAgC,CAAC;GACnC,0BAA0B,CAsEtC;SAtEY,0BAA0B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-popup-partition-keys-input.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport { cloneDeep } from 'lodash-es'\n\nimport { OxGristEditor } from '@operato/data-grist'\nimport { i18next } from '@operato/i18n'\nimport { openPopup, PopupHandle } from '@operato/layout'\n\n@customElement('ox-grist-editor-partition-keys')\nexport class OxGristEditorPartitionKeys extends OxGristEditor {\n private popup?: PopupHandle\n\n get editorTemplate() {\n const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value\n return html` ${value || ''} `\n }\n\n async firstUpdated() {\n await this.updateComplete\n\n this.renderRoot.addEventListener('click', e => {\n e.stopPropagation()\n\n this.openSelector()\n })\n\n this.openSelector()\n }\n\n async openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n const { name, help, objectified = false } = this.column.record?.options || {}\n\n const confirmCallback = (newval: any) => {\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: this.value,\n after: !objectified ? JSON.stringify(newval) : newval,\n record: this.record,\n column: this.column,\n row: this.row\n }\n })\n )\n }\n\n try {\n var value: any =\n !objectified && typeof this.value === 'string' ? JSON.parse(this.value) : cloneDeep(this.value || {})\n } catch (e) {\n var value: any = {}\n }\n\n /* \n 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로, \n layout의 구성에 변화가 발생하면, 다시 render된다.\n 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)\n 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,\n 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.\n 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.\n */\n var template = html`\n <ox-popup-partition-keys-input .value=${value} .confirmCallback=${confirmCallback}>\n </ox-popup-partition-keys-input>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: `${name?.toUpperCase() || i18next.t('field.partition-keys')} `,\n help\n })\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import '@material/mwc-icon';
2
- import { InputEditor } from '@operato/data-grist';
3
- export declare class CodeEditor extends InputEditor {
2
+ import { OxGristEditor } from '@operato/data-grist';
3
+ export declare class OxGristEditorResourceCode extends OxGristEditor {
4
4
  firstUpdated(): Promise<void>;
5
5
  get editorTemplate(): import("lit-html").TemplateResult<1>;
6
6
  }
@@ -1,6 +1,8 @@
1
+ import { __decorate } from "tslib";
1
2
  import '@material/mwc-icon';
2
- import { InputEditor } from '@operato/data-grist';
3
+ import { OxGristEditor } from '@operato/data-grist';
3
4
  import { client, gqlContext } from '@operato/graphql';
5
+ import { customElement } from 'lit/decorators.js';
4
6
  import gql from 'graphql-tag';
5
7
  import { html } from 'lit';
6
8
  const FETCH_COMMON_CODE_GQL = (codeName) => gql `
@@ -14,7 +16,7 @@ const FETCH_COMMON_CODE_GQL = (codeName) => gql `
14
16
  }
15
17
  }
16
18
  `;
17
- export class CodeEditor extends InputEditor {
19
+ let OxGristEditorResourceCode = class OxGristEditorResourceCode extends OxGristEditor {
18
20
  async firstUpdated() {
19
21
  super.firstUpdated();
20
22
  var { codeName, codes } = this.column.record || {};
@@ -45,6 +47,9 @@ export class CodeEditor extends InputEditor {
45
47
  </select>
46
48
  `;
47
49
  }
48
- }
49
- customElements.define('code-editor', CodeEditor);
50
- //# sourceMappingURL=code-editor.js.map
50
+ };
51
+ OxGristEditorResourceCode = __decorate([
52
+ customElement('ox-grist-editor-resource-code')
53
+ ], OxGristEditorResourceCode);
54
+ export { OxGristEditorResourceCode };
55
+ //# sourceMappingURL=ox-grist-editor-resource-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-grist-editor-resource-code.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-editor-resource-code.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,aAAa,EAAgB,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAc1B,MAAM,qBAAqB,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,GAAG,CAAA;;sBAEjC,QAAQ;;;;;;;;CAQ7B,CAAA;AAGD,IAAa,yBAAyB,GAAtC,MAAa,yBAA0B,SA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AC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE;;WAEjE,CACF;;KAEJ,CAAA;IACH,CAAC;CACF,CAAA;AA1CY,yBAAyB;IADrC,aAAa,CAAC,+BAA+B,CAAC;GAClC,yBAAyB,CA0CrC;SA1CY,yBAAyB","sourcesContent":["import '@material/mwc-icon'\n\nimport { OxGristEditor, RecordConfig } from '@operato/data-grist'\nimport { client, gqlContext } from '@operato/graphql'\n\nimport { customElement } from 'lit/decorators.js'\nimport gql from 'graphql-tag'\nimport { html } from 'lit'\n\ntype CommonCodeDetail = {\n name: string\n description: string\n rank: number\n}\n\ntype CommonCode = {\n name: string\n description: string\n details: CommonCodeDetail[]\n}\n\nconst FETCH_COMMON_CODE_GQL = (codeName: string) => gql`\n{\n commonCode(name: \"${codeName}\") {\n details {\n name\n description\n rank\n }\n }\n}\n`\n\n@customElement('ox-grist-editor-resource-code')\nexport class OxGristEditorResourceCode extends OxGristEditor {\n async firstUpdated() {\n super.firstUpdated()\n\n var { codeName, codes } = this.column.record || {}\n\n if (!codes && codeName) {\n /* codeName으로 fetch 해와서, this.column.record.codes에 보관한다. */\n var response = await client.query({\n query: FETCH_COMMON_CODE_GQL(codeName),\n context: gqlContext()\n })\n\n var commonCode = response && response.data && response.data.commonCode\n\n if (commonCode) {\n this.column.record.codes = [{ name: '', description: '' }].concat(\n commonCode.details.sort(function (a: CommonCodeDetail, b: CommonCodeDetail) {\n return a.rank - b.rank\n })\n )\n\n this.requestUpdate()\n }\n }\n }\n\n get editorTemplate() {\n var { codes } = this.column.record || {}\n\n return html`\n <select>\n ${(codes || ['']).map(\n (code: CommonCode) => html`\n <option ?selected=${code.name == this.value} value=${code.name}>\n ${code.name}${code.description ? ` - ${code.description}` : ''}\n </option>\n `\n )}\n </select>\n `\n }\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import '@material/mwc-icon';
2
+ import './ox-selector-resource-id.js';
3
+ import { OxGristEditor } from '@operato/data-grist';
4
+ export declare class OxGristEditorResourceId extends OxGristEditor {
5
+ private popup?;
6
+ render(): import("lit-html").TemplateResult<1>;
7
+ firstUpdated(): Promise<void>;
8
+ openSelector(): void;
9
+ }
@@ -0,0 +1,72 @@
1
+ import { __decorate } from "tslib";
2
+ import '@material/mwc-icon';
3
+ import './ox-selector-resource-id.js';
4
+ import { html } from 'lit';
5
+ import { customElement } from 'lit/decorators.js';
6
+ import { OxGristEditor } from '@operato/data-grist';
7
+ import { openPopup } from '@operato/layout';
8
+ let OxGristEditorResourceId = class OxGristEditorResourceId extends OxGristEditor {
9
+ render() {
10
+ var { nameField = 'name', descriptionField = 'description' } = this.column.record.options || {};
11
+ var value = this.value;
12
+ return html `
13
+ ${!value ? html `` : html ` <span>${value[nameField]} (${value[descriptionField]})</span> `}
14
+ <mwc-icon>arrow_drop_down</mwc-icon>
15
+ `;
16
+ }
17
+ async firstUpdated() {
18
+ await this.updateComplete;
19
+ this.renderRoot.addEventListener('click', e => {
20
+ e.stopPropagation();
21
+ this.openSelector();
22
+ });
23
+ this.openSelector();
24
+ }
25
+ openSelector() {
26
+ if (this.popup) {
27
+ delete this.popup;
28
+ }
29
+ const confirmCallback = selected => {
30
+ if (!selected) {
31
+ return;
32
+ }
33
+ var { idField = 'id', nameField = 'name', descriptionField = 'description' } = this.column.record.options || {};
34
+ this.dispatchEvent(new CustomEvent('field-change', {
35
+ bubbles: true,
36
+ composed: true,
37
+ detail: {
38
+ before: this.value,
39
+ after: selected
40
+ ? {
41
+ [idField]: selected[idField],
42
+ [nameField]: selected[nameField],
43
+ [descriptionField]: selected[descriptionField]
44
+ }
45
+ : null,
46
+ record: this.record,
47
+ column: this.column,
48
+ row: this.row
49
+ }
50
+ }));
51
+ };
52
+ var value = this.value || {};
53
+ var template = html `
54
+ <ox-selector-resource-id
55
+ .value=${value.id}
56
+ .confirmCallback=${confirmCallback.bind(this)}
57
+ .queryName=${this.column.record.options.queryName}
58
+ .basicArgs=${this.column.record.options.basicArgs}
59
+ ></ox-selector-resource-id>
60
+ `;
61
+ this.popup = openPopup(template, {
62
+ backdrop: true,
63
+ size: 'large',
64
+ title: 'select item'
65
+ });
66
+ }
67
+ };
68
+ OxGristEditorResourceId = __decorate([
69
+ customElement('ox-input-resource-id')
70
+ ], OxGristEditorResourceId);
71
+ export { OxGristEditorResourceId };
72
+ //# sourceMappingURL=ox-grist-editor-resource-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-grist-editor-resource-id.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-editor-resource-id.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,8BAA8B,CAAA;AAErC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAe,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,EAAE,SAAS,EAAe,MAAM,iBAAiB,CAAA;AAGxD,IAAa,uBAAuB,GAApC,MAAa,uBAAwB,SAAQ,aAAa;IAGxD,MAAM;QACJ,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,gBAAgB,GAAG,aAAa,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAA;QAC/F,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QAEtB,OAAO,IAAI,CAAA;QACP,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA,UAAU,KAAK,CAAC,SAAS,CAAC,KAAK,KAAK,CAAC,gBAAgB,CAAC,WAAW;;KAE1F,CAAA;IACH,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,cAAc,CAAA;QAEzB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE;YAC5C,CAAC,CAAC,eAAe,EAAE,C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,OAAO,CAAC,SAAS;qBACpC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS;;KAEpD,CAAA;QAED,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/B,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,aAAa;SACrB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AA1EY,uBAAuB;IADnC,aAAa,CAAC,sBAAsB,CAAC;GACzB,uBAAuB,CA0EnC;SA1EY,uBAAuB","sourcesContent":["import '@material/mwc-icon'\nimport './ox-selector-resource-id.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { GristRecord, OxGristEditor } from '@operato/data-grist'\nimport { openPopup, PopupHandle } from '@operato/layout'\n\n@customElement('ox-input-resource-id')\nexport class OxGristEditorResourceId extends OxGristEditor {\n private popup?: PopupHandle\n\n render() {\n var { nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}\n var value = this.value\n\n return html`\n ${!value ? html`` : html` <span>${value[nameField]} (${value[descriptionField]})</span> `}\n <mwc-icon>arrow_drop_down</mwc-icon>\n `\n }\n\n async firstUpdated() {\n await this.updateComplete\n\n this.renderRoot.addEventListener('click', e => {\n e.stopPropagation()\n\n this.openSelector()\n })\n\n this.openSelector()\n }\n\n openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n const confirmCallback: (record?: GristRecord) => void = selected => {\n if (!selected) {\n return\n }\n\n var { idField = 'id', nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}\n\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: this.value,\n after: selected\n ? {\n [idField]: selected[idField],\n [nameField]: selected[nameField],\n [descriptionField]: selected[descriptionField]\n }\n : null,\n record: this.record,\n column: this.column,\n row: this.row\n }\n })\n )\n }\n\n var value = this.value || {}\n var template = html`\n <ox-selector-resource-id\n .value=${value.id}\n .confirmCallback=${confirmCallback.bind(this)}\n .queryName=${this.column.record.options.queryName}\n .basicArgs=${this.column.record.options.basicArgs}\n ></ox-selector-resource-id>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: 'select item'\n })\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import '@material/mwc-icon';
2
+ import './ox-selector-resource-object.js';
3
+ import { TemplateResult } from 'lit';
4
+ import { OxGristEditor } from '@operato/data-grist';
5
+ export declare class OxGristEditorResourceObject extends OxGristEditor {
6
+ private popup?;
7
+ private template?;
8
+ get editorTemplate(): TemplateResult<1>;
9
+ firstUpdated(): Promise<void>;
10
+ openSelector(): void;
11
+ }