@operato/attribute 9.0.0-beta.0 → 9.0.0-beta.10
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.
- package/CHANGELOG.md +42 -0
- package/dist/src/grist-editor/index.d.ts +1 -1
- package/dist/src/grist-editor/index.js +2 -2
- package/dist/src/grist-editor/index.js.map +1 -1
- package/dist/src/grist-editor/ox-grist-editor-attributes.js +9 -0
- package/dist/src/grist-editor/ox-grist-editor-attributes.js.map +1 -1
- package/dist/src/grist-editor/ox-popup-attributes.js +31 -5
- package/dist/src/grist-editor/ox-popup-attributes.js.map +1 -1
- package/dist/src/ox-attribute-form.js +22 -2
- package/dist/src/ox-attribute-form.js.map +1 -1
- package/dist/src/ox-attribute-view.js +24 -4
- package/dist/src/ox-attribute-view.js.map +1 -1
- package/dist/stories/ox-grist-editor-attributes.stories.js +149 -134
- package/dist/stories/ox-grist-editor-attributes.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,48 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [9.0.0-beta.10](https://github.com/hatiolab/operato/compare/v9.0.0-beta.9...v9.0.0-beta.10) (2025-01-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :bug: Bug Fix
|
|
10
|
+
|
|
11
|
+
* tweak tsconfig.json ([3c424b1](https://github.com/hatiolab/operato/commit/3c424b18d046f95d5619076d113d49a4b4dc9bbb))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [9.0.0-beta.7](https://github.com/hatiolab/operato/compare/v9.0.0-beta.6...v9.0.0-beta.7) (2025-01-20)
|
|
16
|
+
|
|
17
|
+
**Note:** Version bump only for package @operato/attribute
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [9.0.0-beta.6](https://github.com/hatiolab/operato/compare/v9.0.0-beta.5...v9.0.0-beta.6) (2025-01-20)
|
|
24
|
+
|
|
25
|
+
**Note:** Version bump only for package @operato/attribute
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## [9.0.0-beta.5](https://github.com/hatiolab/operato/compare/v9.0.0-beta.4...v9.0.0-beta.5) (2025-01-20)
|
|
32
|
+
|
|
33
|
+
**Note:** Version bump only for package @operato/attribute
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## [9.0.0-beta.4](https://github.com/hatiolab/operato/compare/v9.0.0-beta.3...v9.0.0-beta.4) (2025-01-20)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### :bug: Bug Fix
|
|
43
|
+
|
|
44
|
+
* esm module ([0402232](https://github.com/hatiolab/operato/commit/04022327fa47eac64eaf3c56eeec55b9ace13e0e))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
6
48
|
## [9.0.0-beta.0](https://github.com/hatiolab/operato/compare/v8.0.0-beta.11...v9.0.0-beta.0) (2025-01-13)
|
|
7
49
|
|
|
8
50
|
**Note:** Version bump only for package @operato/attribute
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './ox-grist-editor-attributes';
|
|
1
|
+
export * from './ox-grist-editor-attributes.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist';
|
|
2
|
-
import { OxGristEditorAttributes } from './ox-grist-editor-attributes';
|
|
2
|
+
import { OxGristEditorAttributes } from './ox-grist-editor-attributes.js';
|
|
3
3
|
/* register grist renderer/editor for id */
|
|
4
4
|
registerEditor('attributes', OxGristEditorAttributes);
|
|
5
5
|
registerRenderer('attributes', OxGristRendererJson5);
|
|
6
|
-
export * from './ox-grist-editor-attributes';
|
|
6
|
+
export * from './ox-grist-editor-attributes.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/grist-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE5F,OAAO,EAAE,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/grist-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE5F,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAA;AAEzE,2CAA2C;AAC3C,cAAc,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAA;AAErD,gBAAgB,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAA;AAEpD,cAAc,iCAAiC,CAAA","sourcesContent":["import { OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist'\n\nimport { OxGristEditorAttributes } from './ox-grist-editor-attributes.js'\n\n/* register grist renderer/editor for id */\nregisterEditor('attributes', OxGristEditorAttributes)\n\nregisterRenderer('attributes', OxGristRendererJson5)\n\nexport * from './ox-grist-editor-attributes.js'\n"]}
|
|
@@ -10,6 +10,15 @@ import { OxGristEditor } from '@operato/data-grist';
|
|
|
10
10
|
import { i18next } from '@operato/i18n';
|
|
11
11
|
import { openPopup } from '@operato/popup';
|
|
12
12
|
let OxGristEditorAttributes = class OxGristEditorAttributes extends OxGristEditor {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
Object.defineProperty(this, "popup", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: void 0
|
|
20
|
+
});
|
|
21
|
+
}
|
|
13
22
|
get editorTemplate() {
|
|
14
23
|
const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value;
|
|
15
24
|
return html `<div tabindex="0">${value || ''}</div> `;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-grist-editor-attributes.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-editor-attributes.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAe,MAAM,gBAAgB,CAAA;AAGhD,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,aAAa;
|
|
1
|
+
{"version":3,"file":"ox-grist-editor-attributes.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-editor-attributes.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAe,MAAM,gBAAgB,CAAA;AAGhD,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,aAAa;IAAnD;;QACG;;;;;WAAmB;IA4E7B,CAAC;IA1EC,IAAI,cAAc;QAChB,MAAM,KAAK,GAAG,OAAO,IA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;oBACN,MAAM,EAAE,IAAI,CAAC,KAAK;oBAClB,KAAK,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM;oBACrD,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,GAAG,EAAE,IAAI,CAAC,GAAG;iBACd;aACF,CAAC,CACH,CAAA;QACH,CAAC,CAAA;QAED,IAAI,CAAC;YACH,IAAI,KAAK,GACP,CAAC,WAAW,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;QACzG,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,KAAK,GAAQ,EAAE,CAAA;QACrB,CAAC;QAED;;;;;;;UAOE;QACF,IAAI,QAAQ,GAAG,IAAI,CAAA;oCACa,KAAK,kBAAkB,YAAY,qBAAqB,eAAe;;KAEtG,CAAA;QAED,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/B,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,EAAE,KAAI,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,EAAE;YACtE,IAAI;SACL,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AA7EY,uBAAuB;IADnC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,uBAAuB,CA6EnC","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-popup-attributes.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport { cloneDeep } from 'lodash-es'\n\nimport { OxGristEditor } from '@operato/data-grist'\nimport { i18next } from '@operato/i18n'\nimport { openPopup, PopupHandle } from '@operato/popup'\n\n@customElement('ox-grist-editor-attributes')\nexport class OxGristEditorAttributes extends OxGristEditor {\n private popup?: PopupHandle\n\n get editorTemplate() {\n const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value\n return html`<div tabindex=\"0\">${value || ''}</div> `\n }\n\n _onclick(e: Event): void {\n e.stopPropagation()\n this.openPopup()\n }\n\n _onkeydown(e: KeyboardEvent): void {\n const key = e.key\n if (key == 'Enter') {\n e.stopPropagation()\n this.openPopup()\n }\n }\n\n async openPopup() {\n if (this.popup) {\n delete this.popup\n }\n\n var { options } = this.column.record\n\n if (typeof options === 'function') {\n options = await options.call(this, this.value, this.column, this.record, this.row, this.field)\n }\n\n const { name, help, objectified = false, attributeSet } = options\n\n const confirmCallback = (newval: any) => {\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: this.value,\n after: !objectified ? JSON.stringify(newval) : newval,\n record: this.record,\n column: this.column,\n row: this.row\n }\n })\n )\n }\n\n try {\n var value: any =\n !objectified && typeof this.value === 'string' ? JSON.parse(this.value) : cloneDeep(this.value || {})\n } catch (e) {\n var value: any = {}\n }\n\n /* \n 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로, \n layout의 구성에 변화가 발생하면, 다시 render된다.\n 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)\n 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,\n 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.\n 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.\n */\n var template = html`\n <ox-popup-attributes .value=${value} .attributeSet=${attributeSet} .confirmCallback=${confirmCallback}>\n </ox-popup-attributes>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: `${name?.toUpperCase() || ''} ${i18next.t('field.attributes')}`,\n help\n })\n }\n}\n"]}
|
|
@@ -7,6 +7,27 @@ import { i18next } from '@operato/i18n';
|
|
|
7
7
|
import { closePopup } from '@operato/popup';
|
|
8
8
|
import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
|
|
9
9
|
let OxPopupAttributes = class OxPopupAttributes extends LitElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
Object.defineProperty(this, "value", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: void 0
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(this, "attributeSet", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: void 0
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(this, "confirmCallback", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
30
|
+
}
|
|
10
31
|
render() {
|
|
11
32
|
var attributeSet = this.attributeSet || {};
|
|
12
33
|
return html `
|
|
@@ -45,10 +66,14 @@ let OxPopupAttributes = class OxPopupAttributes extends LitElement {
|
|
|
45
66
|
closePopup(this);
|
|
46
67
|
}
|
|
47
68
|
};
|
|
48
|
-
OxPopupAttributes
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
69
|
+
Object.defineProperty(OxPopupAttributes, "styles", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
configurable: true,
|
|
72
|
+
writable: true,
|
|
73
|
+
value: [
|
|
74
|
+
CommonHeaderStyles,
|
|
75
|
+
ScrollbarStyles,
|
|
76
|
+
css `
|
|
52
77
|
:host {
|
|
53
78
|
display: flex;
|
|
54
79
|
flex-direction: column;
|
|
@@ -75,7 +100,8 @@ OxPopupAttributes.styles = [
|
|
|
75
100
|
color: var(--md-sys-color-on-primary-container);
|
|
76
101
|
}
|
|
77
102
|
`
|
|
78
|
-
]
|
|
103
|
+
]
|
|
104
|
+
});
|
|
79
105
|
__decorate([
|
|
80
106
|
property({ type: Object })
|
|
81
107
|
], OxPopupAttributes.prototype, "value", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-popup-attributes.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-popup-attributes.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yBAAyB,CAAA;AAEhC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAK9D,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;
|
|
1
|
+
{"version":3,"file":"ox-popup-attributes.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-popup-attributes.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yBAAyB,CAAA;AAEhC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAi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Q,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAAwC;AAnCxD,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CA+E7B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '../ox-attribute-form.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\nimport { closePopup } from '@operato/popup'\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\n\nimport { AttributeSet } from '../types.js'\n\n@customElement('ox-popup-attributes')\nexport class OxPopupAttributes extends LitElement {\n static styles = [\n CommonHeaderStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: var(--md-sys-color-surface);\n\n width: var(--overlay-center-normal-width, 50%);\n height: var(--overlay-center-normal-height, 50%);\n }\n\n ox-attribute-form {\n flex: 1;\n overflow-y: auto;\n padding: var(--spacing-large);\n }\n\n span {\n flex: 1;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n color: var(--md-sys-color-on-primary-container);\n }\n `\n ]\n\n @property({ type: Object }) value: any\n @property({ type: Object }) attributeSet?: AttributeSet\n @property({ type: Object }) confirmCallback!: (newval: any) => void\n\n render() {\n var attributeSet = this.attributeSet || {}\n\n return html`\n <ox-attribute-form .value=${this.value} .attributeSet=${attributeSet} @change=${this.onChange.bind(this)}>\n </ox-attribute-form>\n\n <div class=\"footer\">\n <div filler></div>\n <button @click=${this.onCancel.bind(this)} danger>\n <md-icon>cancel</md-icon>${i18next.t('button.cancel')}\n </button>\n <button @click=${this.onConfirm.bind(this)} done><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>\n </div>\n `\n }\n\n private onChange(e: CustomEvent) {\n e.stopPropagation()\n\n /* \n 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로, \n layout의 구성에 변화가 발생하면, 다시 render된다.\n 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)\n 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,\n 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.\n 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.\n (이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)\n => \n 이런 이유로, Object.assign(...)을 사용하였다.\n */\n this.value = e.detail\n }\n\n private onCancel(e: Event) {\n closePopup(this)\n }\n\n private onConfirm(e: Event) {\n this.confirmCallback && this.confirmCallback(this.value)\n closePopup(this)\n }\n}\n"]}
|
|
@@ -3,6 +3,21 @@ import '@operato/input/ox-input-file.js';
|
|
|
3
3
|
import { css, html, LitElement } from 'lit';
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js';
|
|
5
5
|
let OxAttributeForm = class OxAttributeForm extends LitElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
Object.defineProperty(this, "attributeSet", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true,
|
|
12
|
+
value: void 0
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(this, "value", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: void 0
|
|
19
|
+
});
|
|
20
|
+
}
|
|
6
21
|
render() {
|
|
7
22
|
var _a, _b;
|
|
8
23
|
return html ` <form @change=${(e) => this.onChange(e)}>
|
|
@@ -73,7 +88,11 @@ let OxAttributeForm = class OxAttributeForm extends LitElement {
|
|
|
73
88
|
}, {});
|
|
74
89
|
}
|
|
75
90
|
};
|
|
76
|
-
OxAttributeForm
|
|
91
|
+
Object.defineProperty(OxAttributeForm, "styles", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
configurable: true,
|
|
94
|
+
writable: true,
|
|
95
|
+
value: css `
|
|
77
96
|
:host {
|
|
78
97
|
display: flex;
|
|
79
98
|
flex-direction: row;
|
|
@@ -182,7 +201,8 @@ OxAttributeForm.styles = css `
|
|
|
182
201
|
text-align: left;
|
|
183
202
|
}
|
|
184
203
|
}
|
|
185
|
-
|
|
204
|
+
`
|
|
205
|
+
});
|
|
186
206
|
__decorate([
|
|
187
207
|
property({ type: Object })
|
|
188
208
|
], OxAttributeForm.prototype, "attributeSet", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-attribute-form.js","sourceRoot":"","sources":["../../src/ox-attribute-form.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAKpD,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;
|
|
1
|
+
{"version":3,"file":"ox-attribute-form.js","sourceRoot":"","sources":["../../src/ox-attribute-form.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAKpD,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QAgHuB;;;;;WAA2B;QAC3B;;;;;WAA8B;IA8F5D,CAAC;IA5FC,MAAM;;QACJ,OAAO,IAAI,CAAA,kBAAkB,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YACnD,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,MAAM,KAAI,EAAE;YAC/B,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,WAAW,KAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6GlB;EA7GY,CA6GZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAA4B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAA+B;AAjH/C,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA+M3B","sourcesContent":["import '@operato/input/ox-input-file.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { AttributeSet } from './types.js'\n\n@customElement('ox-attribute-form')\nexport class OxAttributeForm extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: row;\n --item-description-font: normal 0.8rem/1rem var(--theme-font);\n --item-description-color: var(--page-description-color);\n }\n\n h2 {\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n text-transform: capitalize;\n text-align: center;\n }\n\n h3 {\n margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n text-transform: capitalize;\n text-align: center;\n }\n\n form {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n }\n\n label {\n display: grid;\n\n grid-template-rows: auto 1fr;\n grid-template-columns: 1fr 5fr;\n grid-template-areas: 'name description' 'empty inputs';\n\n grid-gap: 9px;\n align-items: center;\n margin-bottom: var(--spacing-medium);\n }\n\n label:nth-child(odd) {\n background-color: var(--md-sys-color-background);\n padding: var(--padding-default) 0;\n }\n\n div[name] {\n grid-area: name;\n font: var(--label-font);\n color: var(--label-color, var(--md-sys-color-on-surface));\n text-align: right;\n }\n\n div[description] {\n grid-area: description;\n opacity: 0.7;\n font: var(--item-description-font);\n color: var(--item-description-color);\n text-align: left;\n }\n\n div[description] * {\n vertical-align: middle;\n }\n\n div[description] md-icon {\n font-size: 0.9rem;\n }\n\n div[elements] {\n grid-area: inputs;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 10px;\n padding-right: var(--padding-default);\n }\n\n div[elements] * {\n flex: 1;\n }\n\n div[elements] input,\n div[elements] select {\n border: var(--input-field-border);\n border-radius: var(--input-field-border-radius);\n padding: var(--input-field-padding);\n font: var(--input-field-font);\n }\n\n @media only screen and (max-width: 460px) {\n label {\n display: grid;\n\n grid-template-rows: auto auto 1fr;\n grid-template-columns: 1fr;\n grid-template-areas: 'name' 'description' 'inputs';\n\n grid-gap: 9px;\n align-items: center;\n margin-bottom: var(--spacing-medium);\n }\n\n div[name] {\n text-align: left;\n }\n }\n `\n\n @property({ type: Object }) attributeSet?: AttributeSet\n @property({ type: Object }) value?: { [tag: string]: any }\n\n render() {\n return html` <form @change=${(e: Event) => this.onChange(e)}>\n <h2>${this.attributeSet?.entity || ''}</h2>\n <h3>${this.attributeSet?.description || ''}</h3>\n ${this.buildInputs()}\n </form>`\n }\n\n private onChange(e: Event) {\n this.value = this.buildValue()\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n\n private buildInputs() {\n const items = (this.attributeSet?.items || []).filter(item => item.active)\n\n return (items || []).map(item => {\n const { name, description, tag, type, options = {} } = item\n\n const value = this.value && this.value[tag]\n\n switch (type) {\n case 'select':\n var element = html` <select .name=${tag}>\n <option value=\"\"></option>\n ${(options.options || []).map(\n option => html`<option value=${option.value} ?selected=${option.value === value}>${option.text}</option>`\n )}\n </select>`\n break\n\n case 'boolean':\n var element = html` <input type=\"checkbox\" name=${tag} .checked=${value} />`\n break\n\n case 'number':\n var element = html` <input type=\"number\" name=${tag} value=${value} />`\n break\n\n case 'date':\n var element = html` <input type=\"date\" name=${tag} value=${value} />`\n break\n\n case 'datetime':\n var element = html` <input type=\"datetime-local\" name=${tag} value=${value} />`\n break\n\n case 'file':\n var element = html`<ox-input-file\n name=${tag}\n label=\"Attach Files\"\n accept=\"*/*\"\n multiple=\"true\"\n hide-filelist\n ></ox-input-file>`\n\n case 'string':\n default:\n var element = html` <input type=\"text\" name=${tag} value=${value} />`\n }\n\n return html` <label .title=${description}>\n <div name>${name}</div>\n <div description><md-icon>info</md-icon> ${description}</div>\n <div elements>${element}</div>\n </label>`\n })\n }\n\n private buildValue() {\n const items = this.attributeSet!.items\n\n return (items || []).reduce(\n (sum, item) => {\n const { tag, type } = item\n\n const editor = this.renderRoot.querySelector(`[name=${tag}]`) as HTMLInputElement\n\n sum[tag] = type === 'boolean' ? editor.checked : editor.value\n\n return sum\n },\n {} as { [tag: string]: any }\n )\n }\n}\n"]}
|
|
@@ -4,6 +4,21 @@ import { css, html, LitElement } from 'lit';
|
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js';
|
|
5
5
|
import { ScrollbarStyles } from '@operato/styles';
|
|
6
6
|
let OxAttributeView = class OxAttributeView extends LitElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
Object.defineProperty(this, "attributeSet", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true,
|
|
13
|
+
value: void 0
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(this, "value", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: void 0
|
|
20
|
+
});
|
|
21
|
+
}
|
|
7
22
|
render() {
|
|
8
23
|
var _a, _b;
|
|
9
24
|
return html `<form>
|
|
@@ -52,9 +67,13 @@ let OxAttributeView = class OxAttributeView extends LitElement {
|
|
|
52
67
|
});
|
|
53
68
|
}
|
|
54
69
|
};
|
|
55
|
-
OxAttributeView
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
Object.defineProperty(OxAttributeView, "styles", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
configurable: true,
|
|
73
|
+
writable: true,
|
|
74
|
+
value: [
|
|
75
|
+
ScrollbarStyles,
|
|
76
|
+
css `
|
|
58
77
|
:host {
|
|
59
78
|
display: flex;
|
|
60
79
|
flex-direction: row;
|
|
@@ -168,7 +187,8 @@ OxAttributeView.styles = [
|
|
|
168
187
|
}
|
|
169
188
|
}
|
|
170
189
|
`
|
|
171
|
-
]
|
|
190
|
+
]
|
|
191
|
+
});
|
|
172
192
|
__decorate([
|
|
173
193
|
property({ type: Object })
|
|
174
194
|
], OxAttributeView.prototype, "attributeSet", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-attribute-view.js","sourceRoot":"","sources":["../../src/ox-attribute-view.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAK1C,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;
|
|
1
|
+
{"version":3,"file":"ox-attribute-view.js","sourceRoot":"","sources":["../../src/ox-attribute-view.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAK1C,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QAuHuB;;;;;WAA2B;QAC3B;;;;;WAA8B;IA0D5D,CAAC;IAxDC,MAAM;;QACJ,OAAO,IAAI,CAAA;YACH,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,MAAM,KAAI,EAAE;YAC/B,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,WAAW,KAAI,EAA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UAAU,KAAK,cAAc,CAAA;YAClF,CAAC;YAED,OAAO,IAAI,CAAA,kBAAkB,WAAW;oBAC1B,IAAI;mDAC2B,WAAW;wBACtC,OAAO;eAChB,CAAA;QACX,CAAC,CAAC,CAAA;IACJ,CAAC;;AAhLM;;;;WAAS;QACd,eAAe;QACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiHF;KACF;EApHY,CAoHZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAA4B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAA+B;AAxH/C,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAkL3B","sourcesContent":["import '@operato/input/ox-input-file.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport { AttributeSet } from './types.js'\n\n@customElement('ox-attribute-view')\nexport class OxAttributeView extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: row;\n\n --item-description-font: normal 0.8rem/1rem var(--theme-font);\n --item-description-color: var(--page-description-color);\n }\n\n h2 {\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n text-transform: capitalize;\n text-align: center;\n }\n\n h3 {\n margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n text-transform: capitalize;\n text-align: center;\n }\n\n form {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n\n overflow-y: auto;\n padding: var(--padding-default);\n }\n\n label {\n display: grid;\n\n grid-template-rows: auto 1fr;\n grid-template-columns: 1fr 5fr;\n grid-template-areas: 'name description' 'empty inputs';\n\n grid-gap: 9px;\n align-items: center;\n margin-bottom: var(--spacing-medium);\n }\n\n label:nth-child(odd) {\n background-color: var(--md-sys-color-background);\n padding: var(--padding-default) 0;\n }\n\n div[name] {\n grid-area: name;\n font: var(--label-font);\n color: var(--label-color, var(--md-sys-color-on-surface));\n text-align: right;\n }\n\n div[description] {\n grid-area: description;\n opacity: 0.7;\n font: var(--item-description-font);\n color: var(--item-description-color);\n text-align: left;\n }\n\n div[description] * {\n vertical-align: middle;\n }\n\n div[description] md-icon {\n font-size: 0.9rem;\n }\n\n div[elements] {\n grid-area: inputs;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 10px;\n padding-right: var(--padding-default);\n }\n\n div[elements] * {\n flex: 1;\n }\n\n div[elements] input,\n div[elements] select {\n border: var(--input-field-border);\n border-radius: var(--input-field-border-radius);\n padding: var(--input-field-padding);\n font: var(--input-field-font);\n }\n\n @media only screen and (max-width: 460px) {\n label {\n display: grid;\n\n grid-template-rows: auto auto 1fr;\n grid-template-columns: 1fr;\n grid-template-areas: 'name' 'description' 'inputs';\n\n grid-gap: 9px;\n align-items: center;\n margin-bottom: var(--spacing-medium);\n }\n\n div[name] {\n text-align: left;\n }\n }\n `\n ]\n\n @property({ type: Object }) attributeSet?: AttributeSet\n @property({ type: Object }) value?: { [tag: string]: any }\n\n render() {\n return html`<form>\n <h2>${this.attributeSet?.entity || ''}</h2>\n <h3>${this.attributeSet?.description || ''}</h3>\n ${this.buildEntryViews()}\n </form> `\n }\n\n private buildEntryViews() {\n const items = (this.attributeSet?.items || []).filter(item => item.active)\n\n return (items || []).map(item => {\n const { name, description, tag, type, options = {} } = item\n\n const value = this.value && this.value[tag]\n\n switch (type) {\n case 'select':\n var element = html` <select .name=${tag} disabled>\n <option value=\"\"></option>\n ${(options.options || []).map(\n option => html`<option value=${option.value} ?selected=${option.value === value}>${option.text}</option>`\n )}\n </select>`\n break\n\n case 'boolean':\n var element = html` <input type=\"checkbox\" name=${tag} .checked=${value} disabled />`\n break\n\n case 'number':\n var element = html` <input type=\"number\" name=${tag} value=${value} disabled />`\n break\n\n case 'file':\n var element = html`<ox-input-file\n name=${tag}\n label=\"Attach Files\"\n accept=\"*/*\"\n multiple=\"true\"\n hide-filelist\n disabled\n ></ox-input-file>`\n\n case 'string':\n default:\n var element = html` <input type=\"text\" name=${tag} value=${value} disabled />`\n }\n\n return html` <label .title=${description}>\n <div name>${name}</div>\n <div description><md-icon>info</md-icon> ${description}</div>\n <div elements>${element}</div>\n </label>`\n })\n }\n}\n"]}
|