@pisell/materials 1.0.659 → 1.0.661

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 (34) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +4 -4
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +17 -17
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +18 -18
  11. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -0
  12. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +4 -2
  13. package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +1 -0
  14. package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
  15. package/es/components/pisellAnchor/index.d.ts +1 -0
  16. package/es/components/pisellAnchor/index.js +37 -20
  17. package/es/components/pisellAnchor/index.less +25 -13
  18. package/es/components/pisellList01/index.js +77 -62
  19. package/es/components/table/Table/utils.d.ts +1 -1
  20. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -0
  21. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +3 -1
  22. package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +1 -0
  23. package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
  24. package/lib/components/pisellAnchor/index.d.ts +1 -0
  25. package/lib/components/pisellAnchor/index.js +33 -15
  26. package/lib/components/pisellAnchor/index.less +25 -13
  27. package/lib/components/pisellList01/index.js +56 -49
  28. package/lib/components/table/Table/utils.d.ts +1 -1
  29. package/lowcode/data-source-table/meta.ts +4 -0
  30. package/package.json +2 -2
  31. package/es/components/pisellAnchor/PisellAnchor.d.ts +0 -14
  32. package/es/components/pisellAnchor/PisellAnchor.js +0 -18
  33. package/lib/components/pisellAnchor/PisellAnchor.d.ts +0 -14
  34. package/lib/components/pisellAnchor/PisellAnchor.js +0 -35
@@ -92,7 +92,7 @@
92
92
  }
93
93
  }
94
94
 
