@fonixtree/magic-design 2.0.63 → 2.0.66

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 (113) hide show
  1. package/es/assets/images/base64/index.js +28 -2
  2. package/es/common/ImagePicker/index.js +0 -2
  3. package/es/common/LinkModal/FunctionTable/index.js +2 -1
  4. package/es/common/LinkModal/index.js +14 -2
  5. package/es/common/MyModal/index.less +1 -1
  6. package/es/common/UrlPicker/index.js +3 -1
  7. package/es/composite-comp/bol/components/ImageText/pc/index.js +2 -2
  8. package/es/composite-comp/bol/second-config-panels/ImageTextSecondConfig/index.js +8 -6
  9. package/es/composite-comp/common/components/ImageLabel/index.less +9 -3
  10. package/es/composite-comp/common/components/ProductItem/index.js +25 -17
  11. package/es/composite-comp/common/components/ProductItem/index.less +13 -7
  12. package/es/composite-comp/dito/components/AffiliateRecommend/pc/index.js +6 -6
  13. package/es/composite-comp/dito/components/HeadNavigation/defaultJSON.js +76 -66
  14. package/es/composite-comp/dito/components/HeadNavigation/index.js +84 -0
  15. package/es/composite-comp/dito/components/HeadNavigation/mobile/index.js +112 -0
  16. package/es/composite-comp/dito/components/HeadNavigation/mobile/index.less +34 -0
  17. package/es/composite-comp/dito/components/MenuNavigation/MenuNavMetaImage/index.js +206 -0
  18. package/es/composite-comp/dito/components/MenuNavigation/MenuNavMetaImage/index.less +25 -0
  19. package/es/composite-comp/dito/components/MenuNavigation/defaultJSON.js +70 -42
  20. package/es/composite-comp/dito/components/MenuNavigation/index.js +84 -0
  21. package/es/composite-comp/dito/components/MenuNavigation/mobile/index.js +87 -0
  22. package/es/composite-comp/dito/components/MenuNavigation/mobile/index.less +8 -0
  23. package/es/composite-comp/dito/components/Recommend/mobile/index.js +4 -4
  24. package/es/composite-comp/dito/components/Recommend/pc/index.js +6 -6
  25. package/es/composite-comp/dito/config-panels/HeadNavigationConfig/GroupList/index.js +203 -0
  26. package/es/composite-comp/dito/config-panels/HeadNavigationConfig/GroupList/index.less +72 -0
  27. package/es/composite-comp/dito/config-panels/HeadNavigationConfig/HeadNavConfigImageGroup/index.js +142 -0
  28. package/es/composite-comp/dito/config-panels/HeadNavigationConfig/index.js +123 -0
  29. package/es/composite-comp/dito/config-panels/HeadNavigationConfig/index.less +23 -0
  30. package/es/composite-comp/dito/config-panels/MenuNavigationConfig/GroupList/index.js +203 -0
  31. package/es/composite-comp/dito/config-panels/MenuNavigationConfig/GroupList/index.less +72 -0
  32. package/es/composite-comp/dito/config-panels/MenuNavigationConfig/MenuNavConfigImageGroup/index.js +137 -0
  33. package/es/composite-comp/dito/config-panels/MenuNavigationConfig/MenuNavConfigImageGroup/index.less +6 -0
  34. package/es/composite-comp/dito/config-panels/MenuNavigationConfig/index.js +40 -0
  35. package/es/composite-comp/dito/second-config-panels/HeadNavigationSecondConfig/index.js +127 -0
  36. package/es/composite-comp/dito/second-config-panels/MenuNavigationSecondConfig/index.js +127 -0
  37. package/es/constants/component-types.js +15 -3
  38. package/es/constants/index.js +8 -0
  39. package/es/core/Designer/ChatRobot/components/SearchCondition/index.js +110 -0
  40. package/es/core/Designer/ChatRobot/components/SearchCondition/index.less +33 -0
  41. package/es/core/Designer/ChatRobot/index.js +23 -5
  42. package/es/core/Designer/ChatRobot/index.less +40 -20
  43. package/es/core/Designer/History/index.js +2 -2
  44. package/es/core/Designer/PageCompList/index.js +8 -5
  45. package/es/core/Designer/QuickMenuBar/index.js +5 -3
  46. package/es/core/Designer/QuickMenuBar/index.less +4 -0
  47. package/es/core/Designer/index.js +5 -1
  48. package/es/core/Renderer/index.js +3 -1
  49. package/es/decorator/compositeDecorator.js +23 -0
  50. package/es/locale/en/en.json +3 -0
  51. package/es/locale/es/es.json +3 -0
  52. package/es/locale/id/id.json +3 -0
  53. package/es/meta-comp/config-panels/ButtonConfig/index.js +5 -5
  54. package/es/meta-comp/config-panels/ImageConfig/index.js +4 -2
  55. package/es/utils/businessUtil.js +3 -3
  56. package/es/utils/commonUtil.js +2 -2
  57. package/lib/assets/images/base64/index.js +28 -2
  58. package/lib/common/ImagePicker/index.js +0 -2
  59. package/lib/common/LinkModal/FunctionTable/index.js +2 -1
  60. package/lib/common/LinkModal/index.js +14 -2
  61. package/lib/common/MyModal/index.less +1 -1
  62. package/lib/common/UrlPicker/index.js +3 -1
  63. package/lib/composite-comp/bol/components/ImageText/pc/index.js +2 -2
  64. package/lib/composite-comp/bol/second-config-panels/ImageTextSecondConfig/index.js +8 -6
  65. package/lib/composite-comp/common/components/ImageLabel/index.less +9 -3
  66. package/lib/composite-comp/common/components/ProductItem/index.js +25 -17
  67. package/lib/composite-comp/common/components/ProductItem/index.less +13 -7
  68. package/lib/composite-comp/dito/components/AffiliateRecommend/pc/index.js +6 -6
  69. package/lib/composite-comp/dito/components/HeadNavigation/defaultJSON.js +76 -66
  70. package/lib/composite-comp/dito/components/HeadNavigation/index.js +84 -0
  71. package/lib/composite-comp/dito/components/HeadNavigation/mobile/index.js +112 -0
  72. package/lib/composite-comp/dito/components/HeadNavigation/mobile/index.less +34 -0
  73. package/lib/composite-comp/dito/components/MenuNavigation/MenuNavMetaImage/index.js +206 -0
  74. package/lib/composite-comp/dito/components/MenuNavigation/MenuNavMetaImage/index.less +25 -0
  75. package/lib/composite-comp/dito/components/MenuNavigation/defaultJSON.js +70 -42
  76. package/lib/composite-comp/dito/components/MenuNavigation/index.js +84 -0
  77. package/lib/composite-comp/dito/components/MenuNavigation/mobile/index.js +87 -0
  78. package/lib/composite-comp/dito/components/MenuNavigation/mobile/index.less +8 -0
  79. package/lib/composite-comp/dito/components/Recommend/mobile/index.js +4 -4
  80. package/lib/composite-comp/dito/components/Recommend/pc/index.js +6 -6
  81. package/lib/composite-comp/dito/config-panels/HeadNavigationConfig/GroupList/index.js +203 -0
  82. package/lib/composite-comp/dito/config-panels/HeadNavigationConfig/GroupList/index.less +72 -0
  83. package/lib/composite-comp/dito/config-panels/HeadNavigationConfig/HeadNavConfigImageGroup/index.js +142 -0
  84. package/lib/composite-comp/dito/config-panels/HeadNavigationConfig/index.js +123 -0
  85. package/lib/composite-comp/dito/config-panels/HeadNavigationConfig/index.less +23 -0
  86. package/lib/composite-comp/dito/config-panels/MenuNavigationConfig/GroupList/index.js +203 -0
  87. package/lib/composite-comp/dito/config-panels/MenuNavigationConfig/GroupList/index.less +72 -0
  88. package/lib/composite-comp/dito/config-panels/MenuNavigationConfig/MenuNavConfigImageGroup/index.js +137 -0
  89. package/lib/composite-comp/dito/config-panels/MenuNavigationConfig/MenuNavConfigImageGroup/index.less +6 -0
  90. package/lib/composite-comp/dito/config-panels/MenuNavigationConfig/index.js +40 -0
  91. package/lib/composite-comp/dito/second-config-panels/HeadNavigationSecondConfig/index.js +127 -0
  92. package/lib/composite-comp/dito/second-config-panels/MenuNavigationSecondConfig/index.js +127 -0
  93. package/lib/constants/component-types.js +15 -3
  94. package/lib/constants/index.js +8 -0
  95. package/lib/core/Designer/ChatRobot/components/SearchCondition/index.js +110 -0
  96. package/lib/core/Designer/ChatRobot/components/SearchCondition/index.less +33 -0
  97. package/lib/core/Designer/ChatRobot/index.js +23 -5
  98. package/lib/core/Designer/ChatRobot/index.less +40 -20
  99. package/lib/core/Designer/History/index.js +2 -2
  100. package/lib/core/Designer/PageCompList/index.js +8 -5
  101. package/lib/core/Designer/QuickMenuBar/index.js +5 -3
  102. package/lib/core/Designer/QuickMenuBar/index.less +4 -0
  103. package/lib/core/Designer/index.js +5 -1
  104. package/lib/core/Renderer/index.js +3 -1
  105. package/lib/decorator/compositeDecorator.js +23 -0
  106. package/lib/locale/en/en.json +3 -0
  107. package/lib/locale/es/es.json +3 -0
  108. package/lib/locale/id/id.json +3 -0
  109. package/lib/meta-comp/config-panels/ButtonConfig/index.js +5 -5
  110. package/lib/meta-comp/config-panels/ImageConfig/index.js +4 -2
  111. package/lib/utils/businessUtil.js +3 -3
  112. package/lib/utils/commonUtil.js +2 -2
  113. package/package.json +1 -1
