@operato/property-editor 2.0.0-alpha.13 → 2.0.0-alpha.131

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 (33) hide show
  1. package/CHANGELOG.md +630 -0
  2. package/demo/index.html +33 -3
  3. package/dist/src/ox-properties-dynamic-view.d.ts +1 -1
  4. package/dist/src/ox-properties-dynamic-view.js +6 -1
  5. package/dist/src/ox-properties-dynamic-view.js.map +1 -1
  6. package/dist/src/ox-property-editor-action.d.ts +1 -1
  7. package/dist/src/ox-property-editor-action.js +5 -4
  8. package/dist/src/ox-property-editor-action.js.map +1 -1
  9. package/dist/src/ox-property-editor-textarea.d.ts +1 -0
  10. package/dist/src/ox-property-editor-textarea.js +12 -5
  11. package/dist/src/ox-property-editor-textarea.js.map +1 -1
  12. package/dist/src/ox-property-editor.js +1 -1
  13. package/dist/src/ox-property-editor.js.map +1 -1
  14. package/dist/src/types.d.ts +6 -0
  15. package/dist/src/types.js.map +1 -1
  16. package/dist/stories/ox-properties-dynamic-view.stories.d.ts +53 -0
  17. package/dist/stories/ox-properties-dynamic-view.stories.js +274 -0
  18. package/dist/stories/ox-properties-dynamic-view.stories.js.map +1 -0
  19. package/dist/stories/{index.stories.d.ts → ox-properties-editor-textarea.stories.d.ts} +2 -4
  20. package/dist/stories/ox-properties-editor-textarea.stories.js +76 -0
  21. package/dist/stories/ox-properties-editor-textarea.stories.js.map +1 -0
  22. package/dist/tsconfig.tsbuildinfo +1 -1
  23. package/package.json +19 -19
  24. package/src/ox-properties-dynamic-view.ts +8 -2
  25. package/src/ox-property-editor-action.ts +5 -4
  26. package/src/ox-property-editor-textarea.ts +12 -4
  27. package/src/ox-property-editor.ts +1 -1
  28. package/src/types.ts +7 -0
  29. package/stories/ox-properties-dynamic-view.stories.ts +296 -0
  30. package/stories/ox-properties-editor-textarea.stories.ts +97 -0
  31. package/dist/stories/index.stories.js +0 -33
  32. package/dist/stories/index.stories.js.map +0 -1
  33. package/stories/index.stories.ts +0 -52