95
- .pisell-tabs {
95
+ .pisell-anchor-tabs {
96
96
  display: flex;
97
97
  align-items: center;
98
98
  width: 100%;
@@ -103,8 +103,8 @@
103
103
  cursor: default;
104
104
  position: relative;
105
105
 
106
- .pisell-tabs-btn-left,
107
- .pisell-tabs-btn-right {
106
+ .pisell-anchor-tabs-btn-left,
107
+ .pisell-anchor-tabs-btn-right {
108
108
  position: absolute;
109
109
  top: 50%;
110
110
  transform: translateY(-50%);
@@ -119,7 +119,7 @@
119
119
  transition: width 300ms ease;
120
120
  user-select: none;
121
121
 
122
- .pisell-tabs-btn-icon {
122
+ .pisell-anchor-tabs-btn-icon {
123
123
  width: 24px;
124
124
  height: 24px;
125
125
  background: #f1f1f1;
@@ -132,17 +132,17 @@
132
132
  }
133
133
  }
134
134
 
135
- .pisell-tabs-btn-left {
135
+ .pisell-anchor-tabs-btn-left {
136
136
  left: 0;
137
137
  background: linear-gradient(270deg, rgba(255, 255, 255, 0.8) 0%, #fff 70%);
138
138
  }
139
139
 
140
- .pisell-tabs-btn-right {
140
+ .pisell-anchor-tabs-btn-right {
141
141
  right: 0;
142
142
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.8) 0%, #fff 70%);
143
143
  }
144
144
 
145
- .pisell-tabs-content {
145
+ .pisell-anchor-tabs-content {
146
146
  flex: 1;
147
147
  display: flex;
148
148
  overflow-x: auto;
@@ -152,25 +152,37 @@
152
152
  scrollbar-width: none;
153
153
  -ms-overflow-style: none;
154
154
  padding: 0;
155
+ gap: 16px;
155
156
 
156
157
  &::-webkit-scrollbar {
157
158
  display: none;
158
159
  }
159
160
 
160
- .pisell-tabs-tab {
161
+ .pisell-anchor-tabs-tab {
161
162
  flex: 0 0 auto;
162
- padding: 8px 0;
163
+ padding: 0 16px;
163
164
  cursor: pointer;
164
165
  white-space: nowrap;
165
166
  transition: all 0.3s;
167
+ height: 48px;
168
+ display: flex;
169
+ align-items: center;
170
+ justify-content: center;
171
+ font-size: 16px;
172
+ border-radius: 100px;
166
173
 
167
- &:hover {
168
- color: #1677ff;
174
+ &:hover:not(.pisell-anchor-tabs-tab-active) {
175
+ color: var(--theme-color, #7f56d9);
169
176
  }
170
177
 
171
- &.pisell-tabs-tab-active {
172
- color: #1677ff;
178
+ &.pisell-anchor-tabs-tab-active {
179
+ color: #fff;
173
180
  font-weight: 600;
181
+ background-color: var(--theme-color, #7f56d9);
182
+ }
183
+
184
+ .pisell-anchor-tabs-tab-content {
185
+ line-height: 24px;
174
186
  }
175
187
  }
176
188
  }
@@ -33,12 +33,18 @@ __export(pisellList01_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(pisellList01_exports);
35
35
  var import_react = __toESM(require("react"));
36
- var import_icons = require("@ant-design/icons");
37
- var import_pisellViewGrid = __toESM(require("../pisellViewGrid"));
36
+ var import_antd = require("antd");
38
37
  var import_pisellAnchor = __toESM(require("../pisellAnchor"));
39
- var import_pisellEmpty = __toESM(require("../pisellEmpty"));
40
- var import_input = __toESM(require("../input"));
38
+ var import_classnames = __toESM(require("classnames"));
39
+ var import_utils = require("@pisell/utils");
41
40
  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
+ };
42
48
  var PisellList01 = ({
43
49
  showSearch,
44
50
  showCategory,
@@ -53,61 +59,62 @@ var PisellList01 = ({
53
59
  description
54
60
  }) => {
55
61
  const [currentAnchor, setCurrentAnchor] = (0, import_react.useState)("");
56
- const [products, setProducts] = (0, import_react.useState)([]);
62
+ const [filteredData, setFilteredData] = (0, import_react.useState)([]);
63
+ const [searchValue, setSearchValue] = (0, import_react.useState)("");
64
+ const platform = (0, import_utils.isMobile)() ? "h5" : "pc";
57
65
  (0, import_react.useEffect)(() => {
58
- if (!showCategory) {
59
- return setProducts(dataSource ?? []);
60
- }
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) ?? []);
66
+ if (dataSource && dataSource.length > 0) {
67
+ setCurrentAnchor(dataSource[0].key || dataSource[0].id);
68
+ setFilteredData(dataSource);
66
69
  }
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
70
  }, [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,
71
+ const handleSearch = (value) => {
72
+ setSearchValue(value);
73
+ if (onSearch) {
74
+ onSearch(value);
75
+ return;
76
+ }
77
+ if (!value) {
78
+ setFilteredData(dataSource || []);
79
+ return;
80
+ }
81
+ const filtered = (dataSource || []).filter(
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;
92
+ }
93
+ return filteredData.map((item, index) => {
94
+ return renderItem ? renderItem(item, index) : null;
95
+ });
96
+ };
97
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-list-01", className), style }, showSearch ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-list-01-search" }, /* @__PURE__ */ import_react.default.createElement(
98
+ Search,
78
99
  {
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"
100
+ placeholder: placeholder || "请输入搜索内容",
101
+ onSearch: handleSearch,
102
+ value: searchValue,
103
+ onChange: (e) => setSearchValue(e.target.value)
85
104
  }
86
105
  )) : null, showCategory ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-list-01-categories" }, /* @__PURE__ */ import_react.default.createElement(
87
106
  import_pisellAnchor.default,
88
107
  {
89
- items: dataSource,
90
- getCurrentAnchor: currentAnchor,
108
+ options: formatOptions(dataSource),
109
+ tab: currentAnchor,
91
110
  onChange: (e) => {
92
- onChange == null ? void 0 : onChange(e);
111
+ if (typeof e === "string") {
112
+ onChange == null ? void 0 : onChange(e);
113
+ }
93
114
  setCurrentAnchor(e);
94
- }
115
+ },
116
+ platform
95
117
  }
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
- ));
118
+ )) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-list-01-content" }, renderItems()));
112
119
  };
113
120
  var pisellList01_default = PisellList01;
@@ -167,7 +167,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
167
167
  sort?: SortType | undefined;
168
168
  mode: "" | "localStorage" | "remote";
169
169
  currentViewMode: ModeType;
170
- }) => ("view_mode" | "column_setting" | "order_by" | "group_by" | "gallery_setting" | "filter_setting")[];
170
+ }) => ("filter_setting" | "column_setting" | "gallery_setting" | "view_mode" | "group_by" | "order_by")[];
171
171
  export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
172
172
  export declare const stringify: (obj: Record<string, any>) => string;
173
173
  export {};
@@ -5456,6 +5456,10 @@ const dataSourceTable = {
5456
5456
  name: 'onDataSourceChange',
5457
5457
  template: 'onDataSourceChange(currentDataSource) {}',
5458
5458
  },
5459
+ {
5460
+ name: 'onDeleteFinish',
5461
+ template: 'onDeleteFinish(record){\n// 无代码 删除成功回调\nconsole.log("onDeleteFinish", record);}',
5462
+ },
5459
5463
  {
5460
5464
  name: 'rowSelection.onChange',
5461
5465
  template:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.659",
3
+ "version": "1.0.661",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -72,8 +72,8 @@
72
72
  "react-virtualized-auto-sizer": "^1.0.20",
73
73
  "react-window": "^1.8.10",
74
74
  "styled-components": "^6.0.0-rc.3",
75
- "@pisell/icon": "0.0.10",
76
75
  "@pisell/date-picker": "1.0.115",
76
+ "@pisell/icon": "0.0.10",
77
77
  "@pisell/utils": "1.0.43"
78
78
  },
79
79
  "peerDependencies": {
@@ -1,14 +0,0 @@
1
- /// <reference types="react" />
2
- interface PisellAnchorProps {
3
- options: {
4
- id: string;
5
- name: string;
6
- }[];
7
- tab?: string;
8
- containerRef?: any;
9
- onChange?: (key: string) => void;
10
- onTabClick?: () => void;
11
- hideBorder?: boolean;
12
- }
13
- declare const PisellAnchor: React.FC<PisellAnchorProps>;
14
- export default PisellAnchor;
@@ -1,18 +0,0 @@
1
- var PisellAnchor = function PisellAnchor(_ref) {
2
- var _ref$options = _ref.options,
3
- options = _ref$options === void 0 ? [] : _ref$options,
4
- tab = _ref.tab,
5
- containerRef = _ref.containerRef,
6
- onChange = _ref.onChange,
7
- onTabClick = _ref.onTabClick,
8
- _ref$hideBorder = _ref.hideBorder,
9
- hideBorder = _ref$hideBorder === void 0 ? false : _ref$hideBorder;
10
- // ... existing code ...
11
-
12
- return /*#__PURE__*/React.createElement("div", {
13
- className: classNames('pisell-anchor', {
14
- 'pisell-anchor-no-border': hideBorder
15
- })
16
- }, "// ... existing code ...");
17
- };
18
- export default PisellAnchor;
@@ -1,14 +0,0 @@
1
- /// <reference types="react" />
2
- interface PisellAnchorProps {
3
- options: {
4
- id: string;
5
- name: string;
6
- }[];
7
- tab?: string;
8
- containerRef?: any;
9
- onChange?: (key: string) => void;
10
- onTabClick?: () => void;
11
- hideBorder?: boolean;
12
- }
13
- declare const PisellAnchor: React.FC<PisellAnchorProps>;
14
- export default PisellAnchor;
@@ -1,35 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/components/pisellAnchor/PisellAnchor.tsx
20
- var PisellAnchor_exports = {};
21
- __export(PisellAnchor_exports, {
22
- default: () => PisellAnchor_default
23
- });
24
- module.exports = __toCommonJS(PisellAnchor_exports);
25
- var PisellAnchor = ({
26
- options = [],
27
- tab,
28
- containerRef,
29
- onChange,
30
- onTabClick,
31
- hideBorder = false
32
- }) => {
33
- return /* @__PURE__ */ React.createElement("div", { className: classNames("pisell-anchor", { "pisell-anchor-no-border": hideBorder }) }, "// ... existing code ...");
34
- };
35
- var PisellAnchor_default = PisellAnchor;