@pisell/materials 1.0.507 → 1.0.509
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 +3 -3
- package/build/lowcode/preview.js +7 -7
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +13 -13
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +21 -21
- package/es/components/TimeResourceSelector/index.d.ts +21 -0
- package/es/components/TimeResourceSelector/index.js +115 -0
- package/es/components/TimeResourceSelector/index.less +59 -0
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +10 -16
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +6 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +7 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +22 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +6 -0
- package/es/components/dataSourceComponents/provider/variables/VariablesProvider.js +8 -7
- package/es/components/page/index.js +4 -2
- package/es/components/pisellAnchor/index.d.ts +1 -0
- package/es/components/pisellAnchor/index.js +10 -4
- package/es/components/pisellHeaderProgressBar/index.d.ts +27 -0
- package/es/components/pisellHeaderProgressBar/index.js +75 -0
- package/es/components/pisellHeaderProgressBar/index.less +19 -0
- package/es/components/pisellList01/index.d.ts +13 -0
- package/es/components/pisellList01/index.js +94 -0
- package/es/components/pisellList01/index.less +45 -0
- package/es/components/pisellSectionHeaders/index.js +3 -7
- package/es/components/pisellSectionHeaders/index.less +8 -10
- package/es/components/pisellViewGrid/index.js +5 -1
- package/es/components/select/index.js +3 -2
- package/es/index.d.ts +2 -1
- package/es/index.js +3 -2
- package/lib/components/TimeResourceSelector/index.d.ts +21 -0
- package/lib/components/TimeResourceSelector/index.js +109 -0
- package/lib/components/TimeResourceSelector/index.less +59 -0
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +4 -5
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +6 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +7 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +23 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +6 -0
- package/lib/components/dataSourceComponents/provider/variables/VariablesProvider.js +1 -6
- package/lib/components/page/index.js +2 -2
- package/lib/components/pisellAnchor/index.d.ts +1 -0
- package/lib/components/pisellAnchor/index.js +9 -7
- package/lib/components/pisellHeaderProgressBar/index.d.ts +27 -0
- package/lib/components/pisellHeaderProgressBar/index.js +86 -0
- package/lib/components/pisellHeaderProgressBar/index.less +19 -0
- package/lib/components/pisellList01/index.d.ts +13 -0
- package/lib/components/pisellList01/index.js +97 -0
- package/lib/components/pisellList01/index.less +45 -0
- package/lib/components/pisellSectionHeaders/index.js +2 -8
- package/lib/components/pisellSectionHeaders/index.less +8 -10
- package/lib/components/pisellViewGrid/index.js +5 -1
- package/lib/components/select/index.js +2 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -3
- package/lowcode/data-source-table/meta.ts +281 -0
- package/lowcode/pisell-custom-checkbox-group/meta.ts +156 -154
- package/lowcode/pisell-header-progress-bar/meta.ts +116 -0
- package/lowcode/pisell-header-progress-bar/snippets.ts +24 -0
- package/lowcode/pisell-list01/meta.ts +74 -0
- package/lowcode/pisell-list01/snippets.ts +35 -0
- package/package.json +3 -3
- package/es/components/pisellProgressBar/index.d.ts +0 -14
- package/es/components/pisellProgressBar/index.js +0 -44
- package/es/components/pisellProgressBar/index.less +0 -48
- package/lib/components/pisellProgressBar/index.d.ts +0 -14
- package/lib/components/pisellProgressBar/index.js +0 -62
- package/lib/components/pisellProgressBar/index.less +0 -48
- package/lowcode/pisell-progress-bar/meta.ts +0 -115
- package/lowcode/pisell-progress-bar/snippets.ts +0 -15
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
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
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
8
|
+
import { SearchOutlined } from '@ant-design/icons';
|
|
9
|
+
import PisellViewGrid from "../pisellViewGrid";
|
|
10
|
+
import PisellAnchor from "../pisellAnchor";
|
|
11
|
+
import Input from "../input";
|
|
12
|
+
import "./index.less";
|
|
13
|
+
var PisellList01 = function PisellList01(_ref) {
|
|
14
|
+
var showSearch = _ref.showSearch,
|
|
15
|
+
showCategory = _ref.showCategory,
|
|
16
|
+
dataSource = _ref.dataSource,
|
|
17
|
+
renderItem = _ref.renderItem,
|
|
18
|
+
className = _ref.className,
|
|
19
|
+
style = _ref.style,
|
|
20
|
+
_onChange = _ref.onChange;
|
|
21
|
+
var _useState = useState(''),
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
currentAnchor = _useState2[0],
|
|
24
|
+
setCurrentAnchor = _useState2[1];
|
|
25
|
+
var _useState3 = useState([]),
|
|
26
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
27
|
+
products = _useState4[0],
|
|
28
|
+
setProducts = _useState4[1];
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
if (currentAnchor) {
|
|
31
|
+
var _currentData$children;
|
|
32
|
+
var currentData = dataSource === null || dataSource === void 0 ? void 0 : dataSource.find(function (item) {
|
|
33
|
+
return item.href === currentAnchor;
|
|
34
|
+
});
|
|
35
|
+
setProducts((_currentData$children = currentData === null || currentData === void 0 ? void 0 : currentData.children) !== null && _currentData$children !== void 0 ? _currentData$children : []);
|
|
36
|
+
}
|
|
37
|
+
}, [currentAnchor, dataSource]);
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
var _dataSource$0$href, _dataSource$;
|
|
40
|
+
setCurrentAnchor((_dataSource$0$href = dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$ = dataSource[0]) === null || _dataSource$ === void 0 ? void 0 : _dataSource$.href) !== null && _dataSource$0$href !== void 0 ? _dataSource$0$href : '');
|
|
41
|
+
}, [dataSource]);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @title: 分类标题
|
|
45
|
+
* @description:
|
|
46
|
+
* @param {*} useMemo
|
|
47
|
+
* @return {*}
|
|
48
|
+
* @Author: WangHan
|
|
49
|
+
* @Date: 2025-01-13 16:21
|
|
50
|
+
*/
|
|
51
|
+
var categoryTitle = useMemo(function () {
|
|
52
|
+
var _dataSource$find;
|
|
53
|
+
return dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$find = dataSource.find(function (item) {
|
|
54
|
+
return item.href === currentAnchor;
|
|
55
|
+
})) === null || _dataSource$find === void 0 ? void 0 : _dataSource$find.title;
|
|
56
|
+
}, [currentAnchor, dataSource]);
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: "pisell-list-01 ".concat(className),
|
|
59
|
+
style: style
|
|
60
|
+
}, showSearch ? /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: "pisell-list-01-search"
|
|
62
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
63
|
+
placeholder: "Search",
|
|
64
|
+
prefix: /*#__PURE__*/React.createElement(SearchOutlined, {
|
|
65
|
+
style: {
|
|
66
|
+
color: '#667085'
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
// onChange={handleSearch}
|
|
70
|
+
,
|
|
71
|
+
allowClear: true,
|
|
72
|
+
size: "large",
|
|
73
|
+
className: "pisell-list-01-search-input"
|
|
74
|
+
})) : null, showCategory ? /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: "pisell-list-01-categories"
|
|
76
|
+
}, /*#__PURE__*/React.createElement(PisellAnchor, {
|
|
77
|
+
items: dataSource,
|
|
78
|
+
getCurrentAnchor: currentAnchor,
|
|
79
|
+
onChange: function onChange(e) {
|
|
80
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(e);
|
|
81
|
+
setCurrentAnchor(e);
|
|
82
|
+
}
|
|
83
|
+
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: "pisell-list-01-products"
|
|
85
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: "pisell-list-01-products-title"
|
|
87
|
+
}, categoryTitle), /*#__PURE__*/React.createElement(PisellViewGrid, {
|
|
88
|
+
dataSource: products,
|
|
89
|
+
columns: 1,
|
|
90
|
+
verticalGap: 16,
|
|
91
|
+
renderItem: renderItem
|
|
92
|
+
})));
|
|
93
|
+
};
|
|
94
|
+
export default PisellList01;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.pisell-list-01 {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: 100%;
|
|
5
|
+
|
|
6
|
+
&-search {
|
|
7
|
+
width: 100%;
|
|
8
|
+
padding: 16px;
|
|
9
|
+
|
|
10
|
+
.pisell-list-01-search-input {
|
|
11
|
+
display: flex;
|
|
12
|
+
padding: 10px 14px;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: 8px;
|
|
15
|
+
align-self: stretch;
|
|
16
|
+
border-radius: 8px;
|
|
17
|
+
border: 1px solid var(--Gray-300, #d0d5dd);
|
|
18
|
+
background: var(--Base-White, #fff);
|
|
19
|
+
box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
|
|
20
|
+
height: 44px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&-categories {
|
|
25
|
+
padding: 16px 0 16px 20px;
|
|
26
|
+
.pisell-lowcode-anchor-wrapper {
|
|
27
|
+
padding: 0;
|
|
28
|
+
margin: 0;
|
|
29
|
+
}
|
|
30
|
+
.pisell-lowcode-anchor-wrapper-horizontal::before {
|
|
31
|
+
border: none !important;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&-products {
|
|
36
|
+
padding: 20px;
|
|
37
|
+
.pisell-list-01-products-title {
|
|
38
|
+
color: var(--Gray-900, #101828);
|
|
39
|
+
font-size: 16px;
|
|
40
|
+
font-weight: 600;
|
|
41
|
+
line-height: 24px;
|
|
42
|
+
margin-bottom: 16px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -16,12 +16,8 @@ var PisellSectionHeaders = function PisellSectionHeaders(_ref) {
|
|
|
16
16
|
style = _ref.style,
|
|
17
17
|
onBack = _ref.onBack,
|
|
18
18
|
onAction = _ref.onAction;
|
|
19
|
-
var classes = classNames(prefixCls,
|
|
20
|
-
|
|
21
|
-
// [`${prefixCls}-float`]: !takeSpace,
|
|
22
|
-
// },
|
|
23
|
-
className);
|
|
24
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
var classes = classNames(prefixCls, className);
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
25
21
|
className: classes,
|
|
26
22
|
style: _objectSpread({}, style)
|
|
27
23
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -34,6 +30,6 @@ var PisellSectionHeaders = function PisellSectionHeaders(_ref) {
|
|
|
34
30
|
}, centerNode), actionNode && /*#__PURE__*/React.createElement("div", {
|
|
35
31
|
className: "".concat(prefixCls, "-actions"),
|
|
36
32
|
onClick: onAction
|
|
37
|
-
}, actionNode)))
|
|
33
|
+
}, actionNode)));
|
|
38
34
|
};
|
|
39
35
|
export default PisellSectionHeaders;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
@prefix: pisell-section-headers;
|
|
2
|
-
@height: 56px;
|
|
3
2
|
|
|
4
3
|
.@{prefix} {
|
|
5
4
|
width: 100%;
|
|
6
|
-
height: @height;
|
|
7
5
|
z-index: 100;
|
|
8
|
-
position:
|
|
6
|
+
position: sticky;
|
|
9
7
|
top: 0;
|
|
10
|
-
left: 0;
|
|
11
8
|
border-bottom: 1px solid var(--Gray-300, #d0d5dd);
|
|
12
9
|
box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
|
|
10
|
+
padding: 16px;
|
|
11
|
+
height: auto;
|
|
13
12
|
|
|
14
13
|
&-fixed {
|
|
15
14
|
position: fixed;
|
|
@@ -18,15 +17,14 @@
|
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
&-placeholder {
|
|
21
|
-
height: @height;
|
|
22
20
|
width: 100%;
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
&-content {
|
|
26
24
|
height: 100%;
|
|
27
|
-
padding:
|
|
25
|
+
padding: 0;
|
|
28
26
|
display: flex;
|
|
29
|
-
align-items: center;
|
|
27
|
+
// align-items: center;
|
|
30
28
|
justify-content: space-between;
|
|
31
29
|
gap: 10px;
|
|
32
30
|
}
|
|
@@ -37,9 +35,9 @@
|
|
|
37
35
|
|
|
38
36
|
&-main {
|
|
39
37
|
flex: 1;
|
|
40
|
-
display: flex;
|
|
41
|
-
align-items: center;
|
|
42
|
-
justify-content: center;
|
|
38
|
+
// display: flex;
|
|
39
|
+
// align-items: center;
|
|
40
|
+
// justify-content: center;
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
&-actions {
|
|
@@ -68,9 +68,13 @@ var PisellViewGrid = function PisellViewGrid(_ref) {
|
|
|
68
68
|
style: style
|
|
69
69
|
}, /*#__PURE__*/React.createElement("div", {
|
|
70
70
|
className: "pisell-view-grid-content",
|
|
71
|
-
style: {
|
|
71
|
+
style: !singleRow ? {
|
|
72
72
|
gap: "".concat(verticalGap, "px ").concat(horizontalGap, "px"),
|
|
73
73
|
gridTemplateColumns: "repeat(".concat(columns, ", 1fr)")
|
|
74
|
+
} : {
|
|
75
|
+
display: 'flex',
|
|
76
|
+
flexWrap: 'nowrap',
|
|
77
|
+
overflowX: 'auto'
|
|
74
78
|
}
|
|
75
79
|
}, dataSource.map(function (item, index) {
|
|
76
80
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -73,10 +73,11 @@ var SelectBase = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
73
73
|
return mode === 'multiple' && isShowDropdown && selectAll;
|
|
74
74
|
}, [mode, selectAll, isShowDropdown]);
|
|
75
75
|
var checkboxChecked = useMemo(function () {
|
|
76
|
+
var _state$sort, _filteredOptions$map, _filteredOptions$map$;
|
|
76
77
|
if (mode !== 'multiple') return false;
|
|
77
|
-
return (state === null || state === void 0 ? void 0 : state.length) === (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) && state.sort().join('') === filteredOptions.map(function (item) {
|
|
78
|
+
return (state === null || state === void 0 ? void 0 : state.length) === (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) && (state === null || state === void 0 ? void 0 : (_state$sort = state.sort()) === null || _state$sort === void 0 ? void 0 : _state$sort.join('')) === (filteredOptions === null || filteredOptions === void 0 ? void 0 : (_filteredOptions$map = filteredOptions.map(function (item) {
|
|
78
79
|
return item.value;
|
|
79
|
-
}).sort()
|
|
80
|
+
})) === null || _filteredOptions$map === void 0 ? void 0 : (_filteredOptions$map$ = _filteredOptions$map.sort()) === null || _filteredOptions$map$ === void 0 ? void 0 : _filteredOptions$map$.join(''));
|
|
80
81
|
}, [state, filteredOptions]);
|
|
81
82
|
var dropdownRender = useCallback(propsDropdownRender ? propsDropdownRender : function (originNode) {
|
|
82
83
|
return /*#__PURE__*/React.createElement(React.Fragment, null, showSearch && /*#__PURE__*/React.createElement(Input, {
|
package/es/index.d.ts
CHANGED
|
@@ -147,5 +147,6 @@ export { default as PisellViewGrid } from './components/pisellViewGrid';
|
|
|
147
147
|
export { default as PisellCustomCheckboxGroup } from './components/pisellCustomCheckboxGroup';
|
|
148
148
|
export { default as PisellDropdown } from './components/pisellDropdown';
|
|
149
149
|
export { default as PisellSectionHeaders } from './components/pisellSectionHeaders';
|
|
150
|
-
export { default as PisellProgressBar } from './components/pisellProgressBar';
|
|
151
150
|
export { default as PisellImageCarousels } from './components/pisellImageCarousels';
|
|
151
|
+
export { default as PisellHeaderProgressBar } from './components/pisellHeaderProgressBar';
|
|
152
|
+
export { default as PisellList01 } from './components/pisellList01';
|
package/es/index.js
CHANGED
|
@@ -177,5 +177,6 @@ export { default as PisellViewGrid } from "./components/pisellViewGrid";
|
|
|
177
177
|
export { default as PisellCustomCheckboxGroup } from "./components/pisellCustomCheckboxGroup";
|
|
178
178
|
export { default as PisellDropdown } from "./components/pisellDropdown";
|
|
179
179
|
export { default as PisellSectionHeaders } from "./components/pisellSectionHeaders";
|
|
180
|
-
export { default as
|
|
181
|
-
export { default as
|
|
180
|
+
export { default as PisellImageCarousels } from "./components/pisellImageCarousels";
|
|
181
|
+
export { default as PisellHeaderProgressBar } from "./components/pisellHeaderProgressBar";
|
|
182
|
+
export { default as PisellList01 } from "./components/pisellList01";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export interface TimeSlot {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
time: string;
|
|
7
|
+
remainingCount: number;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface TimeResourceSelectorProps {
|
|
11
|
+
timeSlots?: TimeSlot[];
|
|
12
|
+
multiple?: boolean;
|
|
13
|
+
showUnavailable?: boolean;
|
|
14
|
+
defaultExpanded?: boolean;
|
|
15
|
+
defaultSelectFirst?: boolean;
|
|
16
|
+
onChange?: (values: string | string[]) => void;
|
|
17
|
+
className?: string;
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
}
|
|
20
|
+
declare const TimeResourceSelector: React.FC<TimeResourceSelectorProps>;
|
|
21
|
+
export default TimeResourceSelector;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/TimeResourceSelector/index.tsx
|
|
30
|
+
var TimeResourceSelector_exports = {};
|
|
31
|
+
__export(TimeResourceSelector_exports, {
|
|
32
|
+
default: () => TimeResourceSelector_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(TimeResourceSelector_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_materials = require("@pisell/materials");
|
|
38
|
+
var import_PisellCustomCheckboxGroup = __toESM(require("../PisellCustomCheckboxGroup"));
|
|
39
|
+
var import_index = require("./index.less");
|
|
40
|
+
var TimeResourceSelector = ({
|
|
41
|
+
timeSlots = [],
|
|
42
|
+
multiple = false,
|
|
43
|
+
showUnavailable = true,
|
|
44
|
+
defaultExpanded = true,
|
|
45
|
+
defaultSelectFirst = true,
|
|
46
|
+
onChange,
|
|
47
|
+
className,
|
|
48
|
+
style
|
|
49
|
+
}) => {
|
|
50
|
+
const [selectedValues, setSelectedValues] = (0, import_react.useState)([]);
|
|
51
|
+
const [error, setError] = (0, import_react.useState)("");
|
|
52
|
+
const filteredTimeSlots = timeSlots.filter(
|
|
53
|
+
(slot) => showUnavailable ? true : !slot.disabled
|
|
54
|
+
);
|
|
55
|
+
(0, import_react.useEffect)(() => {
|
|
56
|
+
if (defaultSelectFirst && filteredTimeSlots.length > 0 && selectedValues.length === 0) {
|
|
57
|
+
const firstAvailable = filteredTimeSlots.find((slot) => !slot.disabled);
|
|
58
|
+
if (firstAvailable) {
|
|
59
|
+
const value = firstAvailable.value;
|
|
60
|
+
setSelectedValues([value]);
|
|
61
|
+
onChange == null ? void 0 : onChange(multiple ? [value] : value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, [filteredTimeSlots, defaultSelectFirst, multiple, onChange]);
|
|
65
|
+
const renderTimeCard = (item) => {
|
|
66
|
+
const { time, remainingCount, disabled } = item;
|
|
67
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
68
|
+
import_materials.PisellCard,
|
|
69
|
+
{
|
|
70
|
+
className: "time-resource-card",
|
|
71
|
+
bodyStyle: { padding: "12px" }
|
|
72
|
+
},
|
|
73
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "time-slot-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "time-text" }, time), /* @__PURE__ */ import_react.default.createElement("div", { className: "remaining-count" }, "剩余: ", remainingCount))
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
const handleChange = (0, import_react.useCallback)(
|
|
77
|
+
(value) => {
|
|
78
|
+
if (Array.isArray(value)) {
|
|
79
|
+
setSelectedValues(value);
|
|
80
|
+
setError(value.length === 0 ? "Please select a session time" : "");
|
|
81
|
+
} else {
|
|
82
|
+
setSelectedValues([value]);
|
|
83
|
+
setError("");
|
|
84
|
+
}
|
|
85
|
+
onChange == null ? void 0 : onChange(value);
|
|
86
|
+
},
|
|
87
|
+
[onChange]
|
|
88
|
+
);
|
|
89
|
+
const renderContent = () => {
|
|
90
|
+
if (filteredTimeSlots.length === 0) {
|
|
91
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Empty, { description: "No dates are available" });
|
|
92
|
+
}
|
|
93
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, error && /* @__PURE__ */ import_react.default.createElement("div", { className: "time-resource-error" }, error), /* @__PURE__ */ import_react.default.createElement(
|
|
94
|
+
import_PisellCustomCheckboxGroup.default,
|
|
95
|
+
{
|
|
96
|
+
dataSource: filteredTimeSlots,
|
|
97
|
+
renderItem: renderTimeCard,
|
|
98
|
+
value: selectedValues,
|
|
99
|
+
onChange: handleChange,
|
|
100
|
+
isMultiple: multiple,
|
|
101
|
+
columns: 4,
|
|
102
|
+
horizontalGap: 16,
|
|
103
|
+
verticalGap: 16
|
|
104
|
+
}
|
|
105
|
+
));
|
|
106
|
+
};
|
|
107
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `time-resource-selector ${className || ""}`, style }, /* @__PURE__ */ import_react.default.createElement(import_antd.Collapse, { defaultActiveKey: defaultExpanded ? ["1"] : [] }, /* @__PURE__ */ import_react.default.createElement(import_antd.Collapse.Panel, { header: "选择时间段", key: "1" }, renderContent())));
|
|
108
|
+
};
|
|
109
|
+
var TimeResourceSelector_default = TimeResourceSelector;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.time-resource-selector {
|
|
2
|
+
.time-resource-card {
|
|
3
|
+
cursor: pointer;
|
|
4
|
+
transition: all 0.3s;
|
|
5
|
+
|
|
6
|
+
&:hover {
|
|
7
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.time-slot-content {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
min-height: 80px;
|
|
17
|
+
|
|
18
|
+
.time-text {
|
|
19
|
+
font-size: 16px;
|
|
20
|
+
font-weight: 500;
|
|
21
|
+
margin-bottom: 8px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.remaining-count {
|
|
25
|
+
font-size: 14px;
|
|
26
|
+
color: #666;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 选中状态
|
|
31
|
+
.pisell-checkbox-item-selected {
|
|
32
|
+
.time-resource-card {
|
|
33
|
+
border-color: #1890ff;
|
|
34
|
+
background: rgba(24, 144, 255, 0.1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 禁用状态
|
|
39
|
+
.pisell-checkbox-item-disabled {
|
|
40
|
+
.time-resource-card {
|
|
41
|
+
cursor: not-allowed;
|
|
42
|
+
opacity: 0.5;
|
|
43
|
+
|
|
44
|
+
&:hover {
|
|
45
|
+
box-shadow: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 错误提示
|
|
51
|
+
.time-resource-error {
|
|
52
|
+
color: #ff4d4f;
|
|
53
|
+
padding: 8px 0;
|
|
54
|
+
text-align: center;
|
|
55
|
+
background-color: #fff2f0;
|
|
56
|
+
border-radius: 4px;
|
|
57
|
+
margin-bottom: 16px;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -62,18 +62,14 @@ var SubmitButton = (props) => {
|
|
|
62
62
|
const { create, update } = (0, import_useDataSource.default)();
|
|
63
63
|
const isDisabled = status === "disabled";
|
|
64
64
|
const onSubmit = async (values) => {
|
|
65
|
+
setLoading(true);
|
|
65
66
|
try {
|
|
66
|
-
setLoading(true);
|
|
67
67
|
if (renderMode === "edit") {
|
|
68
68
|
await update.runAsync(values);
|
|
69
69
|
} else if (renderMode === "add") {
|
|
70
70
|
const res = await create.runAsync(values);
|
|
71
71
|
form == null ? void 0 : form.resetFields();
|
|
72
72
|
}
|
|
73
|
-
} catch (error) {
|
|
74
|
-
(0, import_pisellToast.default)({
|
|
75
|
-
content: `操作失败:${error.message}`
|
|
76
|
-
});
|
|
77
73
|
} finally {
|
|
78
74
|
setLoading(false);
|
|
79
75
|
}
|
|
@@ -130,6 +126,9 @@ var SubmitButton = (props) => {
|
|
|
130
126
|
}
|
|
131
127
|
}
|
|
132
128
|
} catch (error) {
|
|
129
|
+
(0, import_pisellToast.default)({
|
|
130
|
+
content: `${error.message}`
|
|
131
|
+
});
|
|
133
132
|
}
|
|
134
133
|
};
|
|
135
134
|
const onSubmitClick = async () => {
|
|
@@ -68,6 +68,11 @@ var BaseTable = (props) => {
|
|
|
68
68
|
drawerContent
|
|
69
69
|
} = (0, import_useDrawerState.default)(operationContent);
|
|
70
70
|
const { queryPageConfig, handleValuesChange, refreshData, handleFilterChange } = (0, import_useTableQuery.default)(props);
|
|
71
|
+
const handleAllValuesChange = (changedValues, values) => {
|
|
72
|
+
var _a;
|
|
73
|
+
(_a = props == null ? void 0 : props.onValuesChange) == null ? void 0 : _a.call(props, changedValues, values);
|
|
74
|
+
handleValuesChange(changedValues, values);
|
|
75
|
+
};
|
|
71
76
|
(0, import_useDesignMode.default)(props, {
|
|
72
77
|
registerValueVariable,
|
|
73
78
|
openDrawer,
|
|
@@ -112,7 +117,7 @@ var BaseTable = (props) => {
|
|
|
112
117
|
...transformProps,
|
|
113
118
|
dataSource: (data == null ? void 0 : data.data) || [],
|
|
114
119
|
loading: list == null ? void 0 : list.loading,
|
|
115
|
-
onValuesChange:
|
|
120
|
+
onValuesChange: handleAllValuesChange
|
|
116
121
|
}
|
|
117
122
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
118
123
|
import_ActionsProvider.default,
|
|
@@ -142,7 +142,7 @@ var useFormat = ({ dataSourceKey, fields }) => {
|
|
|
142
142
|
}
|
|
143
143
|
);
|
|
144
144
|
const formatListParams = (0, import_ahooks.useMemoizedFn)((params) => {
|
|
145
|
-
if (!dataSourceKey) {
|
|
145
|
+
if (!dataSourceKey || ["pisell2", "main"].includes(dataSourceKey)) {
|
|
146
146
|
return {
|
|
147
147
|
...params,
|
|
148
148
|
filter: formatFilter(params.filter, fields),
|
|
@@ -30,11 +30,17 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
30
30
|
buttons: any[] | null;
|
|
31
31
|
filter: React.JSX.Element | null;
|
|
32
32
|
onRow: (record: any) => any;
|
|
33
|
+
actionButtons: any[] | null;
|
|
33
34
|
titleButtons?: {
|
|
34
35
|
show: boolean;
|
|
35
36
|
maxCount: number;
|
|
36
37
|
items: OperationItem[];
|
|
37
38
|
} | undefined;
|
|
39
|
+
tableButtons?: {
|
|
40
|
+
show: boolean;
|
|
41
|
+
maxCount: number;
|
|
42
|
+
items: OperationItem[];
|
|
43
|
+
} | undefined;
|
|
38
44
|
operation?: {
|
|
39
45
|
show: boolean;
|
|
40
46
|
title: string;
|
|
@@ -74,5 +80,6 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
74
80
|
sortBy: string;
|
|
75
81
|
}[];
|
|
76
82
|
} | undefined;
|
|
83
|
+
onValuesChange?: ((changedValues: any, values: any) => void) | undefined;
|
|
77
84
|
};
|
|
78
85
|
export default useTableProps;
|
|
@@ -59,6 +59,7 @@ var useTableProps = (props) => {
|
|
|
59
59
|
title: propsTitle,
|
|
60
60
|
subTitle: propsSubTitle,
|
|
61
61
|
titleButtons,
|
|
62
|
+
tableButtons,
|
|
62
63
|
operation,
|
|
63
64
|
filter: propsFilter,
|
|
64
65
|
search,
|
|
@@ -198,6 +199,26 @@ var useTableProps = (props) => {
|
|
|
198
199
|
};
|
|
199
200
|
});
|
|
200
201
|
}, [titleButtons]);
|
|
202
|
+
const actionButtons = (0, import_react.useMemo)(() => {
|
|
203
|
+
var _a2;
|
|
204
|
+
if (!(tableButtons == null ? void 0 : tableButtons.show)) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
return (_a2 = tableButtons == null ? void 0 : tableButtons.items) == null ? void 0 : _a2.map((button) => {
|
|
208
|
+
const { actionType, buttonProps } = button;
|
|
209
|
+
return {
|
|
210
|
+
...button,
|
|
211
|
+
...buttonProps,
|
|
212
|
+
size: "large",
|
|
213
|
+
title: button.label,
|
|
214
|
+
onClick: () => {
|
|
215
|
+
if (actionType === "add") {
|
|
216
|
+
handleOpenDrawer(null, button);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
}, [tableButtons]);
|
|
201
222
|
const filter = (0, import_react.useMemo)(() => {
|
|
202
223
|
if (!(propsFilter == null ? void 0 : propsFilter.show) && !(search == null ? void 0 : search.show)) {
|
|
203
224
|
return null;
|
|
@@ -248,7 +269,8 @@ var useTableProps = (props) => {
|
|
|
248
269
|
subTitle,
|
|
249
270
|
buttons,
|
|
250
271
|
filter,
|
|
251
|
-
onRow
|
|
272
|
+
onRow,
|
|
273
|
+
actionButtons
|
|
252
274
|
};
|
|
253
275
|
};
|
|
254
276
|
var useTableProps_default = useTableProps;
|
|
@@ -42,7 +42,7 @@ var useTableQuery = (props) => {
|
|
|
42
42
|
let filter = prev.filter;
|
|
43
43
|
if ("tabs" in params) {
|
|
44
44
|
sort = ((_a2 = params.tabs) == null ? void 0 : _a2.sortBy) || sortBy || "";
|
|
45
|
-
filter = ((_b2 = params.tabs) == null ? void 0 : _b2.filterBy) || {};
|
|
45
|
+
filter = { ...prev.filter, ...((_b2 = params.tabs) == null ? void 0 : _b2.filterBy) || {} };
|
|
46
46
|
}
|
|
47
47
|
if ("order_by" in params) {
|
|
48
48
|
sort = params.order_by || ((_c2 = allParams.tabs) == null ? void 0 : _c2.sortBy) || sortBy;
|
|
@@ -62,7 +62,7 @@ var useTableQuery = (props) => {
|
|
|
62
62
|
setQueryPageConfig((prev) => ({
|
|
63
63
|
...prev,
|
|
64
64
|
page: 1,
|
|
65
|
-
filter: { ...allFields, ...filterBy || {} }
|
|
65
|
+
filter: { ...prev.filter, ...allFields, ...filterBy || {} }
|
|
66
66
|
}));
|
|
67
67
|
}
|
|
68
68
|
);
|
|
@@ -18,6 +18,11 @@ export interface DataSourceTableProps {
|
|
|
18
18
|
maxCount: number;
|
|
19
19
|
items: OperationItem[];
|
|
20
20
|
};
|
|
21
|
+
tableButtons?: {
|
|
22
|
+
show: boolean;
|
|
23
|
+
maxCount: number;
|
|
24
|
+
items: OperationItem[];
|
|
25
|
+
};
|
|
21
26
|
buttons?: any[];
|
|
22
27
|
operation?: {
|
|
23
28
|
show: boolean;
|
|
@@ -61,4 +66,5 @@ export interface DataSourceTableProps {
|
|
|
61
66
|
sortBy: string;
|
|
62
67
|
}[];
|
|
63
68
|
};
|
|
69
|
+
onValuesChange?: (changedValues: any, values: any) => void;
|
|
64
70
|
}
|
|
@@ -47,13 +47,8 @@ var defaultCustomizer = (objValue, srcValue) => {
|
|
|
47
47
|
var VARIABLE_PATTERN = /{{([^}]+)}}/g;
|
|
48
48
|
var VariablesProvider = (props) => {
|
|
49
49
|
const { children, variables } = props;
|
|
50
|
-
const variablesRef = (0, import_react.useRef)({});
|
|
50
|
+
const variablesRef = (0, import_react.useRef)(variables || {});
|
|
51
51
|
const listenersRef = (0, import_react.useRef)(/* @__PURE__ */ new Set());
|
|
52
|
-
(0, import_react.useEffect)(() => {
|
|
53
|
-
if (variables) {
|
|
54
|
-
variablesRef.current = variables;
|
|
55
|
-
}
|
|
56
|
-
}, [variables]);
|
|
57
52
|
const registerVariable = (0, import_ahooks.useMemoizedFn)((value2) => {
|
|
58
53
|
variablesRef.current = (0, import_utils3.mergeWith)(
|
|
59
54
|
variablesRef.current,
|
|
@@ -69,7 +69,7 @@ var localeDateMap = {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
var Page = (props) => {
|
|
72
|
-
var _a, _b, _c, _d;
|
|
72
|
+
var _a, _b, _c, _d, _e, _f;
|
|
73
73
|
const { children, style, className, locale: propsLocale, ...others } = props;
|
|
74
74
|
const context = (0, import_useEngineContext.default)();
|
|
75
75
|
const { platform, themeColor } = ((_a = context.appHelper) == null ? void 0 : _a.constants) || {};
|
|
@@ -271,7 +271,7 @@ var Page = (props) => {
|
|
|
271
271
|
dateAdapter: import_AdapterDayjs.AdapterDayjs,
|
|
272
272
|
adapterLocale: ((_d = localeDateMap == null ? void 0 : localeDateMap[locale]) == null ? void 0 : _d.adapterLocale) || "en"
|
|
273
273
|
},
|
|
274
|
-
/* @__PURE__ */ import_react.default.createElement(import_date_picker.ThemeProvider, { theme: datePickerTheme }, /* @__PURE__ */ import_react.default.createElement(import_date_picker.LocaleProvider, { value: { locale } }, /* @__PURE__ */ import_react.default.createElement(import_pisell_config_provider.default, { locale }, /* @__PURE__ */ import_react.default.createElement(import_VariablesProvider.default, null, /* @__PURE__ */ import_react.default.createElement(
|
|
274
|
+
/* @__PURE__ */ import_react.default.createElement(import_date_picker.ThemeProvider, { theme: datePickerTheme }, /* @__PURE__ */ import_react.default.createElement(import_date_picker.LocaleProvider, { value: { locale } }, /* @__PURE__ */ import_react.default.createElement(import_pisell_config_provider.default, { locale }, /* @__PURE__ */ import_react.default.createElement(import_VariablesProvider.default, { variables: ((_f = (_e = context.engine) == null ? void 0 : _e.props) == null ? void 0 : _f.variables) || {} }, /* @__PURE__ */ import_react.default.createElement(
|
|
275
275
|
"div",
|
|
276
276
|
{
|
|
277
277
|
style: {
|