@operato/app 1.0.0-beta.2 → 1.0.0-beta.22

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 (41) hide show
  1. package/CHANGELOG.md +413 -0
  2. package/demo/data-grist-test.html +1 -1
  3. package/dist/src/filter-renderer/filter-resource-select.d.ts +4 -0
  4. package/dist/src/filter-renderer/filter-resource-select.js +79 -0
  5. package/dist/src/filter-renderer/filter-resource-select.js.map +1 -0
  6. package/dist/src/filter-renderer/index.d.ts +1 -0
  7. package/dist/src/filter-renderer/index.js +5 -0
  8. package/dist/src/filter-renderer/index.js.map +1 -0
  9. package/dist/src/filters-form/filter-resource-select.d.ts +4 -0
  10. package/dist/src/filters-form/filter-resource-select.js +78 -0
  11. package/dist/src/filters-form/filter-resource-select.js.map +1 -0
  12. package/dist/src/filters-form/index.d.ts +1 -0
  13. package/dist/src/filters-form/index.js +5 -0
  14. package/dist/src/filters-form/index.js.map +1 -0
  15. package/dist/src/grist-editor/ox-grist-renderer-crontab.js +3 -3
  16. package/dist/src/grist-editor/ox-grist-renderer-crontab.js.map +1 -1
  17. package/dist/src/grist-editor/ox-grist-renderer-resource-id.js +5 -2
  18. package/dist/src/grist-editor/ox-grist-renderer-resource-id.js.map +1 -1
  19. package/dist/src/grist-editor/ox-popup-partition-keys-input.js +3 -2
  20. package/dist/src/grist-editor/ox-popup-partition-keys-input.js.map +1 -1
  21. package/dist/src/index.d.ts +2 -1
  22. package/dist/src/index.js +2 -1
  23. package/dist/src/index.js.map +1 -1
  24. package/dist/src/input/ox-input-resource.d.ts +36 -0
  25. package/dist/src/input/ox-input-resource.js +161 -0
  26. package/dist/src/input/ox-input-resource.js.map +1 -0
  27. package/dist/src/property-editor/index.d.ts +2 -1
  28. package/dist/src/property-editor/index.js +5 -2
  29. package/dist/src/property-editor/index.js.map +1 -1
  30. package/dist/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +18 -17
  32. package/src/filter-renderer/filter-resource-select.ts +95 -0
  33. package/src/filter-renderer/index.ts +6 -0
  34. package/src/filters-form/filter-resource-select.ts +94 -0
  35. package/src/filters-form/index.ts +6 -0
  36. package/src/grist-editor/ox-grist-renderer-crontab.ts +5 -4
  37. package/src/grist-editor/ox-grist-renderer-resource-id.ts +6 -2
  38. package/src/grist-editor/ox-popup-partition-keys-input.ts +3 -2
  39. package/src/index.ts +2 -1
  40. package/src/input/ox-input-resource.ts +169 -0
  41. package/src/property-editor/index.ts +5 -2
@@ -1,7 +1,7 @@
1
1
  import cronstrue from 'cronstrue/i18n';
2
- import { detectOverflow } from '@operato/utils';
3
- import { html } from 'lit';
4
2
  import i18next from 'i18next';
