@operato/attachment 1.0.0-alpha.9 → 1.0.0-beta.2

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,390 @@
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.2](https://github.com/hatiolab/operato/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2022-04-12)
7
+
8
+ **Note:** Version bump only for package @operato/attachment
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.0.0-beta.1](https://github.com/hatiolab/operato/compare/v1.0.0-beta.0...v1.0.0-beta.1) (2022-04-11)
15
+
16
+ **Note:** Version bump only for package @operato/attachment
17
+
18
+
19
+
20
+
21
+
22
+ ## [1.0.0-beta.0](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.53...v1.0.0-beta.0) (2022-04-10)
23
+
24
+ **Note:** Version bump only for package @operato/attachment
25
+
26
+
27
+
28
+
29
+
30
+ ## [1.0.0-alpha.53](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.52...v1.0.0-alpha.53) (2022-04-08)
31
+
32
+ **Note:** Version bump only for package @operato/attachment
33
+
34
+
35
+
36
+
37
+
38
+ ## [1.0.0-alpha.52](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.51...v1.0.0-alpha.52) (2022-04-08)
39
+
40
+ **Note:** Version bump only for package @operato/attachment
41
+
42
+
43
+
44
+
45
+
46
+ ## [1.0.0-alpha.51](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.50...v1.0.0-alpha.51) (2022-04-05)
47
+
48
+ **Note:** Version bump only for package @operato/attachment
49
+
50
+
51
+
52
+
53
+
54
+ ## [1.0.0-alpha.50](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.49...v1.0.0-alpha.50) (2022-04-04)
55
+
56
+ **Note:** Version bump only for package @operato/attachment
57
+
58
+
59
+
60
+
61
+
62
+ ## [1.0.0-alpha.49](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.48...v1.0.0-alpha.49) (2022-04-04)
63
+
64
+
65
+ ### :bug: Bug Fix
66
+
67
+ * lit@2.2.1 ([6707752](https://github.com/hatiolab/operato/commit/6707752907d24f7ecbe248cba18a4b18cfda282f))
68
+
69
+
70
+
71
+ ## [1.0.0-alpha.48](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.47...v1.0.0-alpha.48) (2022-04-03)
72
+
73
+ **Note:** Version bump only for package @operato/attachment
74
+
75
+
76
+
77
+
78
+
79
+ ## [1.0.0-alpha.47](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.46...v1.0.0-alpha.47) (2022-04-02)
80
+
81
+ **Note:** Version bump only for package @operato/attachment
82
+
83
+
84
+
85
+
86
+
87
+ ## [1.0.0-alpha.46](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.45...v1.0.0-alpha.46) (2022-04-02)
88
+
89
+ **Note:** Version bump only for package @operato/attachment
90
+
91
+
92
+
93
+
94
+
95
+ ## [1.0.0-alpha.45](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.44...v1.0.0-alpha.45) (2022-03-31)
96
+
97
+ **Note:** Version bump only for package @operato/attachment
98
+
99
+
100
+
101
+
102
+
103
+ ## [1.0.0-alpha.44](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.43...v1.0.0-alpha.44) (2022-03-31)
104
+
105
+ **Note:** Version bump only for package @operato/attachment
106
+
107
+
108
+
109
+
110
+
111
+ ## [1.0.0-alpha.43](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.42...v1.0.0-alpha.43) (2022-03-30)
112
+
113
+ **Note:** Version bump only for package @operato/attachment
114
+
115
+
116
+
117
+
118
+
119
+ ## [1.0.0-alpha.42](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.41...v1.0.0-alpha.42) (2022-03-29)
120
+
121
+ **Note:** Version bump only for package @operato/attachment
122
+
123
+
124
+
125
+
126
+
127
+ ## [1.0.0-alpha.41](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.40...v1.0.0-alpha.41) (2022-03-27)
128
+
129
+ **Note:** Version bump only for package @operato/attachment
130
+
131
+
132
+
133
+
134
+
135
+ ## [1.0.0-alpha.40](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.39...v1.0.0-alpha.40) (2022-03-26)
136
+
137
+ **Note:** Version bump only for package @operato/attachment
138
+
139
+
140
+
141
+
142
+
143
+ ## [1.0.0-alpha.39](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.38...v1.0.0-alpha.39) (2022-03-25)
144
+
145
+ **Note:** Version bump only for package @operato/attachment
146
+
147
+
148
+
149
+
150
+
151
+ ## [1.0.0-alpha.38](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.37...v1.0.0-alpha.38) (2022-03-25)
152
+
153
+ **Note:** Version bump only for package @operato/attachment
154
+
155
+
156
+
157
+
158
+
159
+ ## [1.0.0-alpha.37](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2022-03-25)
160
+
161
+ **Note:** Version bump only for package @operato/attachment
162
+
163
+
164
+
165
+
166
+
167
+ ## [1.0.0-alpha.36](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.35...v1.0.0-alpha.36) (2022-03-21)
168
+
169
+ **Note:** Version bump only for package @operato/attachment
170
+
171
+
172
+
173
+
174
+
175
+ ## [1.0.0-alpha.35](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.34...v1.0.0-alpha.35) (2022-03-21)
176
+
177
+ **Note:** Version bump only for package @operato/attachment
178
+
179
+
180
+
181
+
182
+
183
+ ## [1.0.0-alpha.34](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.33...v1.0.0-alpha.34) (2022-03-20)
184
+
185
+ **Note:** Version bump only for package @operato/attachment
186
+
187
+
188
+
189
+
190
+
191
+ ## [1.0.0-alpha.33](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.32...v1.0.0-alpha.33) (2022-03-19)
192
+
193
+ **Note:** Version bump only for package @operato/attachment
194
+
195
+
196
+
197
+
198
+
199
+ ## [1.0.0-alpha.32](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.31...v1.0.0-alpha.32) (2022-03-19)
200
+
201
+ **Note:** Version bump only for package @operato/attachment
202
+
203
+
204
+
205
+
206
+
207
+ ## [1.0.0-alpha.31](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.30...v1.0.0-alpha.31) (2022-03-19)
208
+
209
+ **Note:** Version bump only for package @operato/attachment
210
+
211
+
212
+
213
+
214
+
215
+ ## [1.0.0-alpha.30](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.29...v1.0.0-alpha.30) (2022-03-18)
216
+
217
+ **Note:** Version bump only for package @operato/attachment
218
+
219
+
220
+
221
+
222
+
223
+ ## [1.0.0-alpha.29](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.28...v1.0.0-alpha.29) (2022-03-17)
224
+
225
+ **Note:** Version bump only for package @operato/attachment
226
+
227
+
228
+
229
+
230
+
231
+ ## [1.0.0-alpha.28](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.26...v1.0.0-alpha.28) (2022-03-17)
232
+
233
+ **Note:** Version bump only for package @operato/attachment
234
+
235
+
236
+
237
+
238
+
239
+ ## [1.0.0-alpha.27](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.26...v1.0.0-alpha.27) (2022-03-17)
240
+
241
+ **Note:** Version bump only for package @operato/attachment
242
+
243
+
244
+
245
+
246
+
247
+ ## [1.0.0-alpha.26](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.25...v1.0.0-alpha.26) (2022-03-17)
248
+
249
+ **Note:** Version bump only for package @operato/attachment
250
+
251
+
252
+
253
+
254
+
255
+ ## [1.0.0-alpha.25](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.24...v1.0.0-alpha.25) (2022-03-17)
256
+
257
+ **Note:** Version bump only for package @operato/attachment
258
+
259
+
260
+
261
+
262
+
263
+ ## [1.0.0-alpha.24](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.23...v1.0.0-alpha.24) (2022-03-17)
264
+
265
+ **Note:** Version bump only for package @operato/attachment
266
+
267
+
268
+
269
+
270
+
271
+ ## [1.0.0-alpha.23](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.22...v1.0.0-alpha.23) (2022-03-17)
272
+
273
+ **Note:** Version bump only for package @operato/attachment
274
+
275
+
276
+
277
+
278
+
279
+ ## [1.0.0-alpha.22](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.21...v1.0.0-alpha.22) (2022-03-17)
280
+
281
+ **Note:** Version bump only for package @operato/attachment
282
+
283
+
284
+
285
+
286
+
287
+ ## [1.0.0-alpha.21](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.20...v1.0.0-alpha.21) (2022-03-16)
288
+
289
+ **Note:** Version bump only for package @operato/attachment
290
+
291
+
292
+
293
+
294
+
295
+ ## [1.0.0-alpha.20](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.19...v1.0.0-alpha.20) (2022-03-15)
296
+
297
+ **Note:** Version bump only for package @operato/attachment
298
+
299
+
300
+
301
+
302
+
303
+ ## [1.0.0-alpha.19](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.18...v1.0.0-alpha.19) (2022-03-14)
304
+
305
+ **Note:** Version bump only for package @operato/attachment
306
+
307
+
308
+
309
+
310
+
311
+ ## [1.0.0-alpha.18](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.17...v1.0.0-alpha.18) (2022-03-14)
312
+
313
+ **Note:** Version bump only for package @operato/attachment
314
+
315
+
316
+
317
+
318
+
319
+ ## [1.0.0-alpha.17](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.16...v1.0.0-alpha.17) (2022-03-13)
320
+
321
+ **Note:** Version bump only for package @operato/attachment
322
+
323
+
324
+
325
+
326
+
327
+ ## [1.0.0-alpha.16](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.15...v1.0.0-alpha.16) (2022-03-13)
328
+
329
+ **Note:** Version bump only for package @operato/attachment
330
+
331
+
332
+
333
+
334
+
335
+ ## [1.0.0-alpha.15](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2022-03-13)
336
+
337
+ **Note:** Version bump only for package @operato/attachment
338
+
339
+
340
+
341
+
342
+
343
+ ## [1.0.0-alpha.14](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.13...v1.0.0-alpha.14) (2022-03-13)
344
+
345
+ **Note:** Version bump only for package @operato/attachment
346
+
347
+
348
+
349
+
350
+
351
+ ## [1.0.0-alpha.13](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2022-03-13)
352
+
353
+ **Note:** Version bump only for package @operato/attachment
354
+
355
+
356
+
357
+
358
+
359
+ ## [1.0.0-alpha.12](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.11...v1.0.0-alpha.12) (2022-03-13)
360
+
361
+
362
+ ### :bug: Bug Fix
363
+
364
+ * missing import ([c9ed5f9](https://github.com/hatiolab/operato/commit/c9ed5f9c3566e899ebd40e920d9f08200ca5a5c6))
365
+
366
+
367
+ ### :rocket: New Features
368
+
369
+ * migrate input, property-editor from things-factory ([4800d85](https://github.com/hatiolab/operato/commit/4800d859473bf623325233a7f2af851e5d093dcb))
370
+
371
+
372
+
373
+ ## [1.0.0-alpha.11](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.10...v1.0.0-alpha.11) (2022-03-12)
374
+
375
+
376
+ ### :bug: Bug Fix
377
+
378
+ * ox-property-editor-attachment-selector ([a1a2d20](https://github.com/hatiolab/operato/commit/a1a2d20640746c891248fdb729097614676c9cff))
379
+
380
+
381
+
382
+ ## [1.0.0-alpha.10](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2022-03-12)
383
+
384
+ **Note:** Version bump only for package @operato/attachment
385
+
386
+
387
+
388
+
389
+
6
390
  ## [1.0.0-alpha.9](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2022-03-12)
7
391
 
8
392
 
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import '@material/mwc-icon';
5
+ import './ox-attachment-list.js';
6
+ import { LitElement } from 'lit';
7
+ export declare class OxPropertyEditorAttachmentSelector extends LitElement {
8
+ static styles: import("lit").CSSResult[];
9
+ value: string;
10
+ properties: any;
11
+ private popup?;
12
+ render(): import("lit-html").TemplateResult<1>;
13
+ getIconByCategory(): "image" | "library_music" | "video_library" | "attachment";
14
+ _onInputChanged(e: KeyboardEvent): void;
15
+ openSelector(): void;
16
+ }
@@ -0,0 +1,108 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import '@material/mwc-icon';
6
+ import './ox-attachment-list.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 OxPropertyEditorAttachmentSelector = class OxPropertyEditorAttachmentSelector extends LitElement {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.value = '';
15
+ }
16
+ render() {
17
+ return html `
18
+ <input
19
+ id="text"
20
+ type="text"
21
+ .value=${this.value || ''}
22
+ @change=${(e) => this._onInputChanged(e)}
23
+ />
24
+
25
+ <mwc-icon @click=${() => this.openSelector()}>${this.getIconByCategory()}</mwc-icon>
26
+ `;
27
+ }
28
+ getIconByCategory() {
29
+ var { category } = this.properties || {};
30
+ switch (category) {
31
+ case 'audio':
32
+ return 'library_music';
33
+ case 'video':
34
+ return 'video_library';
35
+ case 'image':
36
+ return 'image';
37
+ case 'text':
38
+ case 'application':
39
+ default:
40
+ return 'attachment';
41
+ }
42
+ }
43
+ _onInputChanged(e) {
44
+ this.value = e.target.value;
45
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
46
+ }
47
+ openSelector() {
48
+ if (this.popup) {
49
+ delete this.popup;
50
+ }
51
+ /*
52
+ * 기존 설정된 이미지가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.
53
+ * 주의. value는 object일 수도 있고, string일 수도 있다.
54
+ * string인 경우에는 해당 보드의 id로 해석한다.
55
+ */
56
+ var value = this.value || {};
57
+ var { category = 'application' } = this.properties || {};
58
+ var template = html `
59
+ <ox-attachment-list
60
+ .creatable=${true}
61
+ .category=${category}
62
+ @attachment-selected=${async (e) => {
63
+ var attachment = e.detail.attachment;
64
+ this.value = `/attachment/${attachment.path}`;
65
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
66
+ this.popup && this.popup.close();
67
+ }}
68
+ ></ox-attachment-list>
69
+ `;
70
+ this.popup = openPopup(template, {
71
+ backdrop: true,
72
+ size: 'large',
73
+ title: i18next.t('title.select attachment')
74
+ });
75
+ }
76
+ };
77
+ OxPropertyEditorAttachmentSelector.styles = [
78
+ css `
79
+ :host {
80
+ position: relative;
81
+ display: inline-block;
82
+ }
83
+
84
+ input[type='text'] {
85
+ box-sizing: border-box;
86
+ width: 100%;
87
+ height: 100%;
88
+ border: 1px solid rgba(0, 0, 0, 0.2);
89
+ }
90
+
91
+ mwc-icon {
92
+ position: absolute;
93
+ top: 0;
94
+ right: 3px;
95
+ }
96
+ `
97
+ ];
98
+ __decorate([
99
+ property({ type: String })
100
+ ], OxPropertyEditorAttachmentSelector.prototype, "value", void 0);
101
+ __decorate([
102
+ property({ type: Object })
103
+ ], OxPropertyEditorAttachmentSelector.prototype, "properties", void 0);
104
+ OxPropertyEditorAttachmentSelector = __decorate([
105
+ customElement('ox-attachment-selector')
106
+ ], OxPropertyEditorAttachmentSelector);
107
+ export { OxPropertyEditorAttachmentSelector };
108
+ //# sourceMappingURL=ox-attachment-selector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-attachment-selector.js","sourceRoot":"","sources":["../../src/ox-attachment-selector.ts"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AgG9C;SAhGY,kCAAkC","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/mwc-icon'\nimport './ox-attachment-list.js'\n\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-attachment-selector')\nexport class OxPropertyEditorAttachmentSelector extends LitElement {\n static styles = [\n css`\n :host {\n position: relative;\n display: inline-block;\n }\n\n input[type='text'] {\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n mwc-icon {\n position: absolute;\n top: 0;\n right: 3px;\n }\n `\n ]\n\n @property({ type: String }) value: string = ''\n @property({ type: Object }) properties: any\n\n private popup?: PopupHandle\n\n render() {\n return html`\n <input\n id=\"text\"\n type=\"text\"\n .value=${this.value || ''}\n @change=${(e: KeyboardEvent) => this._onInputChanged(e)}\n />\n\n <mwc-icon @click=${() => this.openSelector()}>${this.getIconByCategory()}</mwc-icon>\n `\n }\n\n getIconByCategory() {\n var { category } = this.properties || {}\n switch (category) {\n case 'audio':\n return 'library_music'\n case 'video':\n return 'video_library'\n case 'image':\n return 'image'\n case 'text':\n case 'application':\n default:\n return 'attachment'\n }\n }\n\n _onInputChanged(e: KeyboardEvent) {\n this.value = (e.target as HTMLInputElement).value\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n /*\n * 기존 설정된 이미지가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.\n * 주의. value는 object일 수도 있고, string일 수도 있다.\n * string인 경우에는 해당 보드의 id로 해석한다.\n */\n var value = this.value || {}\n var { category = 'application' } = this.properties || {}\n\n var template = html`\n <ox-attachment-list\n .creatable=${true}\n .category=${category}\n @attachment-selected=${async (e: CustomEvent) => {\n var attachment = e.detail.attachment\n this.value = `/attachment/${attachment.path}`\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n\n this.popup && this.popup.close()\n }}\n ></ox-attachment-list>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.select attachment')\n })\n }\n}\n"]}
@@ -1,16 +1 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
- import '@material/mwc-icon';
5
- import './ox-attachment-list.js';
6
- import { OxPropertyEditor } from '@operato/property-editor';
7
- export declare class OxPropertyEditorAttachmentSelector extends OxPropertyEditor {
8
- static styles: import("lit").CSSResult[];
9
- value: string;
10
- properties: any;
11
- private popup?;
12
- render(): import("lit-html").TemplateResult<1>;
13
- getIconByCategory(): "image" | "library_music" | "video_library" | "attachment";
14
- _onInputChanged(e: KeyboardEvent): void;
15
- openSelector(): void;
16
- }
1
+ import './ox-attachment-selector';
@@ -1,109 +1,16 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
1
  import { __decorate } from "tslib";
5
- import '@material/mwc-icon';
6
- import './ox-attachment-list.js';
7
- import { openPopup } from '@operato/layout';
8
- import { css, html } from 'lit';
9
- import { customElement, property } from 'lit/decorators.js';
2
+ import './ox-attachment-selector';
10
3
  import { OxPropertyEditor } from '@operato/property-editor';
11
- import { i18next } from '@operato/i18n';
4
+ import { customElement } from 'lit/decorators.js';
5
+ import { html } from 'lit';
12
6
  let OxPropertyEditorAttachmentSelector = class OxPropertyEditorAttachmentSelector extends OxPropertyEditor {
13
- constructor() {
14
- super(...arguments);
15
- this.value = '';
16
- }
17
- render() {
7
+ editorTemplate() {
18
8
  return html `
19
- <input
20
- id="text"
21
- type="text"
22
- .value=${this.value || ''}
23
- @change=${(e) => this._onInputChanged(e)}
24
- />
25
-
26
- <mwc-icon @click=${() => this.openSelector()}>${this.getIconByCategory()}</mwc-icon>
27
- `;
28
- }
29
- getIconByCategory() {
30
- var { category } = this.properties || {};
31
- switch (category) {
32
- case 'audio':
33
- return 'library_music';
34
- case 'video':
35
- return 'video_library';
36
- case 'image':
37
- return 'image';
38
- case 'text':
39
- case 'application':
40
- default:
41
- return 'attachment';
42
- }
43
- }
44
- _onInputChanged(e) {
45
- this.value = e.target.value;
46
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
47
- }
48
- openSelector() {
49
- if (this.popup) {
50
- delete this.popup;
51
- }
52
- /*
53
- * 기존 설정된 이미지가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.
54
- * 주의. value는 object일 수도 있고, string일 수도 있다.
55
- * string인 경우에는 해당 보드의 id로 해석한다.
56
- */
57
- var value = this.value || {};
58
- var { category = 'application' } = this.properties || {};
59
- var template = html `
60
- <ox-attachment-list
61
- .creatable=${true}
62
- .category=${category}
63
- @attachment-selected=${async (e) => {
64
- var attachment = e.detail.attachment;
65
- this.value = `/attachment/${attachment.path}`;
66
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
67
- this.popup && this.popup.close();
68
- }}
69
- ></ox-attachment-list>
9
+ <ox-attachment-selector id="editor" .value=${this.value} .properties=${this.property}></ox-attachment-selector>
70
10
  `;
71
- this.popup = openPopup(template, {
72
- backdrop: true,
73
- size: 'large',
74
- title: i18next.t('title.select attachment')
75
- });
76
11
  }
77
12
  };
78
- OxPropertyEditorAttachmentSelector.styles = [
79
- css `
80
- :host {
81
- position: relative;
82
- display: inline-block;
83
- }
84
-
85
- input[type='text'] {
86
- box-sizing: border-box;
87
- width: 100%;
88
- height: 100%;
89
- border: 1px solid rgba(0, 0, 0, 0.2);
90
- }
91
-
92
- mwc-icon {
93
- position: absolute;
94
- top: 0;
95
- right: 3px;
96
- }
97
- `
98
- ];
99
- __decorate([
100
- property({ type: String })
101
- ], OxPropertyEditorAttachmentSelector.prototype, "value", void 0);
102
- __decorate([
103
- property({ type: Object })
104
- ], OxPropertyEditorAttachmentSelector.prototype, "properties", void 0);
105
13
  OxPropertyEditorAttachmentSelector = __decorate([
106
14
  customElement('ox-property-editor-attachment-selector')
107
15
  ], OxPropertyEditorAttachmentSelector);
108
- export { OxPropertyEditorAttachmentSelector };
109
16
  //# sourceMappingURL=ox-property-editor-attachment-selector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ox-property-editor-attachment-selector.js","sourceRoot":"","sources":["../../src/ox-property-editor-attachment-selector.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,oBAAoB,CAAA;AAC3B,OAAO,yBAAyB,CAAA;AAEhC,OAAO,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAGvC,IAAa,kCAAkC,GAA/C,MAAa,kCAAmC,SAAQ,gBAAgB;IAAxE;;QAuB8B,UAAK,GAAW,EAAE,CAAA;IAyEhD,CAAC;IApEC,MAAM;QACJ,OAAO,IAAI,CAAA;;;;iBAIE,IAAI,CAAC,KAAK,IAAI,EAAE;kBACf,CAAC,CAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;;;yBAGtC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,IAAI,CAAC,iBAAiB,EAAE;KACzE,CAAA;IACH,CAAC;IAED,iBAAiB;QACf,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE,CAAA;QACxC,QAAQ,QAAQ,EAAE;YAChB,KAAK,OAAO;gBACV,OAAO,eAAe,CAAA;YACxB,KAAK,OAAO;gBACV,OAAO,eAAe,CAAA;YACxB,KAAK,OAAO;gBACV,OAAO,OAAO,CAAA;YAChB,KAAK,MAAM,CAAC;Y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AAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;KAkBF;CACF,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sEAAgB;AAxBhC,kCAAkC;IAD9C,aAAa,CAAC,wCAAwC,CAAC;GAC3C,kCAAkC,CAgG9C;SAhGY,kCAAkC","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/mwc-icon'\nimport './ox-attachment-list.js'\n\nimport { PopupHandle, openPopup } from '@operato/layout'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxPropertyEditor } from '@operato/property-editor'\nimport { i18next } from '@operato/i18n'\n\n@customElement('ox-property-editor-attachment-selector')\nexport class OxPropertyEditorAttachmentSelector extends OxPropertyEditor {\n static styles = [\n css`\n :host {\n position: relative;\n display: inline-block;\n }\n\n input[type='text'] {\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n mwc-icon {\n position: absolute;\n top: 0;\n right: 3px;\n }\n `\n ]\n\n @property({ type: String }) value: string = ''\n @property({ type: Object }) properties: any\n\n private popup?: PopupHandle\n\n render() {\n return html`\n <input\n id=\"text\"\n type=\"text\"\n .value=${this.value || ''}\n @change=${(e: KeyboardEvent) => this._onInputChanged(e)}\n />\n\n <mwc-icon @click=${() => this.openSelector()}>${this.getIconByCategory()}</mwc-icon>\n `\n }\n\n getIconByCategory() {\n var { category } = this.properties || {}\n switch (category) {\n case 'audio':\n return 'library_music'\n case 'video':\n return 'video_library'\n case 'image':\n return 'image'\n case 'text':\n case 'application':\n default:\n return 'attachment'\n }\n }\n\n _onInputChanged(e: KeyboardEvent) {\n this.value = (e.target as HTMLInputElement).value\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n /*\n * 기존 설정된 이미지가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.\n * 주의. value는 object일 수도 있고, string일 수도 있다.\n * string인 경우에는 해당 보드의 id로 해석한다.\n */\n var value = this.value || {}\n var { category = 'application' } = this.properties || {}\n\n var template = html`\n <ox-attachment-list\n .creatable=${true}\n .category=${category}\n @attachment-selected=${async (e: CustomEvent) => {\n var attachment = e.detail.attachment\n this.value = `/attachment/${attachment.path}`\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n\n this.popup && this.popup.close()\n }}\n ></ox-attachment-list>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.select attachment')\n })\n }\n}\n"]}
1
+ {"version":3,"file":"ox-property-editor-attachment-selector.js","sourceRoot":"","sources":["../../src/ox-property-editor-attachment-selector.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAG1B,IAAM,kCAAkC,GAAxC,MAAM,kCAAmC,SAAQ,gBAAgB;IAC/D,cAAc;QACZ,OAAO,IAAI,CAAA;mDACoC,IAAI,CAAC,KAAK,gBAAgB,IAAI,CAAC,QAAQ;KACrF,CAAA;IACH,CAAC;CACF,CAAA;AANK,kCAAkC;IADvC,aAAa,CAAC,wCAAwC,CAAC;GAClD,kCAAkC,CAMvC","sourcesContent":["import './ox-attachment-selector'\n\nimport { OxPropertyEditor } from '@operato/property-editor'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\n\n@customElement('ox-property-editor-attachment-selector')\nclass OxPropertyEditorAttachmentSelector extends OxPropertyEditor {\n editorTemplate() {\n return html`\n <ox-attachment-selector id=\"editor\" .value=${this.value} .properties=${this.property}></ox-attachment-selector>\n `\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ import './ox-attachment-selector';