@@ -56,7 +56,7 @@ let OxPropertiesDynamicView = class OxPropertiesDynamicView extends LitElement {
56
56
  const specs = this.props || [];
57
57
  this.textContent = '';
58
58
  specs.forEach(spec => {
59
- const { label, type, name, placeholder, editor, quantifier, observe, property, defaultValue } = spec;
59
+ const { label, type, name, placeholder, editor, quantifier, observe, property, defaultValue, styles } = spec;
60
60
  let elementType = OxPropertyEditor.getEditor(type);
61
61
  if (!elementType) {
62
62
  console.warn('Property Editor not defined', type);
@@ -76,6 +76,11 @@ let OxPropertiesDynamicView = class OxPropertiesDynamicView extends LitElement {
76
76
  }
77
77
  element.property = property;
78
78
  element.setAttribute('property-editor', 'true');
79
+ if (styles) {
80
+ Object.keys(styles).forEach((key) => {
81
+ element.style[key] = styles[key];
82
+ });
83
+ }
79
84
  this.appendChild(element);
80
85
  });
81
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ox-properties-dynamic-view.js","sourceRoot":"","sources":["../../src/ox-properties-dynamic-view.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAG1D;;;;;;;;;;;EAWE;AAEF,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,SAAS;IAChB,kBAAkB,EAAE,IAAI;IACxB,qBAAqB,EAAE,IAAI;IAC3B,eAAe,EAAE,EAAE;IACnB,gBAAgB,EAAE,EAAE;IACpB,aAAa,EAAE,IAAI;IACnB,W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AE,MAAM,CAAC,KAAK,CAAC,CAAA;YACzC,CAAC,CAAC,CAAA;IACN,CAAC;IAED,eAAe,CAAC,CAAQ;QACtB,CAAC,CAAC,eAAe,EAAE,CAAA;QACnB,IAAI,MAAM,GAAG,CAAC,CAAC,MAAiB,CAAA;QAEhC,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAqB,CAAA;QAEtE,IAAI,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;QACtC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAM;QACR,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAA;QACjC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,GAAG;gBACX,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,KAAK;aACrB,CAAA;QACH,CAAC;QAED,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,iBAAiB,EAAE;YACjC,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;CACF,CAAA;AA5F6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAoC;AACpC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;sDAAuB;AAFtC,uBAAuB;IADnC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,uBAAuB,CA6FnC","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n\n/**\n모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.\n\nExample:\n\n <ox-properties-dynamic-view value=\"{{value}}\">\n <label>Center X</label>\n <input type=\"number\" .value=\"${value.cx}\">\n <label>Width</label>\n <input type=\"number\" .value=\"${value.width}\">\n </ox-properties-dynamic-view>\n*/\n\nconst DEFAULT_VALUE = {\n legend: '',\n number: 0,\n angle: 0,\n string: '',\n password: '',\n textarea: '',\n checkbox: false,\n select: '',\n color: '#000000',\n 'solidcolor-stops': null,\n 'gradientcolor-stops': null,\n 'gltf-selector': '',\n 'image-selector': '',\n multiplecolor: null,\n editortable: null,\n imageselector: '',\n options: null,\n date: null\n}\n\n@customElement('ox-properties-dynamic-view')\nexport class OxPropertiesDynamicView extends LitElement {\n @property({ type: Object }) value: { [name: string]: any } = {}\n @property({ type: Array }) props?: PropertySpec[]\n\n render() {\n return html`<slot></slot>`\n }\n\n firstUpdated() {\n this.addEventListener('change', this._onValueChanged.bind(this))\n }\n\n updated(changes: PropertyValues<this>) {\n changes.has('props') && this._onPropsChanged(this.props || [])\n changes.has('value') && this._setValues()\n }\n\n _onPropsChanged(props: PropertySpec[]) {\n const specs = this.props || []\n\n this.textContent = ''\n specs.forEach(spec => {\n const { label, type, name, placeholder, editor, quantifier, observe, property, defaultValue } = spec\n\n let elementType = OxPropertyEditor.getEditor(type)\n if (!elementType) {\n console.warn('Property Editor not defined', type)\n return\n }\n let element = document.createElement(elementType) as OxPropertyEditor\n\n element.label = label\n element.type = type\n element.placeholder = placeholder\n element.name = name\n element.setAttribute('name', name)\n element.editor = editor\n element.quantifier = quantifier\n element.defaultValue = defaultValue\n\n if (observe) {\n element.observeHandler = observe\n }\n element.property = property\n element.setAttribute('property-editor', 'true')\n\n this.appendChild(element)\n })\n }\n\n _setValues() {\n this.value &&\n Array.from(this.querySelectorAll('[name]')).forEach(prop => {\n const editor = prop as OxPropertyEditor\n const name = editor.getAttribute('name')\n\n var value = this.value[name!]\n if (value === undefined) {\n value = editor.defaultValue !== undefined ? editor.defaultValue : (DEFAULT_VALUE as any)[editor.type]\n }\n\n editor.value = value\n editor.observe.call(prop, editor.value)\n })\n }\n\n _onValueChanged(e: Event) {\n e.stopPropagation()\n var target = e.target as Element\n\n const editor = target.closest('[property-editor]') as OxPropertyEditor\n\n var name = editor.getAttribute('name')\n if (!name) {\n return\n }\n\n if (this.value) {\n this.value[name] = editor.value\n } else {\n this.value = {\n [name]: editor.value\n }\n }\n\n this.dispatchEvent(\n new CustomEvent('property-change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
1
+ {"version":3,"file":"ox-properties-dynamic-view.js","sourceRoot":"","sources":["../../src/ox-properties-dynamic-view.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAG1D;;;;;;;;;;;EAWE;AAEF,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,SAAS;IAChB,kBAAkB,EAAE,IAAI;IACxB,qBAAqB,EAAE,IAAI;IAC3B,eAAe,EAAE,EAAE;IACnB,gBAAgB,EAAE,EAAE;IACpB,aAAa,EAAE,IAAI;IACnB,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,EAAE;IACjB,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;CACX,CAAA;AAGM,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,UAAU;IAAhD;;QACuB,UAAK,GAA4B,EAAE,CAAA;IAkGjE,CAAC;IA/F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OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;YACzC,CAAC,CAAC,CAAA;IACN,CAAC;IAED,eAAe,CAAC,CAAQ;QACtB,CAAC,CAAC,eAAe,EAAE,CAAA;QACnB,IAAI,MAAM,GAAG,CAAC,CAAC,MAAiB,CAAA;QAEhC,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAqB,CAAA;QAEtE,IAAI,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;QACtC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAM;QACR,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAA;QACjC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,GAAG;gBACX,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,KAAK;aACrB,CAAA;QACH,CAAC;QAED,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,iBAAiB,EAAE;YACjC,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;CACF,CAAA;AAlG6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAoC;AACpC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;sDAAuB;AAFtC,uBAAuB;IADnC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,uBAAuB,CAmGnC","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec, CSSStyles } from './types.js'\n\n/**\n모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.\n\nExample:\n\n <ox-properties-dynamic-view value=\"{{value}}\">\n <label>Center X</label>\n <input type=\"number\" .value=\"${value.cx}\">\n <label>Width</label>\n <input type=\"number\" .value=\"${value.width}\">\n </ox-properties-dynamic-view>\n*/\n\nconst DEFAULT_VALUE = {\n legend: '',\n number: 0,\n angle: 0,\n string: '',\n password: '',\n textarea: '',\n checkbox: false,\n select: '',\n color: '#000000',\n 'solidcolor-stops': null,\n 'gradientcolor-stops': null,\n 'gltf-selector': '',\n 'image-selector': '',\n multiplecolor: null,\n editortable: null,\n imageselector: '',\n options: null,\n date: null\n}\n\n@customElement('ox-properties-dynamic-view')\nexport class OxPropertiesDynamicView extends LitElement {\n @property({ type: Object }) value: { [name: string]: any } = {}\n @property({ type: Array }) props?: PropertySpec[]\n\n render() {\n return html`<slot></slot>`\n }\n\n firstUpdated() {\n this.addEventListener('change', this._onValueChanged.bind(this))\n }\n\n updated(changes: PropertyValues<this>) {\n changes.has('props') && this._onPropsChanged(this.props || [])\n changes.has('value') && this._setValues()\n }\n\n _onPropsChanged(props: PropertySpec[]) {\n const specs = this.props || []\n\n this.textContent = ''\n specs.forEach(spec => {\n const { label, type, name, placeholder, editor, quantifier, observe, property, defaultValue, styles } = spec\n\n let elementType = OxPropertyEditor.getEditor(type)\n if (!elementType) {\n console.warn('Property Editor not defined', type)\n return\n }\n let element = document.createElement(elementType) as OxPropertyEditor\n\n element.label = label\n element.type = type\n element.placeholder = placeholder\n element.name = name\n element.setAttribute('name', name)\n element.editor = editor\n element.quantifier = quantifier\n element.defaultValue = defaultValue\n\n if (observe) {\n element.observeHandler = observe\n }\n element.property = property\n element.setAttribute('property-editor', 'true')\n\n if (styles) {\n Object.keys(styles).forEach((key: string) => {\n element.style[key as keyof CSSStyles] = styles![key as keyof CSSStyles]\n })\n }\n\n this.appendChild(element)\n })\n }\n\n _setValues() {\n this.value &&\n Array.from(this.querySelectorAll('[name]')).forEach(prop => {\n const editor = prop as OxPropertyEditor\n const name = editor.getAttribute('name')\n\n var value = this.value[name!]\n if (value === undefined) {\n value = editor.defaultValue !== undefined ? editor.defaultValue : (DEFAULT_VALUE as any)[editor.type]\n }\n\n editor.value = value\n editor.observe.call(prop, editor.value)\n })\n }\n\n _onValueChanged(e: Event) {\n e.stopPropagation()\n var target = e.target as Element\n\n const editor = target.closest('[property-editor]') as OxPropertyEditor\n\n var name = editor.getAttribute('name')\n if (!name) {\n return\n }\n\n if (this.value) {\n this.value[name] = editor.value\n } else {\n this.value = {\n [name]: editor.value\n }\n }\n\n this.dispatchEvent(\n new CustomEvent('property-change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import '@material/mwc-icon-button';
1
+ import '@material/web/button/elevated-button.js';
2
2
  import { TemplateResult } from 'lit';
3
3
  import { OxPropertyEditor } from './ox-property-editor.js';
4
4
  import { PropertySpec } from './types.js';
@@ -2,7 +2,7 @@
2
2
  * Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
  import { __decorate } from "tslib";
5
- import '@material/mwc-icon-button';
5
+ import '@material/web/button/elevated-button.js';
6
6
  import { html } from 'lit';
7
7
  import { customElement } from 'lit/decorators.js';
8
8
  import { OxPropertyEditor } from './ox-property-editor.js';
@@ -14,8 +14,7 @@ let OxPropertyEditorAction = class OxPropertyEditorAction extends OxPropertyEdit
14
14
  var property = spec.property || {};
15
15
  var { icon, action } = property;
16
16
  return html `
17
- <mwc-icon-button
18
- .icon=${icon}
17
+ <md-elevated-button
19
18
  @click=${(e) => {
20
19
  this.dispatchEvent(new CustomEvent('i-need-selected', {
21
20
  bubbles: true,
@@ -28,7 +27,9 @@ let OxPropertyEditorAction = class OxPropertyEditorAction extends OxPropertyEdit
28
27
  }));
29
28
  }}
30
29
  ?disabled=${this.disabled}
31
- ></mwc-icon-button>
30
+ >
31
+ <md-icon slot="icon">${icon}</md-icon>
32
+ </md-elevated-button>
32
33
  `;
33
34
  }
34
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor-action.js","sourceRoot":"","sources":["../../src/ox-property-editor-action.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,2BAA2B,CAAA;AAElC,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D;;GAEG;AAEY,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,gBAAgB;IAClE,cAAc,CAAC,KAAU,EAAE,IAAkB;QAC3C,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAA;QAClC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAA;QAE/B,OAAO,IAAI,CAAA;;gBAEC,IAAI;iBACH,CAAC,CAAa,EAAE,EAAE;YACzB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,iBAAiB,EAAE;gBACjC,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE;oBACN,QAAQ,EAAE,CAAC,QAAe,EAAE,EAAE;wBAC5B,OAAO,MAAM,KAAK,UAAU,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;oBACrD,CAAC;iBACF;aACF,CAAC,CACH,CAAA;QACH,CAAC;oBACW,IAAI,CAAC,QAAQ;;KAE5B,CAAA;IACH,CAAC;CACF,CAAA;AAzBoB,sBAAsB;IAD1C,aAAa,CAAC,2BAA2B,CAAC;GACtB,sBAAsB,CAyB1C;eAzBoB,sBAAsB","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/mwc-icon-button'\n\nimport { html, TemplateResult } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n/**\n *\n */\n@customElement('ox-property-editor-action')\nexport default class OxPropertyEditorAction extends OxPropertyEditor {\n editorTemplate(value: any, spec: PropertySpec): TemplateResult {\n var property = spec.property || {}\n var { icon, action } = property\n\n return html`\n <mwc-icon-button\n .icon=${icon}\n @click=${(e: MouseEvent) => {\n this.dispatchEvent(\n new CustomEvent('i-need-selected', {\n bubbles: true,\n composed: true,\n detail: {\n callback: (selected: any[]) => {\n typeof action === 'function' && action(selected[0])\n }\n }\n })\n )\n }}\n ?disabled=${this.disabled}\n ></mwc-icon-button>\n `\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor-action.js","sourceRoot":"","sources":["../../src/ox-property-editor-action.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,yCAAyC,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D;;GAEG;AAEY,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,gBAAgB;IAClE,cAAc,CAAC,KAAU,EAAE,IAAkB;QAC3C,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAA;QAClC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAA;QAE/B,OAAO,IAAI,CAAA;;iBAEE,CAAC,CAAa,EAAE,EAAE;YACzB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,iBAAiB,EAAE;gBACjC,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE;oBACN,QAAQ,EAAE,CAAC,QAAe,EAAE,EAAE;wBAC5B,OAAO,MAAM,KAAK,UAAU,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;oBACrD,CAAC;iBACF;aACF,CAAC,CACH,CAAA;QACH,CAAC;oBACW,IAAI,CAAC,QAAQ;;+BAEF,IAAI;;KAE9B,CAAA;IACH,CAAC;CACF,CAAA;AA1BoB,sBAAsB;IAD1C,aAAa,CAAC,2BAA2B,CAAC;GACtB,sBAAsB,CA0B1C;eA1BoB,sBAAsB","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/button/elevated-button.js'\n\nimport { html, TemplateResult } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from './ox-property-editor.js'\nimport { PropertySpec } from './types.js'\n/**\n *\n */\n@customElement('ox-property-editor-action')\nexport default class OxPropertyEditorAction extends OxPropertyEditor {\n editorTemplate(value: any, spec: PropertySpec): TemplateResult {\n var property = spec.property || {}\n var { icon, action } = property\n\n return html`\n <md-elevated-button\n @click=${(e: MouseEvent) => {\n this.dispatchEvent(\n new CustomEvent('i-need-selected', {\n bubbles: true,\n composed: true,\n detail: {\n callback: (selected: any[]) => {\n typeof action === 'function' && action(selected[0])\n }\n }\n })\n )\n }}\n ?disabled=${this.disabled}\n >\n <md-icon slot=\"icon\">${icon}</md-icon>\n </md-elevated-button>\n `\n }\n}\n"]}
@@ -3,5 +3,6 @@ import { TemplateResult } from 'lit';
3
3
  import { OxPropertyEditor } from './ox-property-editor.js';
4
4
  import { PropertySpec } from './types.js';
5
5
  export declare class OxPropertyEditorTextArea extends OxPropertyEditor {
6
+ static styles: import("lit").CSSResult[];
6
7
  editorTemplate(value: any, spec: PropertySpec): TemplateResult;
7
8
  }
@@ -1,26 +1,33 @@
1
1
  import { __decorate } from "tslib";
2
2
  import '@operato/input/ox-input-code.js';
3
- import { html } from 'lit';
3
+ import { css, html } from 'lit';
4
4
  import { customElement } from 'lit/decorators.js';
5
5
  import { OxPropertyEditor } from './ox-property-editor.js';
6
6
  let OxPropertyEditorTextArea = class OxPropertyEditorTextArea extends OxPropertyEditor {
7
7
  editorTemplate(value, spec) {
8
- var _a, _b, _c;
8
+ var _a, _b;
9
9
  const { fullwidth = true } = spec.editor || {};
10
10
  return html `
11
11
  <ox-input-code
12
12
  id="editor"
13
13
  .value=${value}
14
- tab-size=${((_a = spec.property) === null || _a === void 0 ? void 0 : _a.tabSize) || ''}
15
- tab-as-space=${((_b = spec.property) === null || _b === void 0 ? void 0 : _b.tabAsSpace) || 'false'}
14
+ language=${((_a = spec.property) === null || _a === void 0 ? void 0 : _a.language) || 'javascript'}
16
15
  ?fullwidth=${fullwidth}
17
- language=${((_c = spec.property) === null || _c === void 0 ? void 0 : _c.language) || 'javascript'}
18
16
  ?disabled=${this.disabled}
17
+ ?show-line-numbers=${((_b = spec.property) === null || _b === void 0 ? void 0 : _b.showLineNumbers) || false}
19
18
  >
20
19
  </ox-input-code>
21
20
  `;
22
21
  }
23
22
  };
23
+ OxPropertyEditorTextArea.styles = [
24
+ ...OxPropertyEditor.styles,
25
+ css `
26
+ :host {
27
+ grid-template-rows: auto 1fr;
28
+ }
29
+ `
30
+ ];
24
31
  OxPropertyEditorTextArea = __decorate([
25
32
  customElement('ox-property-editor-textarea')
26
33
  ], OxPropertyEditorTextArea);
@@ -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,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAInD,IAAM,wBAAwB,GAA9B,MAAM,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;mBACH,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,KAAI,EAAE;uBACxB,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,UAAU,KAAI,OAAO;qBACtC,SAAS;mBACX,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,QAAQ,KAAI,YAAY;oBACtC,IAAI,CAAC,QAAQ;;;KAG5B,CAAA;IACH,CAAC;CACF,CAAA;AAjBY,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAiBpC","sourcesContent":["import '@operato/input/ox-input-code.js'\n\nimport { html, TemplateResult } 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): TemplateResult {\n const { fullwidth = true } = spec.editor || {}\n\n return html`\n <ox-input-code\n id=\"editor\"\n .value=${value}\n tab-size=${spec.property?.tabSize || ''}\n tab-as-space=${spec.property?.tabAsSpace || 'false'}\n ?fullwidth=${fullwidth}\n language=${spec.property?.language || 'javascript'}\n ?disabled=${this.disabled}\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,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAInD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,gBAAgB;IAU5D,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;mBACH,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,QAAQ,KAAI,YAAY;qBACrC,SAAS;oBACV,IAAI,CAAC,QAAQ;6BACJ,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,eAAe,KAAI,KAAK;;;KAG/D,CAAA;IACH,CAAC;;AAvBM,+BAAM,GAAG;IACd,GAAG,gBAAgB,CAAC,MAAM;IAC1B,GAAG,CAAA;;;;KAIF;CACF,AAPY,CAOZ;AARU,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAyBpC","sourcesContent":["import '@operato/input/ox-input-code.js'\n\nimport { css, html, TemplateResult } 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 static styles = [\n ...OxPropertyEditor.styles,\n css`\n :host {\n grid-template-rows: auto 1fr;\n }\n `\n ]\n\n editorTemplate(value: any, spec: PropertySpec): TemplateResult {\n const { fullwidth = true } = spec.editor || {}\n\n return html`\n <ox-input-code\n id=\"editor\"\n .value=${value}\n language=${spec.property?.language || 'javascript'}\n ?fullwidth=${fullwidth}\n ?disabled=${this.disabled}\n ?show-line-numbers=${spec.property?.showLineNumbers || false}\n >\n </ox-input-code>\n `\n }\n}\n"]}
@@ -174,7 +174,7 @@ OxPropertyEditor.styles = [
174
174
  ox-input-code,
175
175
  ox-input-data,
176
176
  .multiline-input {
177
- height: 300px;
177
+ min-height: 300px;
178
178
  }
179
179
 
180
180
  :host > div {
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor.js","sourceRoot":"","sources":["../../src/ox-property-editor.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE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AQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAmB;AAyCtC;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 border-radius: 4px;\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 .multiline-input {\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 }) observeHandler?: (value: any) => void\n @property({ type: Object }) defaultValue?: any\n @property({ type: Object }) context?: any\n @property({ type: Boolean }) disabled?: boolean\n\n private observing: boolean = false\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 {\n return html``\n }\n\n render() {\n const { defaultValue } = this\n const { value = defaultValue, 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 = this.makeup(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 this.observe(this.value)\n }\n\n observe(value: any) {\n if (this.observeHandler && !this.observing) {\n this.observing = true\n this.observeHandler.call(this, value)\n this.observing = false\n }\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor.js","sourceRoot":"","sources":["../../src/ox-property-editor.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAI3C,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAAhD;;QAqH6B,eAAU,GAAgC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAMnE,cAAS,GAAY,KAAK,CAAA;QAuCzB,YAAO,GAAG,KAAK,CAAA;IA0D1B,CAAC;IAzNQ,MAAM,CAAC,QAAQ,CAAC,KAAiC;QACtD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAChC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;QAC/C,CAAC,CAAC,CAAA;IACJ,CAAC;IAEM,MAAM,CAAC,SAAS,CAAC,IAAY;QAClC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACxC,CAAC;IAkHD,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QAEzB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,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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;wDAAsC;AACrC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAc;AACZ;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAmB;AAyCtC;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 border-radius: 4px;\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 .multiline-input {\n min-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 }) observeHandler?: (value: any) => void\n @property({ type: Object }) defaultValue?: any\n @property({ type: Object }) context?: any\n @property({ type: Boolean }) disabled?: boolean\n\n private observing: boolean = false\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 {\n return html``\n }\n\n render() {\n const { defaultValue } = this\n const { value = defaultValue, 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 = this.makeup(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 this.observe(this.value)\n }\n\n observe(value: any) {\n if (this.observeHandler && !this.observing) {\n this.observing = true\n this.observeHandler.call(this, value)\n this.observing = false\n }\n }\n}\n"]}
@@ -1,6 +1,10 @@
1
1
  export type EditorProperty = {
2
2
  fullwidth?: boolean;
3
3
  };
4
+ type WritableKeysOf<T> = {
5
+ [P in keyof T]: T[P] extends Readonly<T[P]> ? never : P;
6
+ }[keyof T];
7
+ export type CSSStyles = Pick<CSSStyleDeclaration, WritableKeysOf<CSSStyleDeclaration>>;
4
8
  export type PropertySpec = {
5
9
  type: string;
6
10
  label: string;
@@ -12,4 +16,6 @@ export type PropertySpec = {
12
16
  observe?: (value: any) => void;
13
17
  defaultValue?: any;
14
18
  disabled?: boolean;
19
+ styles?: CSSStyles;
15
20
  };
21
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type EditorProperty = {\n fullwidth?: boolean\n}\n\nexport type PropertySpec = {\n type: string\n label: string\n name: string\n placeholder?: string\n property?: any\n editor?: EditorProperty\n quantifier?: [min: number, max: number]\n observe?: (value: any) => void\n defaultValue?: any\n disabled?: boolean\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type EditorProperty = {\n fullwidth?: boolean\n}\n\ntype WritableKeysOf<T> = {\n [P in keyof T]: T[P] extends Readonly<T[P]> ? never : P\n}[keyof T]\n\nexport type CSSStyles = Pick<CSSStyleDeclaration, WritableKeysOf<CSSStyleDeclaration>>\n\nexport type PropertySpec = {\n type: string\n label: string\n name: string\n placeholder?: string\n property?: any\n editor?: EditorProperty\n quantifier?: [min: number, max: number]\n observe?: (value: any) => void\n defaultValue?: any\n disabled?: boolean\n styles?: CSSStyles\n}\n"]}
@@ -0,0 +1,53 @@
1
+ import { TemplateResult } from 'lit';
2
+ import '../src/ox-property-editor-3axis.js';
3
+ import '../src/ox-property-editor-3dish.js';
4
+ import '../src/ox-property-editor-angle.js';
5
+ import '../src/ox-property-editor-checkbox.js';
6
+ import '../src/ox-property-editor-color.js';
7
+ import '../src/ox-property-editor-date.js';
8
+ import '../src/ox-property-editor-legend.js';
9
+ import '../src/ox-property-editor-number.js';
10
+ import '../src/ox-property-editor-unit-number.js';
11
+ import '../src/ox-property-editor-password.js';
12
+ import '../src/ox-property-editor-range.js';
13
+ import '../src/ox-property-editor-select.js';
14
+ import '../src/ox-property-editor-string.js';
15
+ import '../src/ox-property-editor-image.js';
16
+ import '../src/ox-property-editor-file.js';
17
+ import '../src/ox-property-editor-multiple-colors.js';
18
+ import '../src/ox-property-editor-crontab.js';
19
+ import '../src/ox-property-editor-work-shift.js';
20
+ import '../src/ox-property-editor-partition-keys.js';
21
+ import '../src/ox-property-editor-key-values.js';
22
+ import '../src/ox-property-editor-textarea.js';
23
+ import '../src/ox-property-editor-options.js';
24
+ import '../src/ox-property-editor-hashtags.js';
25
+ import '../src/ox-properties-dynamic-view.js';
26
+ declare const _default: {
27
+ title: string;
28
+ component: string;
29
+ argTypes: {
30
+ title: {
31
+ control: string;
32
+ };
33
+ counter: {
34
+ control: string;
35
+ };
36
+ textColor: {
37
+ control: string;
38
+ };
39
+ };
40
+ };
41
+ export default _default;
42
+ interface Story<T> {
43
+ (args: T): TemplateResult;
44
+ args?: Partial<T>;
45
+ argTypes?: Record<string, unknown>;
46
+ }
47
+ interface ArgTypes {
48
+ title?: string;
49
+ counter?: number;
50
+ textColor?: string;
51
+ slot?: TemplateResult;
52
+ }
53
+ export declare const Regular: Story<ArgTypes>;
@@ -0,0 +1,274 @@
1
+ import { html } from 'lit';
2
+ import '../src/ox-property-editor-3axis.js';
3
+ import '../src/ox-property-editor-3dish.js';
4
+ import '../src/ox-property-editor-angle.js';
5
+ import '../src/ox-property-editor-checkbox.js';
6
+ import '../src/ox-property-editor-color.js';
7
+ import '../src/ox-property-editor-date.js';
8
+ import '../src/ox-property-editor-legend.js';
9
+ import '../src/ox-property-editor-number.js';
10
+ import '../src/ox-property-editor-unit-number.js';
11
+ import '../src/ox-property-editor-password.js';
12
+ import '../src/ox-property-editor-range.js';
13
+ import '../src/ox-property-editor-select.js';
14
+ import '../src/ox-property-editor-string.js';
15
+ import '../src/ox-property-editor-image.js';
16
+ import '../src/ox-property-editor-file.js';
17
+ import '../src/ox-property-editor-multiple-colors.js';
18
+ import '../src/ox-property-editor-crontab.js';
19
+ import '../src/ox-property-editor-work-shift.js';
20
+ import '../src/ox-property-editor-partition-keys.js';
21
+ import '../src/ox-property-editor-key-values.js';
22
+ import '../src/ox-property-editor-textarea.js';
23
+ import '../src/ox-property-editor-options.js';
24
+ import '../src/ox-property-editor-hashtags.js';
25
+ import '../src/ox-properties-dynamic-view.js';
26
+ import { OxPropertyEditor } from '../src/ox-property-editor.js';
27
+ export default {
28
+ title: 'Properties Dynamic View',
29
+ component: 'ox-properties-dynamic-view',
30
+ argTypes: {
31
+ title: { control: 'text' },
32
+ counter: { control: 'number' },
33
+ textColor: { control: 'color' }
34
+ }
35
+ };
36
+ OxPropertyEditor.register({
37
+ legend: 'ox-property-editor-legend',
38
+ number: 'ox-property-editor-number',
39
+ 'unit-number': 'ox-property-editor-unit-number',
40
+ slider: 'ox-property-editor-range',
41
+ password: 'ox-property-editor-password',
42
+ angle: 'ox-property-editor-angle',
43
+ string: 'ox-property-editor-string',
44
+ textarea: 'ox-property-editor-textarea',
45
+ javascript: 'ox-property-editor-textarea',
46
+ checkbox: 'ox-property-editor-checkbox',
47
+ boolean: 'ox-property-editor-checkbox',
48
+ select: 'ox-property-editor-select',
49
+ date: 'ox-property-editor-date',
50
+ options: 'ox-property-editor-options',
51
+ data: 'ox-property-editor-data',
52
+ file: 'ox-property-editor-file',
53
+ image: 'ox-property-editor-image',
54
+ 'range-input': 'ox-property-editor-range',
55
+ 'attachment-selector': 'ox-property-editor-attachment-selector',
56
+ 'gltf-selector': 'ox-property-editor-attachment-selector',
57
+ 'image-selector': 'ox-property-editor-image-selector',
58
+ color: 'ox-property-editor-color',
59
+ 'solid-color-stops': 'ox-property-editor-solid-colorstops',
60
+ 'gradient-color-stops': 'ox-property-editor-gradient-colorstops',
61
+ 'multiple-color': 'ox-property-editor-multiple-colors',
62
+ map: 'ox-property-editor-value-map',
63
+ range: 'ox-property-editor-value-ranges',
64
+ graphql: 'ox-property-editor-graphql',
65
+ 'editor-table': 'ox-property-editor-table',
66
+ 'id-input': 'ox-property-editor-scene-component-id',
67
+ 'font-selector': 'ox-property-editor-font-selector',
68
+ crontab: 'ox-property-editor-crontab',
69
+ shift: 'ox-property-editor-work-shift',
70
+ 'partition-keys': 'ox-property-editor-partition-keys',
71
+ 'key-values': 'ox-property-editor-key-values',
72
+ hashtags: 'ox-property-editor-hashtags',
73
+ '3axis': 'ox-property-editor-3axis',
74
+ '3dish': 'ox-property-editor-3dish'
75
+ });
76
+ const properties = [
77
+ {
78
+ type: 'string',
79
+ label: 'ABC',
80
+ name: 'ABC',
81
+ quantifier: [1, 20]
82
+ },
83
+ {
84
+ type: 'password',
85
+ label: 'PWD',
86
+ name: 'PWD'
87
+ },
88
+ {
89
+ type: 'select',
90
+ label: 'SLT',
91
+ name: 'SLT',
92
+ property: {
93
+ options: [
94
+ { display: '', value: '' },
95
+ { display: 'AAA', value: 'aaa' },
96
+ { display: 'BBB', value: 'bbb' }
97
+ ]
98
+ }
99
+ },
100
+ {
101
+ type: 'number',
102
+ label: 'N#',
103
+ name: 'N#'
104
+ },
105
+ {
106
+ type: 'unit-number',
107
+ label: 'NU',
108
+ name: 'NU',
109
+ property: {
110
+ unit: 'K'
111
+ }
112
+ },
113
+ {
114
+ type: 'checkbox',
115
+ label: 'XV',
116
+ name: 'XV'
117
+ },
118
+ {
119
+ type: 'angle',
120
+ label: 'Degree',
121
+ name: 'Degree'
122
+ },
123
+ {
124
+ type: 'date',
125
+ label: 'DD',
126
+ name: 'DD'
127
+ },
128
+ {
129
+ type: 'legend',
130
+ label: '',
131
+ name: 'NEW-GROUP',
132
+ property: {
133
+ label: 'NEW-GROUP'
134
+ }
135
+ },
136
+ {
137
+ type: 'slider',
138
+ label: 'S',
139
+ name: 'S',
140
+ property: {
141
+ min: 30,
142
+ max: 300,
143
+ step: 10
144
+ }
145
+ },
146
+ {
147
+ type: 'textarea',
148
+ label: 'TA',
149
+ name: 'TA',
150
+ styles: {
151
+ flex: '1'
152
+ }
153
+ },
154
+ {
155
+ type: 'options',
156
+ label: 'OT',
157
+ name: 'OT',
158
+ editor: {
159
+ fullwidth: true
160
+ }
161
+ },
162
+ {
163
+ type: 'data',
164
+ label: 'DT',
165
+ name: 'DT'
166
+ },
167
+ {
168
+ type: 'color',
169
+ label: 'CL',
170
+ name: 'CL'
171
+ },
172
+ {
173
+ type: 'multiple-color',
174
+ label: 'CLS',
175
+ name: 'CLS'
176
+ },
177
+ {
178
+ type: 'image',
179
+ label: 'IM',
180
+ name: 'IM'
181
+ },
182
+ {
183
+ type: 'file',
184
+ label: 'FL',
185
+ name: 'FL',
186
+ property: {
187
+ multiple: true
188
+ }
189
+ },
190
+ {
191
+ type: 'crontab',
192
+ label: 'schedule',
193
+ name: 'schedule'
194
+ },
195
+ {
196
+ type: 'shift',
197
+ label: 'shift',
198
+ name: 'shift'
199
+ },
200
+ {
201
+ type: 'key-values',
202
+ label: 'key-values',
203
+ name: 'key-values'
204
+ },
205
+ {
206
+ type: 'hashtags',
207
+ label: 'hashtags',
208
+ name: 'hashtags'
209
+ },
210
+ {
211
+ type: '3dish',
212
+ label: '3dish',
213
+ name: '3dish'
214
+ }
215
+ ];
216
+ const value = {
217
+ ABC: [4, 3, 2, 1],
218
+ S: 290,
219
+ SLT: 'bbb',
220
+ NU: 1000,
221
+ IM: 'https://www.hatiolab.com/assets/img/arch-thingsboard.png',
222
+ CLS: ['yello', 'green'],
223
+ schedule: '* * * * * *',
224
+ shift: [
225
+ {
226
+ name: 'DAY',
227
+ fromDate: -1,
228
+ fromTime: '22:00',
229
+ toDate: 0,
230
+ toTime: '06:00'
231
+ },
232
+ {
233
+ name: 'SWING',
234
+ fromDate: 0,
235
+ fromTime: '06:00',
236
+ toDate: 0,
237
+ toTime: '14:00'
238
+ },
239
+ {
240
+ name: 'NIGHT',
241
+ fromDate: 0,
242
+ fromTime: '14:00',
243
+ toDate: 0,
244
+ toTime: '22:00'
245
+ }
246
+ ],
247
+ hashtags: ['abc', 'def'],
248
+ '3dish': {
249
+ dimension: { x: 1, y: 1, z: 1 },
250
+ position: { x: 1, y: 1, z: 1 },
251
+ rotate: { x: 1, y: 1, z: 1 },
252
+ scale: { x: 1, y: 1, z: 1 }
253
+ }
254
+ };
255
+ const Template = () => html `
256
+ <link href="/themes/app-theme.css" rel="stylesheet" />
257
+
258
+ <link
259
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
260
+ rel="stylesheet"
261
+ />
262
+ <link
263
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
264
+ rel="stylesheet"
265
+ />
266
+ <link
267
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
268
+ rel="stylesheet"
269
+ />
270
+
271
+ <ox-properties-dynamic-view .props=${properties} .value=${value}></ox-properties-dynamic-view>
272
+ `;
273
+ export const Regular = Template.bind({});
274
+ //# sourceMappingURL=ox-properties-dynamic-view.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-properties-dynamic-view.stories.js","sourceRoot":"","sources":["../../stories/ox-properties-dynamic-view.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,uCAAuC,CAAA;AAC9C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,mCAAmC,CAAA;AAC1C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,0CAA0C,CAAA;AACjD,OAAO,uCAAuC,CAAA;AAC9C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,mCAAmC,CAAA;AAC1C,OAAO,8CAA8C,CAAA;AACrD,OAAO,sCAAsC,CAAA;AAC7C,OAAO,yCAAyC,CAAA;AAChD,OAAO,6CAA6C,CAAA;AACpD,OAAO,yCAAyC,CAAA;AAChD,OAAO,uCAAuC,CAAA;AAC9C,OAAO,sCAAsC,CAAA;AAC7C,OAAO,uCAAuC,CAAA;AAE9C,OAAO,sCAAsC,CAAA;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAG/D,eAAe;IACb,KAAK,EAAE,yBAAyB;IAChC,SAAS,EAAE,4BAA4B;IACvC,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC1B,OAAO,EAAE,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cesContent":["import { TemplateResult, html } from 'lit'\n\nimport '../src/ox-property-editor-3axis.js'\nimport '../src/ox-property-editor-3dish.js'\nimport '../src/ox-property-editor-angle.js'\nimport '../src/ox-property-editor-checkbox.js'\nimport '../src/ox-property-editor-color.js'\nimport '../src/ox-property-editor-date.js'\nimport '../src/ox-property-editor-legend.js'\nimport '../src/ox-property-editor-number.js'\nimport '../src/ox-property-editor-unit-number.js'\nimport '../src/ox-property-editor-password.js'\nimport '../src/ox-property-editor-range.js'\nimport '../src/ox-property-editor-select.js'\nimport '../src/ox-property-editor-string.js'\nimport '../src/ox-property-editor-image.js'\nimport '../src/ox-property-editor-file.js'\nimport '../src/ox-property-editor-multiple-colors.js'\nimport '../src/ox-property-editor-crontab.js'\nimport '../src/ox-property-editor-work-shift.js'\nimport '../src/ox-property-editor-partition-keys.js'\nimport '../src/ox-property-editor-key-values.js'\nimport '../src/ox-property-editor-textarea.js'\nimport '../src/ox-property-editor-options.js'\nimport '../src/ox-property-editor-hashtags.js'\n\nimport '../src/ox-properties-dynamic-view.js'\n\nimport { OxPropertyEditor } from '../src/ox-property-editor.js'\nimport { PropertySpec } from '../src/types.js'\n\nexport default {\n title: 'Properties Dynamic View',\n component: 'ox-properties-dynamic-view',\n argTypes: {\n title: { control: 'text' },\n counter: { control: 'number' },\n textColor: { control: 'color' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n title?: string\n counter?: number\n textColor?: string\n slot?: TemplateResult\n}\n\nOxPropertyEditor.register({\n legend: 'ox-property-editor-legend',\n number: 'ox-property-editor-number',\n 'unit-number': 'ox-property-editor-unit-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 crontab: 'ox-property-editor-crontab',\n shift: 'ox-property-editor-work-shift',\n 'partition-keys': 'ox-property-editor-partition-keys',\n 'key-values': 'ox-property-editor-key-values',\n hashtags: 'ox-property-editor-hashtags',\n '3axis': 'ox-property-editor-3axis',\n '3dish': 'ox-property-editor-3dish'\n})\n\nconst properties = [\n {\n type: 'string',\n label: 'ABC',\n name: 'ABC',\n quantifier: [1, 20]\n },\n {\n type: 'password',\n label: 'PWD',\n name: 'PWD'\n },\n {\n type: 'select',\n label: 'SLT',\n name: 'SLT',\n property: {\n options: [\n { display: '', value: '' },\n { display: 'AAA', value: 'aaa' },\n { display: 'BBB', value: 'bbb' }\n ]\n }\n },\n {\n type: 'number',\n label: 'N#',\n name: 'N#'\n },\n {\n type: 'unit-number',\n label: 'NU',\n name: 'NU',\n property: {\n unit: 'K'\n }\n },\n {\n type: 'checkbox',\n label: 'XV',\n name: 'XV'\n },\n {\n type: 'angle',\n label: 'Degree',\n name: 'Degree'\n },\n {\n type: 'date',\n label: 'DD',\n name: 'DD'\n },\n {\n type: 'legend',\n label: '',\n name: 'NEW-GROUP',\n property: {\n label: 'NEW-GROUP'\n }\n },\n {\n type: 'slider',\n label: 'S',\n name: 'S',\n property: {\n min: 30,\n max: 300,\n step: 10\n }\n },\n {\n type: 'textarea',\n label: 'TA',\n name: 'TA',\n styles: {\n flex: '1'\n }\n },\n {\n type: 'options',\n label: 'OT',\n name: 'OT',\n editor: {\n fullwidth: true\n }\n },\n {\n type: 'data',\n label: 'DT',\n name: 'DT'\n },\n {\n type: 'color',\n label: 'CL',\n name: 'CL'\n },\n {\n type: 'multiple-color',\n label: 'CLS',\n name: 'CLS'\n },\n {\n type: 'image',\n label: 'IM',\n name: 'IM'\n },\n {\n type: 'file',\n label: 'FL',\n name: 'FL',\n property: {\n multiple: true\n }\n },\n {\n type: 'crontab',\n label: 'schedule',\n name: 'schedule'\n },\n {\n type: 'shift',\n label: 'shift',\n name: 'shift'\n },\n {\n type: 'key-values',\n label: 'key-values',\n name: 'key-values'\n },\n {\n type: 'hashtags',\n label: 'hashtags',\n name: 'hashtags'\n },\n {\n type: '3dish',\n label: '3dish',\n name: '3dish'\n }\n] as PropertySpec[]\n\nconst value = {\n ABC: [4, 3, 2, 1],\n S: 290,\n SLT: 'bbb',\n NU: 1000,\n IM: 'https://www.hatiolab.com/assets/img/arch-thingsboard.png',\n CLS: ['yello', 'green'],\n schedule: '* * * * * *',\n shift: [\n {\n name: 'DAY',\n fromDate: -1,\n fromTime: '22:00',\n toDate: 0,\n toTime: '06:00'\n },\n {\n name: 'SWING',\n fromDate: 0,\n fromTime: '06:00',\n toDate: 0,\n toTime: '14:00'\n },\n {\n name: 'NIGHT',\n fromDate: 0,\n fromTime: '14:00',\n toDate: 0,\n toTime: '22:00'\n }\n ],\n hashtags: ['abc', 'def'],\n '3dish': {\n dimension: { x: 1, y: 1, z: 1 },\n position: { x: 1, y: 1, z: 1 },\n rotate: { x: 1, y: 1, z: 1 },\n scale: { x: 1, y: 1, z: 1 }\n }\n}\n\nconst Template: Story<ArgTypes> = () => html`\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n\n <ox-properties-dynamic-view .props=${properties} .value=${value}></ox-properties-dynamic-view>\n`\n\nexport const Regular = Template.bind({})\n"]}
@@ -1,5 +1,6 @@
1
- import '../index.js';
2
1
  import { TemplateResult } from 'lit';
2
+ import '../src/ox-property-editor-textarea.js';
3
+ import '../src/ox-properties-dynamic-view.js';
3
4
  declare const _default: {
4
5
  title: string;
5
6
  component: string;
@@ -28,6 +29,3 @@ interface ArgTypes {
28
29
  slot?: TemplateResult;
29
30
  }
30
31
  export declare const Regular: Story<ArgTypes>;
31
- export declare const CustomTitle: Story<ArgTypes>;
32
- export declare const CustomCounter: Story<ArgTypes>;
33
- export declare const SlottedContent: Story<ArgTypes>;