@operato/popup 1.0.0-beta.8 → 1.0.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +389 -0
  2. package/assets/images/no-image.png +0 -0
  3. package/dist/src/index.d.ts +5 -4
  4. package/dist/src/index.js +5 -4
  5. package/dist/src/index.js.map +1 -1
  6. package/dist/src/open-popup.d.ts +59 -0
  7. package/dist/src/open-popup.js +84 -0
  8. package/dist/src/open-popup.js.map +1 -0
  9. package/dist/src/ox-floating-overlay.d.ts +21 -0
  10. package/dist/src/ox-floating-overlay.js +349 -0
  11. package/dist/src/ox-floating-overlay.js.map +1 -0
  12. package/dist/src/ox-popup.js +4 -2
  13. package/dist/src/ox-popup.js.map +1 -1
  14. package/dist/stories/open-popup.stories.d.ts +46 -0
  15. package/dist/stories/open-popup.stories.js +51 -0
  16. package/dist/stories/open-popup.stories.js.map +1 -0
  17. package/dist/stories/ox-popup-list.stories.d.ts +18 -0
  18. package/dist/stories/ox-popup-list.stories.js +50 -0
  19. package/dist/stories/ox-popup-list.stories.js.map +1 -0
  20. package/dist/stories/ox-popup-menu.stories.d.ts +19 -0
  21. package/dist/stories/ox-popup-menu.stories.js +131 -0
  22. package/dist/stories/ox-popup-menu.stories.js.map +1 -0
  23. package/dist/stories/ox-popup.stories.d.ts +15 -0
  24. package/dist/stories/ox-popup.stories.js +32 -0
  25. package/dist/stories/ox-popup.stories.js.map +1 -0
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +28 -8
  28. package/src/index.ts +6 -4
  29. package/src/open-popup.ts +140 -0
  30. package/src/ox-floating-overlay.ts +330 -0
  31. package/src/ox-popup.ts +4 -2
  32. package/stories/open-popup.stories.ts +81 -0
  33. package/stories/ox-popup-list.stories.ts +65 -0
  34. package/stories/ox-popup-menu.stories.ts +145 -0
  35. package/stories/ox-popup.stories.ts +46 -0
  36. package/themes/app-theme.css +142 -0
  37. package/themes/input-theme.css +19 -0
  38. package/dist/stories/index.stories.d.ts +0 -33
  39. package/dist/stories/index.stories.js +0 -33
  40. package/dist/stories/index.stories.js.map +0 -1
  41. package/stories/index.stories.ts +0 -52