@@ -3,78 +3,88 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getDefaultJSON = void 0;
6
+ exports.groupSourceHeadJSON = exports.getDefaultJSON = void 0;
7
7
 
8
8
  var _uuid = require("uuid");
9
9
 
10
+ var _base = require("../../../../assets/images/base64");
11
+
12
+ var defaultHeadName = [{
13
+ name: 'Home',
14
+ icon: _base.headHomeIcon,
15
+ clickUrl: {
16
+ value: '/',
17
+ name: 'Home',
18
+ type: 'FunctionPage'
19
+ }
20
+ }, {
21
+ name: 'Inbox',
22
+ icon: _base.headInboxIcon,
23
+ clickUrl: {
24
+ remark: '/h5/users/inbox/unread/num',
25
+ value: '/message-center',
26
+ name: 'Message',
27
+ type: 'FunctionPage'
28
+ }
29
+ }, {
30
+ name: 'Account',
31
+ icon: _base.headAccountIcon,
32
+ clickUrl: {
33
+ value: '/main/account',
34
+ name: 'Account',
35
+ type: 'FunctionPage'
36
+ }
37
+ }];
38
+
39
+ var groupSourceHeadJSON = function groupSourceHeadJSON(group) {
40
+ if (!group) group = defaultHeadName[0];
41
+ var itemId = (0, _uuid.v4)();
42
+ return {
43
+ id: itemId,
44
+ type: group.name,
45
+ image: {
46
+ parentId: itemId,
47
+ id: (0, _uuid.v4)(),
48
+ open: true,
49
+ type: 'IMAGE',
50
+ content: {
51
+ h5Name: 'name',
52
+ pcName: 'name',
53
+ h5ImgSrc: group.icon,
54
+ pcImgSrc: '',
55
+ clickUrl: group.clickUrl
56
+ }
57
+ }
58
+ };
59
+ };
60
+
61
+ exports.groupSourceHeadJSON = groupSourceHeadJSON;
62
+
10
63
  var getDefaultJSON = function getDefaultJSON() {
64
+ var groupId = (0, _uuid.v4)();
11
65
  return {
12
- id: (0, _uuid.v4)(),
66
+ id: groupId,
13
67
  type: 'HEAD_NAVIGATION',
14
- content: {
15
- logo: {
16
- id: (0, _uuid.v4)(),
17
- open: true,
18
- type: 'IMAGE',
19
- content: {
20
- h5Name: 'name2',
21
- pcName: 'name2',
22
- h5ImgSrc: '',
23
- pcImgSrc: '',
24
- clickUrl: ''
25
- },
26
- hover: {
27
- open: false,
28
- backgroundType: 'enlarge',
29
- magnification: 1.5,
30
- pcImgHoverUrl: '',
31
- h5ImgHoverUrl: ''
32
- }
33
- },
34
- box: {
35
- id: (0, _uuid.v4)(),
36
- open: true,
37
- color: {
38
- pc: '#D92929',
39
- mobile: '#8493AF'
40
- }
41
- },
42
- icon: {
43
- id: (0, _uuid.v4)(),
44
- open: true,
45
- color: {
46
- pc: '#D92929',
47
- mobile: '#232F46'
48
- },
49
- cartIcon: {
50
- pc: true,
51
- mobile: true
52
- },
53
- messageIcon: {
54
- pc: false,
55
- mobile: true
56
- }
57
- }
58
- },
59
- spacing: {
60
- pc: {
61
- paddingTop: 20,
62
- paddingBottom: 30,
63
- marginBottom: window.magicDesign.compSpacing * 1.5,
64
- fillUp: false
65
- },
66
- mobile: {
67
- paddingTop: 8,
68
- paddingBottom: 8,
69
- paddingLeft: 15,
70
- paddingRight: 15,
71
- marginBottom: window.magicDesign.compSpacing
72
- }
73
- },
74
- customize: {
75
- layout: 'left',
76
- align: 'left'
77
- },
68
+ groupSource: defaultHeadName.map(function (group) {
69
+ return groupSourceHeadJSON(group);
70
+ }),
71
+ displayPage: [{
72
+ name: 'Store Home',
73
+ type: '/store-home',
74
+ state: true
75
+ }, {
76
+ name: 'Product Detail',
77
+ type: '/product/list',
78
+ state: true
79
+ }, {
80
+ name: 'Poster Page',
81
+ type: '/poster',
82
+ state: true
83
+ }, {
84
+ name: 'Community',
85
+ type: '/main/community',
86
+ state: true
87
+ }],
78
88
  background: {
79
89
  opacity: 100,
80
90
  color: '#fff',
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _mobile = _interopRequireDefault(require("./mobile"));
11
+
12
+ var _defaultJSON = require("./defaultJSON");
13
+
14
+ var _compositeDecorator = _interopRequireDefault(require("../../../../decorator/compositeDecorator"));
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
+
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+
22
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
23
+
24
+ var __extends = void 0 && (void 0).__extends || function () {
25
+ var _extendStatics = function extendStatics(d, b) {
26
+ _extendStatics = Object.setPrototypeOf || {
27
+ __proto__: []
28
+ } instanceof Array && function (d, b) {
29
+ d.__proto__ = b;
30
+ } || function (d, b) {
31
+ for (var p in b) {
32
+ if (b.hasOwnProperty(p)) d[p] = b[p];
33
+ }
34
+ };
35
+
36
+ return _extendStatics(d, b);
37
+ };
38
+
39
+ return function (d, b) {
40
+ _extendStatics(d, b);
41
+
42
+ function __() {
43
+ this.constructor = d;
44
+ }
45
+
46
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
47
+ };
48
+ }();
49
+
50
+ var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
51
+ var c = arguments.length,
52
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
53
+ d;
54
+ if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
55
+ if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
56
+ }
57
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
58
+ };
59
+
60
+ var HeadNavigation =
61
+ /** @class */
62
+ function (_super) {
63
+ __extends(HeadNavigation, _super);
64
+
65
+ function HeadNavigation() {
66
+ return _super !== null && _super.apply(this, arguments) || this;
67
+ }
68
+
69
+ HeadNavigation.prototype.render = function () {
70
+ var nodeData = this.props.nodeData;
71
+ return /*#__PURE__*/_react["default"].createElement("div", null, window.magicDesign.device === 'pc' ? null : /*#__PURE__*/_react["default"].createElement(_mobile["default"], {
72
+ data: nodeData
73
+ }));
74
+ };
75
+
76
+ HeadNavigation.defaultProps = {};
77
+ HeadNavigation.type = 'HEAD_NAVIGATION';
78
+ HeadNavigation.getDefaultJSON = _defaultJSON.getDefaultJSON;
79
+ HeadNavigation = __decorate([_compositeDecorator["default"]], HeadNavigation);
80
+ return HeadNavigation;
81
+ }(_react.Component);
82
+
83
+ var _default = HeadNavigation;
84
+ exports["default"] = _default;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _components = require("../../../../../meta-comp/components");
11
+
12
+ var _commonUtil = require("../../../../../utils/commonUtil");
13
+
14
+ require("./index.less");
15
+
16
+ var _common = require("../../../../../common");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
20
+ var __extends = void 0 && (void 0).__extends || function () {
21
+ var _extendStatics = function extendStatics(d, b) {
22
+ _extendStatics = Object.setPrototypeOf || {
23
+ __proto__: []
24
+ } instanceof Array && function (d, b) {
25
+ d.__proto__ = b;
26
+ } || function (d, b) {
27
+ for (var p in b) {
28
+ if (b.hasOwnProperty(p)) d[p] = b[p];
29
+ }
30
+ };
31
+
32
+ return _extendStatics(d, b);
33
+ };
34
+
35
+ return function (d, b) {
36
+ _extendStatics(d, b);
37
+
38
+ function __() {
39
+ this.constructor = d;
40
+ }
41
+
42
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
43
+ };
44
+ }();
45
+
46
+ var HeadNavigationMobile =
47
+ /** @class */
48
+ function (_super) {
49
+ __extends(HeadNavigationMobile, _super);
50
+
51
+ function HeadNavigationMobile() {
52
+ var _this = _super !== null && _super.apply(this, arguments) || this;
53
+
54
+ _this.carouselRef = /*#__PURE__*/_react["default"].createRef();
55
+ _this.state = {
56
+ showNav: false
57
+ };
58
+ return _this;
59
+ }
60
+
61
+ HeadNavigationMobile.prototype.render = function () {
62
+ var _this = this;
63
+
64
+ var data = this.props.data;
65
+ var showNav = this.state.showNav;
66
+ console.log('---head data', data);
67
+ var GAData = (0, _commonUtil.getGAData)(data);
68
+ return /*#__PURE__*/_react["default"].createElement("div", {
69
+ className: "m-head-navigation"
70
+ }, /*#__PURE__*/_react["default"].createElement("div", {
71
+ className: "head-wrap"
72
+ }, /*#__PURE__*/_react["default"].createElement("div", {
73
+ className: "head-title"
74
+ }, "Direct Function"), /*#__PURE__*/_react["default"].createElement("div", {
75
+ className: "" + (showNav ? 'icon-wrap rotate' : 'icon-wrap'),
76
+ onClick: function onClick() {
77
+ _this.setState({
78
+ showNav: !showNav
79
+ });
80
+ }
81
+ }, /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
82
+ color: "#232F46",
83
+ size: 20,
84
+ type: "icon-more"
85
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
86
+ className: showNav ? 'content-wrap item-padding-top' : 'content-wrap'
87
+ }, showNav && data.groupSource.map(function (group) {
88
+ return /*#__PURE__*/_react["default"].createElement("div", {
89
+ key: group.id,
90
+ className: "head-item",
91
+ onClick: function onClick() {
92
+ return _this.clickJump(group.title.text);
93
+ }
94
+ }, group.image.open && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
95
+ data: group.image,
96
+ GAData: GAData,
97
+ maxWidth: 64,
98
+ minWidth: 64
99
+ }));
100
+ })));
101
+ };
102
+
103
+ HeadNavigationMobile.defaultProps = {
104
+ data: {
105
+ groupSource: []
106
+ }
107
+ };
108
+ return HeadNavigationMobile;
109
+ }(_react["default"].Component);
110
+
111
+ var _default = HeadNavigationMobile;
112
+ exports["default"] = _default;
@@ -0,0 +1,34 @@
1
+ .m-head-navigation {
2
+ width: 100%;
3
+ }
4
+ .m-head-navigation .head-wrap {
5
+ padding: 0.3rem;
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: space-between;
9
+ border-bottom: 0.02rem solid #E6EAF0;
10
+ }
11
+ .m-head-navigation .head-wrap .head-title {
12
+ font-family: Open Sans;
13
+ font-size: 0.28rem;
14
+ font-weight: 400;
15
+ line-height: 0.44rem;
16
+ color: #000;
17
+ }
18
+ .m-head-navigation .head-wrap .icon-wrap {
19
+ transition: all 0.1s;
20
+ }
21
+ .m-head-navigation .head-wrap .rotate {
22
+ transform: rotate(90deg);
23
+ }
24
+ .m-head-navigation .content-wrap {
25
+ display: flex;
26
+ flex-wrap: wrap;
27
+ }
28
+ .m-head-navigation .content-wrap .head-item {
29
+ margin-bottom: 0.16rem;
30
+ margin-left: 0.14rem;
31
+ }
32
+ .m-head-navigation .item-padding-top {
33
+ padding-top: 0.16rem;
34
+ }
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+
12
+ require("./index.less");
13
+
14
+ var _h5DefImg = _interopRequireDefault(require("../../../../../meta-comp/components/Image/image/h5DefImg.png"));
15
+
16
+ var _pcDefImg = _interopRequireDefault(require("../../../../../meta-comp/components/Image/image/pcDefImg.png"));
17
+
18
+ var _coreUtil = require("../../../../../utils/coreUtil");
19
+
20
+ var _decorator = require("../../../../../decorator");
21
+
22
+ var _commonUtil = require("../../../../../utils/commonUtil");
23
+
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
+
26
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
27
+
28
+ var __extends = void 0 && (void 0).__extends || function () {
29
+ var _extendStatics = function extendStatics(d, b) {
30
+ _extendStatics = Object.setPrototypeOf || {
31
+ __proto__: []
32
+ } instanceof Array && function (d, b) {
33
+ d.__proto__ = b;
34
+ } || function (d, b) {
35
+ for (var p in b) {
36
+ if (b.hasOwnProperty(p)) d[p] = b[p];
37
+ }
38
+ };
39
+
40
+ return _extendStatics(d, b);
41
+ };
42
+
43
+ return function (d, b) {
44
+ _extendStatics(d, b);
45
+
46
+ function __() {
47
+ this.constructor = d;
48
+ }
49
+
50
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
51
+ };
52
+ }();
53
+
54
+ var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
55
+ var c = arguments.length,
56
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
57
+ d;
58
+ if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
59
+ if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
60
+ }
61
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
62
+ };
63
+
64
+ var MetaImage =
65
+ /** @class */
66
+ function (_super) {
67
+ __extends(MetaImage, _super);
68
+
69
+ function MetaImage() {
70
+ var _this = _super !== null && _super.apply(this, arguments) || this;
71
+
72
+ _this.imgRef = /*#__PURE__*/_react["default"].createRef();
73
+ _this.state = {
74
+ // 当仅作为一个图片时,鼠标移上去,hover状态
75
+ hoverImgSrc: false
76
+ };
77
+
78
+ _this.getStyle = function () {
79
+ var _a, _b;
80
+
81
+ var _c = _this.props,
82
+ data = _c.data,
83
+ hoverState = _c.hoverState,
84
+ maxHeight = _c.maxHeight,
85
+ maxWidth = _c.maxWidth,
86
+ minHeight = _c.minHeight,
87
+ minWidth = _c.minWidth,
88
+ limitWidthHeight = _c.limitWidthHeight,
89
+ scale = _c.scale;
90
+ var hoverImgSrc = _this.state.hoverImgSrc;
91
+ var obj = {};
92
+
93
+ if (((_a = data === null || data === void 0 ? void 0 : data.hover) === null || _a === void 0 ? void 0 : _a.open) && ((_b = data === null || data === void 0 ? void 0 : data.hover) === null || _b === void 0 ? void 0 : _b.backgroundType) === 'enlarge' && (hoverState || hoverImgSrc)) {
94
+ // return { transform: `scale(${data.hover.magnification})` };
95
+ obj.transform = "scale(" + data.hover.magnification + ")";
96
+ obj.zIndex = '1';
97
+ }
98
+
99
+ if (maxHeight) {
100
+ obj.maxHeight = maxHeight;
101
+ }
102
+
103
+ if (maxWidth || maxWidth === 0) {
104
+ obj.maxWidth = maxWidth;
105
+ }
106
+
107
+ if (minHeight) {
108
+ obj.minHeight = minHeight;
109
+ }
110
+
111
+ if (minWidth) {
112
+ obj.minWidth = minWidth;
113
+ }
114
+
115
+ if (limitWidthHeight) {
116
+ if ((0, _coreUtil.isPc)()) {
117
+ if (data.content.pcImgWidth) obj.width = data.content.pcImgWidth * scale;
118
+
119
+ if (data.content.pcImgWidth > data.content.pcImgHeight) {
120
+ obj.height = 'auto';
121
+ } else if (data.content.pcImgHeight) obj.height = data.content.pcImgHeight * scale;
122
+ } else {
123
+ if (data.content.h5ImgWidth) obj.width = data.content.h5ImgWidth * scale; // if (data.content.h5ImgHeight) obj.height = data.content.h5ImgHeight * scale;
124
+
125
+ if (data.content.h5ImgWidth > data.content.h5ImgHeight || data.content.h5ImgHeight > maxHeight) {
126
+ obj.height = 'auto';
127
+ } else if (data.content.h5ImgHeight) obj.height = data.content.h5ImgHeight * scale;
128
+ }
129
+ }
130
+
131
+ return obj;
132
+ };
133
+
134
+ _this.mouseEnterImg = function () {
135
+ var _a;
136
+
137
+ var data = _this.props.data;
138
+
139
+ if ((_a = data === null || data === void 0 ? void 0 : data.hover) === null || _a === void 0 ? void 0 : _a.open) {
140
+ _this.setState({
141
+ hoverImgSrc: true
142
+ });
143
+ }
144
+ };
145
+
146
+ _this.mouseLeaveImg = function () {
147
+ var _a;
148
+
149
+ var data = _this.props.data;
150
+
151
+ if ((_a = data === null || data === void 0 ? void 0 : data.hover) === null || _a === void 0 ? void 0 : _a.open) {
152
+ _this.setState({
153
+ hoverImgSrc: false
154
+ });
155
+ }
156
+ };
157
+
158
+ return _this;
159
+ }
160
+
161
+ MetaImage.prototype.render = function () {
162
+ var _a, _b, _c, _d;
163
+
164
+ var _e = this.props,
165
+ data = _e.data,
166
+ hoverState = _e.hoverState;
167
+ var hoverImgSrc = this.state.hoverImgSrc;
168
+ var srcImg = (0, _coreUtil.isPc)() ? (_a = data.content) === null || _a === void 0 ? void 0 : _a.pcImgSrc : (_b = data.content) === null || _b === void 0 ? void 0 : _b.h5ImgSrc;
169
+
170
+ if (((_c = data === null || data === void 0 ? void 0 : data.hover) === null || _c === void 0 ? void 0 : _c.open) && ((_d = data === null || data === void 0 ? void 0 : data.hover) === null || _d === void 0 ? void 0 : _d.backgroundType) === 'new' && (hoverState || hoverImgSrc)) {
171
+ srcImg = (0, _coreUtil.isPc)() ? data.hover.pcImgHoverUrl : data.hover.h5ImgHoverUrl;
172
+ }
173
+
174
+ if (!srcImg) {
175
+ srcImg = (0, _coreUtil.isPc)() ? _pcDefImg["default"] : _h5DefImg["default"];
176
+ }
177
+
178
+ return /*#__PURE__*/_react["default"].createElement("div", {
179
+ className: (0, _classnames["default"])('menu-meta-image'),
180
+ onClick: function onClick() {
181
+ (0, _coreUtil.clickUrl)(data.content.clickUrl);
182
+ }
183
+ }, srcImg && /*#__PURE__*/_react["default"].createElement("img", {
184
+ ref: this.imgRef,
185
+ onMouseEnter: this.mouseEnterImg,
186
+ onMouseLeave: this.mouseLeaveImg,
187
+ src: srcImg,
188
+ style: (0, _commonUtil.pxToRem)(this.getStyle())
189
+ }));
190
+ };
191
+
192
+ MetaImage.defaultProps = {
193
+ data: {
194
+ content: {},
195
+ hover: {}
196
+ },
197
+ hoverState: false,
198
+ limitWidthHeight: false,
199
+ scale: 1
200
+ };
201
+ MetaImage = __decorate([_decorator.metaDecorator], MetaImage);
202
+ return MetaImage;
203
+ }(_react["default"].Component);
204
+
205
+ var _default = MetaImage;
206
+ exports["default"] = _default;
@@ -0,0 +1,25 @@
1
+ .menu-meta-image {
2
+ position: relative;
3
+ width: 100%;
4
+ height: 100%;
5
+ display: flex;
6
+ justify-content: center;
7
+ // overflow: hidden;
8
+ &>img {
9
+ width: 100%;
10
+ height: 100%;
11
+ // object-fit: contain;
12
+ transition: all .2s linear;
13
+ vertical-align: initial;
14
+ max-width: 100%;
15
+ object-fit: contain;
16
+ }
17
+
18
+ &.backgroundImg {
19
+ &>img {
20
+ // object-fit: cover;
21
+ // width: auto;
22
+ max-width: none;
23
+ }
24
+ }
25
+ }