@operato/app 1.0.0-beta.5 → 1.0.0-beta.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,273 @@
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
+ ## [1.0.0-beta.8](https://github.com/hatiolab/operato/compare/v1.0.0-beta.7...v1.0.0-beta.8) (2022-04-27)
7
+
8
+ **Note:** Version bump only for package @operato/app
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.0.0-beta.7](https://github.com/hatiolab/operato/compare/v1.0.0-beta.6...v1.0.0-beta.7) (2022-04-24)
15
+
16
+ **Note:** Version bump only for package @operato/app
17
+
18
+
19
+
20
+
21
+
22
+ ## [1.0.0-beta.6](https://github.com/hatiolab/operato/compare/v0.4.5...v1.0.0-beta.6) (2022-04-22)
23
+
24
+ ## [1.0.0-beta.5](https://github.com/hatiolab/operato/compare/v1.0.0-beta.4...v1.0.0-beta.5) (2022-04-18)
25
+
26
+ ## [1.0.0-beta.4](https://github.com/hatiolab/operato/compare/v1.0.0-beta.3...v1.0.0-beta.4) (2022-04-14)
27
+
28
+
29
+ ### :rocket: New Features
30
+
31
+ * resource-object filter ([c70a727](https://github.com/hatiolab/operato/commit/c70a7270d9b28e51d78d3831bd2f563160d010ef))
32
+ * search for relation fields ([7dc99fd](https://github.com/hatiolab/operato/commit/7dc99fd6df1a96faab4f44ea65c3837934fabc5b))
33
+
34
+ ## [1.0.0-beta.3](https://github.com/hatiolab/operato/compare/v1.0.0-beta.2...v1.0.0-beta.3) (2022-04-12)
35
+
36
+ ## [1.0.0-beta.2](https://github.com/hatiolab/operato/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2022-04-12)
37
+
38
+
39
+ ### :rocket: New Features
40
+
41
+ * add 'empty' button into ox-grist-editor-resource-object ([d739d23](https://github.com/hatiolab/operato/commit/d739d23686ea9487e2b9d887c451290638d3633e))
42
+
43
+ ## [1.0.0-beta.1](https://github.com/hatiolab/operato/compare/v1.0.0-beta.0...v1.0.0-beta.1) (2022-04-11)
44
+
45
+ ## [1.0.0-beta.0](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.53...v1.0.0-beta.0) (2022-04-10)
46
+
47
+ ## [1.0.0-alpha.53](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.52...v1.0.0-alpha.53) (2022-04-08)
48
+
49
+ ## [1.0.0-alpha.52](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.51...v1.0.0-alpha.52) (2022-04-08)
50
+
51
+ ## [1.0.0-alpha.51](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.50...v1.0.0-alpha.51) (2022-04-05)
52
+
53
+
54
+ ### :bug: Bug Fix
55
+
56
+ * crontab translation ([e87b431](https://github.com/hatiolab/operato/commit/e87b43145f5d01c4b71c4498578b4b172c50ae03))
57
+ * export ox-grist-renderer-crontab.js ([3615720](https://github.com/hatiolab/operato/commit/3615720d119526a17272db2369bd80340b6cbc31))
58
+
59
+ ## [1.0.0-alpha.50](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.49...v1.0.0-alpha.50) (2022-04-04)
60
+
61
+ ## [1.0.0-alpha.49](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.48...v1.0.0-alpha.49) (2022-04-04)
62
+
63
+
64
+ ### :bug: Bug Fix
65
+
66
+ * lit@2.2.1 ([6707752](https://github.com/hatiolab/operato/commit/6707752907d24f7ecbe248cba18a4b18cfda282f))
67
+
68
+
69
+ ### :rocket: New Features
70
+
71
+ * translation crontab for ox-grist-renderer-crontab ([c13d6ef](https://github.com/hatiolab/operato/commit/c13d6efab9ff02ceb4b4d244455a480070a80a3e))
72
+
73
+ ## [1.0.0-alpha.48](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.47...v1.0.0-alpha.48) (2022-04-03)
74
+
75
+
76
+ ### :rocket: New Features
77
+
78
+ * support copy and paste in data-grid ([9dd686f](https://github.com/hatiolab/operato/commit/9dd686f6817500863a1c36140ef01b39fcafef9f))
79
+
80
+ ## [1.0.0-alpha.47](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.46...v1.0.0-alpha.47) (2022-04-02)
81
+
82
+ ## [1.0.0-alpha.46](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.45...v1.0.0-alpha.46) (2022-04-02)
83
+
84
+ ## [1.0.0-alpha.45](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.44...v1.0.0-alpha.45) (2022-03-31)
85
+
86
+ ## [1.0.0-alpha.44](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.43...v1.0.0-alpha.44) (2022-03-31)
87
+
88
+ ## [1.0.0-alpha.43](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.42...v1.0.0-alpha.43) (2022-03-30)
89
+
90
+ ## [1.0.0-alpha.42](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.41...v1.0.0-alpha.42) (2022-03-29)
91
+
92
+ ## [1.0.0-alpha.41](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.40...v1.0.0-alpha.41) (2022-03-27)
93
+
94
+ ## [1.0.0-alpha.40](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.39...v1.0.0-alpha.40) (2022-03-26)
95
+
96
+ ## [1.0.0-alpha.39](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.38...v1.0.0-alpha.39) (2022-03-25)
97
+
98
+ ## [1.0.0-alpha.38](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.37...v1.0.0-alpha.38) (2022-03-25)
99
+
100
+ ## [1.0.0-alpha.37](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2022-03-25)
101
+
102
+ ## [1.0.0-alpha.36](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.35...v1.0.0-alpha.36) (2022-03-21)
103
+
104
+ ## [1.0.0-alpha.35](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.34...v1.0.0-alpha.35) (2022-03-21)
105
+
106
+
107
+ ### :bug: Bug Fix
108
+
109
+ * prevent text overflow of grist-renderers ([73e7538](https://github.com/hatiolab/operato/commit/73e7538f9a0c8941689fefd3d4212529a75c413d))
110
+
111
+ ## [1.0.0-alpha.34](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.33...v1.0.0-alpha.34) (2022-03-20)
112
+
113
+ ## [1.0.0-alpha.33](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.32...v1.0.0-alpha.33) (2022-03-19)
114
+
115
+ ## [1.0.0-alpha.32](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.31...v1.0.0-alpha.32) (2022-03-19)
116
+
117
+
118
+ ### :bug: Bug Fix
119
+
120
+ * typo ([2f2e3fc](https://github.com/hatiolab/operato/commit/2f2e3fcce771dcbfe2f1d09cbd25638094a6dc99))
121
+
122
+ ## [1.0.0-alpha.31](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.30...v1.0.0-alpha.31) (2022-03-19)
123
+
124
+
125
+ ### :bug: Bug Fix
126
+
127
+ * ox-grist-renderer support class type renderer (refer ox-grist-renderer-progress) ([ad7c8e1](https://github.com/hatiolab/operato/commit/ad7c8e1b453d19af9daa13ae4eb7c2059d85dfbb))
128
+ * partition-keys related ui components ([c21b4d2](https://github.com/hatiolab/operato/commit/c21b4d292ca4a6d6b4bf774a570dbabd349528fc))
129
+
130
+ ## [1.0.0-alpha.30](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.29...v1.0.0-alpha.30) (2022-03-18)
131
+
132
+ ## [1.0.0-alpha.29](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.28...v1.0.0-alpha.29) (2022-03-17)
133
+
134
+
135
+ ### :bug: Bug Fix
136
+
137
+ * datalist in ox-input-partition-keys ([a25e3a6](https://github.com/hatiolab/operato/commit/a25e3a66cf5f7a25bca057be90ef336b29e915a7))
138
+ * typo ([1f8f2da](https://github.com/hatiolab/operato/commit/1f8f2da3b4780df9f747065a457f6cafb5d9e9cf))
139
+
140
+ ## [1.0.0-alpha.28](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.26...v1.0.0-alpha.28) (2022-03-17)
141
+
142
+
143
+ ### :rocket: New Features
144
+
145
+ * add ox-grist-editor for partition-keys ([7672a27](https://github.com/hatiolab/operato/commit/7672a2729f78475602733a83779f6a7a96e128fd))
146
+
147
+ ## [1.0.0-alpha.26](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.25...v1.0.0-alpha.26) (2022-03-17)
148
+
149
+ ## [1.0.0-alpha.25](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.24...v1.0.0-alpha.25) (2022-03-17)
150
+
151
+
152
+ ### :bug: Bug Fix
153
+
154
+ * typo ([907aceb](https://github.com/hatiolab/operato/commit/907acebaf882613991bce064efea435c2d148543))
155
+
156
+ ## [1.0.0-alpha.24](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.23...v1.0.0-alpha.24) (2022-03-17)
157
+
158
+
159
+ ### :bug: Bug Fix
160
+
161
+ * refactoring grist-editor, property-editor and input ([bdc3197](https://github.com/hatiolab/operato/commit/bdc31977d148c80a3ac0bea4b33160bac277df1e))
162
+ * refactoring grist-editor, property-editor and input ([ea7431a](https://github.com/hatiolab/operato/commit/ea7431a5e2dfd96ef392c1905e9622df7c2ef88c))
163
+
164
+ ## [1.0.0-alpha.23](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.22...v1.0.0-alpha.23) (2022-03-17)
165
+
166
+ ## [1.0.0-alpha.22](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.21...v1.0.0-alpha.22) (2022-03-17)
167
+
168
+ ## [1.0.0-alpha.21](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.20...v1.0.0-alpha.21) (2022-03-16)
169
+
170
+
171
+ ### :rocket: New Features
172
+
173
+ * @operato/ccp module added ([f08ba5a](https://github.com/hatiolab/operato/commit/f08ba5a464c04b7fb132c6f18de975997087846a))
174
+
175
+ ## [1.0.0-alpha.20](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.19...v1.0.0-alpha.20) (2022-03-15)
176
+
177
+ ## [1.0.0-alpha.19](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.18...v1.0.0-alpha.19) (2022-03-14)
178
+
179
+
180
+ ### :bug: Bug Fix
181
+
182
+ * image-selector in ox-input-background-pattern ([b88c6e1](https://github.com/hatiolab/operato/commit/b88c6e141d5d636bff4b29fbae3c790d80b641bc))
183
+
184
+ ## [1.0.0-alpha.18](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.17...v1.0.0-alpha.18) (2022-03-14)
185
+
186
+
187
+ ### :bug: Bug Fix
188
+
189
+ * missing font module import ([a5348cf](https://github.com/hatiolab/operato/commit/a5348cf0d567927f18bf31bba09994f3fbf742f6))
190
+
191
+ ## [1.0.0-alpha.17](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.16...v1.0.0-alpha.17) (2022-03-13)
192
+
193
+
194
+ ### :bug: Bug Fix
195
+
196
+ * some missings in font module ([6c1ba6d](https://github.com/hatiolab/operato/commit/6c1ba6d89b8ff75b03c6b4ce813f5d3d09c7437b))
197
+
198
+ ## [1.0.0-alpha.16](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.15...v1.0.0-alpha.16) (2022-03-13)
199
+
200
+
201
+ ### :bug: Bug Fix
202
+
203
+ * downgrad graphql related libraries ([d26b80f](https://github.com/hatiolab/operato/commit/d26b80fc31b10bfd3bf31b6473151af52f857c66))
204
+
205
+ ## [1.0.0-alpha.15](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2022-03-13)
206
+
207
+
208
+ ### :rocket: New Features
209
+
210
+ * migrate input, property-editor from things-factory ([dbd5e73](https://github.com/hatiolab/operato/commit/dbd5e73eac328e72c4bb7abd113a819532bc894d))
211
+
212
+ ## [1.0.0-alpha.14](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.13...v1.0.0-alpha.14) (2022-03-13)
213
+
214
+ ## [1.0.0-alpha.13](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2022-03-13)
215
+
216
+ ## [1.0.0-alpha.12](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.11...v1.0.0-alpha.12) (2022-03-13)
217
+
218
+
219
+ ### :rocket: New Features
220
+
221
+ * migrate input, property-editor from things-factory ([4800d85](https://github.com/hatiolab/operato/commit/4800d859473bf623325233a7f2af851e5d093dcb))
222
+
223
+ ## [1.0.0-alpha.11](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.10...v1.0.0-alpha.11) (2022-03-12)
224
+
225
+
226
+ ### :bug: Bug Fix
227
+
228
+ * code-editor for grist ([cb80692](https://github.com/hatiolab/operato/commit/cb80692039e41d7b94b98ac1845822563e179e24))
229
+ * ox-property-editor-attachment-selector ([a1a2d20](https://github.com/hatiolab/operato/commit/a1a2d20640746c891248fdb729097614676c9cff))
230
+
231
+ ## [1.0.0-alpha.10](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2022-03-12)
232
+
233
+ ## [1.0.0-alpha.9](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2022-03-12)
234
+
235
+
236
+ ### :rocket: New Features
237
+
238
+ * settled concept for input, property-editor, grist-editor, so on ([0c9e1d0](https://github.com/hatiolab/operato/commit/0c9e1d054c7aef5d965868242cf471667af7a3c3))
239
+
240
+ ## [1.0.0-alpha.8](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2022-03-11)
241
+
242
+ ## [1.0.0-alpha.7](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2022-03-11)
243
+
244
+ ## [1.0.0-alpha.6](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2022-03-11)
245
+
246
+ ## [1.0.0-alpha.5](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2022-03-11)
247
+
248
+
249
+ ### :bug: Bug Fix
250
+
251
+ * migrate parameter-editor from things-factory ([019a30d](https://github.com/hatiolab/operato/commit/019a30df6fd4c8a273d4194d13f5784ed6f8d956))
252
+
253
+ ## [1.0.0-alpha.4](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2022-03-11)
254
+
255
+
256
+ ### :rocket: New Features
257
+
258
+ * start migration grist editors from things-factory ([8b31c7f](https://github.com/hatiolab/operato/commit/8b31c7f00ae9b32e68f6860c559a768c3d456704))
259
+
260
+ ## [1.0.0-alpha.3](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2022-03-10)
261
+
262
+ ## [1.0.0-alpha.2](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2022-03-10)
263
+
264
+ ## [1.0.0-alpha.1](https://github.com/hatiolab/operato/compare/v0.4.3...v1.0.0-alpha.1) (2022-03-09)
265
+
266
+
267
+ ### :rocket: New Features
268
+
269
+ * 1.0-alpha ([42f87cf](https://github.com/hatiolab/operato/commit/42f87cf6a3cef0381db91ecb1179e63c64c01370))
270
+
271
+
272
+
6
273
  ## [1.0.0-beta.5](https://github.com/hatiolab/operato/compare/v1.0.0-beta.4...v1.0.0-beta.5) (2022-04-18)
7
274
 
8
275
  **Note:** Version bump only for package @operato/app
@@ -0,0 +1,19 @@
1
+ import '@material/mwc-icon';
2
+ import './id-selector.js';
3
+ import { ColumnConfig, GristRecord, InputEditor } from '@operato/data-grist';
4
+ import { TemplateResult } from 'lit';
5
+ export declare class IdInput extends InputEditor {
6
+ static styles: import("lit").CSSResult;
7
+ value?: {
8
+ id?: string;
9
+ [propany: string]: any;
10
+ };
11
+ column: ColumnConfig;
12
+ record: GristRecord;
13
+ row: number;
14
+ private popup?;
15
+ private template?;
16
+ render(): TemplateResult<1>;
17
+ firstUpdated(): Promise<void>;
18
+ openSelector(): void;
19
+ }
@@ -0,0 +1,119 @@
1
+ import { __decorate } from "tslib";
2
+ import '@material/mwc-icon';
3
+ import './id-selector.js';
4
+ import { InputEditor } from '@operato/data-grist';
5
+ import { css, html } from 'lit';
6
+ import { customElement, property } from 'lit/decorators.js';
7
+ import { openPopup } from '@operato/layout';
8
+ let IdInput = class IdInput extends InputEditor {
9
+ render() {
10
+ var { nameField = 'name', descriptionField = 'description' } = this.column.record.options || {};
11
+ var value = this.value;
12
+ return html `
13
+ ${!value ? html `` : html ` <span>${value[nameField]} (${value[descriptionField]})</span> `}
14
+ <mwc-icon>arrow_drop_down</mwc-icon>
15
+ `;
16
+ }
17
+ async firstUpdated() {
18
+ this.value = this.record[this.column.name];
19
+ this.template = ((this.column.record || {}).options || {}).template;
20
+ await this.updateComplete;
21
+ this.renderRoot.addEventListener('click', e => {
22
+ e.stopPropagation();
23
+ this.openSelector();
24
+ });
25
+ this.openSelector();
26
+ }
27
+ openSelector() {
28
+ if (this.popup) {
29
+ delete this.popup;
30
+ }
31
+ const confirmCallback = selected => {
32
+ if (!selected) {
33
+ return;
34
+ }
35
+ var { idField = 'id', nameField = 'name', descriptionField = 'description' } = this.column.record.options || {};
36
+ this.dispatchEvent(new CustomEvent('field-change', {
37
+ bubbles: true,
38
+ composed: true,
39
+ detail: {
40
+ before: this.value,
41
+ after: {
42
+ [idField]: selected[idField],
43
+ [nameField]: selected[nameField],
44
+ [descriptionField]: selected[descriptionField]
45
+ },
46
+ record: this.record,
47
+ column: this.column,
48
+ row: this.row
49
+ }
50
+ }));
51
+ };
52
+ var value = this.value || {};
53
+ var template = this.template ||
54
+ html `
55
+ <ox-id-selector
56
+ .value=${value.id}
57
+ .confirmCallback=${confirmCallback.bind(this)}
58
+ .queryName=${this.column.record.options.queryName}
59
+ .basicArgs=${this.column.record.options.basicArgs}
60
+ ></ox-id-selector>
61
+ `;
62
+ this.popup = openPopup(template, {
63
+ backdrop: true,
64
+ size: 'large',
65
+ title: 'select item'
66
+ });
67
+ }
68
+ };
69
+ IdInput.styles = css `
70
+ :host {
71
+ display: flex;
72
+ flex-flow: row nowrap;
73
+ align-items: center;
74
+
75
+ padding: 7px 0px;
76
+ box-sizing: border-box;
77
+
78
+ width: 100%;
79
+ height: 100%;
80
+
81
+ border: 0;
82
+ background-color: transparent;
83
+
84
+ font: var(--grist-object-editor-font);
85
+ color: var(--grist-object-editor-color);
86
+
87
+ justify-content: inherit;
88
+ }
89
+
90
+ span {
91
+ display: flex;
92
+ flex: auto;
93
+
94
+ justify-content: inherit;
95
+ }
96
+
97
+ mwc-icon {
98
+ width: 20px;
99
+ font-size: 1.5em;
100
+ margin-left: auto;
101
+ }
102
+ `;
103
+ __decorate([
104
+ property({ type: Object })
105
+ ], IdInput.prototype, "value", void 0);
106
+ __decorate([
107
+ property({ type: Object })
108
+ ], IdInput.prototype, "column", void 0);
109
+ __decorate([
110
+ property({ type: Object })
111
+ ], IdInput.prototype, "record", void 0);
112
+ __decorate([
113
+ property({ type: Number })
114
+ ], IdInput.prototype, "row", void 0);
115
+ IdInput = __decorate([
116
+ customElement('ox-id-input')
117
+ ], IdInput);
118
+ export { IdInput };
119
+ //# sourceMappingURL=id-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id-input.js","sourceRoot":"","sources":["../../../src/grist/id-input.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAA6B,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAG3C,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,WAAW;IAkDtC,MAAM;QACJ,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,gBAAgB,GAAG,aAAa,EAAE,GAAG,IAA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AAE,CAAC;uCAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCAAa;AAvC7B,OAAO;IADnB,aAAa,CAAC,aAAa,CAAC;GAChB,OAAO,CA4HnB;SA5HY,OAAO","sourcesContent":["import '@material/mwc-icon'\nimport './id-selector.js'\n\nimport { ColumnConfig, GristRecord, InputEditor } from '@operato/data-grist'\nimport { TemplateResult, css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { openPopup } from '@operato/layout'\n\n@customElement('ox-id-input')\nexport class IdInput extends InputEditor {\n static styles = css`\n :host {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n padding: 7px 0px;\n box-sizing: border-box;\n\n width: 100%;\n height: 100%;\n\n border: 0;\n background-color: transparent;\n\n font: var(--grist-object-editor-font);\n color: var(--grist-object-editor-color);\n\n justify-content: inherit;\n }\n\n span {\n display: flex;\n flex: auto;\n\n justify-content: inherit;\n }\n\n mwc-icon {\n width: 20px;\n font-size: 1.5em;\n margin-left: auto;\n }\n `\n\n @property({ type: Object }) value?: { id?: string; [propany: string]: any }\n @property({ type: Object }) column!: ColumnConfig\n @property({ type: Object }) record!: GristRecord\n @property({ type: Number }) row!: number\n\n private popup?: {\n name: string\n close: () => void\n closed: boolean\n onclosed?: (() => void) | undefined\n }\n\n private template?: TemplateResult\n\n render() {\n var { nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}\n var value = this.value\n\n return html`\n ${!value ? html`` : html` <span>${value[nameField]} (${value[descriptionField]})</span> `}\n <mwc-icon>arrow_drop_down</mwc-icon>\n `\n }\n\n async firstUpdated() {\n this.value = this.record[this.column.name]\n this.template = ((this.column.record || {}).options || {}).template\n\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 openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n const confirmCallback: (record: GristRecord | undefined) => void = selected => {\n if (!selected) {\n return\n }\n\n var { idField = 'id', nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}\n\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: this.value,\n after: {\n [idField]: selected[idField],\n [nameField]: selected[nameField],\n [descriptionField]: selected[descriptionField]\n },\n record: this.record,\n column: this.column,\n row: this.row\n }\n })\n )\n }\n\n var value = this.value || {}\n var template =\n this.template ||\n html`\n <ox-id-selector\n .value=${value.id}\n .confirmCallback=${confirmCallback.bind(this)}\n .queryName=${this.column.record.options.queryName}\n .basicArgs=${this.column.record.options.basicArgs}\n ></ox-id-selector>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: 'select item'\n })\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { FieldRenderer } from '@operato/data-grist';
2
+ export declare const IdRenderer: FieldRenderer;
@@ -0,0 +1,9 @@
1
+ import { html } from 'lit';
2
+ export const IdRenderer = (value, column, record, rowIndex, field) => {
3
+ if (!value) {
4
+ return '';
5
+ }
6
+ var { nameField = 'name', descriptionField = 'description' } = column.record.options || {};
7
+ return html ` ${value[nameField] || ''}(${value[descriptionField] || ''}) `;
8
+ };
9
+ //# sourceMappingURL=id-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id-renderer.js","sourceRoot":"","sources":["../../../src/grist/id-renderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,MAAM,CAAC,MAAM,UAAU,GAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAClF,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,EAAE,CAAA;KACV;IAED,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,gBAAgB,GAAG,aAAa,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAA;IAE1F,OAAO,IAAI,CAAA,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAA;AAC5E,CAAC,CAAA","sourcesContent":["import { FieldRenderer } from '@operato/data-grist'\nimport { html } from 'lit'\n\nexport const IdRenderer: FieldRenderer = (value, column, record, rowIndex, field) => {\n if (!value) {\n return ''\n }\n\n var { nameField = 'name', descriptionField = 'description' } = column.record.options || {}\n\n return html` ${value[nameField] || ''}(${value[descriptionField] || ''}) `\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import '@operato/data-grist';
2
+ import { DataGrist, FetchOption, GristData, GristRecord } from '@operato/data-grist';
3
+ import { LitElement } from 'lit';
4
+ export declare class IdSelector extends LitElement {
5
+ static styles: import("lit").CSSResult;
6
+ value?: string;
7
+ config: any;
8
+ data: GristData;
9
+ queryName: string;
10
+ basicArgs: any;
11
+ confirmCallback?: (record: GristRecord | undefined) => void;
12
+ selectedRecords: GristRecord[];
13
+ grist: DataGrist;
14
+ render(): import("lit-html").TemplateResult<1>;
15
+ oncancel(): void;
16
+ onconfirm(): void;
17
+ firstUpdated(): Promise<void>;
18
+ fetchHandler({ page, limit, sorters, filters }: FetchOption): Promise<{
19
+ total: any;
20
+ records: any;
21
+ }>;
22
+ get selected(): GristRecord | undefined;
23
+ }
@@ -0,0 +1,197 @@
1
+ import { __decorate } from "tslib";
2
+ import '@operato/data-grist';
3
+ import { ZERO_DATA } from '@operato/data-grist';
4
+ import { LitElement, css, html } from 'lit';
5
+ import { customElement, property, query } from 'lit/decorators.js';
6
+ import { client } from '@operato/graphql';
7
+ import gql from 'graphql-tag';
8
+ import { i18next } from '@operato/i18n';
9
+ import { isMobileDevice } from '@operato/utils';
10
+ let IdSelector = class IdSelector extends LitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.data = ZERO_DATA;
14
+ this.selectedRecords = [];
15
+ }
16
+ render() {
17
+ return html `
18
+ <ox-grist
19
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
20
+ .config=${this.config}
21
+ .fetchHandler=${this.fetchHandler.bind(this)}
22
+ .selectedRecords=${this.selectedRecords}
23
+ >
24
+ <div id="filters" slot="headless">
25
+ <ox-filters-form></ox-filters-form>
26
+ </div>
27
+ </ox-grist>
28
+
29
+ <div class="button-container">
30
+ <mwc-button @click=${this.oncancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
31
+ <mwc-button @click=${this.onconfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
32
+ </div>
33
+ `;
34
+ }
35
+ oncancel() {
36
+ history.back();
37
+ }
38
+ onconfirm() {
39
+ this.confirmCallback && this.confirmCallback(this.selected);
40
+ history.back();
41
+ }
42
+ async firstUpdated() {
43
+ this.config = {
44
+ columns: [
45
+ {
46
+ type: 'gutter',
47
+ gutterName: 'sequence'
48
+ },
49
+ {
50
+ type: 'gutter',
51
+ gutterName: 'row-selector',
52
+ multiple: false
53
+ },
54
+ {
55
+ type: 'string',
56
+ name: 'id',
57
+ header: i18next.t('field.id'),
58
+ hidden: true
59
+ },
60
+ {
61
+ type: 'string',
62
+ name: 'name',
63
+ header: i18next.t('field.name'),
64
+ record: {
65
+ align: 'left'
66
+ },
67
+ filter: 'search',
68
+ sortable: true,
69
+ width: 160
70
+ },
71
+ {
72
+ type: 'string',
73
+ name: 'description',
74
+ header: i18next.t('field.description'),
75
+ record: {
76
+ align: 'left'
77
+ },
78
+ filter: 'search',
79
+ sortable: true,
80
+ width: 300
81
+ }
82
+ ],
83
+ rows: {
84
+ selectable: {
85
+ multiple: false
86
+ },
87
+ handlers: {
88
+ click: 'select-row'
89
+ }
90
+ },
91
+ pagination: {
92
+ infinite: true
93
+ }
94
+ };
95
+ await this.updateComplete;
96
+ /* TODO config가 설정될 때, fetch() 가 동작하므로, fetch 완료 이벤트를 받아서, selected를 설정해주는 것이 좋겠다.
97
+ 현재는 fetch() 가 두번 일어난다.
98
+ */
99
+ await this.grist.fetch();
100
+ var selected = this.grist.data.records.find(item => this.value == item.id);
101
+ if (selected) {
102
+ this.selectedRecords = [selected];
103
+ }
104
+ /* TODO config가 설정될 때, fetch() 가 동작하므로, fetch 완료 이벤트를 받아서, selected를 설정해주는 것이 좋겠다. */
105
+ await this.updateComplete;
106
+ this.grist.focus();
107
+ }
108
+ async fetchHandler({ page = 1, limit = 100, sorters = [], filters = [] }) {
109
+ const response = await client.query({
110
+ query: gql `
111
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
112
+ q: ${this.queryName}(filters: $filters, pagination: $pagination, sortings: $sortings) {
113
+ items {
114
+ id
115
+ name
116
+ description
117
+ }
118
+ total
119
+ }
120
+ }
121
+ `,
122
+ variables: {
123
+ filters,
124
+ pagination: { page, limit },
125
+ sortings: sorters
126
+ }
127
+ });
128
+ return {
129
+ total: response.data.q.total || 0,
130
+ records: response.data.q.items || []
131
+ };
132
+ }
133
+ get selected() {
134
+ var grist = this.renderRoot.querySelector('ox-grist');
135
+ var selected = grist.selected;
136
+ return selected && selected.length > 0 ? selected[0] : undefined;
137
+ }
138
+ };
139
+ IdSelector.styles = css `
140
+ :host {
141
+ display: flex;
142
+ flex-direction: column;
143
+
144
+ background-color: #fff;
145
+
146
+ width: var(--overlay-center-normal-width, 50%);
147
+ height: var(--overlay-center-normal-height, 50%);
148
+ }
149
+
150
+ ox-grist {
151
+ flex: 1;
152
+ }
153
+
154
+ #filters {
155
+ display: flex;
156
+ flex-direction: row;
157
+ justify-content: space-between;
158
+ }
159
+
160
+ #filters > * {
161
+ padding: var(--padding-default) var(--padding-wide);
162
+ }
163
+
164
+ .button-container {
165
+ display: flex;
166
+ margin-left: auto;
167
+ }
168
+ `;
169
+ __decorate([
170
+ property({ type: String })
171
+ ], IdSelector.prototype, "value", void 0);
172
+ __decorate([
173
+ property({ type: Object })
174
+ ], IdSelector.prototype, "config", void 0);
175
+ __decorate([
176
+ property({ type: Object })
177
+ ], IdSelector.prototype, "data", void 0);
178
+ __decorate([
179
+ property({ type: String })
180
+ ], IdSelector.prototype, "queryName", void 0);
181
+ __decorate([
182
+ property({ type: Object })
183
+ ], IdSelector.prototype, "basicArgs", void 0);
184
+ __decorate([
185
+ property({ type: Object })
186
+ ], IdSelector.prototype, "confirmCallback", void 0);
187
+ __decorate([
188
+ property({ type: Array })
189
+ ], IdSelector.prototype, "selectedRecords", void 0);
190
+ __decorate([
191
+ query('ox-grist')
192
+ ], IdSelector.prototype, "grist", void 0);
193
+ IdSelector = __decorate([
194
+ customElement('ox-id-selector')
195
+ ], IdSelector);
196
+ export { IdSelector };
197
+ //# sourceMappingURL=id-selector.js.map