File tree Expand file tree Collapse file tree 14 files changed +44
-24
lines changed
app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/converter Expand file tree Collapse file tree 14 files changed +44
-24
lines changed Original file line number Diff line number Diff line change 3
3
* See COPYING.txt for license details.
4
4
*/
5
5
import _ from "underscore" ;
6
+ import { DataObject } from "../../data-store" ;
6
7
import ConverterInterface from "../converter-interface" ;
7
8
8
9
/**
@@ -12,7 +13,15 @@ export default class CreateValueForHref implements ConverterInterface {
12
13
/**
13
14
* @type object
14
15
*/
15
- private widgetParamsByLinkType : object = {
16
+ private widgetParamsByLinkType : {
17
+ [ key : string ] : {
18
+ type : string ;
19
+ page_id ?: string ;
20
+ id_path ?: string ;
21
+ template : string ;
22
+ type_name : string ;
23
+ } ;
24
+ } = {
16
25
category : {
17
26
type : "Magento\\Catalog\\Block\\Category\\Widget\\Link" ,
18
27
id_path : `category/:href` ,
@@ -50,7 +59,7 @@ export default class CreateValueForHref implements ConverterInterface {
50
59
* @param data Object
51
60
* @returns {string }
52
61
*/
53
- public toDom ( name : string , data : object ) : string {
62
+ public toDom ( name : string , data : DataObject ) : string {
54
63
55
64
const link = data [ name ] ;
56
65
let href = "" ;
Original file line number Diff line number Diff line change 3
3
* See COPYING.txt for license details.
4
4
*/
5
5
6
+ import { DataObject } from "../../data-store" ;
6
7
import ConverterInterface from "../converter-interface" ;
7
8
8
9
/**
@@ -26,7 +27,7 @@ export default class CreateValueForTarget implements ConverterInterface {
26
27
* @param data Object
27
28
* @returns {string }
28
29
*/
29
- public toDom ( name : string , data : object ) : string {
30
+ public toDom ( name : string , data : DataObject ) : string {
30
31
if ( ! data [ name ] ) {
31
32
return "" ;
32
33
}
Original file line number Diff line number Diff line change 3
3
* See COPYING.txt for license details.
4
4
*/
5
5
6
+ import { DataObject } from "../../data-store" ;
6
7
import ConverterInterface from "../converter-interface" ;
7
8
8
9
/**
@@ -27,7 +28,7 @@ export default class CreateValueForLinkType implements ConverterInterface {
27
28
* @param data Object
28
29
* @returns {string }
29
30
*/
30
- public toDom ( name : string , data : object ) : string {
31
+ public toDom ( name : string , data : DataObject ) : string {
31
32
32
33
return data [ name ] ? data [ name ] . type : "" ;
33
34
}
Original file line number Diff line number Diff line change 3
3
* See COPYING.txt for license details.
4
4
*/
5
5
6
+ import { DataObject } from "../../../data-store" ;
6
7
import ConverterInterface from "../../converter-interface" ;
7
8
8
9
/**
@@ -26,7 +27,7 @@ export default class Src implements ConverterInterface {
26
27
* @param data Object
27
28
* @returns {string }
28
29
*/
29
- public toDom ( name : string , data : object ) : string {
30
+ public toDom ( name : string , data : DataObject ) : string {
30
31
const value = data [ name ] ;
31
32
if ( value && typeof value [ 0 ] === "object" ) {
32
33
return value [ 0 ] . url ;
Original file line number Diff line number Diff line change 4
4
*/
5
5
6
6
import Config from "../../config" ;
7
+ import { DataObject } from "../../data-store" ;
7
8
import { decodeUrl } from "../../utils/image" ;
8
9
import { convertUrlToPathIfOtherUrlIsOnlyAPath } from "../../utils/url" ;
9
10
import ConverterInterface from "../converter-interface" ;
@@ -32,7 +33,7 @@ export default class Src implements ConverterInterface {
32
33
* @param data Object
33
34
* @returns {string }
34
35
*/
35
- public toDom ( name : string , data : object ) : string {
36
+ public toDom ( name : string , data : DataObject ) : string {
36
37
const value = data [ name ] ;
37
38
if ( value [ 0 ] === undefined || value [ 0 ] . url === undefined ) {
38
39
return "" ;
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import {DataObject} from "../data-store";
8
8
/**
9
9
* @api
10
10
*/
11
- export interface ConverterInterface {
11
+ export default interface ConverterInterface {
12
12
/**
13
13
* Convert value to internal format
14
14
*
Original file line number Diff line number Diff line change 3
3
* See COPYING.txt for license details.
4
4
*/
5
5
6
- import { ConverterInterface } from "./converter-interface" ;
6
+ import ConverterInterface from "./converter-interface" ;
7
7
8
8
/**
9
9
* @api
Original file line number Diff line number Diff line change 3
3
* See COPYING.txt for license details.
4
4
*/
5
5
6
+ import { DataObject } from "../../data-store" ;
6
7
import { convertMediaDirectivesToUrls , removeQuotesInMediaDirectives } from "../../utils/directives" ;
7
8
import ConverterInterface from "../converter-interface" ;
8
9
@@ -27,7 +28,7 @@ export default class Directives implements ConverterInterface {
27
28
* @param {Object } data
28
29
* @returns {string }
29
30
*/
30
- public toDom ( name : string , data : object ) : string {
31
+ public toDom ( name : string , data : DataObject ) : string {
31
32
return convertMediaDirectivesToUrls ( removeQuotesInMediaDirectives ( data [ name ] ) ) ;
32
33
}
33
34
}
Original file line number Diff line number Diff line change 4
4
*/
5
5
6
6
import Config from "../../config" ;
7
+ import { DataObject } from "../../data-store" ;
7
8
import { toDataUrl } from "../../utils/directives" ;
8
9
import { decodeUrl } from "../../utils/image" ;
9
10
import { convertUrlToPathIfOtherUrlIsOnlyAPath } from "../../utils/url" ;
@@ -33,7 +34,7 @@ export default class BackgroundImage implements ConverterInterface {
33
34
* @param data Object
34
35
* @returns {string }
35
36
*/
36
- public toDom ( name : string , data : object ) : string {
37
+ public toDom ( name : string , data : DataObject ) : string {
37
38
const value = data [ name ] ;
38
39
if ( value [ 0 ] === undefined || value [ 0 ] . url === undefined ) {
39
40
return "" ;
Original file line number Diff line number Diff line change 3
3
* See COPYING.txt for license details.
4
4
*/
5
5
6
+ import { DataObject } from "../../data-store" ;
6
7
import ConverterInterface from "../converter-interface" ;
7
8
8
9
/**
@@ -22,11 +23,11 @@ export default class BorderWidth implements ConverterInterface {
22
23
/**
23
24
* Convert value to knockout format
24
25
*
25
- * @param name string
26
- * @param data Object
26
+ * @param { string } name
27
+ * @param { DataObject } data
27
28
* @returns {string | object }
28
29
*/
29
- public toDom ( name : string , data : object ) : string | object {
30
+ public toDom ( name : string , data : DataObject ) : string | object {
30
31
if ( data [ name ] ) {
31
32
return data [ name ] + "px" ;
32
33
}
You can’t perform that action at this time.
0 commit comments