@dckj-npm/dc-material 0.1.145 → 0.1.147
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.
- package/build/lowcode/assets-daily.json +13 -13
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +13 -13
- package/build/lowcode/meta.design.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/dist/BizComps.css +1 -1
- package/dist/BizComps.js +2 -2
- package/dist/BizComps.js.map +1 -1
- package/es/assets/icon/grid-nav/right.png +0 -0
- package/es/assets/icon/position/img.png +0 -0
- package/es/assets/icon/position/location.png +0 -0
- package/es/assets/icon/search/delete.png +0 -0
- package/es/assets/icon/search/search.png +0 -0
- package/es/assets/icon/teletext-list/arr.png +0 -0
- package/es/components/form/form-item.js +79 -0
- package/es/components/form/form-item.scss +20 -0
- package/lowcode_es/meta.js +1 -1
- package/lowcode_lib/meta.js +1 -1
- package/package.json +2 -2
- package/es/components/goods-card-list/goods-card-list-common.js +0 -60
- package/es/components/goods-card-list/goods-card-list-common.scss +0 -118
- package/es/components/goods-card-list/goods-card-list.js +0 -156
- package/es/components/goods-card-list/goods-card-list.scss +0 -112
- package/es/components/goods-card-list/index.js +0 -3
- package/es/components/goods-card-list/types.js +0 -1
- package/es/components/grid-nav/grid-nav.js +0 -91
- package/es/components/grid-nav/index.js +0 -2
- package/es/components/grid-nav/index.scss +0 -41
- package/es/components/integral-task/index.js +0 -5
- package/es/components/integral-task/index.scss +0 -35
- package/es/components/integral-task/integral-task.js +0 -54
- package/es/components/menu-list/index.js +0 -6
- package/es/components/menu-list/index.scss +0 -16
- package/es/components/menu-list/menu-list-item.js +0 -32
- package/es/components/menu-list/menu-list-item.scss +0 -49
- package/es/components/menu-list/menu-list.js +0 -25
- package/es/components/menu-list/types.js +0 -1
- package/es/components/message-list/index.js +0 -6
- package/es/components/message-list/index.scss +0 -22
- package/es/components/message-list/message-list-item.js +0 -41
- package/es/components/message-list/message-list-item.scss +0 -60
- package/es/components/message-list/message-list.js +0 -53
- package/es/components/notice-bar/components/ScrollSwitcher.js +0 -45
- package/es/components/notice-bar/components/ScrollSwitcher.scss +0 -17
- package/es/components/notice-bar/index.js +0 -2
- package/es/components/notice-bar/index.scss +0 -42
- package/es/components/notice-bar/notice-bar-item.js +0 -29
- package/es/components/notice-bar/notice-bar-item.scss +0 -26
- package/es/components/notice-bar/notice-bar.js +0 -83
- package/es/components/position/entity.js +0 -1
- package/es/components/position/index.js +0 -2
- package/es/components/position/index.scss +0 -27
- package/es/components/position/position-left.js +0 -28
- package/es/components/position/position-list.js +0 -30
- package/es/components/position/position.js +0 -48
- package/es/components/radio-group/index.js +0 -7
- package/es/components/radio-group/index.scss +0 -40
- package/es/components/radio-group/radio-group-item.js +0 -74
- package/es/components/radio-group/radio-group.js +0 -80
- package/es/components/rich-text/index.js +0 -6
- package/es/components/rich-text/index.scss +0 -19
- package/es/components/rich-text/rich-text.js +0 -37
- package/es/components/search-bar/index.js +0 -2
- package/es/components/search-bar/index.scss +0 -13
- package/es/components/search-bar/search-bar.js +0 -33
- package/es/components/swiper/index.js +0 -2
- package/es/components/swiper/index.scss +0 -12
- package/es/components/swiper/swiper.js +0 -34
- package/es/components/tab/index.js +0 -5
- package/es/components/tab/index.scss +0 -39
- package/es/components/tab/tab.js +0 -50
- package/es/components/tab-container/index.js +0 -2
- package/es/components/tab-container/index.scss +0 -48
- package/es/components/tab-container/tab-container.js +0 -26
- package/es/components/tab-container-item/index.js +0 -2
- package/es/components/tab-container-item/index.scss +0 -0
- package/es/components/tab-container-item/tab-container-item.js +0 -19
- package/es/components/tag/index.js +0 -5
- package/es/components/tag/index.scss +0 -24
- package/es/components/tag/tag.js +0 -14
- package/es/components/teletext-list/index.js +0 -6
- package/es/components/teletext-list/index.scss +0 -19
- package/es/components/teletext-list/teletext-list-item.js +0 -61
- package/es/components/teletext-list/teletext-list-item.scss +0 -55
- package/es/components/teletext-list/teletext-list.js +0 -38
- package/es/components/title/index.js +0 -7
- package/es/components/title/title-1.js +0 -16
- package/es/components/title/title-1.scss +0 -25
- package/es/components/title/title-2.js +0 -31
- package/es/components/title/title-2.scss +0 -22
- package/es/index.js +0 -78
- package/es/index.scss +0 -6
- package/es/style.js +0 -5
- package/es/utils/children-node-handle.js +0 -25
- package/es/utils/component-wrapper.js +0 -38
- package/es/utils/debounce.js +0 -14
- package/es/utils/time-util.js +0 -18
- package/es/variables.js +0 -2
- package/es/variables.scss +0 -3
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
2
|
+
import _Upload from "@alifd/next/es/upload";
|
|
3
|
+
import _Form from "@alifd/next/es/form";
|
|
4
|
+
import _Icon from "@alifd/next/es/icon";
|
|
5
|
+
import _Input from "@alifd/next/es/input";
|
|
6
|
+
var _excluded = ["columnComment", "columnType", "columnKeyType", "columnKeyTypeEnum", "isOnlyRead", "isRequired", "defaultValue", "guideWords", "onClick"];
|
|
7
|
+
import React, { useState } from 'react';
|
|
8
|
+
import "./form-item.scss";
|
|
9
|
+
var Input = _Input,
|
|
10
|
+
Icon = _Icon,
|
|
11
|
+
Form = _Form,
|
|
12
|
+
Upload = _Upload;
|
|
13
|
+
var Item = Form.Item;
|
|
14
|
+
var DCFormItem = function DCFormItem(_ref) {
|
|
15
|
+
var columnComment = _ref.columnComment,
|
|
16
|
+
columnType = _ref.columnType,
|
|
17
|
+
columnKeyType = _ref.columnKeyType,
|
|
18
|
+
columnKeyTypeEnum = _ref.columnKeyTypeEnum,
|
|
19
|
+
isOnlyRead = _ref.isOnlyRead,
|
|
20
|
+
isRequired = _ref.isRequired,
|
|
21
|
+
defaultValue = _ref.defaultValue,
|
|
22
|
+
guideWords = _ref.guideWords,
|
|
23
|
+
_ref$onClick = _ref.onClick,
|
|
24
|
+
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
25
|
+
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
26
|
+
var _otherProps = otherProps || {};
|
|
27
|
+
console.log();
|
|
28
|
+
// 使用 useState 来管理输入框的值
|
|
29
|
+
var _useState = useState(defaultValue),
|
|
30
|
+
value = _useState[0],
|
|
31
|
+
setValue = _useState[1];
|
|
32
|
+
|
|
33
|
+
// 动态渲染内容
|
|
34
|
+
var renderContent = function renderContent() {
|
|
35
|
+
switch (columnKeyTypeEnum.name) {
|
|
36
|
+
case '单行文本':
|
|
37
|
+
case '联系人':
|
|
38
|
+
case '手机':
|
|
39
|
+
case '邮箱':
|
|
40
|
+
// 文本框
|
|
41
|
+
return /*#__PURE__*/React.createElement(Input, {
|
|
42
|
+
value: value,
|
|
43
|
+
placeholder: guideWords || '请输入',
|
|
44
|
+
onChange: function onChange(v, e) {
|
|
45
|
+
return setValue(e.target.value);
|
|
46
|
+
},
|
|
47
|
+
style: {
|
|
48
|
+
textAlign: 'right'
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
case '图片':
|
|
52
|
+
return /*#__PURE__*/React.createElement(Upload.Card, {
|
|
53
|
+
listType: "card",
|
|
54
|
+
action: "https://www.easy-mock.com/mock/5b713974309d0d7d107a74a3/alifd/upload",
|
|
55
|
+
accept: "image/png, image/jpg, image/jpeg, image/gif, image/bmp",
|
|
56
|
+
reUpload: true,
|
|
57
|
+
style: {
|
|
58
|
+
width: '90px',
|
|
59
|
+
height: '90px'
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
case '多行文本':
|
|
63
|
+
return /*#__PURE__*/React.createElement(Input.TextArea, {
|
|
64
|
+
value: value,
|
|
65
|
+
placeholder: guideWords || '请输入'
|
|
66
|
+
});
|
|
67
|
+
default:
|
|
68
|
+
return /*#__PURE__*/React.createElement("span", null, guideWords || '未定义的类型');
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
"class": "form-item"
|
|
73
|
+
}, /*#__PURE__*/React.cloneElement(renderContent()));
|
|
74
|
+
};
|
|
75
|
+
var RefDCFormItem = /*#__PURE__*/React.forwardRef(DCFormItem);
|
|
76
|
+
RefDCFormItem.displayName = 'DCFormItem';
|
|
77
|
+
RefDCFormItem.defaultProps = {};
|
|
78
|
+
RefDCFormItem.propTypes = {};
|
|
79
|
+
export default RefDCFormItem;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.form-item {
|
|
2
|
+
input {
|
|
3
|
+
outline: none;
|
|
4
|
+
border: none;
|
|
5
|
+
text-align: right;
|
|
6
|
+
}
|
|
7
|
+
.next-input {
|
|
8
|
+
border: none !important;
|
|
9
|
+
}
|
|
10
|
+
:global{
|
|
11
|
+
.next-input {
|
|
12
|
+
outline: none;
|
|
13
|
+
border: none !important;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
.next-upload-card {
|
|
17
|
+
width: 90px;
|
|
18
|
+
height: 90px;
|
|
19
|
+
}
|
|
20
|
+
}
|
package/lowcode_es/meta.js
CHANGED
|
@@ -95,7 +95,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
|
|
|
95
95
|
packageName = '@dckj-npm/dc-material';
|
|
96
96
|
}
|
|
97
97
|
if (version === void 0) {
|
|
98
|
-
version = '0.1.
|
|
98
|
+
version = '0.1.147';
|
|
99
99
|
}
|
|
100
100
|
if (basicLibraryVersion === void 0) {
|
|
101
101
|
basicLibraryVersion = {
|
package/lowcode_lib/meta.js
CHANGED
|
@@ -100,7 +100,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
|
|
|
100
100
|
packageName = '@dckj-npm/dc-material';
|
|
101
101
|
}
|
|
102
102
|
if (version === void 0) {
|
|
103
|
-
version = '0.1.
|
|
103
|
+
version = '0.1.147';
|
|
104
104
|
}
|
|
105
105
|
if (basicLibraryVersion === void 0) {
|
|
106
106
|
basicLibraryVersion = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dckj-npm/dc-material",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.147",
|
|
4
4
|
"description": "dc低代码物料",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
},
|
|
104
104
|
"componentConfig": {
|
|
105
105
|
"isComponentLibrary": true,
|
|
106
|
-
"materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.
|
|
106
|
+
"materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.147/build/lowcode/assets-prod.json"
|
|
107
107
|
},
|
|
108
108
|
"lcMeta": {
|
|
109
109
|
"type": "component"
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["dataList", "maxSales", "onClick"];
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import Carousel from "../carousel/carousel";
|
|
6
|
-
import "./goods-card-list-common.scss";
|
|
7
|
-
var GoodsCardListCommon = function GoodsCardListCommon(_ref) {
|
|
8
|
-
var _ref$dataList = _ref.dataList,
|
|
9
|
-
dataList = _ref$dataList === void 0 ? [] : _ref$dataList,
|
|
10
|
-
_ref$maxSales = _ref.maxSales,
|
|
11
|
-
maxSales = _ref$maxSales === void 0 ? 1000 : _ref$maxSales,
|
|
12
|
-
_ref$onClick = _ref.onClick,
|
|
13
|
-
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
14
|
-
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
15
|
-
var _otherProps = otherProps || {};
|
|
16
|
-
var resolveResultDesc = function resolveResultDesc(desc) {
|
|
17
|
-
var htmlString = "<div>" + desc + "</div>";
|
|
18
|
-
// 创建一个虚拟的 DOM 容器
|
|
19
|
-
var tempDiv = document.createElement('div');
|
|
20
|
-
tempDiv.innerHTML = htmlString;
|
|
21
|
-
// 提取文本
|
|
22
|
-
return tempDiv.textContent || tempDiv.innerText;
|
|
23
|
-
};
|
|
24
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
25
|
-
className: "card-list-goods-common__container"
|
|
26
|
-
}, _otherProps), dataList.map(function (item) {
|
|
27
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
28
|
-
key: item.key,
|
|
29
|
-
className: "card-list-goods__item",
|
|
30
|
-
onClick: function onClick() {
|
|
31
|
-
return _onClick(item);
|
|
32
|
-
}
|
|
33
|
-
}, item.imageList && item.imageList.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
34
|
-
className: "card-list-goods__image"
|
|
35
|
-
}, /*#__PURE__*/React.createElement(Carousel, {
|
|
36
|
-
images: item.imageList,
|
|
37
|
-
interval: 3000
|
|
38
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
39
|
-
className: "card-list-goods__content"
|
|
40
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
41
|
-
className: "card-list-goods__title"
|
|
42
|
-
}, item.title), /*#__PURE__*/React.createElement("div", {
|
|
43
|
-
className: "card-list-goods__desc"
|
|
44
|
-
}, resolveResultDesc(item.desc)), /*#__PURE__*/React.createElement("div", {
|
|
45
|
-
className: "card-list-goods__bottom"
|
|
46
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
47
|
-
className: "card-list-goods__unit"
|
|
48
|
-
}, "\uFFE5"), /*#__PURE__*/React.createElement("div", {
|
|
49
|
-
className: "card-list-goods__price"
|
|
50
|
-
}, item.activePrice || item.price), item.activePrice && /*#__PURE__*/React.createElement("div", {
|
|
51
|
-
className: "card-list-goods__unit__delete"
|
|
52
|
-
}, "\uFFE5"), item.activePrice && /*#__PURE__*/React.createElement("div", {
|
|
53
|
-
className: "card-list-goods__price__delete"
|
|
54
|
-
}, item.price), /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
className: "card-list-goods__sales"
|
|
56
|
-
}, "\u5DF2\u552E", item.sales > maxSales ? maxSales + "+" : item.sales))));
|
|
57
|
-
}));
|
|
58
|
-
};
|
|
59
|
-
GoodsCardListCommon.displayName = 'GoodsCardListCommon';
|
|
60
|
-
export default GoodsCardListCommon;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
.card-list-goods-common__container {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-template-columns:repeat(2, minmax(0, 1fr));
|
|
4
|
-
row-gap: 12px;
|
|
5
|
-
column-gap: 10px;
|
|
6
|
-
width: 100%;
|
|
7
|
-
|
|
8
|
-
& > .card-list-goods__item {
|
|
9
|
-
box-sizing: border-box;
|
|
10
|
-
transition: top 0.35s ease, left 0.35s ease, width 0.35s ease;
|
|
11
|
-
overflow: hidden;
|
|
12
|
-
border-radius: 8px;
|
|
13
|
-
box-shadow: 0 3px 9px 1px rgba(204, 204, 204, 0.35);
|
|
14
|
-
|
|
15
|
-
& > .card-list-goods__image {
|
|
16
|
-
height: 200px;
|
|
17
|
-
width: 100%;
|
|
18
|
-
overflow: hidden;
|
|
19
|
-
display: flex;
|
|
20
|
-
|
|
21
|
-
& > img {
|
|
22
|
-
height: 100%;
|
|
23
|
-
width: 100%;
|
|
24
|
-
object-fit: cover;
|
|
25
|
-
//object-position: center;
|
|
26
|
-
object-position: 50% 50%;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
& > .card-list-goods__content {
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
justify-content: space-between;
|
|
34
|
-
padding: 0.5rem;
|
|
35
|
-
|
|
36
|
-
.card-list-goods__title {
|
|
37
|
-
overflow: hidden;
|
|
38
|
-
display: -webkit-box;
|
|
39
|
-
-webkit-box-orient: vertical;
|
|
40
|
-
-webkit-line-clamp: 2;
|
|
41
|
-
line-clamp: 2;
|
|
42
|
-
margin-top: 0.25rem;
|
|
43
|
-
margin-bottom: 0.25rem;
|
|
44
|
-
font-size: 14px;
|
|
45
|
-
font-weight: 700;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.card-list-goods__desc {
|
|
49
|
-
overflow: hidden;
|
|
50
|
-
text-overflow: ellipsis;
|
|
51
|
-
white-space: nowrap;
|
|
52
|
-
line-clamp: 2;
|
|
53
|
-
margin-top: 0.25rem;
|
|
54
|
-
margin-bottom: 0.25rem;
|
|
55
|
-
font-size: 12px;
|
|
56
|
-
color: #333333;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.card-list-goods__bottom {
|
|
60
|
-
margin-top: 0.25rem;
|
|
61
|
-
margin-bottom: 0.25rem;
|
|
62
|
-
display: flex;
|
|
63
|
-
align-items: baseline;
|
|
64
|
-
flex-wrap: wrap;
|
|
65
|
-
row-gap: 0.5rem;
|
|
66
|
-
|
|
67
|
-
& > div {
|
|
68
|
-
display: flex;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.card-list-goods__unit {
|
|
72
|
-
font-size: 12px;
|
|
73
|
-
color: #F57D51;
|
|
74
|
-
font-weight: 700;
|
|
75
|
-
line-height: 1;
|
|
76
|
-
|
|
77
|
-
&__delete {
|
|
78
|
-
margin-left: 0;
|
|
79
|
-
font-size: 14px;
|
|
80
|
-
color: #666666;
|
|
81
|
-
line-height: 1;
|
|
82
|
-
text-decoration: line-through
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.card-list-goods__price {
|
|
88
|
-
font-size: 17px;
|
|
89
|
-
color: #F57D51;
|
|
90
|
-
font-weight: 700;
|
|
91
|
-
line-height: 1;
|
|
92
|
-
|
|
93
|
-
&__delete {
|
|
94
|
-
margin-left: 0;
|
|
95
|
-
font-size: 14px;
|
|
96
|
-
color: #666666;
|
|
97
|
-
line-height: 1;
|
|
98
|
-
text-decoration: line-through
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.card-list-goods__sales {
|
|
103
|
-
margin-left: 3px;
|
|
104
|
-
font-size: 12px;
|
|
105
|
-
color: #666666;
|
|
106
|
-
line-height: 1;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["dataList", "maxSales", "onClick"];
|
|
4
|
-
import React, { useEffect, useState } from 'react';
|
|
5
|
-
import { debounce } from "../../utils/debounce";
|
|
6
|
-
import Carousel from "../carousel/carousel";
|
|
7
|
-
import "./goods-card-list.scss";
|
|
8
|
-
var GoodsCardList = function GoodsCardList(_ref) {
|
|
9
|
-
var _ref$dataList = _ref.dataList,
|
|
10
|
-
dataList = _ref$dataList === void 0 ? [] : _ref$dataList,
|
|
11
|
-
_ref$maxSales = _ref.maxSales,
|
|
12
|
-
maxSales = _ref$maxSales === void 0 ? 1000 : _ref$maxSales,
|
|
13
|
-
_ref$onClick = _ref.onClick,
|
|
14
|
-
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
15
|
-
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
16
|
-
var _useState = useState([]),
|
|
17
|
-
positions = _useState[0],
|
|
18
|
-
setPositions = _useState[1];
|
|
19
|
-
var _useState2 = useState(0),
|
|
20
|
-
columnWidth = _useState2[0],
|
|
21
|
-
setColumnWidth = _useState2[1];
|
|
22
|
-
var _useState3 = useState(0),
|
|
23
|
-
maxContainerHeight = _useState3[0],
|
|
24
|
-
setMaxContainerHeight = _useState3[1];
|
|
25
|
-
useEffect(function () {
|
|
26
|
-
var updateLayout = function updateLayout() {
|
|
27
|
-
var container = document.querySelector('.waterfall-container');
|
|
28
|
-
if (container) {
|
|
29
|
-
var itemElements = document.querySelectorAll('.waterfall-item');
|
|
30
|
-
// 横向间距
|
|
31
|
-
var horizontalGap = 12;
|
|
32
|
-
// 纵向间距
|
|
33
|
-
var verticalGap = 10;
|
|
34
|
-
var containerWidth = container.offsetWidth;
|
|
35
|
-
// 每列宽度为容器宽度的一半减去间距
|
|
36
|
-
var calculatedColumnWidth = (containerWidth - horizontalGap) / 2;
|
|
37
|
-
setColumnWidth(calculatedColumnWidth);
|
|
38
|
-
// 两列布局
|
|
39
|
-
var columnHeights = Array.from({
|
|
40
|
-
length: 2
|
|
41
|
-
}).fill(0);
|
|
42
|
-
var newPositions = [];
|
|
43
|
-
// 循环计算所有的子元素的信息
|
|
44
|
-
itemElements.forEach(function (item) {
|
|
45
|
-
var _item$getBoundingClie = item.getBoundingClientRect(),
|
|
46
|
-
height = _item$getBoundingClie.height;
|
|
47
|
-
// 找到最短的那一列
|
|
48
|
-
var minHeight = Math.min.apply(Math, columnHeights);
|
|
49
|
-
// 获取该列的索引
|
|
50
|
-
var columnIndex = columnHeights.indexOf(minHeight);
|
|
51
|
-
var left = columnIndex * (calculatedColumnWidth + horizontalGap);
|
|
52
|
-
var top = columnHeights[columnIndex];
|
|
53
|
-
// 存储元素的定位
|
|
54
|
-
newPositions.push({
|
|
55
|
-
left: left,
|
|
56
|
-
top: top
|
|
57
|
-
});
|
|
58
|
-
// 更新该列的高度
|
|
59
|
-
columnHeights[columnIndex] += height + verticalGap;
|
|
60
|
-
});
|
|
61
|
-
// 更新位置
|
|
62
|
-
setPositions(newPositions);
|
|
63
|
-
setMaxContainerHeight(Math.max.apply(Math, columnHeights));
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
var debouncedUpdateLayout = dataList.length < 15 ? updateLayout : debounce(updateLayout, 200);
|
|
67
|
-
// 图片加载完成后更新布局
|
|
68
|
-
var handleImageLoad = function handleImageLoad() {
|
|
69
|
-
debouncedUpdateLayout();
|
|
70
|
-
};
|
|
71
|
-
// 初始化布局
|
|
72
|
-
debouncedUpdateLayout();
|
|
73
|
-
// 监听图片加载事件,以确保所有图片都加载完后再更新布局
|
|
74
|
-
var images = document.querySelectorAll('.waterfall-container img');
|
|
75
|
-
images.forEach(function (img) {
|
|
76
|
-
// 如果图片已经加载完成(缓存中加载),则立即更新布局
|
|
77
|
-
if (img.complete) {
|
|
78
|
-
handleImageLoad();
|
|
79
|
-
} else {
|
|
80
|
-
// 如果图片未加载完成,监听加载事件
|
|
81
|
-
img.addEventListener('load', handleImageLoad);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// 窗口变化时更新布局
|
|
86
|
-
window.addEventListener('resize', debouncedUpdateLayout);
|
|
87
|
-
return function () {
|
|
88
|
-
// 清理事件监听
|
|
89
|
-
window.removeEventListener('resize', debouncedUpdateLayout);
|
|
90
|
-
images.forEach(function (img) {
|
|
91
|
-
return img.removeEventListener('load', handleImageLoad);
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
},
|
|
95
|
-
// 当 dataList 变化时重新计算
|
|
96
|
-
[dataList]);
|
|
97
|
-
var resolveResultDesc = function resolveResultDesc(desc) {
|
|
98
|
-
var htmlString = "<div>" + desc + "</div>";
|
|
99
|
-
// 创建一个虚拟的 DOM 容器
|
|
100
|
-
var tempDiv = document.createElement('div');
|
|
101
|
-
tempDiv.innerHTML = htmlString;
|
|
102
|
-
// 提取文本
|
|
103
|
-
return tempDiv.textContent || tempDiv.innerText;
|
|
104
|
-
};
|
|
105
|
-
var resultStyle = _extends({}, otherProps.style || {}, {
|
|
106
|
-
height: maxContainerHeight + 20 + "px"
|
|
107
|
-
});
|
|
108
|
-
var _otherProps = _extends({}, otherProps || {}, {
|
|
109
|
-
style: resultStyle
|
|
110
|
-
});
|
|
111
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
112
|
-
className: "card-list-goods__container waterfall-container",
|
|
113
|
-
style: {
|
|
114
|
-
height: maxContainerHeight + 20 + "px"
|
|
115
|
-
}
|
|
116
|
-
}, _otherProps), dataList.map(function (item, index) {
|
|
117
|
-
var _positions$index, _positions$index2;
|
|
118
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
119
|
-
key: item.key,
|
|
120
|
-
className: "card-list-goods__item waterfall-item",
|
|
121
|
-
onClick: function onClick() {
|
|
122
|
-
return _onClick(item);
|
|
123
|
-
},
|
|
124
|
-
style: {
|
|
125
|
-
left: ((_positions$index = positions[index]) === null || _positions$index === void 0 ? void 0 : _positions$index.left) + "px",
|
|
126
|
-
top: ((_positions$index2 = positions[index]) === null || _positions$index2 === void 0 ? void 0 : _positions$index2.top) + "px",
|
|
127
|
-
width: columnWidth + "px"
|
|
128
|
-
}
|
|
129
|
-
}, item.imageList && item.imageList.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
130
|
-
className: "card-list-goods__image"
|
|
131
|
-
}, /*#__PURE__*/React.createElement(Carousel, {
|
|
132
|
-
images: item.imageList,
|
|
133
|
-
interval: 3000
|
|
134
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
135
|
-
className: "card-list-goods__content"
|
|
136
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
137
|
-
className: "card-list-goods__title"
|
|
138
|
-
}, item.title), /*#__PURE__*/React.createElement("div", {
|
|
139
|
-
className: "card-list-goods__desc"
|
|
140
|
-
}, resolveResultDesc(item.desc)), /*#__PURE__*/React.createElement("div", {
|
|
141
|
-
className: "card-list-goods__bottom"
|
|
142
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
143
|
-
className: "card-list-goods__unit"
|
|
144
|
-
}, "\uFFE5"), /*#__PURE__*/React.createElement("div", {
|
|
145
|
-
className: "card-list-goods__price"
|
|
146
|
-
}, item.activePrice || item.price), item.activePrice && /*#__PURE__*/React.createElement("div", {
|
|
147
|
-
className: "card-list-goods__unit__delete"
|
|
148
|
-
}, "\uFFE5"), item.activePrice && /*#__PURE__*/React.createElement("div", {
|
|
149
|
-
className: "card-list-goods__price__delete"
|
|
150
|
-
}, item.price), /*#__PURE__*/React.createElement("div", {
|
|
151
|
-
className: "card-list-goods__sales"
|
|
152
|
-
}, "\u5DF2\u552E", item.sales > maxSales ? maxSales + "+" : item.sales))));
|
|
153
|
-
}));
|
|
154
|
-
};
|
|
155
|
-
GoodsCardList.displayName = 'GoodsCardList';
|
|
156
|
-
export default GoodsCardList;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
.card-list-goods__container {
|
|
2
|
-
position: relative;
|
|
3
|
-
width: 100%;
|
|
4
|
-
|
|
5
|
-
& > .card-list-goods__item {
|
|
6
|
-
position: absolute;
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
transition: top 0.35s ease, left 0.35s ease, width 0.35s ease;
|
|
9
|
-
overflow: hidden;
|
|
10
|
-
border-radius: 8px;
|
|
11
|
-
box-shadow: 0 3px 9px 1px rgba(204, 204, 204, 0.35);
|
|
12
|
-
|
|
13
|
-
& > .card-list-goods__image {
|
|
14
|
-
height: 200px;
|
|
15
|
-
width: 100%;
|
|
16
|
-
overflow: hidden;
|
|
17
|
-
display: flex;
|
|
18
|
-
|
|
19
|
-
& > img {
|
|
20
|
-
height: 100%;
|
|
21
|
-
width: 100%;
|
|
22
|
-
object-fit: cover;
|
|
23
|
-
object-position: center;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
& > .card-list-goods__content {
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
justify-content: space-between;
|
|
31
|
-
padding: 0.5rem;
|
|
32
|
-
|
|
33
|
-
.card-list-goods__title {
|
|
34
|
-
overflow: hidden;
|
|
35
|
-
display: -webkit-box;
|
|
36
|
-
-webkit-box-orient: vertical;
|
|
37
|
-
-webkit-line-clamp: 2;
|
|
38
|
-
line-clamp: 2;
|
|
39
|
-
margin-top: 0.25rem;
|
|
40
|
-
margin-bottom: 0.25rem;
|
|
41
|
-
font-size: 14px;
|
|
42
|
-
font-weight: 700;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.card-list-goods__desc {
|
|
46
|
-
overflow: hidden;
|
|
47
|
-
text-overflow: ellipsis;
|
|
48
|
-
white-space: nowrap;
|
|
49
|
-
line-clamp: 2;
|
|
50
|
-
margin-top: 0.25rem;
|
|
51
|
-
margin-bottom: 0.25rem;
|
|
52
|
-
font-size: 12px;
|
|
53
|
-
color: #333333;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.card-list-goods__bottom {
|
|
57
|
-
margin-top: 0.25rem;
|
|
58
|
-
margin-bottom: 0.25rem;
|
|
59
|
-
display: flex;
|
|
60
|
-
align-items: baseline;
|
|
61
|
-
flex-wrap: wrap;
|
|
62
|
-
row-gap: 0.5rem;
|
|
63
|
-
|
|
64
|
-
& > div {
|
|
65
|
-
display: flex;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.card-list-goods__unit {
|
|
69
|
-
font-size: 12px;
|
|
70
|
-
color: #F57D51;
|
|
71
|
-
font-weight: 700;
|
|
72
|
-
line-height: 1;
|
|
73
|
-
|
|
74
|
-
&__delete {
|
|
75
|
-
margin-left: 0;
|
|
76
|
-
font-size: 14px;
|
|
77
|
-
color: #666666;
|
|
78
|
-
line-height: 1;
|
|
79
|
-
text-decoration: line-through
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.card-list-goods__price {
|
|
85
|
-
font-size: 17px;
|
|
86
|
-
color: #F57D51;
|
|
87
|
-
font-weight: 700;
|
|
88
|
-
line-height: 1;
|
|
89
|
-
|
|
90
|
-
&__delete {
|
|
91
|
-
margin-left: 0;
|
|
92
|
-
font-size: 14px;
|
|
93
|
-
color: #666666;
|
|
94
|
-
line-height: 1;
|
|
95
|
-
text-decoration: line-through
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.card-list-goods__sales {
|
|
100
|
-
margin-left: 3px;
|
|
101
|
-
font-size: 12px;
|
|
102
|
-
color: #666666;
|
|
103
|
-
line-height: 1;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|