@pisell/materials 1.0.744 → 1.0.746
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 +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +4 -4
- package/build/lowcode/render/default/view.js +14 -14
- package/build/lowcode/view.js +13 -13
- package/es/components/pisellList01/index.js +62 -77
- package/lib/components/pisellList01/index.js +49 -56
- package/package.json +3 -3
|
@@ -4,27 +4,13 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import React, {
|
|
8
|
-
import {
|
|
7
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
8
|
+
import { SearchOutlined } from '@ant-design/icons';
|
|
9
|
+
import PisellViewGrid from "../pisellViewGrid";
|
|
9
10
|
import PisellAnchor from "../pisellAnchor";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
11
|
+
import PisellEmpty from "../pisellEmpty";
|
|
12
|
+
import Input from "../input";
|
|
12
13
|
import "./index.less";
|
|
13
|
-
var Search = Input.Search;
|
|
14
|
-
/**
|
|
15
|
-
* 将dataSource格式化为PisellAnchor需要的格式
|
|
16
|
-
* @param data
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
|
-
var formatOptions = function formatOptions() {
|
|
20
|
-
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
21
|
-
return data.map(function (item) {
|
|
22
|
-
return {
|
|
23
|
-
id: item.key || item.id,
|
|
24
|
-
name: item.title || item.name
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
14
|
var PisellList01 = function PisellList01(_ref) {
|
|
29
15
|
var showSearch = _ref.showSearch,
|
|
30
16
|
showCategory = _ref.showCategory,
|
|
@@ -44,77 +30,76 @@ var PisellList01 = function PisellList01(_ref) {
|
|
|
44
30
|
setCurrentAnchor = _useState2[1];
|
|
45
31
|
var _useState3 = useState([]),
|
|
46
32
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var _useState5 = useState(''),
|
|
50
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
51
|
-
searchValue = _useState6[0],
|
|
52
|
-
setSearchValue = _useState6[1];
|
|
53
|
-
var platform = isMobile() ? 'h5' : 'pc';
|
|
33
|
+
products = _useState4[0],
|
|
34
|
+
setProducts = _useState4[1];
|
|
54
35
|
useEffect(function () {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
}, [dataSource]);
|
|
60
|
-
|
|
61
|
-
// 处理搜索
|
|
62
|
-
var handleSearch = function handleSearch(value) {
|
|
63
|
-
setSearchValue(value);
|
|
64
|
-
if (onSearch) {
|
|
65
|
-
onSearch(value);
|
|
66
|
-
return;
|
|
36
|
+
// 不显示分类时,默认展示所有数据
|
|
37
|
+
if (!showCategory) {
|
|
38
|
+
return setProducts(dataSource !== null && dataSource !== void 0 ? dataSource : []);
|
|
67
39
|
}
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
|
|
40
|
+
if (currentAnchor) {
|
|
41
|
+
var _currentData$children;
|
|
42
|
+
var currentData = dataSource === null || dataSource === void 0 ? void 0 : dataSource.find(function (item) {
|
|
43
|
+
return item.href === currentAnchor;
|
|
44
|
+
});
|
|
45
|
+
setProducts((_currentData$children = currentData === null || currentData === void 0 ? void 0 : currentData.children) !== null && _currentData$children !== void 0 ? _currentData$children : []);
|
|
71
46
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
47
|
+
}, [currentAnchor, dataSource, showCategory]);
|
|
48
|
+
useEffect(function () {
|
|
49
|
+
var _dataSource$0$href, _dataSource$;
|
|
50
|
+
setCurrentAnchor((_dataSource$0$href = dataSource === null || dataSource === void 0 || (_dataSource$ = dataSource[0]) === null || _dataSource$ === void 0 ? void 0 : _dataSource$.href) !== null && _dataSource$0$href !== void 0 ? _dataSource$0$href : '');
|
|
51
|
+
}, [dataSource]);
|
|
77
52
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return
|
|
89
|
-
return
|
|
90
|
-
});
|
|
91
|
-
};
|
|
53
|
+
/**
|
|
54
|
+
* @title: 分类标题
|
|
55
|
+
* @description:
|
|
56
|
+
* @param {*} useMemo
|
|
57
|
+
* @return {*}
|
|
58
|
+
* @Author: WangHan
|
|
59
|
+
* @Date: 2025-01-13 16:21
|
|
60
|
+
*/
|
|
61
|
+
var categoryTitle = useMemo(function () {
|
|
62
|
+
var _dataSource$find;
|
|
63
|
+
return dataSource === null || dataSource === void 0 || (_dataSource$find = dataSource.find(function (item) {
|
|
64
|
+
return item.href === currentAnchor;
|
|
65
|
+
})) === null || _dataSource$find === void 0 ? void 0 : _dataSource$find.title;
|
|
66
|
+
}, [currentAnchor, dataSource]);
|
|
92
67
|
return /*#__PURE__*/React.createElement("div", {
|
|
93
|
-
className:
|
|
68
|
+
className: "pisell-list-01 ".concat(className),
|
|
94
69
|
style: style
|
|
95
70
|
}, showSearch ? /*#__PURE__*/React.createElement("div", {
|
|
96
71
|
className: "pisell-list-01-search"
|
|
97
|
-
}, /*#__PURE__*/React.createElement(
|
|
98
|
-
placeholder: placeholder || '
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
72
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
73
|
+
placeholder: placeholder || 'Search',
|
|
74
|
+
prefix: /*#__PURE__*/React.createElement(SearchOutlined, {
|
|
75
|
+
style: {
|
|
76
|
+
color: '#667085'
|
|
77
|
+
}
|
|
78
|
+
}),
|
|
79
|
+
onChange: onSearch,
|
|
80
|
+
allowClear: true,
|
|
81
|
+
size: "large",
|
|
82
|
+
className: "pisell-list-01-search-input"
|
|
104
83
|
})) : null, showCategory ? /*#__PURE__*/React.createElement("div", {
|
|
105
84
|
className: "pisell-list-01-categories"
|
|
106
85
|
}, /*#__PURE__*/React.createElement(PisellAnchor, {
|
|
107
|
-
|
|
108
|
-
|
|
86
|
+
items: dataSource,
|
|
87
|
+
getCurrentAnchor: currentAnchor,
|
|
109
88
|
onChange: function onChange(e) {
|
|
110
|
-
|
|
111
|
-
_onChange === null || _onChange === void 0 || _onChange(e);
|
|
112
|
-
}
|
|
89
|
+
_onChange === null || _onChange === void 0 || _onChange(e);
|
|
113
90
|
setCurrentAnchor(e);
|
|
114
|
-
}
|
|
115
|
-
platform: platform
|
|
91
|
+
}
|
|
116
92
|
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
117
|
-
className: "pisell-list-01-
|
|
118
|
-
},
|
|
93
|
+
className: "pisell-list-01-products ".concat(!products.length && isShowEmpty ? 'pisell-list-01-products-empty' : '')
|
|
94
|
+
}, showCategory ? /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
className: "pisell-list-01-products-title"
|
|
96
|
+
}, categoryTitle) : null, products.length > 0 ? /*#__PURE__*/React.createElement(PisellViewGrid, {
|
|
97
|
+
dataSource: products,
|
|
98
|
+
columns: 1,
|
|
99
|
+
verticalGap: 16,
|
|
100
|
+
renderItem: renderItem
|
|
101
|
+
}) : isShowEmpty ? /*#__PURE__*/React.createElement(PisellEmpty, {
|
|
102
|
+
description: description
|
|
103
|
+
}) : null));
|
|
119
104
|
};
|
|
120
105
|
export default PisellList01;
|
|
@@ -33,18 +33,12 @@ __export(pisellList01_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(pisellList01_exports);
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
|
-
var
|
|
36
|
+
var import_icons = require("@ant-design/icons");
|
|
37
|
+
var import_pisellViewGrid = __toESM(require("../pisellViewGrid"));
|
|
37
38
|
var import_pisellAnchor = __toESM(require("../pisellAnchor"));
|
|
38
|
-
var
|
|
39
|
-
var
|
|
39
|
+
var import_pisellEmpty = __toESM(require("../pisellEmpty"));
|
|
40
|
+
var import_input = __toESM(require("../input"));
|
|
40
41
|
var import_index = require("./index.less");
|
|
41
|
-
var { Search } = import_antd.Input;
|
|
42
|
-
var formatOptions = (data = []) => {
|
|
43
|
-
return data.map((item) => ({
|
|
44
|
-
id: item.key || item.id,
|
|
45
|
-
name: item.title || item.name
|
|
46
|
-
}));
|
|
47
|
-
};
|
|
48
42
|
var PisellList01 = ({
|
|
49
43
|
showSearch,
|
|
50
44
|
showCategory,
|
|
@@ -59,62 +53,61 @@ var PisellList01 = ({
|
|
|
59
53
|
description
|
|
60
54
|
}) => {
|
|
61
55
|
const [currentAnchor, setCurrentAnchor] = (0, import_react.useState)("");
|
|
62
|
-
const [
|
|
63
|
-
const [searchValue, setSearchValue] = (0, import_react.useState)("");
|
|
64
|
-
const platform = (0, import_utils.isMobile)() ? "h5" : "pc";
|
|
56
|
+
const [products, setProducts] = (0, import_react.useState)([]);
|
|
65
57
|
(0, import_react.useEffect)(() => {
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
setFilteredData(dataSource);
|
|
69
|
-
}
|
|
70
|
-
}, [dataSource]);
|
|
71
|
-
const handleSearch = (value) => {
|
|
72
|
-
setSearchValue(value);
|
|
73
|
-
if (onSearch) {
|
|
74
|
-
onSearch(value);
|
|
75
|
-
return;
|
|
58
|
+
if (!showCategory) {
|
|
59
|
+
return setProducts(dataSource ?? []);
|
|
76
60
|
}
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
(item) => item.title && item.title.toLowerCase().includes(value.toLowerCase()) || item.name && item.name.toLowerCase().includes(value.toLowerCase())
|
|
83
|
-
);
|
|
84
|
-
setFilteredData(filtered);
|
|
85
|
-
};
|
|
86
|
-
const renderItems = () => {
|
|
87
|
-
if (!filteredData || filteredData.length === 0) {
|
|
88
|
-
if (isShowEmpty) {
|
|
89
|
-
return /* @__PURE__ */ import_react.default.createElement(import_antd.Empty, { description: description || "暂无数据" });
|
|
90
|
-
}
|
|
91
|
-
return null;
|
|
61
|
+
if (currentAnchor) {
|
|
62
|
+
const currentData = dataSource == null ? void 0 : dataSource.find(
|
|
63
|
+
(item) => item.href === currentAnchor
|
|
64
|
+
);
|
|
65
|
+
setProducts((currentData == null ? void 0 : currentData.children) ?? []);
|
|
92
66
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
67
|
+
}, [currentAnchor, dataSource, showCategory]);
|
|
68
|
+
(0, import_react.useEffect)(() => {
|
|
69
|
+
var _a;
|
|
70
|
+
setCurrentAnchor(((_a = dataSource == null ? void 0 : dataSource[0]) == null ? void 0 : _a.href) ?? "");
|
|
71
|
+
}, [dataSource]);
|
|
72
|
+
const categoryTitle = (0, import_react.useMemo)(() => {
|
|
73
|
+
var _a;
|
|
74
|
+
return (_a = dataSource == null ? void 0 : dataSource.find((item) => item.href === currentAnchor)) == null ? void 0 : _a.title;
|
|
75
|
+
}, [currentAnchor, dataSource]);
|
|
76
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-list-01 ${className}`, style }, showSearch ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-list-01-search" }, /* @__PURE__ */ import_react.default.createElement(
|
|
77
|
+
import_input.default,
|
|
99
78
|
{
|
|
100
|
-
placeholder: placeholder || "
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
79
|
+
placeholder: placeholder || "Search",
|
|
80
|
+
prefix: /* @__PURE__ */ import_react.default.createElement(import_icons.SearchOutlined, { style: { color: "#667085" } }),
|
|
81
|
+
onChange: onSearch,
|
|
82
|
+
allowClear: true,
|
|
83
|
+
size: "large",
|
|
84
|
+
className: "pisell-list-01-search-input"
|
|
104
85
|
}
|
|
105
86
|
)) : null, showCategory ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-list-01-categories" }, /* @__PURE__ */ import_react.default.createElement(
|
|
106
87
|
import_pisellAnchor.default,
|
|
107
88
|
{
|
|
108
|
-
|
|
109
|
-
|
|
89
|
+
items: dataSource,
|
|
90
|
+
getCurrentAnchor: currentAnchor,
|
|
110
91
|
onChange: (e) => {
|
|
111
|
-
|
|
112
|
-
onChange == null ? void 0 : onChange(e);
|
|
113
|
-
}
|
|
92
|
+
onChange == null ? void 0 : onChange(e);
|
|
114
93
|
setCurrentAnchor(e);
|
|
115
|
-
}
|
|
116
|
-
platform
|
|
94
|
+
}
|
|
117
95
|
}
|
|
118
|
-
)) : null, /* @__PURE__ */ import_react.default.createElement(
|
|
96
|
+
)) : null, /* @__PURE__ */ import_react.default.createElement(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
className: `pisell-list-01-products ${!products.length && isShowEmpty ? "pisell-list-01-products-empty" : ""}`
|
|
100
|
+
},
|
|
101
|
+
showCategory ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-list-01-products-title" }, categoryTitle) : null,
|
|
102
|
+
products.length > 0 ? /* @__PURE__ */ import_react.default.createElement(
|
|
103
|
+
import_pisellViewGrid.default,
|
|
104
|
+
{
|
|
105
|
+
dataSource: products,
|
|
106
|
+
columns: 1,
|
|
107
|
+
verticalGap: 16,
|
|
108
|
+
renderItem
|
|
109
|
+
}
|
|
110
|
+
) : isShowEmpty ? /* @__PURE__ */ import_react.default.createElement(import_pisellEmpty.default, { description }) : null
|
|
111
|
+
));
|
|
119
112
|
};
|
|
120
113
|
var pisellList01_default = PisellList01;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/materials",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.746",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"swiper": "^8.4.7",
|
|
72
72
|
"react-barcode": "^1.5.3",
|
|
73
73
|
"vod-js-sdk-v6": "^1.4.11",
|
|
74
|
-
"@pisell/date-picker": "1.0.115",
|
|
75
74
|
"@pisell/icon": "0.0.10",
|
|
76
|
-
"@pisell/utils": "1.0.43"
|
|
75
|
+
"@pisell/utils": "1.0.43",
|
|
76
|
+
"@pisell/date-picker": "1.0.115"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"react": "^18.0.0",
|