@operato/property-editor 1.0.0-beta.7 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/CHANGELOG.md +375 -0
  2. package/demo/index.html +19 -5
  3. package/dist/src/ox-properties-dynamic-view.js +14 -10
  4. package/dist/src/ox-properties-dynamic-view.js.map +1 -1
  5. package/dist/src/ox-property-editor-angle.d.ts +2 -1
  6. package/dist/src/ox-property-editor-angle.js +4 -6
  7. package/dist/src/ox-property-editor-angle.js.map +1 -1
  8. package/dist/src/ox-property-editor-checkbox.d.ts +2 -1
  9. package/dist/src/ox-property-editor-checkbox.js +4 -4
  10. package/dist/src/ox-property-editor-checkbox.js.map +1 -1
  11. package/dist/src/ox-property-editor-color.d.ts +2 -1
  12. package/dist/src/ox-property-editor-color.js +4 -9
  13. package/dist/src/ox-property-editor-color.js.map +1 -1
  14. package/dist/src/ox-property-editor-crontab.d.ts +2 -1
  15. package/dist/src/ox-property-editor-crontab.js +3 -2
  16. package/dist/src/ox-property-editor-crontab.js.map +1 -1
  17. package/dist/src/ox-property-editor-data.d.ts +2 -1
  18. package/dist/src/ox-property-editor-data.js +5 -4
  19. package/dist/src/ox-property-editor-data.js.map +1 -1
  20. package/dist/src/ox-property-editor-date.d.ts +2 -1
  21. package/dist/src/ox-property-editor-date.js +4 -4
  22. package/dist/src/ox-property-editor-date.js.map +1 -1
  23. package/dist/src/ox-property-editor-duration.d.ts +6 -0
  24. package/dist/src/ox-property-editor-duration.js +16 -0
  25. package/dist/src/ox-property-editor-duration.js.map +1 -0
  26. package/dist/src/ox-property-editor-file.d.ts +2 -1
  27. package/dist/src/ox-property-editor-file.js +8 -5
  28. package/dist/src/ox-property-editor-file.js.map +1 -1
  29. package/dist/src/ox-property-editor-gradient-colorstops.d.ts +2 -1
  30. package/dist/src/ox-property-editor-gradient-colorstops.js +8 -7
  31. package/dist/src/ox-property-editor-gradient-colorstops.js.map +1 -1
  32. package/dist/src/ox-property-editor-image.d.ts +2 -1
  33. package/dist/src/ox-property-editor-image.js +5 -4
  34. package/dist/src/ox-property-editor-image.js.map +1 -1
  35. package/dist/src/ox-property-editor-key-values.d.ts +6 -0
  36. package/dist/src/ox-property-editor-key-values.js +24 -0
  37. package/dist/src/ox-property-editor-key-values.js.map +1 -0
  38. package/dist/src/ox-property-editor-legend.d.ts +2 -1
  39. package/dist/src/ox-property-editor-legend.js +4 -4
  40. package/dist/src/ox-property-editor-legend.js.map +1 -1
  41. package/dist/src/ox-property-editor-multiple-colors.d.ts +2 -1
  42. package/dist/src/ox-property-editor-multiple-colors.js +4 -4
  43. package/dist/src/ox-property-editor-multiple-colors.js.map +1 -1
  44. package/dist/src/ox-property-editor-number.d.ts +2 -1
  45. package/dist/src/ox-property-editor-number.js +6 -6
  46. package/dist/src/ox-property-editor-number.js.map +1 -1
  47. package/dist/src/ox-property-editor-options.d.ts +2 -1
  48. package/dist/src/ox-property-editor-options.js +5 -4
  49. package/dist/src/ox-property-editor-options.js.map +1 -1
  50. package/dist/src/ox-property-editor-partition-keys.d.ts +6 -0
  51. package/dist/src/ox-property-editor-partition-keys.js +18 -0
  52. package/dist/src/ox-property-editor-partition-keys.js.map +1 -0
  53. package/dist/src/ox-property-editor-password.d.ts +2 -1
  54. package/dist/src/ox-property-editor-password.js +4 -4
  55. package/dist/src/ox-property-editor-password.js.map +1 -1
  56. package/dist/src/ox-property-editor-range.d.ts +2 -1
  57. package/dist/src/ox-property-editor-range.js +13 -5
  58. package/dist/src/ox-property-editor-range.js.map +1 -1
  59. package/dist/src/ox-property-editor-scene-component-id.d.ts +2 -1
  60. package/dist/src/ox-property-editor-scene-component-id.js +4 -8
  61. package/dist/src/ox-property-editor-scene-component-id.js.map +1 -1
  62. package/dist/src/ox-property-editor-select.d.ts +4 -1
  63. package/dist/src/ox-property-editor-select.js +11 -5
  64. package/dist/src/ox-property-editor-select.js.map +1 -1
  65. package/dist/src/ox-property-editor-solid-colorstops.d.ts +2 -1
  66. package/dist/src/ox-property-editor-solid-colorstops.js +8 -7
  67. package/dist/src/ox-property-editor-solid-colorstops.js.map +1 -1
  68. package/dist/src/ox-property-editor-string.d.ts +2 -1
  69. package/dist/src/ox-property-editor-string.js +4 -4
  70. package/dist/src/ox-property-editor-string.js.map +1 -1
  71. package/dist/src/ox-property-editor-table.d.ts +2 -1
  72. package/dist/src/ox-property-editor-table.js +5 -4
  73. package/dist/src/ox-property-editor-table.js.map +1 -1
  74. package/dist/src/ox-property-editor-textarea.d.ts +2 -1
  75. package/dist/src/ox-property-editor-textarea.js +9 -8
  76. package/dist/src/ox-property-editor-textarea.js.map +1 -1
  77. package/dist/src/ox-property-editor-value-map.d.ts +2 -1
  78. package/dist/src/ox-property-editor-value-map.js +11 -5
  79. package/dist/src/ox-property-editor-value-map.js.map +1 -1
  80. package/dist/src/ox-property-editor-value-ranges.d.ts +2 -1
  81. package/dist/src/ox-property-editor-value-ranges.js +9 -3
  82. package/dist/src/ox-property-editor-value-ranges.js.map +1 -1
  83. package/dist/src/ox-property-editor-work-shift.d.ts +3 -2
  84. package/dist/src/ox-property-editor-work-shift.js +8 -7
  85. package/dist/src/ox-property-editor-work-shift.js.map +1 -1
  86. package/dist/src/ox-property-editor.d.ts +8 -6
  87. package/dist/src/ox-property-editor.js +60 -7
  88. package/dist/src/ox-property-editor.js.map +1 -1
  89. package/dist/src/types.d.ts +5 -0
  90. package/dist/src/types.js.map +1 -1
  91. package/dist/tsconfig.tsbuildinfo +1 -1
  92. package/package.json +14 -11
  93. package/src/ox-properties-dynamic-view.ts +15 -10
  94. package/src/ox-property-editor-angle.ts +6 -6
  95. package/src/ox-property-editor-checkbox.ts +6 -4
  96. package/src/ox-property-editor-color.ts +6 -9
  97. package/src/ox-property-editor-crontab.ts +5 -2
  98. package/src/ox-property-editor-data.ts +8 -4
  99. package/src/ox-property-editor-date.ts +6 -4
  100. package/src/ox-property-editor-duration.ts +16 -0
  101. package/src/ox-property-editor-file.ts +11 -5
  102. package/src/ox-property-editor-gradient-colorstops.ts +11 -7
  103. package/src/ox-property-editor-image.ts +9 -4
  104. package/src/ox-property-editor-key-values.ts +24 -0
  105. package/src/ox-property-editor-legend.ts +6 -4
  106. package/src/ox-property-editor-multiple-colors.ts +6 -4
  107. package/src/ox-property-editor-number.ts +8 -6
  108. package/src/ox-property-editor-options.ts +8 -4
  109. package/src/ox-property-editor-partition-keys.ts +18 -0
  110. package/src/ox-property-editor-password.ts +6 -4
  111. package/src/ox-property-editor-range.ts +15 -5
  112. package/src/ox-property-editor-scene-component-id.ts +6 -8
  113. package/src/ox-property-editor-select.ts +12 -6
  114. package/src/ox-property-editor-solid-colorstops.ts +11 -7
  115. package/src/ox-property-editor-string.ts +6 -4
  116. package/src/ox-property-editor-table.ts +8 -4
  117. package/src/ox-property-editor-textarea.ts +12 -8
  118. package/src/ox-property-editor-value-map.ts +13 -5
  119. package/src/ox-property-editor-value-ranges.ts +10 -3
  120. package/src/ox-property-editor-work-shift.ts +6 -4
  121. package/src/ox-property-editor.ts +59 -10
  122. package/src/types.ts +6 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor-scene-component-id.js","sourceRoot":"","sources":["../../src/ox-property-editor-scene-component-id.ts"],"names":[],"mappings":";AAAA,OAAO,+CAA+C,CAAA;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAG1B,IAAa,gCAAgC,GAA7C,MAAa,gCAAiC,SAAQ,gBAAgB;IACpE,cAAc;QACZ,OAAO,IAAI,CAAA;;;iBAGE,IAAI,CAAC,KAAK;oBACP,IAAI,CAAC,QAAQ;;KAE5B,CAAA;IACH,CAAC;CACF,CAAA;AAVY,gCAAgC;IAD5C,aAAa,CAAC,uCAAuC,CAAC;GAC1C,gCAAgC,CAU5C;SAVY,gCAAgC","sourcesContent":["import '@operato/input/ox-input-scene-component-id.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\n\n@customElement('ox-property-editor-scene-component-id')\nexport class OxPropertyEditorSceneComponentId extends OxPropertyEditor {\n editorTemplate() {\n return html`\n <ox-input-scene-component-id\n id=\"editor\"\n .value=${this.value}\n .property=${this.property}\n ></ox-input-scene-component-id>\n `\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor-scene-component-id.js","sourceRoot":"","sources":["../../src/ox-property-editor-scene-component-id.ts"],"names":[],"mappings":";AAAA,OAAO,+CAA+C,CAAA;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAI1D,IAAa,gCAAgC,GAA7C,MAAa,gCAAiC,SAAQ,gBAAgB;IACpE,cAAc,CAAC,KAAU,EAAE,IAAkB;QAC3C,OAAO,IAAI,CAAA;wDACyC,KAAK,cAAc,IAAI,CAAC,QAAQ;KACnF,CAAA;IACH,CAAC;CACF,CAAA;AANY,gCAAgC;IAD5C,aAAa,CAAC,uCAAuC,CAAC;GAC1C,gCAAgC,CAM5C;SANY,gCAAgC","sourcesContent":["import '@operato/input/ox-input-scene-component-id.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n\n@customElement('ox-property-editor-scene-component-id')\nexport class OxPropertyEditorSceneComponentId extends OxPropertyEditor {\n editorTemplate(value: any, spec: PropertySpec) {\n return html`\n <ox-input-scene-component-id id=\"editor\" .value=${value} .property=${spec.property}></ox-input-scene-component-id>\n `\n }\n}\n"]}