3
+ import { html } from 'lit';
4
+ import { detectOverflow } from '@operato/utils';
5
5
  function onmouseover(e) {
6
6
  const element = e.target;
7
7
  if (detectOverflow(element)) {
@@ -16,7 +16,7 @@ export const OxGristRendererCrontab = (value, column, record, rowIndex, field) =
16
16
  let text = '';
17
17
  try {
18
18
  const language = (i18next.language || 'en').substring(0, 2);
19
- text = value === undefined ? '' : cronstrue.toString(value, { locale: language || 'en' });
19
+ text = !value ? '' : cronstrue.toString(value, { locale: language || 'en' });
20
20
  }
21
21
  catch (e) {
22
22
  console.error(e);
@@ -1 +1 @@
1
- {"version":3,"file":"ox-grist-renderer-crontab.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-renderer-crontab.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,SAAS,WAAW,CAAC,CAAQ;IAC3B,MAAM,OAAO,GAAG,CAAC,CAAC,MAAyB,CAAA;IAC3C,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;QAC3B,OAAO,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,WAAY,CAAC,CAAA;KAC3D;AACH,CAAC;AAED,SAAS,UAAU,CAAC,CAAQ;IAC1B,MAAM,OAAO,GAAG,CAAC,CAAC,MAAyB,CAAA;IAC3C,OAAO,CAAC,eAAe,CAAC,cAAc,CAAC,CAAA;AACzC,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAC9F,IAAI,IAAI,GAAG,EAAE,CAAA;IAEb,IAAI;QACF,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAC3D,IAAI,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAA;KAC1F;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;KACjB;IAED,OAAO,IAAI,CAAA,oBAAoB,WAAW,cAAc,UAAU,IAAI,IAAI,SAAS,CAAA;AACrF,CAAC,CAAA","sourcesContent":["import { FieldRenderer } from '@operato/data-grist'\nimport cronstrue from 'cronstrue/i18n'\nimport { detectOverflow } from '@operato/utils'\nimport { html } from 'lit'\nimport i18next from 'i18next'\n\nfunction onmouseover(e: Event) {\n const element = e.target as HTMLSpanElement\n if (detectOverflow(element)) {\n element.setAttribute('data-tooltip', element.textContent!)\n }\n}\n\nfunction onmouseout(e: Event) {\n const element = e.target as HTMLSpanElement\n element.removeAttribute('data-tooltip')\n}\n\nexport const OxGristRendererCrontab: FieldRenderer = (value, column, record, rowIndex, field) => {\n let text = ''\n\n try {\n const language = (i18next.language || 'en').substring(0, 2)\n text = value === undefined ? '' : cronstrue.toString(value, { locale: language || 'en' })\n } catch (e) {\n console.error(e)\n }\n\n return html`<span @mouseover=${onmouseover} @mouseout=${onmouseout}>${text}</span>`\n}\n"]}
1
+ {"version":3,"file":"ox-grist-renderer-crontab.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-renderer-crontab.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAG1B,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,SAAS,WAAW,CAAC,CAAQ;IAC3B,MAAM,OAAO,GAAG,CAAC,CAAC,MAAyB,CAAA;IAC3C,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;QAC3B,OAAO,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,WAAY,CAAC,CAAA;KAC3D;AACH,CAAC;AAED,SAAS,UAAU,CAAC,CAAQ;IAC1B,MAAM,OAAO,GAAG,CAAC,CAAC,MAAyB,CAAA;IAC3C,OAAO,CAAC,eAAe,CAAC,cAAc,CAAC,CAAA;AACzC,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAC9F,IAAI,IAAI,GAAG,EAAE,CAAA;IAEb,IAAI;QACF,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAC3D,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAA;KAC7E;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;KACjB;IAED,OAAO,IAAI,CAAA,oBAAoB,WAAW,cAAc,UAAU,IAAI,IAAI,SAAS,CAAA;AACrF,CAAC,CAAA","sourcesContent":["import cronstrue from 'cronstrue/i18n'\nimport i18next from 'i18next'\nimport { html } from 'lit'\n\nimport { FieldRenderer } from '@operato/data-grist'\nimport { detectOverflow } from '@operato/utils'\n\nfunction onmouseover(e: Event) {\n const element = e.target as HTMLSpanElement\n if (detectOverflow(element)) {\n element.setAttribute('data-tooltip', element.textContent!)\n }\n}\n\nfunction onmouseout(e: Event) {\n const element = e.target as HTMLSpanElement\n element.removeAttribute('data-tooltip')\n}\n\nexport const OxGristRendererCrontab: FieldRenderer = (value, column, record, rowIndex, field) => {\n let text = ''\n\n try {\n const language = (i18next.language || 'en').substring(0, 2)\n text = !value ? '' : cronstrue.toString(value, { locale: language || 'en' })\n } catch (e) {\n console.error(e)\n }\n\n return html`<span @mouseover=${onmouseover} @mouseout=${onmouseout}>${text}</span>`\n}\n"]}
@@ -3,7 +3,10 @@ export const OxGristRendererResourceId = (value, column, record, rowIndex, field
3
3
  if (!value) {
4
4
  return '';
5
5
  }
6
- var { nameField = 'name', descriptionField = 'description' } = column.record.options || {};
7
- return html `<span>${value[nameField] || ''}(${value[descriptionField] || ''})</span> `;
6
+ const { nameField = 'name', descriptionField = 'description' } = column.record.options || {};
7
+ const name = value[nameField] || '';
8
+ const description = value[descriptionField] || '';
9
+ const suffix = description ? `(${description})` : '';
10
+ return html `<span>${name}${suffix}</span> `;
8
11
  };
9
12
  //# sourceMappingURL=ox-grist-renderer-resource-id.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ox-grist-renderer-resource-id.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-renderer-resource-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAI1B,MAAM,CAAC,MAAM,yBAAyB,GAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IACjG,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,EAAE,CAAA;KACV;IAED,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,gBAAgB,GAAG,aAAa,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAA;IAE1F,OAAO,IAAI,CAAA,SAAS,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,WAAW,CAAA;AACxF,CAAC,CAAA","sourcesContent":["import { html } from 'lit'\n\nimport { FieldRenderer } from '@operato/data-grist'\n\nexport const OxGristRendererResourceId: FieldRenderer = (value, column, record, rowIndex, field) => {\n if (!value) {\n return ''\n }\n\n var { nameField = 'name', descriptionField = 'description' } = column.record.options || {}\n\n return html`<span>${value[nameField] || ''}(${value[descriptionField] || ''})</span> `\n}\n"]}
1
+ {"version":3,"file":"ox-grist-renderer-resource-id.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-renderer-resource-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAI1B,MAAM,CAAC,MAAM,yBAAyB,GAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IACjG,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,EAAE,CAAA;KACV;IAED,MAAM,EAAE,SAAS,GAAG,MAAM,EAAE,gBAAgB,GAAG,aAAa,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAA;IAE5F,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;IACnC,MAAM,WAAW,GAAG,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAA;IACjD,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IAEpD,OAAO,IAAI,CAAA,SAAS,IAAI,GAAG,MAAM,UAAU,CAAA;AAC7C,CAAC,CAAA","sourcesContent":["import { html } from 'lit'\n\nimport { FieldRenderer } from '@operato/data-grist'\n\nexport const OxGristRendererResourceId: FieldRenderer = (value, column, record, rowIndex, field) => {\n if (!value) {\n return ''\n }\n\n const { nameField = 'name', descriptionField = 'description' } = column.record.options || {}\n\n const name = value[nameField] || ''\n const description = value[descriptionField] || ''\n const suffix = description ? `(${description})` : ''\n\n return html`<span>${name}${suffix}</span> `\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  import { __decorate } from "tslib";
2
2
  import '@operato/input/ox-input-partition-keys.js';
3
- import { LitElement, css, html } from 'lit';
3
+ import { css, html, LitElement } from 'lit';
4
4
  import { customElement, property } from 'lit/decorators.js';
5
- import { ScrollbarStyles } from '@operato/styles';
6
5
  import { i18next } from '@operato/i18n';
6
+ import { ScrollbarStyles } from '@operato/styles';
7
7
  let OxPopupPartitionKeysInput = class OxPopupPartitionKeysInput extends LitElement {
8
8
  constructor() {
9
9
  super(...arguments);
@@ -64,6 +64,7 @@ OxPopupPartitionKeysInput.styles = [
64
64
  ox-input-partition-keys {
65
65
  flex: 1;
66
66
  overflow-y: auto;
67
+ padding: 10px;
67
68
  }
68
69
 
69
70
  span {
@@ -1 +1 @@
1
- {"version":3,"file":"ox-popup-partition-keys-input.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-popup-partition-keys-input.ts"],"names":[],"mappings":";AAAA,OAAO,2CAA2C,CAAA;AAElD,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAGvC,IAAa,yBAAyB,G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AAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAA6B;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kEAAwC;AAtCxD,yBAAyB;IADrC,aAAa,CAAC,+BAA+B,CAAC;GAClC,yBAAyB,CAqFrC;SArFY,yBAAyB","sourcesContent":["import '@operato/input/ox-input-partition-keys.js'\n\nimport { LitElement, css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\nimport { i18next } from '@operato/i18n'\n\n@customElement('ox-popup-partition-keys-input')\nexport class OxPopupPartitionKeysInput extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n\n width: var(--overlay-center-normal-width, 50%);\n height: var(--overlay-center-normal-height, 50%);\n }\n\n ox-input-partition-keys {\n flex: 1;\n overflow-y: auto;\n }\n\n span {\n flex: 1;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n color: var(--primary-color);\n }\n\n .button-container {\n display: flex;\n margin-left: auto;\n }\n `\n ]\n\n @property({ type: Object }) value: any\n @property({ type: String }) valuetype: string = 'string'\n @property({ type: Object }) confirmCallback!: (newval: any) => void\n\n render() {\n return html`\n <ox-input-partition-keys .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-partition-keys>\n\n <div class=\"button-container\">\n <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>\n <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>\n </div>\n `\n }\n\n private onChange(e: CustomEvent) {\n e.stopPropagation()\n\n /* \n 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로, \n layout의 구성에 변화가 발생하면, 다시 render된다.\n 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)\n 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,\n 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.\n 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.\n (이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)\n => \n 이런 이유로, Object.assign(...)을 사용하였다.\n */\n\n if (!this.value || typeof this.value !== 'object') {\n this.value = {}\n }\n\n for (let key in this.value) {\n delete this.value[key]\n }\n\n Object.assign(this.value, e.detail)\n }\n\n private onCancel(e: Event) {\n history.back()\n }\n\n private onConfirm(e: Event) {\n this.confirmCallback && this.confirmCallback(this.value)\n history.back()\n }\n}\n"]}
1
+ {"version":3,"file":"ox-popup-partition-keys-input.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-popup-partition-keys-input.ts"],"names":[],"mappings":";AAAA,OAAO,2CAA2C,CAAA;AAElD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGjD,IAAa,yBAAyB,GAAtC,MAAa,yBAA0B,SAAQ,UAAU;IAAzD;;QAsC8B,cAAS,GAAW,QAAQ,CAAA;IAgD1D,CAAC;IA7CC,MAAM;QACJ,OAAO,IAAI,CAAA;wCACyB,IAAI,CAAC,KAAK,YAAY,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;;;6BAGzD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;6BACt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n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\n\n@customElement('ox-popup-partition-keys-input')\nexport class OxPopupPartitionKeysInput extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n\n width: var(--overlay-center-normal-width, 50%);\n height: var(--overlay-center-normal-height, 50%);\n }\n\n ox-input-partition-keys {\n flex: 1;\n overflow-y: auto;\n padding: 10px;\n }\n\n span {\n flex: 1;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n color: var(--primary-color);\n }\n\n .button-container {\n display: flex;\n margin-left: auto;\n }\n `\n ]\n\n @property({ type: Object }) value: any\n @property({ type: String }) valuetype: string = 'string'\n @property({ type: Object }) confirmCallback!: (newval: any) => void\n\n render() {\n return html`\n <ox-input-partition-keys .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-partition-keys>\n\n <div class=\"button-container\">\n <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>\n <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>\n </div>\n `\n }\n\n private onChange(e: CustomEvent) {\n e.stopPropagation()\n\n /* \n 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로, \n layout의 구성에 변화가 발생하면, 다시 render된다.\n 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)\n 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,\n 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.\n 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.\n (이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)\n => \n 이런 이유로, Object.assign(...)을 사용하였다.\n */\n\n if (!this.value || typeof this.value !== 'object') {\n this.value = {}\n }\n\n for (let key in this.value) {\n delete this.value[key]\n }\n\n Object.assign(this.value, e.detail)\n }\n\n private onCancel(e: Event) {\n history.back()\n }\n\n private onConfirm(e: Event) {\n this.confirmCallback && this.confirmCallback(this.value)\n history.back()\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
1
  export * from './input/index.js';
2
- export * from './property-editor';
2
+ export * from './property-editor/index.js';
3
3
  export * from './grist-editor/index.js';
4
+ export * from './filter-renderer/index.js';
package/dist/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './input/index.js';
2
- export * from './property-editor';
2
+ export * from './property-editor/index.js';
3
3
  export * from './grist-editor/index.js';
4
+ export * from './filter-renderer/index.js';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA","sourcesContent":["export * from './input/index.js'\nexport * from './property-editor'\nexport * from './grist-editor/index.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,4BAA4B,CAAA","sourcesContent":["export * from './input/index.js'\nexport * from './property-editor/index.js'\nexport * from './grist-editor/index.js'\nexport * from './filter-renderer/index.js'\n"]}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import 'codemirror/addon/display/fullscreen';
5
+ import 'codemirror/addon/display/autorefresh';
6
+ import 'codemirror/addon/hint/show-hint';
7
+ import 'codemirror/addon/lint/lint';
8
+ import 'codemirror-graphql/hint';
9
+ import 'codemirror-graphql/lint';
10
+ import 'codemirror-graphql/mode';
11
+ import { LitElement, PropertyValues } from 'lit';
12
+ import CodeMirror from 'codemirror';
13
+ /**
14
+ WEB Component for code-mirror graphql editor.
15
+
16
+ Example:
17
+
18
+ <ox-input-graphql value=${text} link=${link}>
19
+ </ox-input-graphql>
20
+ */
21
+ export default class OxInputGraphql extends LitElement {
22
+ static styles: import("lit").CSSResult[];
23
+ /**
24
+ * `value`는 에디터에서 작성중인 contents이다.
25
+ */
26
+ value?: string;
27
+ link?: string;
28
+ textarea: HTMLTextAreaElement;
29
+ private _self_changing;
30
+ private _changed;
31
+ private _editor?;
32
+ updated(changes: PropertyValues<this>): Promise<void>;
33
+ render(): import("lit-html").TemplateResult<1>;
34
+ getSchema(): Promise<import("graphql").GraphQLSchema>;
35
+ getEditor(): Promise<CodeMirror.EditorFromTextArea | undefined>;
36
+ }
@@ -0,0 +1,161 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import 'codemirror/addon/display/fullscreen';
6
+ import 'codemirror/addon/display/autorefresh';
7
+ import 'codemirror/addon/hint/show-hint';
8
+ import 'codemirror/addon/lint/lint';
9
+ import 'codemirror-graphql/hint';
10
+ import 'codemirror-graphql/lint';
11
+ import 'codemirror-graphql/mode';
12
+ import { GRAPHQL_URI } from '@operato/graphql';
13
+ import { LitElement, css, html, unsafeCSS } from 'lit';
14
+ import { customElement, property, query } from 'lit/decorators.js';
15
+ import { introspectSchema, wrapSchema } from '@graphql-tools/wrap';
16
+ import CodeMirror from 'codemirror';
17
+ import CodeMirrorStyle from '!!text-loader!codemirror/lib/codemirror.css';
18
+ import FullScreenStyle from '!!text-loader!codemirror/addon/display/fullscreen.css';
19
+ import LintStyle from '!!text-loader!codemirror/addon/lint/lint.css';
20
+ import NightThemeStyle from '!!text-loader!codemirror/theme/night.css';
21
+ import ShowHintStyle from '!!text-loader!codemirror/addon/hint/show-hint.css';
22
+ import { fetch } from 'cross-fetch';
23
+ import { print } from 'graphql';
24
+ /**
25
+ WEB Component for code-mirror graphql editor.
26
+
27
+ Example:
28
+
29
+ <ox-input-graphql value=${text} link=${link}>
30
+ </ox-input-graphql>
31
+ */
32
+ let OxInputGraphql = class OxInputGraphql extends LitElement {
33
+ constructor() {
34
+ super(...arguments);
35
+ this._self_changing = false;
36
+ this._changed = false;
37
+ }
38
+ async updated(changes) {
39
+ if ((!this._editor || changes.has('value') || changes.has('link')) && !this._self_changing) {
40
+ if (changes.has('link')) {
41
+ this._editor = undefined;
42
+ }
43
+ ;
44
+ (await this.getEditor()).setValue(this.value === undefined ? '' : String(this.value));
45
+ // ;(await this.getEditor()).refresh()
46
+ }
47
+ }
48
+ render() {
49
+ return html ` <textarea></textarea> `;
50
+ }
51
+ async getSchema() {
52
+ const executor = async ({ document, variables }) => {
53
+ const query = print(document);
54
+ const uri = this.link || GRAPHQL_URI;
55
+ const fetchResult = await fetch(uri, {
56
+ method: 'POST',
57
+ headers: {
58
+ 'Content-Type': 'application/json'
59
+ },
60
+ body: JSON.stringify({ query, variables })
61
+ });
62
+ return fetchResult.json();
63
+ };
64
+ return await wrapSchema({
65
+ schema: await introspectSchema(executor),
66
+ executor
67
+ });
68
+ }
69
+ async getEditor() {
70
+ if (!this._editor) {
71
+ try {
72
+ var schema = await this.getSchema();
73
+ }
74
+ catch (err) {
75
+ console.error(err);
76
+ }
77
+ if (this.textarea) {
78
+ this._editor = CodeMirror.fromTextArea(this.textarea, {
79
+ value: this.value,
80
+ mode: 'graphql',
81
+ lint: {
82
+ //@ts-ignore
83
+ schema
84
+ },
85
+ hintOptions: {
86
+ //@ts-ignore
87
+ schema
88
+ },
89
+ tabSize: 2,
90
+ lineNumbers: false,
91
+ showCursorWhenSelecting: true,
92
+ theme: 'night',
93
+ extraKeys: {
94
+ F11: function (cm) {
95
+ cm.setOption('fullScreen', !cm.getOption('fullScreen'));
96
+ },
97
+ Esc: function (cm) {
98
+ cm.setOption('fullScreen', !cm.getOption('fullScreen'));
99
+ }
100
+ },
101
+ autoRefresh: {
102
+ delay: 500
103
+ }
104
+ });
105
+ this._editor.on('blur', (editor, e) => {
106
+ if (!this._changed)
107
+ return;
108
+ this.value = editor.getValue();
109
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
110
+ });
111
+ this._editor.on('change', async (editor, changeObj) => {
112
+ this._self_changing = true;
113
+ this._changed = true;
114
+ await this.requestUpdate();
115
+ this._self_changing = false;
116
+ });
117
+ }
118
+ }
119
+ return this._editor;
120
+ }
121
+ };
122
+ OxInputGraphql.styles = [
123
+ css `
124
+ ${unsafeCSS(CodeMirrorStyle)}
125
+ ${unsafeCSS(FullScreenStyle)}
126
+ ${unsafeCSS(NightThemeStyle)}
127
+ ${unsafeCSS(LintStyle)}
128
+ ${unsafeCSS(ShowHintStyle)}
129
+ `,
130
+ css `
131
+ :host {
132
+ display: block;
133
+ position: relative;
134
+ }
135
+
136
+ textarea {
137
+ display: block;
138
+ height: 100%;
139
+ width: 100%;
140
+ resize: none;
141
+ font-size: 16px;
142
+ line-height: 20px;
143
+ border: 0px;
144
+ padding: 0px;
145
+ }
146
+ `
147
+ ];
148
+ __decorate([
149
+ property({ type: String })
150
+ ], OxInputGraphql.prototype, "value", void 0);
151
+ __decorate([
152
+ property({ type: String })
153
+ ], OxInputGraphql.prototype, "link", void 0);
154
+ __decorate([
155
+ query('textarea')
156
+ ], OxInputGraphql.prototype, "textarea", void 0);
157
+ OxInputGraphql = __decorate([
158
+ customElement('ox-input-graphql')
159
+ ], OxInputGraphql);
160
+ export default OxInputGraphql;
161
+ //# sourceMappingURL=ox-input-resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-resource.js","sourceRoot":"","sources":["../../../src/input/ox-input-resource.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,qCAAqC,CAAA;AAC5C,OAAO,sCAAsC,CAAA;AAC7C,OAAO,iCAAiC,CAAA;AACxC,OAAO,4BAA4B,CAAA;AACn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;gBAC7B,CAAC,CAAC,CAAA;aACH;SACF;QAED,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF,CAAA;AApIQ,qBAAM,GAAG;IACd,GAAG,CAAA;QACC,SAAS,CAAC,eAAe,CAAC;QAC1B,SAAS,CAAC,eAAe,CAAC;WACvB,SAAS,CAAC,eAAe,CAAC;WAC1B,SAAS,CAAC,SAAS,CAAC;WACpB,SAAS,CAAC,aAAa,CAAC;KAC9B;IACD,GAAG,CAAA;;;;;;;;;;;;;;;;KAgBF;CACF,CAAA;AAK2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAc;AAEtB;IAAlB,KAAK,CAAC,UAAU,CAAC;gDAA+B;AAlC9B,cAAc;IADlC,aAAa,CAAC,kBAAkB,CAAC;GACb,cAAc,CAqIlC;eArIoB,cAAc","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport 'codemirror/addon/display/fullscreen'\nimport 'codemirror/addon/display/autorefresh'\nimport 'codemirror/addon/hint/show-hint'\nimport 'codemirror/addon/lint/lint'\nimport 'codemirror-graphql/hint'\nimport 'codemirror-graphql/lint'\nimport 'codemirror-graphql/mode'\n\nimport { GRAPHQL_URI, client } from '@operato/graphql'\nimport { LitElement, PropertyValues, css, html, unsafeCSS } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { introspectSchema, wrapSchema } from '@graphql-tools/wrap'\n\nimport CodeMirror from 'codemirror'\nimport CodeMirrorStyle from '!!text-loader!codemirror/lib/codemirror.css'\nimport FullScreenStyle from '!!text-loader!codemirror/addon/display/fullscreen.css'\nimport LintStyle from '!!text-loader!codemirror/addon/lint/lint.css'\nimport NightThemeStyle from '!!text-loader!codemirror/theme/night.css'\nimport ShowHintStyle from '!!text-loader!codemirror/addon/hint/show-hint.css'\nimport { fetch } from 'cross-fetch'\nimport { print } from 'graphql'\n\n/**\n WEB Component for code-mirror graphql editor.\n \n Example:\n \n <ox-input-graphql value=${text} link=${link}>\n </ox-input-graphql>\n */\n@customElement('ox-input-graphql')\nexport default class OxInputGraphql extends LitElement {\n static styles = [\n css`\n ${unsafeCSS(CodeMirrorStyle)}\n ${unsafeCSS(FullScreenStyle)}\n ${unsafeCSS(NightThemeStyle)}\n ${unsafeCSS(LintStyle)}\n ${unsafeCSS(ShowHintStyle)}\n `,\n css`\n :host {\n display: block;\n position: relative;\n }\n\n textarea {\n display: block;\n height: 100%;\n width: 100%;\n resize: none;\n font-size: 16px;\n line-height: 20px;\n border: 0px;\n padding: 0px;\n }\n `\n ]\n\n /**\n * `value`는 에디터에서 작성중인 contents이다.\n */\n @property({ type: String }) value?: string\n @property({ type: String }) link?: string\n\n @query('textarea') textarea!: HTMLTextAreaElement\n\n private _self_changing: boolean = false\n private _changed: boolean = false\n private _editor?: CodeMirror.EditorFromTextArea\n\n async updated(changes: PropertyValues<this>) {\n if ((!this._editor || changes.has('value') || changes.has('link')) && !this._self_changing) {\n if (changes.has('link')) {\n this._editor = undefined\n }\n ;(await this.getEditor())!.setValue(this.value === undefined ? '' : String(this.value))\n // ;(await this.getEditor()).refresh()\n }\n }\n\n render() {\n return html` <textarea></textarea> `\n }\n\n async getSchema() {\n const executor = async ({ document, variables }: any) => {\n const query = print(document)\n const uri = this.link || GRAPHQL_URI\n\n const fetchResult = await fetch(uri, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({ query, variables })\n })\n return fetchResult.json()\n }\n\n return await wrapSchema({\n schema: await introspectSchema(executor),\n executor\n })\n }\n\n async getEditor() {\n if (!this._editor) {\n try {\n var schema = await this.getSchema()\n } catch (err) {\n console.error(err)\n }\n\n if (this.textarea) {\n this._editor = CodeMirror.fromTextArea(this.textarea, {\n value: this.value,\n mode: 'graphql',\n lint: {\n //@ts-ignore\n schema\n },\n hintOptions: {\n //@ts-ignore\n schema\n },\n tabSize: 2,\n lineNumbers: false,\n showCursorWhenSelecting: true,\n theme: 'night',\n extraKeys: {\n F11: function (cm) {\n cm.setOption('fullScreen', !cm.getOption('fullScreen'))\n },\n Esc: function (cm) {\n cm.setOption('fullScreen', !cm.getOption('fullScreen'))\n }\n },\n autoRefresh: {\n delay: 500\n }\n })\n\n this._editor.on('blur', (editor: CodeMirror.Editor, e: FocusEvent) => {\n if (!this._changed) return\n\n this.value = editor.getValue()\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n })\n\n this._editor.on('change', async (editor: CodeMirror.Editor, changeObj: CodeMirror.EditorChange) => {\n this._self_changing = true\n\n this._changed = true\n\n await this.requestUpdate()\n\n this._self_changing = false\n })\n }\n }\n\n return this._editor\n }\n}\n"]}
@@ -13,9 +13,10 @@ import '@operato/property-editor/ox-property-editor-color.js';
13
13
  import '@operato/property-editor/ox-property-editor-multiple-colors.js';
14
14
  import '@operato/property-editor/ox-property-editor-solid-colorstops.js';
15
15
  import '@operato/property-editor/ox-property-editor-gradient-colorstops.js';
16
- import '@operato/property-editor/ox-property-editor-gradient-colorstops.js';
17
16
  import '@operato/property-editor/ox-property-editor-textarea.js';
18
17
  import '@operato/property-editor/ox-property-editor-table.js';
18
+ import '@operato/property-editor/ox-property-editor-key-values.js';
19
+ import '@operato/property-editor/ox-property-editor-partition-keys.js';
19
20
  import '@operato/property-editor/ox-property-editor-value-map.js';
20
21
  import '@operato/property-editor/ox-property-editor-value-ranges.js';
21
22
  import '@operato/attachment/ox-property-editor-attachment-selector.js';
@@ -13,9 +13,10 @@ import '@operato/property-editor/ox-property-editor-color.js';
13
13
  import '@operato/property-editor/ox-property-editor-multiple-colors.js';
14
14
  import '@operato/property-editor/ox-property-editor-solid-colorstops.js';
15
15
  import '@operato/property-editor/ox-property-editor-gradient-colorstops.js';
16
- import '@operato/property-editor/ox-property-editor-gradient-colorstops.js';
17
16
  import '@operato/property-editor/ox-property-editor-textarea.js';
18
17
  import '@operato/property-editor/ox-property-editor-table.js';
18
+ import '@operato/property-editor/ox-property-editor-key-values.js';
19
+ import '@operato/property-editor/ox-property-editor-partition-keys.js';
19
20
  import '@operato/property-editor/ox-property-editor-value-map.js';
20
21
  import '@operato/property-editor/ox-property-editor-value-ranges.js';
21
22
  import '@operato/attachment/ox-property-editor-attachment-selector.js';
@@ -53,6 +54,8 @@ OxPropertyEditor.register({
53
54
  graphql: 'ox-property-editor-graphql',
54
55
  'editor-table': 'ox-property-editor-table',
55
56
  'id-input': 'ox-property-editor-scene-component-id',
56
- 'font-selector': 'ox-property-editor-font-selector'
57
+ 'font-selector': 'ox-property-editor-font-selector',
58
+ 'partition-keys': 'ox-property-editor-partion-keys',
59
+ 'key-values': 'ox-property-editor-key-values'
57
60
  });
58
61
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/property-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,uDAAuD,CAAA;AAC9D,OAAO,uDAAuD,CAAA;AAC9D,OAAO,yDAAyD,CAAA;AAChE,OAAO,sDAAsD,CAAA;AAC7D,OAAO,uDAAuD,CAAA;AAC9D,OAAO,qDAAqD,CAAA;AAC5D,OAAO,qDAAqD,CAAA;AAC5D,OAAO,yDAAyD,CAAA;AAChE,OAAO,wDAAwD,CAAA;AAC/D,OAAO,uDAAuD,CAAA;AAC9D,OAAO,mEAAmE,CAAA;AAC1E,OAAO,sDAAsD,CAAA;AAC7D,OAAO,gEAAgE,CAAA;AACvE,OAAO,iEAAiE,CAAA;AACxE,OAAO,oEAAoE,CAAA;AAC3E,OAAO,oEAAoE,CAAA;AAC3E,OAAO,yDAAyD,CAAA;AAChE,OAAO,sDAAsD,CAAA;AAC7D,OAAO,0DAA0D,CAAA;AACjE,OAAO,6DAA6D,CAAA;AACpE,OAAO,+DAA+D,CAAA;AACtE,OAAO,0DAA0D,CAAA;AACjE,OAAO,mDAAmD,CAAA;AAC1D,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE3D,gBAAgB,CAAC,QAAQ,CAAC;IACxB,MAAM,EAAE,2BAA2B;IACnC,MAAM,EAAE,2BAA2B;IACnC,MAAM,EAAE,0BAA0B;IAClC,QAAQ,EAAE,6BAA6B;IACvC,KAAK,EAAE,0BAA0B;IACjC,MAAM,EAAE,2BAA2B;IACnC,QAAQ,EAAE,6BAA6B;IACvC,UAAU,EAAE,6BAA6B;IACzC,QAAQ,EAAE,6BAA6B;IACvC,OAAO,EAAE,6BAA6B;IACtC,MAAM,EAAE,2BAA2B;IACnC,IAAI,EAAE,yBAAyB;IAC/B,OAAO,EAAE,4BAA4B;IACrC,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE,yBAAyB;IAC/B,KAAK,EAAE,0BAA0B;IACjC,aAAa,EAAE,0BAA0B;IACzC,qBAAqB,EAAE,wCAAwC;IAC/D,eAAe,EAAE,wCAAwC;IACzD,gBAAgB,EAAE,mCAAmC;IACrD,KAAK,EAAE,0BAA0B;IACjC,mBAAmB,EAAE,qCAAqC;IAC1D,sBAAsB,EAAE,wCAAwC;IAChE,gBAAgB,EAAE,oCAAoC;IACtD,GAAG,EAAE,8BAA8B;IACnC,KAAK,EAAE,iCAAiC;IACxC,OAAO,EAAE,4BAA4B;IACrC,cAAc,EAAE,0BAA0B;IAC1C,UAAU,EAAE,uCAAuC;IACnD,eAAe,EAAE,kCAAkC;CACpD,CAAC,CAAA","sourcesContent":["import '@operato/property-editor/ox-property-editor-legend.js'\nimport '@operato/property-editor/ox-property-editor-number.js'\nimport '@operato/property-editor/ox-property-editor-password.js'\nimport '@operato/property-editor/ox-property-editor-angle.js'\nimport '@operato/property-editor/ox-property-editor-string.js'\nimport '@operato/property-editor/ox-property-editor-data.js'\nimport '@operato/property-editor/ox-property-editor-date.js'\nimport '@operato/property-editor/ox-property-editor-checkbox.js'\nimport '@operato/property-editor/ox-property-editor-options.js'\nimport '@operato/property-editor/ox-property-editor-select.js'\nimport '@operato/property-editor/ox-property-editor-scene-component-id.js'\nimport '@operato/property-editor/ox-property-editor-color.js'\nimport '@operato/property-editor/ox-property-editor-multiple-colors.js'\nimport '@operato/property-editor/ox-property-editor-solid-colorstops.js'\nimport '@operato/property-editor/ox-property-editor-gradient-colorstops.js'\nimport '@operato/property-editor/ox-property-editor-gradient-colorstops.js'\nimport '@operato/property-editor/ox-property-editor-textarea.js'\nimport '@operato/property-editor/ox-property-editor-table.js'\nimport '@operato/property-editor/ox-property-editor-value-map.js'\nimport '@operato/property-editor/ox-property-editor-value-ranges.js'\nimport '@operato/attachment/ox-property-editor-attachment-selector.js'\nimport '@operato/attachment/ox-property-editor-image-selector.js'\nimport '@operato/font/ox-property-editor-font-selector.js'\nimport './ox-property-editor-graphql.js'\n\nimport { OxPropertyEditor } from '@operato/property-editor'\n\nOxPropertyEditor.register({\n legend: 'ox-property-editor-legend',\n number: 'ox-property-editor-number',\n slider: 'ox-property-editor-range',\n password: 'ox-property-editor-password',\n angle: 'ox-property-editor-angle',\n string: 'ox-property-editor-string',\n textarea: 'ox-property-editor-textarea',\n javascript: 'ox-property-editor-textarea',\n checkbox: 'ox-property-editor-checkbox',\n boolean: 'ox-property-editor-checkbox',\n select: 'ox-property-editor-select',\n date: 'ox-property-editor-date',\n options: 'ox-property-editor-options',\n data: 'ox-property-editor-data',\n file: 'ox-property-editor-file',\n image: 'ox-property-editor-image',\n 'range-input': 'ox-property-editor-range',\n 'attachment-selector': 'ox-property-editor-attachment-selector',\n 'gltf-selector': 'ox-property-editor-attachment-selector',\n 'image-selector': 'ox-property-editor-image-selector',\n color: 'ox-property-editor-color',\n 'solid-color-stops': 'ox-property-editor-solid-colorstops',\n 'gradient-color-stops': 'ox-property-editor-gradient-colorstops',\n 'multiple-color': 'ox-property-editor-multiple-colors',\n map: 'ox-property-editor-value-map',\n range: 'ox-property-editor-value-ranges',\n graphql: 'ox-property-editor-graphql',\n 'editor-table': 'ox-property-editor-table',\n 'id-input': 'ox-property-editor-scene-component-id',\n 'font-selector': 'ox-property-editor-font-selector'\n})\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/property-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,uDAAuD,CAAA;AAC9D,OAAO,uDAAuD,CAAA;AAC9D,OAAO,yDAAyD,CAAA;AAChE,OAAO,sDAAsD,CAAA;AAC7D,OAAO,uDAAuD,CAAA;AAC9D,OAAO,qDAAqD,CAAA;AAC5D,OAAO,qDAAqD,CAAA;AAC5D,OAAO,yDAAyD,CAAA;AAChE,OAAO,wDAAwD,CAAA;AAC/D,OAAO,uDAAuD,CAAA;AAC9D,OAAO,mEAAmE,CAAA;AAC1E,OAAO,sDAAsD,CAAA;AAC7D,OAAO,gEAAgE,CAAA;AACvE,OAAO,iEAAiE,CAAA;AACxE,OAAO,oEAAoE,CAAA;AAC3E,OAAO,yDAAyD,CAAA;AAChE,OAAO,sDAAsD,CAAA;AAC7D,OAAO,2DAA2D,CAAA;AAClE,OAAO,+DAA+D,CAAA;AACtE,OAAO,0DAA0D,CAAA;AACjE,OAAO,6DAA6D,CAAA;AACpE,OAAO,+DAA+D,CAAA;AACtE,OAAO,0DAA0D,CAAA;AACjE,OAAO,mDAAmD,CAAA;AAC1D,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE3D,gBAAgB,CAAC,QAAQ,CAAC;IACxB,MAAM,EAAE,2BAA2B;IACnC,MAAM,EAAE,2BAA2B;IACnC,MAAM,EAAE,0BAA0B;IAClC,QAAQ,EAAE,6BAA6B;IACvC,KAAK,EAAE,0BAA0B;IACjC,MAAM,EAAE,2BAA2B;IACnC,QAAQ,EAAE,6BAA6B;IACvC,UAAU,EAAE,6BAA6B;IACzC,QAAQ,EAAE,6BAA6B;IACvC,OAAO,EAAE,6BAA6B;IACtC,MAAM,EAAE,2BAA2B;IACnC,IAAI,EAAE,yBAAyB;IAC/B,OAAO,EAAE,4BAA4B;IACrC,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE,yBAAyB;IAC/B,KAAK,EAAE,0BAA0B;IACjC,aAAa,EAAE,0BAA0B;IACzC,qBAAqB,EAAE,wCAAwC;IAC/D,eAAe,EAAE,wCAAwC;IACzD,gBAAgB,EAAE,mCAAmC;IACrD,KAAK,EAAE,0BAA0B;IACjC,mBAAmB,EAAE,qCAAqC;IAC1D,sBAAsB,EAAE,wCAAwC;IAChE,gBAAgB,EAAE,oCAAoC;IACtD,GAAG,EAAE,8BAA8B;IACnC,KAAK,EAAE,iCAAiC;IACxC,OAAO,EAAE,4BAA4B;IACrC,cAAc,EAAE,0BAA0B;IAC1C,UAAU,EAAE,uCAAuC;IACnD,eAAe,EAAE,kCAAkC;IACnD,gBAAgB,EAAE,iCAAiC;IACnD,YAAY,EAAE,+BAA+B;CAC9C,CAAC,CAAA","sourcesContent":["import '@operato/property-editor/ox-property-editor-legend.js'\nimport '@operato/property-editor/ox-property-editor-number.js'\nimport '@operato/property-editor/ox-property-editor-password.js'\nimport '@operato/property-editor/ox-property-editor-angle.js'\nimport '@operato/property-editor/ox-property-editor-string.js'\nimport '@operato/property-editor/ox-property-editor-data.js'\nimport '@operato/property-editor/ox-property-editor-date.js'\nimport '@operato/property-editor/ox-property-editor-checkbox.js'\nimport '@operato/property-editor/ox-property-editor-options.js'\nimport '@operato/property-editor/ox-property-editor-select.js'\nimport '@operato/property-editor/ox-property-editor-scene-component-id.js'\nimport '@operato/property-editor/ox-property-editor-color.js'\nimport '@operato/property-editor/ox-property-editor-multiple-colors.js'\nimport '@operato/property-editor/ox-property-editor-solid-colorstops.js'\nimport '@operato/property-editor/ox-property-editor-gradient-colorstops.js'\nimport '@operato/property-editor/ox-property-editor-textarea.js'\nimport '@operato/property-editor/ox-property-editor-table.js'\nimport '@operato/property-editor/ox-property-editor-key-values.js'\nimport '@operato/property-editor/ox-property-editor-partition-keys.js'\nimport '@operato/property-editor/ox-property-editor-value-map.js'\nimport '@operato/property-editor/ox-property-editor-value-ranges.js'\nimport '@operato/attachment/ox-property-editor-attachment-selector.js'\nimport '@operato/attachment/ox-property-editor-image-selector.js'\nimport '@operato/font/ox-property-editor-font-selector.js'\nimport './ox-property-editor-graphql.js'\n\nimport { OxPropertyEditor } from '@operato/property-editor'\n\nOxPropertyEditor.register({\n legend: 'ox-property-editor-legend',\n number: 'ox-property-editor-number',\n slider: 'ox-property-editor-range',\n password: 'ox-property-editor-password',\n angle: 'ox-property-editor-angle',\n string: 'ox-property-editor-string',\n textarea: 'ox-property-editor-textarea',\n javascript: 'ox-property-editor-textarea',\n checkbox: 'ox-property-editor-checkbox',\n boolean: 'ox-property-editor-checkbox',\n select: 'ox-property-editor-select',\n date: 'ox-property-editor-date',\n options: 'ox-property-editor-options',\n data: 'ox-property-editor-data',\n file: 'ox-property-editor-file',\n image: 'ox-property-editor-image',\n 'range-input': 'ox-property-editor-range',\n 'attachment-selector': 'ox-property-editor-attachment-selector',\n 'gltf-selector': 'ox-property-editor-attachment-selector',\n 'image-selector': 'ox-property-editor-image-selector',\n color: 'ox-property-editor-color',\n 'solid-color-stops': 'ox-property-editor-solid-colorstops',\n 'gradient-color-stops': 'ox-property-editor-gradient-colorstops',\n 'multiple-color': 'ox-property-editor-multiple-colors',\n map: 'ox-property-editor-value-map',\n range: 'ox-property-editor-value-ranges',\n graphql: 'ox-property-editor-graphql',\n 'editor-table': 'ox-property-editor-table',\n 'id-input': 'ox-property-editor-scene-component-id',\n 'font-selector': 'ox-property-editor-font-selector',\n 'partition-keys': 'ox-property-editor-partion-keys',\n 'key-values': 'ox-property-editor-key-values'\n})\n"]}