1
- import Vue from 'vue' ;
2
- import { ComponentBase , EJComponentDecorator } from '@syncfusion/ej2-vue-base' ;
1
+ import { Options } from 'vue-class-component' ;
2
+ import { ComponentBase , EJComponentDecorator , getProps , allVue , gh } from '@syncfusion/ej2-vue-base' ;
3
+ import { isNullOrUndefined } from '@syncfusion/ej2-base' ;
4
+
3
5
import { DataMatrixGenerator } from '@syncfusion/ej2-barcode-generator' ;
4
6
5
7
8
+ // {{VueImport}}
6
9
export const properties : string [ ] = [ 'backgroundColor' , 'displayText' , 'enablePersistence' , 'enableRtl' , 'encoding' , 'foreColor' , 'height' , 'locale' , 'margin' , 'mode' , 'size' , 'value' , 'width' , 'xDimension' , 'invalid' ] ;
7
10
export const modelProps : string [ ] = [ ] ;
8
11
12
+ export const testProp : any = getProps ( { props : properties } ) ;
13
+ export const props = testProp [ 0 ] ;
14
+ export const watch = testProp [ 1 ] ;
15
+
16
+ export const emitProbs : any = Object . keys ( watch ) ;
17
+ emitProbs . push ( 'modelchanged' ) ;
18
+ for ( let props of modelProps ) {
19
+ emitProbs . push (
20
+ 'update:' + props
21
+ ) ;
22
+ }
23
+
24
+ export const isExecute : any = gh ? false : true ;
25
+
26
+ export let tempProxy : any ;
27
+
9
28
/**
10
29
* Represents vue DataMatrix Component
11
30
* ```html
@@ -14,7 +33,14 @@ export const modelProps: string[] = [];
14
33
*/
15
34
@EJComponentDecorator ( {
16
35
props : properties
17
- } )
36
+ } , isExecute )
37
+
38
+ /* Start Options({
39
+ props: props,
40
+ watch: watch,
41
+ emits: emitProbs
42
+ }) End */
43
+
18
44
export class DataMatrixGeneratorComponent extends ComponentBase {
19
45
20
46
public ej2Instances : any ;
@@ -24,31 +50,46 @@ export class DataMatrixGeneratorComponent extends ComponentBase {
24
50
protected hasInjectedModules : boolean = false ;
25
51
public tagMapper : { [ key : string ] : Object } = { } ;
26
52
public tagNameMapper : Object = { } ;
53
+ public isVue3 : boolean ;
27
54
28
55
constructor ( ) {
29
- super ( ) ;
56
+ super ( arguments ) ;
57
+ this . isVue3 = ! isExecute ;
30
58
this . ej2Instances = new DataMatrixGenerator ( { } ) ;
31
59
this . bindProperties ( ) ;
32
60
this . ej2Instances . _setProperties = this . ej2Instances . setProperties ;
33
61
this . ej2Instances . setProperties = this . setProperties ;
62
+ tempProxy = this ;
34
63
}
35
64
public setProperties ( prop : any , muteOnChange : boolean ) : void {
65
+ if ( this . isVue3 ) {
66
+ this . models = ! this . models ? this . ej2Instances . referModels : this . models ;
67
+ }
36
68
if ( this . ej2Instances && this . ej2Instances . _setProperties ) {
37
69
this . ej2Instances . _setProperties ( prop , muteOnChange ) ;
38
70
}
39
71
if ( prop && this . models && this . models . length ) {
40
72
Object . keys ( prop ) . map ( ( key : string ) : void => {
41
73
this . models . map ( ( model : string ) : void => {
42
74
if ( ( key === model ) && ! ( / d a t a s o u r c e / i. test ( key ) ) ) {
43
- this . $emit ( 'update:' + key , prop [ key ] ) ;
75
+ if ( this . isVue3 ) {
76
+ this . ej2Instances . vueInstance . $emit ( 'update:' + key , prop [ key ] ) ;
77
+ } else {
78
+ ( this as any ) . $emit ( 'update:' + key , prop [ key ] ) ;
79
+ }
44
80
}
45
81
} ) ;
46
82
} ) ;
47
83
}
48
84
}
49
85
50
86
public render ( createElement : any ) {
51
- return createElement ( 'div' , ( this as any ) . $slots . default ) ;
87
+ let h : any = gh || createElement ;
88
+ let slots : any = null ;
89
+ if ( ! isNullOrUndefined ( ( this as any ) . $slots . default ) ) {
90
+ slots = gh ? ( this as any ) . $slots . default ( ) : ( this as any ) . $slots . default ;
91
+ }
92
+ return h ( 'div' , slots ) ;
52
93
}
53
94
54
95
public exportAsBase64Image ( barcodeExportType : Object ) : Object {
0 commit comments