@@ -1,14 +1,17 @@
1
1
  import '@operato/input/ox-select.js';
2
2
  import '@operato/popup/ox-popup-list.js';
3
+ import { LitElement } from 'lit';
3
4
  import { OxPropertyEditor } from './ox-property-editor.js';
5
+ import { PropertySpec } from './types.js';
4
6
  declare type Option = {
5
7
  display: string;
6
8
  value: any;
7
9
  } | string;
8
10
  export declare class OxPropertyEditorSelect extends OxPropertyEditor {
9
11
  static styles: import("lit").CSSResult[];
12
+ oxSelect: LitElement;
10
13
  connectedCallback(): Promise<void>;
11
- editorTemplate(): import("lit-html").TemplateResult<1>;
14
+ editorTemplate(value: any, spec: PropertySpec): import("lit-html").TemplateResult<1>;
12
15
  _getOptionValue(item: Option): any;
13
16
  _getOptionDisplay(item: Option): string;
14
17
  _isSelected(value: any, item: Option): boolean;
@@ -2,8 +2,8 @@ import { __decorate } from "tslib";
2
2
  import '@operato/input/ox-select.js';
3
3
  import '@operato/popup/ox-popup-list.js';
4
4
  import { css, html } from 'lit';
5
+ import { customElement, query } from 'lit/decorators.js';
5
6
  import { OxPropertyEditor } from './ox-property-editor.js';
6
- import { customElement } from 'lit/decorators.js';
7
7
  let OxPropertyEditorSelect = class OxPropertyEditorSelect extends OxPropertyEditor {
8
8
  async connectedCallback() {
9
9
  var _a;
@@ -14,19 +14,22 @@ let OxPropertyEditorSelect = class OxPropertyEditorSelect extends OxPropertyEdit
14
14
  ...this.property,
15
15
  options: await options.apply(this)
16
16
  };
17
+ await this.updateComplete;
18
+ this.oxSelect.requestUpdate();
17
19
  }
18
20
  }
