@operato/app 1.0.0-alpha.4 → 1.0.0-alpha.8

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.
@@ -0,0 +1,111 @@
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, css, html } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { ScrollbarStyles } from '@operato/styles';
5
+ import { i18next } from '@operato/i18n';
6
+ let ParametersEditorPopup = class ParametersEditorPopup extends LitElement {
7
+ render() {
8
+ var props = this.props instanceof Array ? this.props : [];
9
+ return html `
10
+ ${props.length > 0
11
+ ? html `
12
+ <ox-parameters-editor-builder
13
+ .value=${this.value}
14
+ .props=${props}
15
+ .host=${this.host}
16
+ .context=${this.context}
17
+ @property-change=${this.onChange.bind(this)}
18
+ >
19
+ </ox-parameters-editor-builder>
20
+ `
21
+ : html ` <span><i18n-msg msgid="text.no properties to set"></i18n-msg></span> `}
22
+
23
+ <div class="button-container">
24
+ <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
25
+ <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
26
+ </div>
27
+ `;
28
+ }
29
+ onChange(e) {
30
+ e.stopPropagation();
31
+ /*
32
+ 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
33
+ layout의 구성에 변화가 발생하면, 다시 render된다.
34
+ 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
35
+ 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
36
+ 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
37
+ 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
38
+ (이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)
39
+ =>
40
+ 이런 이유로, Object.assign(...)을 사용하였다.
41
+ */
42
+ if (!this.value) {
43
+ this.value = {};
44
+ }
45
+ for (let key in this.value) {
46
+ delete this.value[key];
47
+ }
48
+ Object.assign(this.value, e.detail);
49
+ }
50
+ onCancel(e) {
51
+ history.back();
52
+ }
53
+ onConfirm(e) {
54
+ this.confirmCallback && this.confirmCallback(this.value);
55
+ history.back();
56
+ }
57
+ };
58
+ ParametersEditorPopup.styles = [
59
+ ScrollbarStyles,
60
+ css `
61
+ :host {
62
+ display: flex;
63
+ flex-direction: column;
64
+
65
+ background-color: #fff;
66
+
67
+ width: var(--overlay-center-normal-width, 50%);
68
+ height: var(--overlay-center-normal-height, 50%);
69
+ }
70
+
71
+ ox-parameters-editor-builder {
72
+ flex: 1;
73
+ overflow-y: auto;
74
+ }
75
+
76
+ span {
77
+ flex: 1;
78
+
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: center;
82
+
83
+ color: var(--primary-color);
84
+ }
85
+
86
+ .button-container {
87
+ display: flex;
88
+ margin-left: auto;
89
+ }
90
+ `
91
+ ];
92
+ __decorate([
93
+ property({ type: Object })
94
+ ], ParametersEditorPopup.prototype, "value", void 0);
95
+ __decorate([
96
+ property({ type: Object })
97
+ ], ParametersEditorPopup.prototype, "props", void 0);
98
+ __decorate([
99
+ property({ type: Object })
100
+ ], ParametersEditorPopup.prototype, "host", void 0);
101
+ __decorate([
102
+ property({ type: Object })
103
+ ], ParametersEditorPopup.prototype, "context", void 0);
104
+ __decorate([
105
+ property({ type: Object })
106
+ ], ParametersEditorPopup.prototype, "confirmCallback", void 0);
107
+ ParametersEditorPopup = __decorate([
108
+ customElement('ox-parameters-editor-popup')
109
+ ], ParametersEditorPopup);
110
+ export { ParametersEditorPopup };
111
+ //# sourceMappingURL=parameters-editor-popup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameters-editor-popup.js","sourceRoot":"","sources":["../../../src/grist/parameters-editor-popup.ts"],"names":[],"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D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;IACrC,CAAC;IAEO,QAAQ,CAAC,CAAQ;QACvB,OAAO,CAAC,IAAI,EAAE,CAAA;IAChB,CAAC;IAEO,SAAS,CAAC,CAAQ;QACxB,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACxD,OAAO,CAAC,IAAI,EAAE,CAAA;IAChB,CAAC;CACF,CAAA;AAjGQ,4BAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BF;CACF,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAU;AACT;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAa;AACZ;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAwC;AAxCxD,qBAAqB;IADjC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,qBAAqB,CAkGjC;SAlGY,qBAAqB","sourcesContent":["import { LitElement, css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\nimport { i18next } from '@operato/i18n'\n\n@customElement('ox-parameters-editor-popup')\nexport class ParametersEditorPopup extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n\n width: var(--overlay-center-normal-width, 50%);\n height: var(--overlay-center-normal-height, 50%);\n }\n\n ox-parameters-editor-builder {\n flex: 1;\n overflow-y: auto;\n }\n\n span {\n flex: 1;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n color: var(--primary-color);\n }\n\n .button-container {\n display: flex;\n margin-left: auto;\n }\n `\n ]\n\n @property({ type: Object }) value: any\n @property({ type: Object }) props: any\n @property({ type: Object }) host: any\n @property({ type: Object }) context: any\n @property({ type: Object }) confirmCallback!: (newval: any) => void\n\n render() {\n var props = this.props instanceof Array ? this.props : []\n\n return html`\n ${props.length > 0\n ? html`\n <ox-parameters-editor-builder\n .value=${this.value}\n .props=${props}\n .host=${this.host}\n .context=${this.context}\n @property-change=${this.onChange.bind(this)}\n >\n </ox-parameters-editor-builder>\n `\n : html` <span><i18n-msg msgid=\"text.no properties to set\"></i18n-msg></span> `}\n\n <div class=\"button-container\">\n <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>\n <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>\n </div>\n `\n }\n\n private onChange(e: CustomEvent) {\n e.stopPropagation()\n\n /* \n 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로, \n layout의 구성에 변화가 발생하면, 다시 render된다.\n 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)\n 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,\n 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.\n 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.\n (이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)\n => \n 이런 이유로, Object.assign(...)을 사용하였다.\n */\n if (!this.value) {\n this.value = {}\n }\n\n for (let key in this.value) {\n delete this.value[key]\n }\n Object.assign(this.value, e.detail)\n }\n\n private onCancel(e: Event) {\n history.back()\n }\n\n private onConfirm(e: Event) {\n this.confirmCallback && this.confirmCallback(this.value)\n history.back()\n }\n}\n"]}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import './parameters-editor-builder.js';
5
+ import './parameters-editor-popup.js';
6
+ import { ColumnConfig, GristRecord } from '@operato/data-grist';
7
+ import { LitElement } from 'lit';
8
+ export declare class ParametersEditor extends LitElement {
9
+ static styles: import("lit").CSSResult;
10
+ value: any;
11
+ column: ColumnConfig;
12
+ record: GristRecord;
13
+ row: number;
14
+ field: any;
15
+ private popup?;
16
+ render(): import("lit-html").TemplateResult<1>;
17
+ firstUpdated(): Promise<void>;
18
+ openSelector(): Promise<void>;
19
+ }
@@ -0,0 +1,105 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import './parameters-editor-builder.js';
6
+ import './parameters-editor-popup.js';
7
+ import { LitElement, css, html } from 'lit';
8
+ import { openPopup } from '@operato/layout';
9
+ import { customElement, property } from 'lit/decorators.js';
10
+ import { i18next } from '@operato/i18n';
11
+ let ParametersEditor = class ParametersEditor extends LitElement {
12
+ render() {
13
+ const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value;
14
+ return html ` ${value || ''} `;
15
+ }
16
+ async firstUpdated() {
17
+ await this.updateComplete;
18
+ this.renderRoot.addEventListener('click', e => {
19
+ e.stopPropagation();
20
+ this.openSelector();
21
+ });
22
+ this.openSelector();
23
+ }
24
+ async openSelector() {
25
+ if (this.popup) {
26
+ delete this.popup;
27
+ }
28
+ var { options } = this.column.record;
29
+ if (typeof options === 'function') {
30
+ options = await options.call(this, this.value, this.column, this.record, this.row, this.field);
31
+ }
32
+ const { name, help, spec, context, objectified = false } = options;
33
+ const confirmCallback = (newval) => {
34
+ this.dispatchEvent(new CustomEvent('field-change', {
35
+ bubbles: true,
36
+ composed: true,
37
+ detail: {
38
+ before: this.value,
39
+ after: !objectified ? JSON.stringify(newval) : newval,
40
+ record: this.record,
41
+ column: this.column,
42
+ row: this.row
43
+ }
44
+ }));
45
+ };
46
+ try {
47
+ var value = !objectified && typeof this.value === 'string' ? JSON.parse(this.value) : this.value;
48
+ }
49
+ catch (e) {
50
+ var value = {};
51
+ }
52
+ /*
53
+ 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
54
+ layout의 구성에 변화가 발생하면, 다시 render된다.
55
+ 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
56
+ 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
57
+ 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
58
+ 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
59
+ */
60
+ var template = html `
61
+ <ox-parameters-editor-popup
62
+ .value=${value}
63
+ .props=${spec}
64
+ .host=${this.record}
65
+ .context=${context}
66
+ .confirmCallback=${confirmCallback}
67
+ >
68
+ </ox-parameters-editor-popup>
69
+ `;
70
+ this.popup = openPopup(template, {
71
+ backdrop: true,
72
+ size: 'large',
73
+ title: `${(name === null || name === void 0 ? void 0 : name.toUpperCase()) || ''} ${i18next.t('field.params')}`,
74
+ help
75
+ });
76
+ }
77
+ };
78
+ ParametersEditor.styles = css `
79
+ :host {
80
+ color: black;
81
+
82
+ overflow: hidden;
83
+ text-overflow: ellipsis;
84
+ }
85
+ `;
86
+ __decorate([
87
+ property({ type: Object })
88
+ ], ParametersEditor.prototype, "value", void 0);
89
+ __decorate([
90
+ property({ type: Object })
91
+ ], ParametersEditor.prototype, "column", void 0);
92
+ __decorate([
93
+ property({ type: Object })
94
+ ], ParametersEditor.prototype, "record", void 0);
95
+ __decorate([
96
+ property({ type: Number })
97
+ ], ParametersEditor.prototype, "row", void 0);
98
+ __decorate([
99
+ property({ type: Object })
100
+ ], ParametersEditor.prototype, "field", void 0);
101
+ ParametersEditor = __decorate([
102
+ customElement('ox-parameters-editor')
103
+ ], ParametersEditor);
104
+ export { ParametersEditor };
105
+ //# sourceMappingURL=parameters-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameters-editor.js","sourceRoot":"","sources":["../../../src/grist/parameters-editor.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,gCAAgC,CAAA;AACvC,OAAO,8BAA8B,CAAA;AAGrC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAGvC,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,UAAU;IAkB9C,MAAM;QACJ,MAAM,KAAK,GAAG,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA;QACtF,OAAO,IAAI,CAAA,IAAI,KAAK,IAAI,EAAE,GAAG,CAAA;IAC/B,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,cAAc,CAAA;QAEzB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE;YAC5C,CAAC,CAAC,eAAe,EAAE,CAAA;YAEnB,IAAI,CAAC,YAAY,EAAE,CAAA;QACrB,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,YAAY,EAAE,CAAA;IACrB,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,OAAO,IAAI,CAAC,KAAK,CAAA;SAClB;QAED,IAAI,EAAE,OAAO,E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I,CAAC,MAAM;mBACR,OAAO;2BACC,eAAe;;;KAGrC,CAAA;QAED,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/B,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,EAAE,KAAI,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE;YAClE,IAAI;SACL,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AA/FQ,uBAAM,GAAG,GAAG,CAAA;;;;;;;GAOlB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAa;AACZ;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAY;AAd5B,gBAAgB;IAD5B,aAAa,CAAC,sBAAsB,CAAC;GACzB,gBAAgB,CAgG5B;SAhGY,gBAAgB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './parameters-editor-builder.js'\nimport './parameters-editor-popup.js'\n\nimport { ColumnConfig, GristRecord } from '@operato/data-grist'\nimport { LitElement, css, html } from 'lit'\nimport { PopupHandle, openPopup } from '@operato/layout'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\n\n@customElement('ox-parameters-editor')\nexport class ParametersEditor extends LitElement {\n static styles = css`\n :host {\n color: black;\n\n overflow: hidden;\n text-overflow: ellipsis;\n }\n `\n\n @property({ type: Object }) value: any\n @property({ type: Object }) column!: ColumnConfig\n @property({ type: Object }) record!: GristRecord\n @property({ type: Number }) row!: number\n @property({ type: Object }) field!: any\n\n private popup?: PopupHandle\n\n render() {\n const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value\n return html` ${value || ''} `\n }\n\n async firstUpdated() {\n await this.updateComplete\n\n this.renderRoot.addEventListener('click', e => {\n e.stopPropagation()\n\n this.openSelector()\n })\n\n this.openSelector()\n }\n\n async openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n var { options } = this.column.record\n\n if (typeof options === 'function') {\n options = await options.call(this, this.value, this.column, this.record, this.row, this.field)\n }\n\n const { name, help, spec, context, objectified = false } = options\n\n const confirmCallback = (newval: any) => {\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: this.value,\n after: !objectified ? JSON.stringify(newval) : newval,\n record: this.record,\n column: this.column,\n row: this.row\n }\n })\n )\n }\n\n try {\n var value: any = !objectified && typeof this.value === 'string' ? JSON.parse(this.value) : 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-parameters-editor-popup\n .value=${value}\n .props=${spec}\n .host=${this.record}\n .context=${context}\n .confirmCallback=${confirmCallback}\n >\n </ox-parameters-editor-popup>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: `${name?.toUpperCase() || ''} ${i18next.t('field.params')}`,\n help\n })\n }\n}\n"]}