inviton-powerduck 0.0.21 → 0.0.23

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.
@@ -216,8 +216,8 @@ export abstract class PowerduckViewModelBase extends Vue {
216
216
  }
217
217
 
218
218
  unwrapRootElement(): HTMLElement {
219
- if ((this.$el as any).$childSlots != null) {
220
- return ((this.$el as any).$childSlots[0]?.el || this.$el) as any;
219
+ if ((this.$el as any).$getChildSlots != null) {
220
+ return (((this.$el as any).$getChildSlots() || [])[0]?.el || this.$el) as any;
221
221
  }
222
222
 
223
223
  return this.$el as any;
@@ -16,13 +16,17 @@ interface LightboxArgs {
16
16
  scrollDisabled?: boolean;
17
17
  moveDisabled?: boolean;
18
18
  rotateDisabled?: boolean;
19
- customPortalContainer?: string;
19
+ customPortalContainer?: string;
20
20
  }
21
21
 
22
22
  interface LightboxShowArgs {
23
23
  index?: number;
24
24
  }
25
25
 
26
+ export class LightboxConfig {
27
+ static defaultPortalTarget = 'body'
28
+ }
29
+
26
30
  @Component({
27
31
  components: {
28
32
  'teleport': Teleport,
@@ -34,7 +38,7 @@ class LightboxComponent extends TsxComponent<LightboxArgs> implements LightboxAr
34
38
  @Prop() scrollDisabled: boolean;
35
39
  @Prop({ default: true }) moveDisabled: boolean;
36
40
  @Prop({ default: true }) rotateDisabled: boolean;
37
- @Prop() customPortalContainer: string;
41
+ @Prop() customPortalContainer: string;
38
42
  visible: boolean = false;
39
43
  index: number = 0
40
44
  everShown: boolean = false;
@@ -69,13 +73,13 @@ class LightboxComponent extends TsxComponent<LightboxArgs> implements LightboxAr
69
73
  return this.$refs.lightboxInstance;
70
74
  }
71
75
 
72
- get portalContainer(): string {
73
- return this.customPortalContainer || "lightbox-container";
74
- }
76
+ get portalContainer(): string {
77
+ return this.customPortalContainer || LightboxConfig.defaultPortalTarget;
78
+ }
75
79
 
76
80
  render(h) {
77
81
  return (
78
- <teleport to={"#" + this.portalContainer}>
82
+ <teleport to={this.portalContainer}>
79
83
  {this.everShown &&
80
84
  <vue-easy-lightbox
81
85
  ref={'lightboxInstance'}
@@ -21,7 +21,7 @@ interface ModalArgs {
21
21
  mobileFullscreen?: boolean;
22
22
  modalLazyMode?: boolean;
23
23
  preventHistoryEntry?: boolean;
24
- alternativePortal?: boolean;
24
+ portalTarget?: string;
25
25
  }
26
26
 
27
27
  export enum ModalSize {
@@ -48,6 +48,10 @@ declare global {
48
48
  }
49
49
  }
50
50
 
51
+ export class ModalConfig {
52
+ static defaultPortalTarget = 'body'
53
+ }
54
+
51
55
  @Component
52
56
  class ModalComponent extends TsxComponent<ModalArgs> implements ModalArgs {
53
57
  @Prop() title!: string;
@@ -122,7 +126,7 @@ class ModalComponent extends TsxComponent<ModalArgs> implements ModalArgs {
122
126
  }
123
127
 
124
128
  return (
125
- <Teleport to={"#" + (this.alternativePortal ? "bs-modal-container-alt" : "bs-modal-container")}>
129
+ <Teleport to={ModalConfig.defaultPortalTarget}>
126
130
  <div
127
131
  id={this.getFullId()}
128
132
  key={this.getFullId()}
@@ -14,17 +14,25 @@ interface TeleportArgs {
14
14
  })
15
15
  class TeleportComponent extends TsxComponent<TeleportArgs> implements TeleportArgs {
16
16
  @Prop() to!: string;
17
+ _currentSlots: any = null;
17
18
 
18
19
 
19
- render() {
20
- const childSlots = this.$slots.default?.();
21
- this.$nextTick(() => {
22
- this.$el.$childSlots = childSlots;
23
- })
20
+ beforeUnmount() {
21
+ this.$el.$getChildSlots = null;
22
+ this._currentSlots = null;
23
+ }
24
24
 
25
+ render() {
26
+ this._currentSlots = this.$slots.default?.();
27
+ if (this.$el == null || this.$el.$getChildSlots == null) {
28
+ this.$nextTick(() => {
29
+ this.$el.$getChildSlots = () => this._currentSlots;
30
+ })
31
+ }
32
+
25
33
  return (
26
34
  <teleport to={this.to}>
27
- {childSlots}
35
+ {this._currentSlots}
28
36
  </teleport>
29
37
  );
30
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": " vite build && vue-tsc --declaration --emitDeclarationOnly",