@operato/app 1.0.0-beta.5 → 1.0.0-beta.6
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 +251 -0
- package/dist/src/grist/id-input.d.ts +19 -0
- package/dist/src/grist/id-input.js +119 -0
- package/dist/src/grist/id-input.js.map +1 -0
- package/dist/src/grist/id-renderer.d.ts +2 -0
- package/dist/src/grist/id-renderer.js +9 -0
- package/dist/src/grist/id-renderer.js.map +1 -0
- package/dist/src/grist/id-selector.d.ts +23 -0
- package/dist/src/grist/id-selector.js +197 -0
- package/dist/src/grist/id-selector.js.map +1 -0
- package/dist/src/grist/index.d.ts +1 -0
- package/dist/src/grist/index.js +7 -0
- package/dist/src/grist/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,257 @@
|
|
|
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.6](https://github.com/hatiolab/operato/compare/v0.4.5...v1.0.0-beta.6) (2022-04-22)
|
|
7
|
+
|
|
8
|
+
## [1.0.0-beta.5](https://github.com/hatiolab/operato/compare/v1.0.0-beta.4...v1.0.0-beta.5) (2022-04-18)
|
|
9
|
+
|
|
10
|
+
## [1.0.0-beta.4](https://github.com/hatiolab/operato/compare/v1.0.0-beta.3...v1.0.0-beta.4) (2022-04-14)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### :rocket: New Features
|
|
14
|
+
|
|
15
|
+
* resource-object filter ([c70a727](https://github.com/hatiolab/operato/commit/c70a7270d9b28e51d78d3831bd2f563160d010ef))
|
|
16
|
+
* search for relation fields ([7dc99fd](https://github.com/hatiolab/operato/commit/7dc99fd6df1a96faab4f44ea65c3837934fabc5b))
|
|
17
|
+
|
|
18
|
+
## [1.0.0-beta.3](https://github.com/hatiolab/operato/compare/v1.0.0-beta.2...v1.0.0-beta.3) (2022-04-12)
|
|
19
|
+
|
|
20
|
+
## [1.0.0-beta.2](https://github.com/hatiolab/operato/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2022-04-12)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### :rocket: New Features
|
|
24
|
+
|
|
25
|
+
* add 'empty' button into ox-grist-editor-resource-object ([d739d23](https://github.com/hatiolab/operato/commit/d739d23686ea9487e2b9d887c451290638d3633e))
|
|
26
|
+
|
|
27
|
+
## [1.0.0-beta.1](https://github.com/hatiolab/operato/compare/v1.0.0-beta.0...v1.0.0-beta.1) (2022-04-11)
|
|
28
|
+
|
|
29
|
+
## [1.0.0-beta.0](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.53...v1.0.0-beta.0) (2022-04-10)
|
|
30
|
+
|
|
31
|
+
## [1.0.0-alpha.53](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.52...v1.0.0-alpha.53) (2022-04-08)
|
|
32
|
+
|
|
33
|
+
## [1.0.0-alpha.52](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.51...v1.0.0-alpha.52) (2022-04-08)
|
|
34
|
+
|
|
35
|
+
## [1.0.0-alpha.51](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.50...v1.0.0-alpha.51) (2022-04-05)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### :bug: Bug Fix
|
|
39
|
+
|
|
40
|
+
* crontab translation ([e87b431](https://github.com/hatiolab/operato/commit/e87b43145f5d01c4b71c4498578b4b172c50ae03))
|
|
41
|
+
* export ox-grist-renderer-crontab.js ([3615720](https://github.com/hatiolab/operato/commit/3615720d119526a17272db2369bd80340b6cbc31))
|
|
42
|
+
|
|
43
|
+
## [1.0.0-alpha.50](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.49...v1.0.0-alpha.50) (2022-04-04)
|
|
44
|
+
|
|
45
|
+
## [1.0.0-alpha.49](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.48...v1.0.0-alpha.49) (2022-04-04)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### :bug: Bug Fix
|
|
49
|
+
|
|
50
|
+
* lit@2.2.1 ([6707752](https://github.com/hatiolab/operato/commit/6707752907d24f7ecbe248cba18a4b18cfda282f))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### :rocket: New Features
|
|
54
|
+
|
|
55
|
+
* translation crontab for ox-grist-renderer-crontab ([c13d6ef](https://github.com/hatiolab/operato/commit/c13d6efab9ff02ceb4b4d244455a480070a80a3e))
|
|
56
|
+
|
|
57
|
+
## [1.0.0-alpha.48](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.47...v1.0.0-alpha.48) (2022-04-03)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### :rocket: New Features
|
|
61
|
+
|
|
62
|
+
* support copy and paste in data-grid ([9dd686f](https://github.com/hatiolab/operato/commit/9dd686f6817500863a1c36140ef01b39fcafef9f))
|
|
63
|
+
|
|
64
|
+
## [1.0.0-alpha.47](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.46...v1.0.0-alpha.47) (2022-04-02)
|
|
65
|
+
|
|
66
|
+
## [1.0.0-alpha.46](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.45...v1.0.0-alpha.46) (2022-04-02)
|
|
67
|
+
|
|
68
|
+
## [1.0.0-alpha.45](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.44...v1.0.0-alpha.45) (2022-03-31)
|
|
69
|
+
|
|
70
|
+
## [1.0.0-alpha.44](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.43...v1.0.0-alpha.44) (2022-03-31)
|
|
71
|
+
|
|
72
|
+
## [1.0.0-alpha.43](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.42...v1.0.0-alpha.43) (2022-03-30)
|
|
73
|
+
|
|
74
|
+
## [1.0.0-alpha.42](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.41...v1.0.0-alpha.42) (2022-03-29)
|
|
75
|
+
|
|
76
|
+
## [1.0.0-alpha.41](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.40...v1.0.0-alpha.41) (2022-03-27)
|
|
77
|
+
|
|
78
|
+
## [1.0.0-alpha.40](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.39...v1.0.0-alpha.40) (2022-03-26)
|
|
79
|
+
|
|
80
|
+
## [1.0.0-alpha.39](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.38...v1.0.0-alpha.39) (2022-03-25)
|
|
81
|
+
|
|
82
|
+
## [1.0.0-alpha.38](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.37...v1.0.0-alpha.38) (2022-03-25)
|
|
83
|
+
|
|
84
|
+
## [1.0.0-alpha.37](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2022-03-25)
|
|
85
|
+
|
|
86
|
+
## [1.0.0-alpha.36](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.35...v1.0.0-alpha.36) (2022-03-21)
|
|
87
|
+
|
|
88
|
+
## [1.0.0-alpha.35](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.34...v1.0.0-alpha.35) (2022-03-21)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### :bug: Bug Fix
|
|
92
|
+
|
|
93
|
+
* prevent text overflow of grist-renderers ([73e7538](https://github.com/hatiolab/operato/commit/73e7538f9a0c8941689fefd3d4212529a75c413d))
|
|
94
|
+
|
|
95
|
+
## [1.0.0-alpha.34](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.33...v1.0.0-alpha.34) (2022-03-20)
|
|
96
|
+
|
|
97
|
+
## [1.0.0-alpha.33](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.32...v1.0.0-alpha.33) (2022-03-19)
|
|
98
|
+
|
|
99
|
+
## [1.0.0-alpha.32](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.31...v1.0.0-alpha.32) (2022-03-19)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
### :bug: Bug Fix
|
|
103
|
+
|
|
104
|
+
* typo ([2f2e3fc](https://github.com/hatiolab/operato/commit/2f2e3fcce771dcbfe2f1d09cbd25638094a6dc99))
|
|
105
|
+
|
|
106
|
+
## [1.0.0-alpha.31](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.30...v1.0.0-alpha.31) (2022-03-19)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### :bug: Bug Fix
|
|
110
|
+
|
|
111
|
+
* ox-grist-renderer support class type renderer (refer ox-grist-renderer-progress) ([ad7c8e1](https://github.com/hatiolab/operato/commit/ad7c8e1b453d19af9daa13ae4eb7c2059d85dfbb))
|
|
112
|
+
* partition-keys related ui components ([c21b4d2](https://github.com/hatiolab/operato/commit/c21b4d292ca4a6d6b4bf774a570dbabd349528fc))
|
|
113
|
+
|
|
114
|
+
## [1.0.0-alpha.30](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.29...v1.0.0-alpha.30) (2022-03-18)
|
|
115
|
+
|
|
116
|
+
## [1.0.0-alpha.29](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.28...v1.0.0-alpha.29) (2022-03-17)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
### :bug: Bug Fix
|
|
120
|
+
|
|
121
|
+
* datalist in ox-input-partition-keys ([a25e3a6](https://github.com/hatiolab/operato/commit/a25e3a66cf5f7a25bca057be90ef336b29e915a7))
|
|
122
|
+
* typo ([1f8f2da](https://github.com/hatiolab/operato/commit/1f8f2da3b4780df9f747065a457f6cafb5d9e9cf))
|
|
123
|
+
|
|
124
|
+
## [1.0.0-alpha.28](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.26...v1.0.0-alpha.28) (2022-03-17)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### :rocket: New Features
|
|
128
|
+
|
|
129
|
+
* add ox-grist-editor for partition-keys ([7672a27](https://github.com/hatiolab/operato/commit/7672a2729f78475602733a83779f6a7a96e128fd))
|
|
130
|
+
|
|
131
|
+
## [1.0.0-alpha.26](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.25...v1.0.0-alpha.26) (2022-03-17)
|
|
132
|
+
|
|
133
|
+
## [1.0.0-alpha.25](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.24...v1.0.0-alpha.25) (2022-03-17)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
### :bug: Bug Fix
|
|
137
|
+
|
|
138
|
+
* typo ([907aceb](https://github.com/hatiolab/operato/commit/907acebaf882613991bce064efea435c2d148543))
|
|
139
|
+
|
|
140
|
+
## [1.0.0-alpha.24](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.23...v1.0.0-alpha.24) (2022-03-17)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
### :bug: Bug Fix
|
|
144
|
+
|
|
145
|
+
* refactoring grist-editor, property-editor and input ([bdc3197](https://github.com/hatiolab/operato/commit/bdc31977d148c80a3ac0bea4b33160bac277df1e))
|
|
146
|
+
* refactoring grist-editor, property-editor and input ([ea7431a](https://github.com/hatiolab/operato/commit/ea7431a5e2dfd96ef392c1905e9622df7c2ef88c))
|
|
147
|
+
|
|
148
|
+
## [1.0.0-alpha.23](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.22...v1.0.0-alpha.23) (2022-03-17)
|
|
149
|
+
|
|
150
|
+
## [1.0.0-alpha.22](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.21...v1.0.0-alpha.22) (2022-03-17)
|
|
151
|
+
|
|
152
|
+
## [1.0.0-alpha.21](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.20...v1.0.0-alpha.21) (2022-03-16)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
### :rocket: New Features
|
|
156
|
+
|
|
157
|
+
* @operato/ccp module added ([f08ba5a](https://github.com/hatiolab/operato/commit/f08ba5a464c04b7fb132c6f18de975997087846a))
|
|
158
|
+
|
|
159
|
+
## [1.0.0-alpha.20](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.19...v1.0.0-alpha.20) (2022-03-15)
|
|
160
|
+
|
|
161
|
+
## [1.0.0-alpha.19](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.18...v1.0.0-alpha.19) (2022-03-14)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
### :bug: Bug Fix
|
|
165
|
+
|
|
166
|
+
* image-selector in ox-input-background-pattern ([b88c6e1](https://github.com/hatiolab/operato/commit/b88c6e141d5d636bff4b29fbae3c790d80b641bc))
|
|
167
|
+
|
|
168
|
+
## [1.0.0-alpha.18](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.17...v1.0.0-alpha.18) (2022-03-14)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
### :bug: Bug Fix
|
|
172
|
+
|
|
173
|
+
* missing font module import ([a5348cf](https://github.com/hatiolab/operato/commit/a5348cf0d567927f18bf31bba09994f3fbf742f6))
|
|
174
|
+
|
|
175
|
+
## [1.0.0-alpha.17](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.16...v1.0.0-alpha.17) (2022-03-13)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
### :bug: Bug Fix
|
|
179
|
+
|
|
180
|
+
* some missings in font module ([6c1ba6d](https://github.com/hatiolab/operato/commit/6c1ba6d89b8ff75b03c6b4ce813f5d3d09c7437b))
|
|
181
|
+
|
|
182
|
+
## [1.0.0-alpha.16](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.15...v1.0.0-alpha.16) (2022-03-13)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
### :bug: Bug Fix
|
|
186
|
+
|
|
187
|
+
* downgrad graphql related libraries ([d26b80f](https://github.com/hatiolab/operato/commit/d26b80fc31b10bfd3bf31b6473151af52f857c66))
|
|
188
|
+
|
|
189
|
+
## [1.0.0-alpha.15](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2022-03-13)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
### :rocket: New Features
|
|
193
|
+
|
|
194
|
+
* migrate input, property-editor from things-factory ([dbd5e73](https://github.com/hatiolab/operato/commit/dbd5e73eac328e72c4bb7abd113a819532bc894d))
|
|
195
|
+
|
|
196
|
+
## [1.0.0-alpha.14](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.13...v1.0.0-alpha.14) (2022-03-13)
|
|
197
|
+
|
|
198
|
+
## [1.0.0-alpha.13](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2022-03-13)
|
|
199
|
+
|
|
200
|
+
## [1.0.0-alpha.12](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.11...v1.0.0-alpha.12) (2022-03-13)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
### :rocket: New Features
|
|
204
|
+
|
|
205
|
+
* migrate input, property-editor from things-factory ([4800d85](https://github.com/hatiolab/operato/commit/4800d859473bf623325233a7f2af851e5d093dcb))
|
|
206
|
+
|
|
207
|
+
## [1.0.0-alpha.11](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.10...v1.0.0-alpha.11) (2022-03-12)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
### :bug: Bug Fix
|
|
211
|
+
|
|
212
|
+
* code-editor for grist ([cb80692](https://github.com/hatiolab/operato/commit/cb80692039e41d7b94b98ac1845822563e179e24))
|
|
213
|
+
* ox-property-editor-attachment-selector ([a1a2d20](https://github.com/hatiolab/operato/commit/a1a2d20640746c891248fdb729097614676c9cff))
|
|
214
|
+
|
|
215
|
+
## [1.0.0-alpha.10](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2022-03-12)
|
|
216
|
+
|
|
217
|
+
## [1.0.0-alpha.9](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2022-03-12)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
### :rocket: New Features
|
|
221
|
+
|
|
222
|
+
* settled concept for input, property-editor, grist-editor, so on ([0c9e1d0](https://github.com/hatiolab/operato/commit/0c9e1d054c7aef5d965868242cf471667af7a3c3))
|
|
223
|
+
|
|
224
|
+
## [1.0.0-alpha.8](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2022-03-11)
|
|
225
|
+
|
|
226
|
+
## [1.0.0-alpha.7](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2022-03-11)
|
|
227
|
+
|
|
228
|
+
## [1.0.0-alpha.6](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2022-03-11)
|
|
229
|
+
|
|
230
|
+
## [1.0.0-alpha.5](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2022-03-11)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
### :bug: Bug Fix
|
|
234
|
+
|
|
235
|
+
* migrate parameter-editor from things-factory ([019a30d](https://github.com/hatiolab/operato/commit/019a30df6fd4c8a273d4194d13f5784ed6f8d956))
|
|
236
|
+
|
|
237
|
+
## [1.0.0-alpha.4](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2022-03-11)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
### :rocket: New Features
|
|
241
|
+
|
|
242
|
+
* start migration grist editors from things-factory ([8b31c7f](https://github.com/hatiolab/operato/commit/8b31c7f00ae9b32e68f6860c559a768c3d456704))
|
|
243
|
+
|
|
244
|
+
## [1.0.0-alpha.3](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2022-03-10)
|
|
245
|
+
|
|
246
|
+
## [1.0.0-alpha.2](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2022-03-10)
|
|
247
|
+
|
|
248
|
+
## [1.0.0-alpha.1](https://github.com/hatiolab/operato/compare/v0.4.3...v1.0.0-alpha.1) (2022-03-09)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
### :rocket: New Features
|
|
252
|
+
|
|
253
|
+
* 1.0-alpha ([42f87cf](https://github.com/hatiolab/operato/commit/42f87cf6a3cef0381db91ecb1179e63c64c01370))
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
6
257
|
## [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
258
|
|
|
8
259
|
**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":[],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,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/B,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,aAAa;SACrB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AA3HQ,cAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiClB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAgD;AAC/C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,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,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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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;GA6BlB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAA4B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAA4D;AAC5D;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;mDAAoC;AAE3C;IAAlB,KAAK,CAAC,UAAU,CAAC;yCAAkB;AAxCzB,UAAU;IADtB,aAAa,CAAC,gBAAgB,CAAC;GACnB,UAAU,CAgLtB;SAhLY,UAAU","sourcesContent":["import '@operato/data-grist'\n\nimport {\n DataGrist,\n FetchOption,\n GristConfig,\n GristData,\n GristRecord,\n ZERO_CONFIG,\n ZERO_DATA\n} from '@operato/data-grist'\nimport { LitElement, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport gql from 'graphql-tag'\nimport { i18next } from '@operato/i18n'\nimport { isMobileDevice } from '@operato/utils'\n\n@customElement('ox-id-selector')\nexport class IdSelector extends LitElement {\n static styles = 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-grist {\n flex: 1;\n }\n\n #filters {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n }\n\n #filters > * {\n padding: var(--padding-default) var(--padding-wide);\n }\n\n .button-container {\n display: flex;\n margin-left: auto;\n }\n `\n\n @property({ type: String }) value?: string\n @property({ type: Object }) config: any\n @property({ type: Object }) data: GristData = ZERO_DATA\n @property({ type: String }) queryName!: string\n @property({ type: Object }) basicArgs: any\n @property({ type: Object }) confirmCallback?: (record: GristRecord | undefined) => void\n @property({ type: Array }) selectedRecords: GristRecord[] = []\n\n @query('ox-grist') grist!: DataGrist\n\n render() {\n return html`\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.config}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .selectedRecords=${this.selectedRecords}\n >\n <div id=\"filters\" slot=\"headless\">\n <ox-filters-form></ox-filters-form>\n </div>\n </ox-grist>\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 oncancel() {\n history.back()\n }\n\n onconfirm() {\n this.confirmCallback && this.confirmCallback(this.selected)\n history.back()\n }\n\n async firstUpdated() {\n this.config = {\n columns: [\n {\n type: 'gutter',\n gutterName: 'sequence'\n },\n {\n type: 'gutter',\n gutterName: 'row-selector',\n multiple: false\n },\n {\n type: 'string',\n name: 'id',\n header: i18next.t('field.id'),\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n align: 'left'\n },\n filter: 'search',\n sortable: true,\n width: 160\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n align: 'left'\n },\n filter: 'search',\n sortable: true,\n width: 300\n }\n ],\n rows: {\n selectable: {\n multiple: false\n },\n handlers: {\n click: 'select-row'\n }\n },\n pagination: {\n infinite: true\n }\n }\n\n await this.updateComplete\n\n /* TODO config가 설정될 때, fetch() 가 동작하므로, fetch 완료 이벤트를 받아서, selected를 설정해주는 것이 좋겠다. \n 현재는 fetch() 가 두번 일어난다.\n */\n await this.grist.fetch()\n\n var selected = this.grist.data.records.find(item => this.value == item.id)\n if (selected) {\n this.selectedRecords = [selected]\n }\n /* TODO config가 설정될 때, fetch() 가 동작하므로, fetch 완료 이벤트를 받아서, selected를 설정해주는 것이 좋겠다. */\n\n await this.updateComplete\n this.grist.focus()\n }\n\n async fetchHandler({ page = 1, limit = 100, sorters = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n q: ${this.queryName}(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings: sorters\n }\n })\n\n return {\n total: response.data.q.total || 0,\n records: response.data.q.items || []\n }\n }\n\n get selected() {\n var grist = this.renderRoot.querySelector('ox-grist') as DataGrist\n\n var selected = grist.selected\n\n return selected && selected.length > 0 ? selected[0] : undefined\n }\n}\n"]}
|