19
- editorTemplate() {
21
+ editorTemplate(value, spec) {
20
22
  var _a;
21
- var options = (_a = this.property) === null || _a === void 0 ? void 0 : _a.options;
23
+ var options = (_a = spec.property) === null || _a === void 0 ? void 0 : _a.options;
22
24
  if (!(options instanceof Array)) {
23
25
  options = [];
24
26
  }
27
+ const { fullwidth = false } = spec.editor || {};
25
28
  return html `
26
- <ox-select id="editor" .value=${this.value} placeholder=${this.placeholder}>
29
+ <ox-select id="editor" .value=${value} placeholder=${spec.placeholder} ?fullwidth=${fullwidth}>
27
30
  <ox-popup-list with-search>
28
31
  ${options.map(item => html `
29
- <div option value=${this._getOptionValue(item)} ?selected=${this._isSelected(this.value, item)}>
32
+ <div option value=${this._getOptionValue(item)} ?selected=${this._isSelected(value, item)}>
30
33
  ${this._getOptionDisplay(item) || html `&nbsp;`}
31
34
  </div>
32
35
  `)}
@@ -59,6 +62,9 @@ OxPropertyEditorSelect.styles = [
59
62
  }
60
63
  `
61
64
  ];
65
+ __decorate([
66
+ query('ox-select')
67
+ ], OxPropertyEditorSelect.prototype, "oxSelect", void 0);
62
68
  OxPropertyEditorSelect = __decorate([
63
69
  customElement('ox-property-editor-select')
64
70
  ], OxPropertyEditorSelect);
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor-select.js","sourceRoot":"","sources":["../../src/ox-property-editor-select.ts"],"names":[],"mappings":";AAAA,OAAO,6BAA6B,CAAA;AACpC,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAKjD,IAAa,sBAAsB,GAAnC,MAAa,sBAAuB,SAAQ,gBAAgB;IAa1D,KAAK,CAAC,iBAAiB;;QACrB,KAAK,CAAC,iBAAiB,EAAE,CAAA;QAEzB,IAAI,OAAO,GAAG,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,CAAA;QACpC,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;YACjC,IAAI,CAAC,QAAQ,GAAG;gBACd,GAAG,IAAI,CAAC,QAAQ;gBAChB,OAAO,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;aACnC,CAAA;SACF;IACH,CAAC;IAED,cAAc;;QACZ,IAAI,OAAO,GAAG,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAmB,CAAA;QAChD,IAAI,CAAC,CAAC,OAAO,YAAY,KAAK,CAAC,EAAE;YAC/B,OAAO,GAAG,EAAE,CAAA;SACb;QAED,OAAO,IAAI,CAAA;sCACuB,IAAI,CAAC,KAAK,gBAAgB,IAAI,CAAC,WAAW;;YAEpE,OAAO,CAAC,GAAG,CACX,IAAI,CAAC,EAAE,CAAC,IAAI,CAAA;kCACU,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC;kBAC1F,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAA,QAAQ;;aAEjD,CACF;;;KAGN,CAAA;IACH,CAAC;IAED,eAAe,CAAC,IAAY;QAC1B,IAAI,OAAO,IAAI,IAAI,QAAQ;YAAE,OAAO,IAAI,CAAA;QAExC,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED,iBAAiB,CAAC,IAAY;QAC5B,IAAI,OAAO,IAAI,IAAI,QAAQ;YAAE,OAAO,IAAI,CAAA;QAExC,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,WAAW,CAAC,KAAU,EAAE,IAAY;QAClC,OAAO,KAAK,KAAK,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;IAC7C,CAAC;CACF,CAAA;AA5DQ,6BAAM,GAAG;IACd,GAAG,gBAAgB,CAAC,MAAM;IAC1B,GAAG,CAAA;;;;;;;KAOF;CACF,CAAA;AAXU,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CA6DlC;SA7DY,sBAAsB","sourcesContent":["import '@operato/input/ox-select.js'\nimport '@operato/popup/ox-popup-list.js'\n\nimport { css, html } from 'lit'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { customElement } from 'lit/decorators.js'\n\ntype Option = { display: string; value: any } | string\n\n@customElement('ox-property-editor-select')\nexport class OxPropertyEditorSelect extends OxPropertyEditor {\n static styles = [\n ...OxPropertyEditor.styles,\n css`\n ox-select {\n background-color: var(--theme-white-color);\n padding: 1px 2px;\n color: var(--theme-black-color);\n font-size: 13.5px;\n }\n `\n ]\n\n async connectedCallback() {\n super.connectedCallback()\n\n var options = this.property?.options\n if (typeof options === 'function') {\n this.property = {\n ...this.property,\n options: await options.apply(this)\n }\n }\n }\n\n editorTemplate() {\n var options = this.property?.options as Option[]\n if (!(options instanceof Array)) {\n options = []\n }\n\n return html`\n <ox-select id=\"editor\" .value=${this.value} placeholder=${this.placeholder}>\n <ox-popup-list with-search>\n ${options.map(\n item => html`\n <div option value=${this._getOptionValue(item)} ?selected=${this._isSelected(this.value, item)}>\n ${this._getOptionDisplay(item) || html`&nbsp;`}\n </div>\n `\n )}\n </ox-popup-list>\n </ox-select>\n `\n }\n\n _getOptionValue(item: Option) {\n if (typeof item == 'string') return item\n\n return item.value\n }\n\n _getOptionDisplay(item: Option) {\n if (typeof item == 'string') return item\n\n return item.display\n }\n\n _isSelected(value: any, item: Option) {\n return value === this._getOptionValue(item)\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor-select.js","sourceRoot":"","sources":["../../src/ox-property-editor-select.ts"],"names":[],"mappings":";AAAA,OAAO,6BAA6B,CAAA;AACpC,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAc,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAM1D,IAAa,sBAAsB,GAAnC,MAAa,sBAAuB,SAAQ,gBAAgB;IAe1D,KAAK,CAAC,iBAAiB;;QACrB,KAAK,CAAC,iBAAiB,EAAE,CAAA;QAEzB,IAAI,OAAO,GAAG,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,CAAA;QACpC,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;YACjC,IAAI,CAAC,QAAQ,GAAG;gBACd,GAAG,IAAI,CAAC,QAAQ;gBACh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AAgB,CAAC,MAAM;IAC1B,GAAG,CAAA;;;;;;;KAOF;CACF,CAAA;AAEmB;IAAnB,KAAK,CAAC,WAAW,CAAC;wDAAsB;AAb9B,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CAkElC;SAlEY,sBAAsB","sourcesContent":["import '@operato/input/ox-select.js'\nimport '@operato/popup/ox-popup-list.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, query } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n\ntype Option = { display: string; value: any } | string\n\n@customElement('ox-property-editor-select')\nexport class OxPropertyEditorSelect extends OxPropertyEditor {\n static styles = [\n ...OxPropertyEditor.styles,\n css`\n ox-select {\n background-color: var(--theme-white-color);\n padding: 1px 2px;\n color: var(--theme-black-color);\n font-size: 13.5px;\n }\n `\n ]\n\n @query('ox-select') oxSelect!: LitElement\n\n async connectedCallback() {\n super.connectedCallback()\n\n var options = this.property?.options\n if (typeof options === 'function') {\n this.property = {\n ...this.property,\n options: await options.apply(this)\n }\n await this.updateComplete\n this.oxSelect.requestUpdate()\n }\n }\n\n editorTemplate(value: any, spec: PropertySpec) {\n var options = spec.property?.options as Option[]\n if (!(options instanceof Array)) {\n options = []\n }\n const { fullwidth = false } = spec.editor || {}\n\n return html`\n <ox-select id=\"editor\" .value=${value} placeholder=${spec.placeholder} ?fullwidth=${fullwidth}>\n <ox-popup-list with-search>\n ${options.map(\n item => html`\n <div option value=${this._getOptionValue(item)} ?selected=${this._isSelected(value, item)}>\n ${this._getOptionDisplay(item) || html`&nbsp;`}\n </div>\n `\n )}\n </ox-popup-list>\n </ox-select>\n `\n }\n\n _getOptionValue(item: Option) {\n if (typeof item == 'string') return item\n\n return item.value\n }\n\n _getOptionDisplay(item: Option) {\n if (typeof item == 'string') return item\n\n return item.display\n }\n\n _isSelected(value: any, item: Option) {\n return value === this._getOptionValue(item)\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import '@operato/input/ox-input-color-stops.js';
2
2
  import { OxPropertyEditor } from './ox-property-editor.js';
3
+ import { PropertySpec } from './types.js';
3
4
  export declare class OxPropertyEditorSolidColorStops extends OxPropertyEditor {
4
- editorTemplate(): import("lit-html").TemplateResult<1>;
5
+ editorTemplate(value: any, spec: PropertySpec): import("lit-html").TemplateResult<1>;
5
6
  }
@@ -1,18 +1,19 @@
1
1
  import { __decorate } from "tslib";
2
2
  import '@operato/input/ox-input-color-stops.js';
3
- import { OxPropertyEditor } from './ox-property-editor.js';
4
- import { customElement } from 'lit/decorators.js';
5
3
  import { html } from 'lit';
4
+ import { customElement } from 'lit/decorators.js';
5
+ import { OxPropertyEditor } from './ox-property-editor.js';
6
6
  let OxPropertyEditorSolidColorStops = class OxPropertyEditorSolidColorStops extends OxPropertyEditor {
7
- editorTemplate() {
7
+ editorTemplate(value, spec) {
8
+ const { fullwidth = true } = spec.editor || {};
8
9
  return html `
9
10
  <ox-input-color-stops
10
11
  id="editor"
11
12
  type="solid"
12
- .value=${this.value}
13
- .min=${this.property && this.property.min}
14
- .max=${this.property && this.property.max}
15
- fullwidth
13
+ .value=${value}
14
+ .min=${spec.property && spec.property.min}
15
+ .max=${spec.property && spec.property.max}
16
+ ?fullwidth=${fullwidth}
16
17
  >
17
18
  </ox-input-color-stops>
18
19
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor-solid-colorstops.js","sourceRoot":"","sources":["../../src/ox-property-editor-solid-colorstops.ts"],"names":[],"mappings":";AAAA,OAAO,wCAAwC,CAAA;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAG1B,IAAa,+BAA+B,GAA5C,MAAa,+BAAgC,SAAQ,gBAAgB;IACnE,cAAc;QACZ,OAAO,IAAI,CAAA;;;;iBAIE,IAAI,CAAC,KAAK;eACZ,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG;eAClC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG;;;;KAI5C,CAAA;IACH,CAAC;CACF,CAAA;AAdY,+BAA+B;IAD3C,aAAa,CAAC,qCAAqC,CAAC;GACxC,+BAA+B,CAc3C;SAdY,+BAA+B","sourcesContent":["import '@operato/input/ox-input-color-stops.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\n\n@customElement('ox-property-editor-solid-colorstops')\nexport class OxPropertyEditorSolidColorStops extends OxPropertyEditor {\n editorTemplate() {\n return html`\n <ox-input-color-stops\n id=\"editor\"\n type=\"solid\"\n .value=${this.value}\n .min=${this.property && this.property.min}\n .max=${this.property && this.property.max}\n fullwidth\n >\n </ox-input-color-stops>\n `\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor-solid-colorstops.js","sourceRoot":"","sources":["../../src/ox-property-editor-solid-colorstops.ts"],"names":[],"mappings":";AAAA,OAAO,wCAAwC,CAAA;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAI1D,IAAa,+BAA+B,GAA5C,MAAa,+BAAgC,SAAQ,gBAAgB;IACnE,cAAc,CAAC,KAAU,EAAE,IAAkB;QAC3C,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAA;QAE9C,OAAO,IAAI,CAAA;;;;iBAIE,KAAK;eACP,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG;eAClC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG;qBAC5B,SAAS;;;KAGzB,CAAA;IACH,CAAC;CACF,CAAA;AAhBY,+BAA+B;IAD3C,aAAa,CAAC,qCAAqC,CAAC;GACxC,+BAA+B,CAgB3C;SAhBY,+BAA+B","sourcesContent":["import '@operato/input/ox-input-color-stops.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n\n@customElement('ox-property-editor-solid-colorstops')\nexport class OxPropertyEditorSolidColorStops extends OxPropertyEditor {\n editorTemplate(value: any, spec: PropertySpec) {\n const { fullwidth = true } = spec.editor || {}\n\n return html`\n <ox-input-color-stops\n id=\"editor\"\n type=\"solid\"\n .value=${value}\n .min=${spec.property && spec.property.min}\n .max=${spec.property && spec.property.max}\n ?fullwidth=${fullwidth}\n >\n </ox-input-color-stops>\n `\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { OxPropertyEditor } from './ox-property-editor.js';
2
+ import { PropertySpec } from './types.js';
2
3
  export declare class OxPropertyEditorString extends OxPropertyEditor {
3
- editorTemplate(): import("lit-html").TemplateResult<1>;
4
+ editorTemplate(value: any, spec: PropertySpec): import("lit-html").TemplateResult<1>;
4
5
  }
@@ -1,10 +1,10 @@
1
1
  import { __decorate } from "tslib";
2
- import { OxPropertyEditor } from './ox-property-editor.js';
3
- import { customElement } from 'lit/decorators.js';
4
2
  import { html } from 'lit';
3
+ import { customElement } from 'lit/decorators.js';
4
+ import { OxPropertyEditor } from './ox-property-editor.js';
5
5
  let OxPropertyEditorString = class OxPropertyEditorString extends OxPropertyEditor {
6
- editorTemplate() {
7
- return html ` <input type="text" id="editor" .value=${this.value || ''} placeholder=${this.placeholder || ''} /> `;
6
+ editorTemplate(value, spec) {
7
+ return html ` <input type="text" id="editor" .value=${value || ''} placeholder=${spec.placeholder || ''} /> `;
8
8
  }
9
9
  };
10
10
  OxPropertyEditorString = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor-string.js","sourceRoot":"","sources":["../../src/ox-property-editor-string.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAG1B,IAAa,sBAAsB,GAAnC,MAAa,sBAAuB,SAAQ,gBAAgB;IAC1D,cAAc;QACZ,OAAO,IAAI,CAAA,0CAA0C,IAAI,CAAC,KAAK,IAAI,EAAE,gBAAgB,IAAI,CAAC,WAAW,IAAI,EAAE,MAAM,CAAA;IACnH,CAAC;CACF,CAAA;AAJY,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CAIlC;SAJY,sBAAsB","sourcesContent":["import { OxPropertyEditor } from './ox-property-editor.js'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\n\n@customElement('ox-property-editor-string')\nexport class OxPropertyEditorString extends OxPropertyEditor {\n editorTemplate() {\n return html` <input type=\"text\" id=\"editor\" .value=${this.value || ''} placeholder=${this.placeholder || ''} /> `\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor-string.js","sourceRoot":"","sources":["../../src/ox-property-editor-string.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAI1D,IAAa,sBAAsB,GAAnC,MAAa,sBAAuB,SAAQ,gBAAgB;IAC1D,cAAc,CAAC,KAAU,EAAE,IAAkB;QAC3C,OAAO,IAAI,CAAA,0CAA0C,KAAK,IAAI,EAAE,gBAAgB,IAAI,CAAC,WAAW,IAAI,EAAE,MAAM,CAAA;IAC9G,CAAC;CACF,CAAA;AAJY,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CAIlC;SAJY,sBAAsB","sourcesContent":["import { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n\n@customElement('ox-property-editor-string')\nexport class OxPropertyEditorString extends OxPropertyEditor {\n editorTemplate(value: any, spec: PropertySpec) {\n return html` <input type=\"text\" id=\"editor\" .value=${value || ''} placeholder=${spec.placeholder || ''} /> `\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import '@operato/input/ox-input-table.js';
2
2
  import { OxPropertyEditor } from './ox-property-editor.js';
3
+ import { PropertySpec } from './types.js';
3
4
  export declare class OxPropertyEditorString extends OxPropertyEditor {
4
- editorTemplate(): import("lit-html").TemplateResult<1>;
5
+ editorTemplate(value: any, spec: PropertySpec): import("lit-html").TemplateResult<1>;
5
6
  }
@@ -1,11 +1,12 @@
1
1
  import { __decorate } from "tslib";
2
2
  import '@operato/input/ox-input-table.js';
3
- import { OxPropertyEditor } from './ox-property-editor.js';
4
- import { customElement } from 'lit/decorators.js';
5
3
  import { html } from 'lit';
4
+ import { customElement } from 'lit/decorators.js';
5
+ import { OxPropertyEditor } from './ox-property-editor.js';
6
6
  let OxPropertyEditorString = class OxPropertyEditorString extends OxPropertyEditor {
7
- editorTemplate() {
8
- return html ` <ox-input-table id="editor" .property=${this.property} fullwidth></ox-input-table> `;
7
+ editorTemplate(value, spec) {
8
+ const { fullwidth = true } = spec.editor || {};
9
+ return html ` <ox-input-table id="editor" .property=${spec.property} ?fullwidth=${fullwidth}></ox-input-table> `;
9
10
  }
10
11
  };
11
12
  OxPropertyEditorString = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor-table.js","sourceRoot":"","sources":["../../src/ox-property-editor-table.ts"],"names":[],"mappings":";AAAA,OAAO,kCAAkC,CAAA;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAG1B,IAAa,sBAAsB,GAAnC,MAAa,sBAAuB,SAAQ,gBAAgB;IAC1D,cAAc;QACZ,OAAO,IAAI,CAAA,0CAA0C,IAAI,CAAC,QAAQ,+BAA+B,CAAA;IACnG,CAAC;CACF,CAAA;AAJY,sBAAsB;IADlC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,sBAAsB,CAIlC;SAJY,sBAAsB","sourcesContent":["import '@operato/input/ox-input-table.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\n\n@customElement('ox-property-editor-table')\nexport class OxPropertyEditorString extends OxPropertyEditor {\n editorTemplate() {\n return html` <ox-input-table id=\"editor\" .property=${this.property} fullwidth></ox-input-table> `\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor-table.js","sourceRoot":"","sources":["../../src/ox-property-editor-table.ts"],"names":[],"mappings":";AAAA,OAAO,kCAAkC,CAAA;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAI1D,IAAa,sBAAsB,GAAnC,MAAa,sBAAuB,SAAQ,gBAAgB;IAC1D,cAAc,CAAC,KAAU,EAAE,IAAkB;QAC3C,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAA;QAE9C,OAAO,IAAI,CAAA,0CAA0C,IAAI,CAAC,QAAQ,eAAe,SAAS,qBAAqB,CAAA;IACjH,CAAC;CACF,CAAA;AANY,sBAAsB;IADlC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,sBAAsB,CAMlC;SANY,sBAAsB","sourcesContent":["import '@operato/input/ox-input-table.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n\n@customElement('ox-property-editor-table')\nexport class OxPropertyEditorString extends OxPropertyEditor {\n editorTemplate(value: any, spec: PropertySpec) {\n const { fullwidth = true } = spec.editor || {}\n\n return html` <ox-input-table id=\"editor\" .property=${spec.property} ?fullwidth=${fullwidth}></ox-input-table> `\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import '@operato/input/ox-input-code.js';
2
2
  import { OxPropertyEditor } from './ox-property-editor.js';
3
+ import { PropertySpec } from './types.js';
3
4
  export declare class OxPropertyEditorTextArea extends OxPropertyEditor {
4
- editorTemplate(): import("lit-html").TemplateResult<1>;
5
+ editorTemplate(value: any, spec: PropertySpec): import("lit-html").TemplateResult<1>;
5
6
  }
@@ -1,19 +1,20 @@
1
1
  import { __decorate } from "tslib";
2
2
  import '@operato/input/ox-input-code.js';
3
- import { OxPropertyEditor } from './ox-property-editor.js';
4
- import { customElement } from 'lit/decorators.js';
5
3
  import { html } from 'lit';
4
+ import { customElement } from 'lit/decorators.js';
5
+ import { OxPropertyEditor } from './ox-property-editor.js';
6
6
  let OxPropertyEditorTextArea = class OxPropertyEditorTextArea extends OxPropertyEditor {
7
- editorTemplate() {
7
+ editorTemplate(value, spec) {
8
8
  var _a, _b, _c;
9
+ const { fullwidth = true } = spec.editor || {};
9
10
  return html `
10
11
  <ox-input-code
11
12
  id="editor"
12
- .value=${this.value}
13
- mode=${((_a = this.property) === null || _a === void 0 ? void 0 : _a.mode) || ''}
14
- tab-size=${((_b = this.property) === null || _b === void 0 ? void 0 : _b.tabSize) || ''}
15
- tab-as-space=${((_c = this.property) === null || _c === void 0 ? void 0 : _c.tabAsSpace) || 'false'}
16
- fullwidth
13
+ .value=${value}
14
+ mode=${((_a = spec.property) === null || _a === void 0 ? void 0 : _a.mode) || ''}
15
+ tab-size=${((_b = spec.property) === null || _b === void 0 ? void 0 : _b.tabSize) || ''}
16
+ tab-as-space=${((_c = spec.property) === null || _c === void 0 ? void 0 : _c.tabAsSpace) || 'false'}
17
+ ?fullwidth=${fullwidth}
17
18
  >
18
19
  </ox-input-code>
19
20
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor-textarea.js","sourceRoot":"","sources":["../../src/ox-property-editor-textarea.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAG1B,IAAa,wBAAwB,GAArC,MAAa,wBAAyB,SAAQ,gBAAgB;IAC5D,cAAc;;QACZ,OAAO,IAAI,CAAA;;;iBAGE,IAAI,CAAC,KAAK;eACZ,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,KAAI,EAAE;mBACrB,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,KAAI,EAAE;uBACxB,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,UAAU,KAAI,OAAO;;;;KAItD,CAAA;IACH,CAAC;CACF,CAAA;AAdY,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAcpC;SAdY,wBAAwB","sourcesContent":["import '@operato/input/ox-input-code.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\n\n@customElement('ox-property-editor-textarea')\nexport class OxPropertyEditorTextArea extends OxPropertyEditor {\n editorTemplate() {\n return html`\n <ox-input-code\n id=\"editor\"\n .value=${this.value}\n mode=${this.property?.mode || ''}\n tab-size=${this.property?.tabSize || ''}\n tab-as-space=${this.property?.tabAsSpace || 'false'}\n fullwidth\n >\n </ox-input-code>\n `\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor-textarea.js","sourceRoot":"","sources":["../../src/ox-property-editor-textarea.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAI1D,IAAa,wBAAwB,GAArC,MAAa,wBAAyB,SAAQ,gBAAgB;IAC5D,cAAc,CAAC,KAAU,EAAE,IAAkB;;QAC3C,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAA;QAE9C,OAAO,IAAI,CAAA;;;iBAGE,KAAK;eACP,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,KAAI,EAAE;mBACrB,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,KAAI,EAAE;uBACxB,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,UAAU,KAAI,OAAO;qBACtC,SAAS;;;KAGzB,CAAA;IACH,CAAC;CACF,CAAA;AAhBY,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAgBpC;SAhBY,wBAAwB","sourcesContent":["import '@operato/input/ox-input-code.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n\n@customElement('ox-property-editor-textarea')\nexport class OxPropertyEditorTextArea extends OxPropertyEditor {\n editorTemplate(value: any, spec: PropertySpec) {\n const { fullwidth = true } = spec.editor || {}\n\n return html`\n <ox-input-code\n id=\"editor\"\n .value=${value}\n mode=${spec.property?.mode || ''}\n tab-size=${spec.property?.tabSize || ''}\n tab-as-space=${spec.property?.tabAsSpace || 'false'}\n ?fullwidth=${fullwidth}\n >\n </ox-input-code>\n `\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import '@operato/input/ox-input-value-map.js';
2
2
  import { OxPropertyEditor } from './ox-property-editor.js';
3
+ import { PropertySpec } from './types.js';
3
4
  export declare class OxPropertyEditorValueMap extends OxPropertyEditor {
4
- editorTemplate(): import("lit-html").TemplateResult<1>;
5
+ editorTemplate(value: any, spec: PropertySpec): import("lit-html").TemplateResult<1>;
5
6
  }
@@ -1,15 +1,21 @@
1
1
  import { __decorate } from "tslib";
2
2
  import '@operato/input/ox-input-value-map.js';
3
- import { OxPropertyEditor } from './ox-property-editor.js';
4
- import { customElement } from 'lit/decorators.js';
5
3
  import { html } from 'lit';
4
+ import { customElement } from 'lit/decorators.js';
5
+ import { OxPropertyEditor } from './ox-property-editor.js';
6
6
  let OxPropertyEditorValueMap = class OxPropertyEditorValueMap extends OxPropertyEditor {
7
- editorTemplate() {
8
- const { value, property } = this;
7
+ editorTemplate(value, spec) {
8
+ const { property } = spec;
9
9
  const valuetype = (property === null || property === void 0 ? void 0 : property.valuetype) || 'string';
10
10
  /* IMPLEMENT-ME valuetype 에 editor를 전달할 수 있는 기능 개발 */
11
+ const { fullwidth = true } = spec.editor || {};
11
12
  return html `
12
- <ox-input-value-map id="editor" .valuetype=${valuetype} .value=${value} fullwidth></ox-input-value-map>
13
+ <ox-input-value-map
14
+ id="editor"
15
+ .valuetype=${valuetype}
16
+ .value=${value}
17
+ ?fullwidth=${fullwidth}
18
+ ></ox-input-value-map>
13
19
  `;
14
20
  }
15
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor-value-map.js","sourceRoot":"","sources":["../../src/ox-property-editor-value-map.ts"],"names":[],"mappings":";AAAA,OAAO,sCAAsC,CAAA;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAG1B,IAAa,wBAAwB,GAArC,MAAa,wBAAyB,SAAQ,gBAAgB;IAC5D,cAAc;QACZ,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAA;QAChC,MAAM,SAAS,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,KAAI,QAAQ,CAAA;QACjD,qDAAqD;QAErD,OAAO,IAAI,CAAA;mDACoC,SAAS,WAAW,KAAK;KACvE,CAAA;IACH,CAAC;CACF,CAAA;AAVY,wBAAwB;IADpC,aAAa,CAAC,8BAA8B,CAAC;GACjC,wBAAwB,CAUpC;SAVY,wBAAwB","sourcesContent":["import '@operato/input/ox-input-value-map.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\n\n@customElement('ox-property-editor-value-map')\nexport class OxPropertyEditorValueMap extends OxPropertyEditor {\n editorTemplate() {\n const { value, property } = this\n const valuetype = property?.valuetype || 'string'\n /* IMPLEMENT-ME valuetype 에 editor를 전달할 수 있는 기능 개발 */\n\n return html`\n <ox-input-value-map id=\"editor\" .valuetype=${valuetype} .value=${value} fullwidth></ox-input-value-map>\n `\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor-value-map.js","sourceRoot":"","sources":["../../src/ox-property-editor-value-map.ts"],"names":[],"mappings":";AAAA,OAAO,sCAAsC,CAAA;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAI1D,IAAa,wBAAwB,GAArC,MAAa,wBAAyB,SAAQ,gBAAgB;IAC5D,cAAc,CAAC,KAAU,EAAE,IAAkB;QAC3C,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAA;QACzB,MAAM,SAAS,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,KAAI,QAAQ,CAAA;QACjD,qDAAqD;QACrD,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAA;QAE9C,OAAO,IAAI,CAAA;;;qBAGM,SAAS;iBACb,KAAK;qBACD,SAAS;;KAEzB,CAAA;IACH,CAAC;CACF,CAAA;AAhBY,wBAAwB;IADpC,aAAa,CAAC,8BAA8B,CAAC;GACjC,wBAAwB,CAgBpC;SAhBY,wBAAwB","sourcesContent":["import '@operato/input/ox-input-value-map.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n\n@customElement('ox-property-editor-value-map')\nexport class OxPropertyEditorValueMap extends OxPropertyEditor {\n editorTemplate(value: any, spec: PropertySpec) {\n const { property } = spec\n const valuetype = property?.valuetype || 'string'\n /* IMPLEMENT-ME valuetype 에 editor를 전달할 수 있는 기능 개발 */\n const { fullwidth = true } = spec.editor || {}\n\n return html`\n <ox-input-value-map\n id=\"editor\"\n .valuetype=${valuetype}\n .value=${value}\n ?fullwidth=${fullwidth}\n ></ox-input-value-map>\n `\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import '@operato/input/ox-input-value-ranges.js';
2
2
  import { OxPropertyEditor } from './ox-property-editor.js';
3
+ import { PropertySpec } from './types.js';
3
4
  export declare class OxPropertyEditorValueRanges extends OxPropertyEditor {
4
- editorTemplate(): import("lit-html").TemplateResult<1>;
5
+ editorTemplate(value: any, spec: PropertySpec): import("lit-html").TemplateResult<1>;
5
6
  }
@@ -4,12 +4,18 @@ import { html } from 'lit';
4
4
  import { customElement } from 'lit/decorators.js';
5
5
  import { OxPropertyEditor } from './ox-property-editor.js';
6
6
  let OxPropertyEditorValueRanges = class OxPropertyEditorValueRanges extends OxPropertyEditor {
7
- editorTemplate() {
8
- const { value, property } = this;
7
+ editorTemplate(value, spec) {
8
+ const { property } = spec;
9
9
  const valuetype = (property === null || property === void 0 ? void 0 : property.valuetype) || 'string';
10
10
  /* IMPLEMENT-ME valuetype 에 editor를 전달할 수 있는 기능 개발 */
11
+ const { fullwidth = true } = spec.editor || {};
11
12
  return html `
12
- <ox-input-value-ranges id="editor" .valuetype=${valuetype} .value=${value} fullwidth></ox-input-value-ranges>
13
+ <ox-input-value-ranges
14
+ id="editor"
15
+ .valuetype=${valuetype}
16
+ .value=${value}
17
+ ?fullwidth=${fullwidth}
18
+ ></ox-input-value-ranges>
13
19
  `;
14
20
  }
15
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor-value-ranges.js","sourceRoot":"","sources":["../../src/ox-property-editor-value-ranges.ts"],"names":[],"mappings":";AAAA,OAAO,yCAAyC,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAG1D,IAAa,2BAA2B,GAAxC,MAAa,2BAA4B,SAAQ,gBAAgB;IAC/D,cAAc;QACZ,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAA;QAChC,MAAM,SAAS,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,KAAI,QAAQ,CAAA;QACjD,qDAAqD;QAErD,OAAO,IAAI,CAAA;sDACuC,SAAS,WAAW,KAAK;KAC1E,CAAA;IACH,CAAC;CACF,CAAA;AAVY,2BAA2B;IADvC,aAAa,CAAC,iCAAiC,CAAC;GACpC,2BAA2B,CAUvC;SAVY,2BAA2B","sourcesContent":["import '@operato/input/ox-input-value-ranges.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\n\n@customElement('ox-property-editor-value-ranges')\nexport class OxPropertyEditorValueRanges extends OxPropertyEditor {\n editorTemplate() {\n const { value, property } = this\n const valuetype = property?.valuetype || 'string'\n /* IMPLEMENT-ME valuetype 에 editor를 전달할 수 있는 기능 개발 */\n\n return html`\n <ox-input-value-ranges id=\"editor\" .valuetype=${valuetype} .value=${value} fullwidth></ox-input-value-ranges>\n `\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor-value-ranges.js","sourceRoot":"","sources":["../../src/ox-property-editor-value-ranges.ts"],"names":[],"mappings":";AAAA,OAAO,yCAAyC,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAI1D,IAAa,2BAA2B,GAAxC,MAAa,2BAA4B,SAAQ,gBAAgB;IAC/D,cAAc,CAAC,KAAU,EAAE,IAAkB;QAC3C,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAA;QACzB,MAAM,SAAS,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,KAAI,QAAQ,CAAA;QACjD,qDAAqD;QACrD,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAA;QAE9C,OAAO,IAAI,CAAA;;;qBAGM,SAAS;iBACb,KAAK;qBACD,SAAS;;KAEzB,CAAA;IACH,CAAC;CACF,CAAA;AAhBY,2BAA2B;IADvC,aAAa,CAAC,iCAAiC,CAAC;GACpC,2BAA2B,CAgBvC;SAhBY,2BAA2B","sourcesContent":["import '@operato/input/ox-input-value-ranges.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n\n@customElement('ox-property-editor-value-ranges')\nexport class OxPropertyEditorValueRanges extends OxPropertyEditor {\n editorTemplate(value: any, spec: PropertySpec) {\n const { property } = spec\n const valuetype = property?.valuetype || 'string'\n /* IMPLEMENT-ME valuetype 에 editor를 전달할 수 있는 기능 개발 */\n const { fullwidth = true } = spec.editor || {}\n\n return html`\n <ox-input-value-ranges\n id=\"editor\"\n .valuetype=${valuetype}\n .value=${value}\n ?fullwidth=${fullwidth}\n ></ox-input-value-ranges>\n `\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import '@operato/input/ox-input-work-shift.js';
2
2
  import { OxPropertyEditor } from './ox-property-editor.js';
3
- export declare class OxPropertyEditorValueRanges extends OxPropertyEditor {
4
- editorTemplate(): import("lit-html").TemplateResult<1>;
3
+ import { PropertySpec } from './types.js';
4
+ export declare class OxPropertyEditorWorkShift extends OxPropertyEditor {
5
+ editorTemplate(value: any, spec: PropertySpec): import("lit-html").TemplateResult<1>;
5
6
  }
@@ -3,14 +3,15 @@ import '@operato/input/ox-input-work-shift.js';
3
3
  import { html } from 'lit';
4
4
  import { customElement } from 'lit/decorators.js';
5
5
  import { OxPropertyEditor } from './ox-property-editor.js';
6
- let OxPropertyEditorValueRanges = class OxPropertyEditorValueRanges extends OxPropertyEditor {
7
- editorTemplate() {
8
- const { value } = this;
9
- return html ` <ox-input-work-shift id="editor" .value=${value} fullwidth></ox-input-work-shift> `;
6
+ let OxPropertyEditorWorkShift = class OxPropertyEditorWorkShift extends OxPropertyEditor {
7
+ editorTemplate(value, spec) {
8
+ const { editor } = spec;
9
+ const { fullwidth = true } = editor || {};
10
+ return html ` <ox-input-work-shift id="editor" .value=${value} ?fullwidth=${fullwidth}></ox-input-work-shift> `;
10
11
  }
11
12
  };
12
- OxPropertyEditorValueRanges = __decorate([
13
+ OxPropertyEditorWorkShift = __decorate([
13
14
  customElement('ox-property-editor-work-shift')
14
- ], OxPropertyEditorValueRanges);
15
- export { OxPropertyEditorValueRanges };
15
+ ], OxPropertyEditorWorkShift);
16
+ export { OxPropertyEditorWorkShift };
16
17
  //# sourceMappingURL=ox-property-editor-work-shift.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor-work-shift.js","sourceRoot":"","sources":["../../src/ox-property-editor-work-shift.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAG1D,IAAa,2BAA2B,GAAxC,MAAa,2BAA4B,SAAQ,gBAAgB;IAC/D,cAAc;QACZ,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;QAEtB,OAAO,IAAI,CAAA,4CAA4C,KAAK,oCAAoC,CAAA;IAClG,CAAC;CACF,CAAA;AANY,2BAA2B;IADvC,aAAa,CAAC,+BAA+B,CAAC;GAClC,2BAA2B,CAMvC;SANY,2BAA2B","sourcesContent":["import '@operato/input/ox-input-work-shift.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\n\n@customElement('ox-property-editor-work-shift')\nexport class OxPropertyEditorValueRanges extends OxPropertyEditor {\n editorTemplate() {\n const { value } = this\n\n return html` <ox-input-work-shift id=\"editor\" .value=${value} fullwidth></ox-input-work-shift> `\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor-work-shift.js","sourceRoot":"","sources":["../../src/ox-property-editor-work-shift.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAI1D,IAAa,yBAAyB,GAAtC,MAAa,yBAA0B,SAAQ,gBAAgB;IAC7D,cAAc,CAAC,KAAU,EAAE,IAAkB;QAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;QACvB,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,MAAM,IAAI,EAAE,CAAA;QAEzC,OAAO,IAAI,CAAA,4CAA4C,KAAK,eAAe,SAAS,0BAA0B,CAAA;IAChH,CAAC;CACF,CAAA;AAPY,yBAAyB;IADrC,aAAa,CAAC,+BAA+B,CAAC;GAClC,yBAAyB,CAOrC;SAPY,yBAAyB","sourcesContent":["import '@operato/input/ox-input-work-shift.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n\n@customElement('ox-property-editor-work-shift')\nexport class OxPropertyEditorWorkShift extends OxPropertyEditor {\n editorTemplate(value: any, spec: PropertySpec) {\n const { editor } = spec\n const { fullwidth = true } = editor || {}\n\n return html` <ox-input-work-shift id=\"editor\" .value=${value} ?fullwidth=${fullwidth}></ox-input-work-shift> `\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import '@operato/i18n/ox-i18n.js';
2
- import { LitElement } from 'lit';
2
+ import { LitElement, TemplateResult } from 'lit';
3
+ import { EditorProperty, PropertySpec } from './types';
3
4
  export declare class OxPropertyEditor extends LitElement {
4
5
  static registry: {
5
6
  [type: string]: string;
@@ -11,16 +12,17 @@ export declare class OxPropertyEditor extends LitElement {
11
12
  static styles: import("lit").CSSResult[];
12
13
  value: any;
13
14
  type: string;
15
+ name: string;
14
16
  label: string;
15
17
  placeholder?: string;
16
- property: any;
18
+ property?: any;
19
+ editor?: EditorProperty;
17
20
  host: any;
21
+ quantifier?: [min: number, max: number];
18
22
  observe?: (value: any) => void;
19
23
  connectedCallback(): void;
20
- editorTemplate(props: {
21
- [key: string]: any;
22
- }): import("lit-html").TemplateResult<1>;
23
- render(): import("lit-html").TemplateResult<1>;
24
+ editorTemplate(value: any, spec: PropertySpec): TemplateResult<1>;
25
+ render(): TemplateResult<1>;
24
26
  __by_me: boolean;
25
27
  shouldUpdate(changedProperties: any): boolean;
26
28
  get valueProperty(): string;
@@ -6,6 +6,7 @@ import deepClone from 'lodash-es/cloneDeep';
6
6
  export class OxPropertyEditor extends LitElement {
7
7
  constructor() {
8
8
  super(...arguments);
9
+ this.quantifier = [1, 1];
9
10
  this.__by_me = false;
10
11
  }
11
12
  static register(types) {
@@ -20,12 +21,23 @@ export class OxPropertyEditor extends LitElement {
20
21
  super.connectedCallback();
21
22
  this.renderRoot.addEventListener('change', this._valueChanged.bind(this));
22
23
  }
23
- editorTemplate(props) {
24
+ editorTemplate(value, spec) {
24
25
  return html ``;
25
26
  }
26
27
  render() {
28
+ var _a;
29
+ const { value, quantifier } = this;
30
+ const [min = 1, max = 1] = quantifier || [1, 1];
27
31
  return html `
28
- ${this.editorTemplate(this)}
32
+ ${max <= 1
33
+ ? this.editorTemplate(value, this)
34
+ : html `
35
+ <div ?fullwidth=${(_a = this.editor) === null || _a === void 0 ? void 0 : _a.fullwidth}>
36
+ ${new Array(max)
37
+ .fill('')
38
+ .map((_, idx) => html ` <div editor data-index=${idx}>${this.editorTemplate(value === null || value === void 0 ? void 0 : value[idx], this)}</div> `)}
39
+ </div>
40
+ `}
29
41
  ${this.label
30
42
  ? html `
31
43
  <label for="editor">
@@ -58,8 +70,20 @@ export class OxPropertyEditor extends LitElement {
58
70
  return 'label.' + label;
59
71
  }
60
72
  _valueChanged(e) {
73
+ var _a;
61
74
  e.stopPropagation();
62
- this.value = this.makeup(e.target[this.valueProperty]);
75
+ const editor = e.target;
76
+ const [min = 1, max = 1] = this.quantifier || [];
77
+ const value = this.makeup(editor[this.valueProperty]);
78
+ if (max > 1) {
79
+ const index = Number((_a = editor.closest('[data-index]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-index'));
80
+ var array = this.value instanceof Array ? [...this.value] : [];
81
+ array[index] = value;
82
+ this.value = array;
83
+ }
84
+ else {
85
+ this.value = value;
86
+ }
63
87
  this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
64
88
  if (!this.observe)
65
89
  return;
@@ -75,6 +99,7 @@ OxPropertyEditor.styles = [
75
99
  display: grid;
76
100
  grid-template-columns: repeat(10, 1fr);
77
101
  grid-gap: 5px;
102
+ grid-auto-rows: minmax(24px, auto);
78
103
 
79
104
  align-items: center;
80
105
 
@@ -110,10 +135,9 @@ OxPropertyEditor.styles = [
110
135
  text-align: left;
111
136
  }
112
137
 
113
- :host > select,
114
- :host > ox-select,
115
- :host > input[type='text'],
116
- :host > input[type='number'] {
138
+ select,
139
+ ox-select,
140
+ input:not([type='checkbox']) {
117
141
  border: 1px solid rgba(0, 0, 0, 0.2);
118
142
  }
119
143
 
@@ -138,6 +162,26 @@ OxPropertyEditor.styles = [
138
162
  justify-self: end;
139
163
  align-self: center;
140
164
  }
165
+
166
+ ox-input-code,
167
+ ox-input-data {
168
+ height: 300px;
169
+ }
170
+
171
+ :host > div {
172
+ display: flex;
173
+ flex-direction: column;
174
+ gap: 3px;
175
+ }
176
+
177
+ div[data-index] {
178
+ display: flex;
179
+ min-height: 24px;
180
+ }
181
+
182
+ div[data-index] > * {
183
+ flex: 1;
184
+ }
141
185
  `
142
186
  ];
143
187
  __decorate([
@@ -146,6 +190,9 @@ __decorate([
146
190
  __decorate([
147
191
  property({ type: String })
148
192
  ], OxPropertyEditor.prototype, "type", void 0);
193
+ __decorate([
194
+ property({ type: String, attribute: true, reflect: true })
195
+ ], OxPropertyEditor.prototype, "name", void 0);
149
196
  __decorate([
150
197
  property({ type: String })
151
198
  ], OxPropertyEditor.prototype, "label", void 0);
@@ -155,9 +202,15 @@ __decorate([
155
202
  __decorate([
156
203
  property({ type: Object })
157
204
  ], OxPropertyEditor.prototype, "property", void 0);
205
+ __decorate([
206
+ property({ type: Object })
207
+ ], OxPropertyEditor.prototype, "editor", void 0);
158
208
  __decorate([
159
209
  property({ type: Object })
160
210
  ], OxPropertyEditor.prototype, "host", void 0);
211
+ __decorate([
212
+ property({ type: Array })
213
+ ], OxPropertyEditor.prototype, "quantifier", void 0);
161
214
  __decorate([
162
215
  property({ type: Object })
163
216
  ], OxPropertyEditor.prototype, "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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsEF;CACF,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAU;AACT;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAA+B;AAyBjD;IAAR,KAAK,EAAE;iDAAgB","sourcesContent":["import '@operato/i18n/ox-i18n.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport deepClone from 'lodash-es/cloneDeep'\n\nexport class OxPropertyEditor extends LitElement {\n static registry: { [type: string]: string } = {}\n\n public static register(types: { [type: string]: string }) {\n Object.keys(types).forEach(type => {\n OxPropertyEditor.registry[type] = types[type]\n })\n }\n\n public static getEditor(type: string): string {\n return OxPropertyEditor.registry[type]\n }\n\n static styles = [\n css`\n :host {\n margin: 5px;\n\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n\n align-items: center;\n\n color: var(--property-sidebar-fieldset-legend-color);\n }\n\n :host > * {\n box-sizing: border-box;\n\n grid-column: span 7;\n order: 2;\n\n align-self: stretch;\n }\n\n :host > label {\n grid-column: span 3;\n order: 1;\n\n text-align: right;\n\n font: var(--label-font);\n text-transform: capitalize;\n\n align-self: center;\n }\n\n :host > input[type='checkbox'] ~ label,\n :host > ox-checkbox ~ label {\n grid-column: span 6;\n order: 2;\n\n text-align: left;\n }\n\n :host > select,\n :host > ox-select,\n :host > input[type='text'],\n :host > input[type='number'] {\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n :host > legend {\n grid-column: 1 / -1;\n\n display: inline-block;\n\n text-align: left;\n text-transform: capitalize;\n }\n\n :host > [fullwidth] {\n grid-column: 1 / -1;\n }\n\n :host > input[type='checkbox'],\n :host > ox-checkbox {\n grid-column: span 4;\n order: 1;\n\n justify-self: end;\n align-self: center;\n }\n `\n ]\n\n @property({ type: Object }) value: any\n @property({ type: String }) type!: string\n @property({ type: String }) label!: string\n @property({ type: String }) placeholder?: string\n @property({ type: Object }) property: any\n @property({ type: Object }) host: any\n @property({ type: Object }) observe?: (value: any) => void\n\n connectedCallback() {\n super.connectedCallback()\n\n this.renderRoot.addEventListener('change', this._valueChanged.bind(this))\n }\n\n editorTemplate(props: { [key: string]: any }) {\n return html``\n }\n\n render() {\n return html`\n ${this.editorTemplate(this)}\n ${this.label\n ? html`\n <label for=\"editor\">\n <ox-i18n msgid=${this._computeLabelId(this.label)}>${this.label}</ox-i18n>\n </label>\n `\n : html``}\n `\n }\n\n @state() __by_me = false\n\n shouldUpdate(changedProperties: any) {\n if (this.__by_me) {\n return false\n }\n\n if (changedProperties.has('value')) {\n this.__by_me = true\n this.value = deepClone(this.value)\n this.__by_me = false\n }\n\n return true\n }\n\n get valueProperty() {\n return 'value'\n }\n\n makeup(v: any) {\n return deepClone(v)\n }\n\n _computeLabelId(label: string) {\n if (label.indexOf('label.') >= 0) return label\n\n return 'label.' + label\n }\n\n _valueChanged(e: Event) {\n e.stopPropagation()\n\n this.value = this.makeup((e.target as any)[this.valueProperty])\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n\n if (!this.observe) return\n this.observe.call(this, this.value)\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor.js","sourceRoot":"","sources":["../../src/ox-property-editor.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AA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,EAAE,MAAM,EAAE,CAAC;+CAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAc;AACmB;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAc;AAC7C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAU;AACV;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAAiD;AAC/C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAA+B;AAsCjD;IAAR,KAAK,EAAE;iDAAgB","sourcesContent":["import '@operato/i18n/ox-i18n.js'\n\nimport { css, html, LitElement, TemplateResult } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport deepClone from 'lodash-es/cloneDeep'\n\nimport { EditorProperty, PropertySpec } from './types'\n\nexport class OxPropertyEditor extends LitElement {\n static registry: { [type: string]: string } = {}\n\n public static register(types: { [type: string]: string }) {\n Object.keys(types).forEach(type => {\n OxPropertyEditor.registry[type] = types[type]\n })\n }\n\n public static getEditor(type: string): string {\n return OxPropertyEditor.registry[type]\n }\n\n static styles = [\n css`\n :host {\n margin: 5px;\n\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n grid-auto-rows: minmax(24px, auto);\n\n align-items: center;\n\n color: var(--property-sidebar-fieldset-legend-color);\n }\n\n :host > * {\n box-sizing: border-box;\n\n grid-column: span 7;\n order: 2;\n\n align-self: stretch;\n }\n\n :host > label {\n grid-column: span 3;\n order: 1;\n\n text-align: right;\n\n font: var(--label-font);\n text-transform: capitalize;\n\n align-self: center;\n }\n\n :host > input[type='checkbox'] ~ label,\n :host > ox-checkbox ~ label {\n grid-column: span 6;\n order: 2;\n\n text-align: left;\n }\n\n select,\n ox-select,\n input:not([type='checkbox']) {\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n :host > legend {\n grid-column: 1 / -1;\n\n display: inline-block;\n\n text-align: left;\n text-transform: capitalize;\n }\n\n :host > [fullwidth] {\n grid-column: 1 / -1;\n }\n\n :host > input[type='checkbox'],\n :host > ox-checkbox {\n grid-column: span 4;\n order: 1;\n\n justify-self: end;\n align-self: center;\n }\n\n ox-input-code,\n ox-input-data {\n height: 300px;\n }\n\n :host > div {\n display: flex;\n flex-direction: column;\n gap: 3px;\n }\n\n div[data-index] {\n display: flex;\n min-height: 24px;\n }\n\n div[data-index] > * {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) value: any\n @property({ type: String }) type!: string\n @property({ type: String, attribute: true, reflect: true }) name!: string\n @property({ type: String }) label!: string\n @property({ type: String }) placeholder?: string\n @property({ type: Object }) property?: any\n @property({ type: Object }) editor?: EditorProperty\n @property({ type: Object }) host: any\n @property({ type: Array }) quantifier?: [min: number, max: number] = [1, 1]\n @property({ type: Object }) observe?: (value: any) => void\n\n connectedCallback() {\n super.connectedCallback()\n\n this.renderRoot.addEventListener('change', this._valueChanged.bind(this))\n }\n\n editorTemplate(value: any, spec: PropertySpec): TemplateResult<1> {\n return html``\n }\n\n render() {\n const { value, quantifier } = this\n const [min = 1, max = 1] = quantifier || [1, 1]\n\n return html`\n ${max <= 1\n ? this.editorTemplate(value, this)\n : html`\n <div ?fullwidth=${this.editor?.fullwidth}>\n ${new Array(max)\n .fill('')\n .map(\n (_, idx) => html` <div editor data-index=${idx}>${this.editorTemplate(value?.[idx], this)}</div> `\n )}\n </div>\n `}\n ${this.label\n ? html`\n <label for=\"editor\">\n <ox-i18n msgid=${this._computeLabelId(this.label)}>${this.label}</ox-i18n>\n </label>\n `\n : html``}\n `\n }\n\n @state() __by_me = false\n\n shouldUpdate(changedProperties: any) {\n if (this.__by_me) {\n return false\n }\n\n if (changedProperties.has('value')) {\n this.__by_me = true\n this.value = deepClone(this.value)\n this.__by_me = false\n }\n\n return true\n }\n\n get valueProperty() {\n return 'value'\n }\n\n makeup(v: any) {\n return deepClone(v)\n }\n\n _computeLabelId(label: string) {\n if (label.indexOf('label.') >= 0) return label\n\n return 'label.' + label\n }\n\n _valueChanged(e: Event) {\n e.stopPropagation()\n const editor = e.target as HTMLInputElement\n\n const [min = 1, max = 1] = this.quantifier || []\n const value = this.makeup((editor as any)[this.valueProperty])\n\n if (max > 1) {\n const index = Number(editor.closest('[data-index]')?.getAttribute('data-index'))\n var array: any[] = this.value instanceof Array ? [...this.value] : []\n array[index] = value\n this.value = array\n } else {\n this.value = value\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n\n if (!this.observe) return\n this.observe.call(this, this.value)\n }\n}\n"]}