package/CHANGELOG.md CHANGED
@@ -3,6 +3,395 @@
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.6](https://github.com/hatiolab/operato/compare/v1.0.5...v1.0.6) (2022-07-31)
7
+
8
+ **Note:** Version bump only for package @operato/popup
9
+
10
+
11
+
12
+
13
+
14
+ ### [1.0.5](https://github.com/hatiolab/operato/compare/v1.0.4...v1.0.5) (2022-07-31)
15
+
16
+ **Note:** Version bump only for package @operato/popup
17
+
18
+
19
+
20
+
21
+
22
+ ### [1.0.4](https://github.com/hatiolab/operato/compare/v1.0.3...v1.0.4) (2022-07-31)
23
+
24
+ **Note:** Version bump only for package @operato/popup
25
+
26
+
27
+
28
+
29
+
30
+ ### [1.0.3](https://github.com/hatiolab/operato/compare/v1.0.2...v1.0.3) (2022-07-31)
31
+
32
+
33
+ ### :bug: Bug Fix
34
+
35
+ * exports types ([ff5dc11](https://github.com/hatiolab/operato/commit/ff5dc119acbbf5a93459115f3929ba4a6720f9bb))
36
+
37
+
38
+
39
+ ## [1.0.0](https://github.com/hatiolab/operato/compare/v1.0.0-beta.51...v1.0.0) (2022-07-24)
40
+
41
+ **Note:** Version bump only for package @operato/popup
42
+
43
+
44
+
45
+
46
+
47
+ ## [1.0.0-beta.51](https://github.com/hatiolab/operato/compare/v1.0.0-beta.50...v1.0.0-beta.51) (2022-07-22)
48
+
49
+ **Note:** Version bump only for package @operato/popup
50
+
51
+
52
+
53
+
54
+
55
+ ## [1.0.0-beta.50](https://github.com/hatiolab/operato/compare/v1.0.0-beta.49...v1.0.0-beta.50) (2022-07-18)
56
+
57
+ **Note:** Version bump only for package @operato/popup
58
+
59
+
60
+
61
+
62
+
63
+ ## [1.0.0-beta.49](https://github.com/hatiolab/operato/compare/v1.0.0-beta.48...v1.0.0-beta.49) (2022-07-17)
64
+
65
+ **Note:** Version bump only for package @operato/popup
66
+
67
+
68
+
69
+
70
+
71
+ ## [1.0.0-beta.48](https://github.com/hatiolab/operato/compare/v1.0.0-beta.47...v1.0.0-beta.48) (2022-07-17)
72
+
73
+ **Note:** Version bump only for package @operato/popup
74
+
75
+
76
+
77
+
78
+
79
+ ## [1.0.0-beta.47](https://github.com/hatiolab/operato/compare/v1.0.0-beta.46...v1.0.0-beta.47) (2022-07-15)
80
+
81
+ **Note:** Version bump only for package @operato/popup
82
+
83
+
84
+
85
+
86
+
87
+ ## [1.0.0-beta.46](https://github.com/hatiolab/operato/compare/v1.0.0-beta.45...v1.0.0-beta.46) (2022-07-11)
88
+
89
+ **Note:** Version bump only for package @operato/popup
90
+
91
+
92
+
93
+
94
+
95
+ ## [1.0.0-beta.45](https://github.com/hatiolab/operato/compare/v1.0.0-beta.44...v1.0.0-beta.45) (2022-07-09)
96
+
97
+
98
+ ### :bug: Bug Fix
99
+
100
+ * upgrade dependencies ([4986392](https://github.com/hatiolab/operato/commit/4986392e64524b5602cc9a144def239e85524bee))
101
+
102
+
103
+
104
+ ## [1.0.0-beta.44](https://github.com/hatiolab/operato/compare/v1.0.0-beta.43...v1.0.0-beta.44) (2022-07-07)
105
+
106
+ **Note:** Version bump only for package @operato/popup
107
+
108
+
109
+
110
+
111
+
112
+ ## [1.0.0-beta.43](https://github.com/hatiolab/operato/compare/v1.0.0-beta.42...v1.0.0-beta.43) (2022-07-03)
113
+
114
+ **Note:** Version bump only for package @operato/popup
115
+
116
+
117
+
118
+
119
+
120
+ ## [1.0.0-beta.42](https://github.com/hatiolab/operato/compare/v1.0.0-beta.41...v1.0.0-beta.42) (2022-07-03)
121
+
122
+ **Note:** Version bump only for package @operato/popup
123
+
124
+
125
+
126
+
127
+
128
+ ## [1.0.0-beta.41](https://github.com/hatiolab/operato/compare/v1.0.0-beta.40...v1.0.0-beta.41) (2022-06-30)
129
+
130
+ **Note:** Version bump only for package @operato/popup
131
+
132
+
133
+
134
+
135
+
136
+ ## [1.0.0-beta.40](https://github.com/hatiolab/operato/compare/v1.0.0-beta.39...v1.0.0-beta.40) (2022-06-29)
137
+
138
+
139
+ ### :bug: Bug Fix
140
+
141
+ * [#43](https://github.com/hatiolab/operato/issues/43)-datasample ([14ab019](https://github.com/hatiolab/operato/commit/14ab0199311f340c784018b9fc78b70e57b09567))
142
+
143
+
144
+
145
+ ## [1.0.0-beta.39](https://github.com/hatiolab/operato/compare/v1.0.0-beta.38...v1.0.0-beta.39) (2022-06-22)
146
+
147
+ **Note:** Version bump only for package @operato/popup
148
+
149
+
150
+
151
+
152
+
153
+ ## [1.0.0-beta.38](https://github.com/hatiolab/operato/compare/v1.0.0-beta.37...v1.0.0-beta.38) (2022-06-20)
154
+
155
+ **Note:** Version bump only for package @operato/popup
156
+
157
+
158
+
159
+
160
+
161
+ ## [1.0.0-beta.37](https://github.com/hatiolab/operato/compare/v1.0.0-beta.36...v1.0.0-beta.37) (2022-06-20)
162
+
163
+ **Note:** Version bump only for package @operato/popup
164
+
165
+
166
+
167
+
168
+
169
+ ## [1.0.0-beta.36](https://github.com/hatiolab/operato/compare/v1.0.0-beta.35...v1.0.0-beta.36) (2022-06-16)
170
+
171
+ **Note:** Version bump only for package @operato/popup
172
+
173
+
174
+
175
+
176
+
177
+ ## [1.0.0-beta.35](https://github.com/hatiolab/operato/compare/v1.0.0-beta.34...v1.0.0-beta.35) (2022-06-16)
178
+
179
+ **Note:** Version bump only for package @operato/popup
180
+
181
+
182
+
183
+
184
+
185
+ ## [1.0.0-beta.34](https://github.com/hatiolab/operato/compare/v1.0.0-beta.33...v1.0.0-beta.34) (2022-06-16)
186
+
187
+ **Note:** Version bump only for package @operato/popup
188
+
189
+
190
+
191
+
192
+
193
+ ## [1.0.0-beta.33](https://github.com/hatiolab/operato/compare/v1.0.0-beta.32...v1.0.0-beta.33) (2022-06-16)
194
+
195
+ **Note:** Version bump only for package @operato/popup
196
+
197
+
198
+
199
+
200
+
201
+ ## [1.0.0-beta.32](https://github.com/hatiolab/operato/compare/v1.0.0-beta.31...v1.0.0-beta.32) (2022-06-15)
202
+
203
+ **Note:** Version bump only for package @operato/popup
204
+
205
+
206
+
207
+
208
+
209
+ ## [1.0.0-beta.31](https://github.com/hatiolab/operato/compare/v1.0.0-beta.30...v1.0.0-beta.31) (2022-06-15)
210
+
211
+ **Note:** Version bump only for package @operato/popup
212
+
213
+
214
+
215
+
216
+
217
+ ## [1.0.0-beta.30](https://github.com/hatiolab/operato/compare/v1.0.0-beta.29...v1.0.0-beta.30) (2022-06-13)
218
+
219
+ **Note:** Version bump only for package @operato/popup
220
+
221
+
222
+
223
+
224
+
225
+ ## [1.0.0-beta.29](https://github.com/hatiolab/operato/compare/v1.0.0-beta.28...v1.0.0-beta.29) (2022-06-10)
226
+
227
+ **Note:** Version bump only for package @operato/popup
228
+
229
+
230
+
231
+
232
+
233
+ ## [1.0.0-beta.28](https://github.com/hatiolab/operato/compare/v1.0.0-beta.27...v1.0.0-beta.28) (2022-06-10)
234
+
235
+ **Note:** Version bump only for package @operato/popup
236
+
237
+
238
+
239
+
240
+
241
+ ## [1.0.0-beta.27](https://github.com/hatiolab/operato/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2022-06-09)
242
+
243
+ **Note:** Version bump only for package @operato/popup
244
+
245
+
246
+
247
+
248
+
249
+ ## [1.0.0-beta.26](https://github.com/hatiolab/operato/compare/v1.0.0-beta.25...v1.0.0-beta.26) (2022-06-04)
250
+
251
+ **Note:** Version bump only for package @operato/popup
252
+
253
+
254
+
255
+
256
+
257
+ ## [1.0.0-beta.25](https://github.com/hatiolab/operato/compare/v1.0.0-beta.24...v1.0.0-beta.25) (2022-06-02)
258
+
259
+ **Note:** Version bump only for package @operato/popup
260
+
261
+
262
+
263
+
264
+
265
+ ## [1.0.0-beta.24](https://github.com/hatiolab/operato/compare/v1.0.0-beta.23...v1.0.0-beta.24) (2022-06-02)
266
+
267
+ **Note:** Version bump only for package @operato/popup
268
+
269
+
270
+
271
+
272
+
273
+ ## [1.0.0-beta.23](https://github.com/hatiolab/operato/compare/v1.0.0-beta.22...v1.0.0-beta.23) (2022-06-02)
274
+
275
+ **Note:** Version bump only for package @operato/popup
276
+
277
+
278
+
279
+
280
+
281
+ ## [1.0.0-beta.22](https://github.com/hatiolab/operato/compare/v1.0.0-beta.21...v1.0.0-beta.22) (2022-05-31)
282
+
283
+ **Note:** Version bump only for package @operato/popup
284
+
285
+
286
+
287
+
288
+
289
+ ## [1.0.0-beta.21](https://github.com/hatiolab/operato/compare/v1.0.0-beta.20...v1.0.0-beta.21) (2022-05-31)
290
+
291
+ **Note:** Version bump only for package @operato/popup
292
+
293
+
294
+
295
+
296
+
297
+ ## [1.0.0-beta.20](https://github.com/hatiolab/operato/compare/v1.0.0-beta.19...v1.0.0-beta.20) (2022-05-30)
298
+
299
+ **Note:** Version bump only for package @operato/popup
300
+
301
+
302
+
303
+
304
+
305
+ ## [1.0.0-beta.19](https://github.com/hatiolab/operato/compare/v1.0.0-beta.18...v1.0.0-beta.19) (2022-05-29)
306
+
307
+ **Note:** Version bump only for package @operato/popup
308
+
309
+
310
+
311
+
312
+
313
+ ## [1.0.0-beta.18](https://github.com/hatiolab/operato/compare/v1.0.0-beta.17...v1.0.0-beta.18) (2022-05-27)
314
+
315
+ **Note:** Version bump only for package @operato/popup
316
+
317
+
318
+
319
+
320
+
321
+ ## [1.0.0-beta.17](https://github.com/hatiolab/operato/compare/v1.0.0-beta.16...v1.0.0-beta.17) (2022-05-25)
322
+
323
+ **Note:** Version bump only for package @operato/popup
324
+
325
+
326
+
327
+
328
+
329
+ ## [1.0.0-beta.16](https://github.com/hatiolab/operato/compare/v1.0.0-beta.15...v1.0.0-beta.16) (2022-05-23)
330
+
331
+ **Note:** Version bump only for package @operato/popup
332
+
333
+
334
+
335
+
336
+
337
+ ## [1.0.0-beta.15](https://github.com/hatiolab/operato/compare/v1.0.0-beta.14...v1.0.0-beta.15) (2022-05-20)
338
+
339
+ **Note:** Version bump only for package @operato/popup
340
+
341
+
342
+
343
+
344
+
345
+ ## [1.0.0-beta.14](https://github.com/hatiolab/operato/compare/v1.0.0-beta.13...v1.0.0-beta.14) (2022-05-19)
346
+
347
+ **Note:** Version bump only for package @operato/popup
348
+
349
+
350
+
351
+
352
+
353
+ ## [1.0.0-beta.13](https://github.com/hatiolab/operato/compare/v1.0.0-beta.12...v1.0.0-beta.13) (2022-05-19)
354
+
355
+
356
+ ### :bug: Bug Fix
357
+
358
+ * incorrect package.json scripts for storybooks ([8c8c405](https://github.com/hatiolab/operato/commit/8c8c405443247108b9c411b8161c008d9b6a2261))
359
+
360
+
361
+
362
+ ## [1.0.0-beta.12](https://github.com/hatiolab/operato/compare/v1.0.0-beta.11...v1.0.0-beta.12) (2022-05-13)
363
+
364
+
365
+ ### :rocket: New Features
366
+
367
+ * storybook started ([90c08c9](https://github.com/hatiolab/operato/commit/90c08c9a15e5fe554baaa1becca07793e8434799))
368
+
369
+
370
+
371
+ ## [1.0.0-beta.11](https://github.com/hatiolab/operato/compare/v1.0.0-beta.10...v1.0.0-beta.11) (2022-05-01)
372
+
373
+ **Note:** Version bump only for package @operato/popup
374
+
375
+
376
+
377
+
378
+
379
+ ## [1.0.0-beta.10](https://github.com/hatiolab/operato/compare/v1.0.0-beta.9...v1.0.0-beta.10) (2022-04-28)
380
+
381
+ **Note:** Version bump only for package @operato/popup
382
+
383
+
384
+
385
+
386
+
387
+ ## [1.0.0-beta.9](https://github.com/hatiolab/operato/compare/v1.0.0-beta.8...v1.0.0-beta.9) (2022-04-28)
388
+
389
+ **Note:** Version bump only for package @operato/popup
390
+
391
+
392
+
393
+
394
+
6
395
  ## [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
396
 
8
397
  **Note:** Version bump only for package @operato/popup
Binary file
@@ -1,4 +1,5 @@
1
- export * from './ox-popup';
2
- export * from './ox-popup-list';
3
- export * from './ox-popup-menu';
4
- export * from './ox-popup-menuitem';
1
+ export * from './ox-popup.js';
2
+ export * from './ox-popup-list.js';
3
+ export * from './ox-popup-menu.js';
4
+ export * from './ox-popup-menuitem.js';
5
+ export * from './open-popup.js';
package/dist/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
- export * from './ox-popup';
2
- export * from './ox-popup-list';
3
- export * from './ox-popup-menu';
4
- export * from './ox-popup-menuitem';
1
+ export * from './ox-popup.js';
2
+ export * from './ox-popup-list.js';
3
+ export * from './ox-popup-menu.js';
4
+ export * from './ox-popup-menuitem.js';
5
+ export * from './open-popup.js';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA","sourcesContent":["export * from './ox-popup'\nexport * from './ox-popup-list'\nexport * from './ox-popup-menu'\nexport * from './ox-popup-menuitem'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AAEtC,cAAc,iBAAiB,CAAA","sourcesContent":["export * from './ox-popup.js'\nexport * from './ox-popup-list.js'\nexport * from './ox-popup-menu.js'\nexport * from './ox-popup-menuitem.js'\n\nexport * from './open-popup.js'\n"]}
@@ -0,0 +1,59 @@
1
+ import './ox-floating-overlay.js';
2
+ import { TemplateResult } from 'lit';
3
+ /**
4
+ * Options for popup
5
+ *
6
+ * @typedef {Object} PopupOptions
7
+ * @property {String} [title] - popup title
8
+ * @property {'center' | 'next' | 'edge'} [hovering] - hovering position (default: 'center'). 'edge' : edge of the HEADERBAR, 'next' : next of the clicked position.
9
+ * @property {'large' | 'medium' | small'} [size] - popup size
10
+ * @property {Boolean} [closable] - set whether the close 'X' button is shown on top-right most position (default true)
11
+ * @property {Boolean} [escapable] - set whether the close popup with 'ESC' key (default true)
12
+ * @property {Boolean} [backdrop] - set whether to do background masking around the pop-up. If true, it becomes modal (default true)
13
+ */
14
+ export declare type PopupOptions = {
15
+ title?: string;
16
+ hovering?: 'center' | 'next' | 'edge';
17
+ size?: 'large' | 'medium' | 'small';
18
+ closable?: boolean;
19
+ escapable?: boolean;
20
+ backdrop?: boolean;
21
+ help?: string;
22
+ };
23
+ /**
24
+ * Popup handle object that will be returned openPopup
25
+ *
26
+ * @typedef {Object} PopupHandle
27
+ * @property {String} [name] - popup instance name
28
+ * @property {Function} [close] - call this function to close the popup.
29
+ * @property {Boolean} [closed] - state telling whether the popup is closed or not.
30
+ * @property {Function} [onclosed] - set callback function on close. It will be called when the popup about to close.
31
+ */
32
+ export declare type PopupHandle = {
33
+ name: string;
34
+ close: () => void;
35
+ closed: boolean;
36
+ onclosed?: () => void;
37
+ };
38
+ /**
39
+ * replace default openPopup implementation
40
+ *
41
+ * @param {(template: TemplateResult, options: PopupOptions) => PopupHandle} implementation
42
+ */
43
+ export declare function setOpenPopupImplementation(implementation: (template: TemplateResult, options: PopupOptions) => PopupHandle): void;
44
+ /**
45
+ * open popup out of operato application environment
46
+ *
47
+ * @param {*} template html template to be rendered inside the popup
48
+ * @param {PopupOptions} options
49
+ * @returns popup handle object. This object is used to close the popup.
50
+ */
51
+ export declare const openPopup: (template: TemplateResult, options?: PopupOptions) => PopupHandle;
52
+ /**
53
+ * open popup out of operato application environment
54
+ *
55
+ * @param {*} template html template to be rendered inside the popup
56
+ * @param {PopupOptions} options
57
+ * @returns popup handle object. This object is used to close the popup.
58
+ */
59
+ export declare const closePopup: (element: HTMLElement) => void;
@@ -0,0 +1,84 @@
1
+ import './ox-floating-overlay.js';
2
+ import { html, render } from 'lit';
3
+ /*
4
+ * popup handling
5
+ *
6
+ * popup은 overlay의 특별한 형태이다.
7
+ * popup은 open될 때, viewpart를 append 하며, close 될 때 viewpart를 remove 한다.
8
+ * - name: '$popup-${popupSequence}'
9
+ * - position: VIEWPART_POSITION_HEADERBAR
10
+ * - hovering: 'center' | 'next' | 'edge'
11
+ */
12
+ var popupSequence = 0;
13
+ /**
14
+ * default openPopup implementation for operato application environment
15
+ *
16
+ * @param {*} template html template to be rendered inside the popup
17
+ * @param {PopupOptions} options
18
+ * @returns popup handle object. This object is used to close the popup.
19
+ */
20
+ function defaultOpenPopup(template, options = {}) {
21
+ const { title, size = 'large', closable = false, escapable = false, help, hovering, backdrop } = options;
22
+ const name = `$popup-${popupSequence++}`;
23
+ render(html `
24
+ <ox-floating-overlay
25
+ id=${name}
26
+ name=${name}
27
+ .backdrop=${backdrop}
28
+ direction="down"
29
+ .hovering=${hovering}
30
+ .title=${title}
31
+ .help=${help}
32
+ .size=${size}
33
+ .closable=${closable}
34
+ .historical=${false}
35
+ >${template}</ox-floating-overlay
36
+ >
37
+ `, document.body);
38
+ requestAnimationFrame(() => {
39
+ dispatchEvent(new Event('resize'));
40
+ });
41
+ const popupHandle = {
42
+ name,
43
+ close: () => {
44
+ const popup = document.body.querySelector(`#${name}`);
45
+ popup === null || popup === void 0 ? void 0 : popup.close();
46
+ popupHandle.onclosed && popupHandle.onclosed();
47
+ },
48
+ closed: false
49
+ };
50
+ return popupHandle;
51
+ }
52
+ var openPopupImpl = defaultOpenPopup;
53
+ /**
54
+ * replace default openPopup implementation
55
+ *
56
+ * @param {(template: TemplateResult, options: PopupOptions) => PopupHandle} implementation
57
+ */
58
+ export function setOpenPopupImplementation(implementation) {
59
+ openPopupImpl = implementation;
60
+ }
61
+ /**
62
+ * open popup out of operato application environment
63
+ *
64
+ * @param {*} template html template to be rendered inside the popup
65
+ * @param {PopupOptions} options
66
+ * @returns popup handle object. This object is used to close the popup.
67
+ */
68
+ export const openPopup = (template, options = {}) => {
69
+ return openPopupImpl(template, options);
70
+ };
71
+ /**
72
+ * open popup out of operato application environment
73
+ *
74
+ * @param {*} template html template to be rendered inside the popup
75
+ * @param {PopupOptions} options
76
+ * @returns popup handle object. This object is used to close the popup.
77
+ */
78
+ export const closePopup = (element) => {
79
+ element.dispatchEvent(new CustomEvent('close-overlay', {
80
+ bubbles: true,
81
+ composed: true
82
+ }));
83
+ };
84
+ //# sourceMappingURL=open-popup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-popup.js","sourceRoot":"","sources":["../../src/open-popup.ts"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAkB,MAAM,KAAK,CAAA;AAyClD;;;;;;;;GAQG;AACH,IAAI,aAAa,GAAG,CAAC,CAAA;AAErB;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,QAAwB,EAAE,UAAwB,EAAE;IAC5E,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,OAAO,EAAE,QAAQ,GAAG,KAAK,EAAE,SAAS,GAAG,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;IACxG,MAAM,IAAI,GAAG,UAAU,aAAa,EAAE,EAAE,CAAA;IAExC,MAAM,CACJ,IAAI,CAAA;;aAEK,IAAI;eACF,IAAI;oBACC,QAAQ;;oBAER,QAAQ;iBACX,KAAK;gBACN,IAAI;gBACJ,IAAI;oBACA,QAAQ;sBACN,KAAK;WAChB,QAAQ;;KAEd,EACD,QAAQ,CAAC,IAAI,CACd,CAAA;IAED,qBAAqB,CAAC,GAAG,EAAE;QACzB,aAAa,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;IAEF,MAAM,WAAW,GAAG;QAClB,IAAI;QACJ,KAAK,EAAE,GAAG,EAAE;YACV,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,EAAE,CAAsB,CAAA;YAC1E,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,EAAE,CAAA;YACd,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAA;QAChD,CAAC;QACD,MAAM,EAAE,KAAK;KACC,CAAA;IAEhB,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,IAAI,aAAa,GAAqE,gBAAgB,CAAA;AAEtG;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACxC,cAAgF;IAEhF,aAAa,GAAG,cAAc,CAAA;AAChC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,QAAwB,EAAE,UAAwB,EAAE,EAAe,EAAE;IAC7F,OAAO,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;AACzC,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAoB,EAAQ,EAAE;IACvD,OAAO,CAAC,aAAa,CACnB,IAAI,WAAW,CAAC,eAAe,EAAE;QAC/B,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;KACf,CAAC,CACH,CAAA;AACH,CAAC,CAAA","sourcesContent":["import './ox-floating-overlay.js'\n\nimport { html, render, TemplateResult } from 'lit'\n\nimport { OxFloatingOverlay } from './ox-floating-overlay.js'\n\n/**\n * Options for popup\n *\n * @typedef {Object} PopupOptions\n * @property {String} [title] - popup title\n * @property {'center' | 'next' | 'edge'} [hovering] - hovering position (default: 'center'). 'edge' : edge of the HEADERBAR, 'next' : next of the clicked position.\n * @property {'large' | 'medium' | small'} [size] - popup size\n * @property {Boolean} [closable] - set whether the close 'X' button is shown on top-right most position (default true)\n * @property {Boolean} [escapable] - set whether the close popup with 'ESC' key (default true)\n * @property {Boolean} [backdrop] - set whether to do background masking around the pop-up. If true, it becomes modal (default true)\n */\nexport type PopupOptions = {\n title?: string\n hovering?: 'center' | 'next' | 'edge'\n size?: 'large' | 'medium' | 'small'\n closable?: boolean\n escapable?: boolean\n backdrop?: boolean\n help?: string\n}\n\n/**\n * Popup handle object that will be returned openPopup\n *\n * @typedef {Object} PopupHandle\n * @property {String} [name] - popup instance name\n * @property {Function} [close] - call this function to close the popup.\n * @property {Boolean} [closed] - state telling whether the popup is closed or not.\n * @property {Function} [onclosed] - set callback function on close. It will be called when the popup about to close.\n */\nexport type PopupHandle = {\n name: string\n close: () => void\n closed: boolean\n onclosed?: () => void\n}\n\n/*\n * popup handling\n *\n * popup은 overlay의 특별한 형태이다.\n * popup은 open될 때, viewpart를 append 하며, close 될 때 viewpart를 remove 한다.\n * - name: '$popup-${popupSequence}'\n * - position: VIEWPART_POSITION_HEADERBAR\n * - hovering: 'center' | 'next' | 'edge'\n */\nvar popupSequence = 0\n\n/**\n * default openPopup implementation for operato application environment\n *\n * @param {*} template html template to be rendered inside the popup\n * @param {PopupOptions} options\n * @returns popup handle object. This object is used to close the popup.\n */\nfunction defaultOpenPopup(template: TemplateResult, options: PopupOptions = {}): PopupHandle {\n const { title, size = 'large', closable = false, escapable = false, help, hovering, backdrop } = options\n const name = `$popup-${popupSequence++}`\n\n render(\n html`\n <ox-floating-overlay\n id=${name}\n name=${name}\n .backdrop=${backdrop}\n direction=\"down\"\n .hovering=${hovering}\n .title=${title}\n .help=${help}\n .size=${size}\n .closable=${closable}\n .historical=${false}\n >${template}</ox-floating-overlay\n >\n `,\n document.body\n )\n\n requestAnimationFrame(() => {\n dispatchEvent(new Event('resize'))\n })\n\n const popupHandle = {\n name,\n close: () => {\n const popup = document.body.querySelector(`#${name}`) as OxFloatingOverlay\n popup?.close()\n popupHandle.onclosed && popupHandle.onclosed()\n },\n closed: false\n } as PopupHandle\n\n return popupHandle\n}\n\nvar openPopupImpl: (template: TemplateResult, options: PopupOptions) => PopupHandle = defaultOpenPopup\n\n/**\n * replace default openPopup implementation\n *\n * @param {(template: TemplateResult, options: PopupOptions) => PopupHandle} implementation\n */\nexport function setOpenPopupImplementation(\n implementation: (template: TemplateResult, options: PopupOptions) => PopupHandle\n) {\n openPopupImpl = implementation\n}\n\n/**\n * open popup out of operato application environment\n *\n * @param {*} template html template to be rendered inside the popup\n * @param {PopupOptions} options\n * @returns popup handle object. This object is used to close the popup.\n */\nexport const openPopup = (template: TemplateResult, options: PopupOptions = {}): PopupHandle => {\n return openPopupImpl(template, options)\n}\n\n/**\n * open popup out of operato application environment\n *\n * @param {*} template html template to be rendered inside the popup\n * @param {PopupOptions} options\n * @returns popup handle object. This object is used to close the popup.\n */\nexport const closePopup = (element: HTMLElement): void => {\n element.dispatchEvent(\n new CustomEvent('close-overlay', {\n bubbles: true,\n composed: true\n })\n )\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import '@material/mwc-icon';
2
+ import { LitElement, PropertyValues } from 'lit';
3
+ export declare class OxFloatingOverlay extends LitElement {
4
+ static styles: import("lit").CSSResult[];
5
+ backdrop?: boolean;
6
+ direction?: 'up' | 'down' | 'left' | 'right';
7
+ hovering?: 'center' | 'edge' | 'next';
8
+ size?: 'small' | 'medium' | 'large';
9
+ name?: string;
10
+ title: string;
11
+ closable?: boolean;
12
+ templateProperties: any;
13
+ help: any;
14
+ historical?: boolean;
15
+ render(): import("lit-html").TemplateResult<1>;
16
+ updated(changes: PropertyValues<this>): void;
17
+ firstUpdated(): void;
18
+ disconnectedCallback(): void;
19
+ close(): void;
20
+ onClose(escape?: boolean): true | undefined;
21
+ }