@pisell/private-materials 3.4.82 → 3.4.83
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 +2 -2
- package/build/lowcode/preview.js +152 -152
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +18 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +18 -10
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/es/components/booking/notes/NoteBlock/index.js +3 -2
- package/es/components/booking/utils.d.ts +2 -2
- package/es/components/eftpos/hooks.d.ts +0 -1
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/app.d.ts +1 -1
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +2 -2
- package/es/components/eftposPay/store/index.d.ts +6 -6
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
- package/es/hooks/usePaymentLogger.d.ts +0 -1
- package/es/index.d.ts +4 -2
- package/es/index.js +3 -1
- package/es/plus/contactInfo/components/SwipeAction/index.js +1 -1
- package/es/plus/orderList/components/HandleActions.d.ts +1 -0
- package/es/plus/orderList/components/HandleActions.js +5 -2
- package/es/plus/orderList/components/Toolbar.d.ts +1 -0
- package/es/plus/orderList/components/Toolbar.js +4 -2
- package/es/plus/orderList/index.d.ts +1 -0
- package/es/plus/orderList/index.js +7 -2
- package/es/plus/pisellSalesGrid/PisellSalesGrid.d.ts +5 -0
- package/es/plus/pisellSalesGrid/PisellSalesGrid.js +363 -0
- package/es/plus/pisellSalesGrid/PisellSalesGrid.less +16 -0
- package/es/plus/pisellSalesGrid/PisellSalesGrid.stories.d.ts +14 -0
- package/es/plus/pisellSalesGrid/PisellSalesGrid.stories.js +559 -0
- package/es/plus/pisellSalesGrid/hooks/useActions.d.ts +19 -0
- package/es/plus/pisellSalesGrid/hooks/useActions.js +723 -0
- package/es/plus/pisellSalesGrid/index.d.ts +4 -0
- package/es/plus/pisellSalesGrid/index.js +3 -0
- package/es/plus/pisellSalesGrid/locales.d.ts +9 -0
- package/es/plus/pisellSalesGrid/locales.js +8 -0
- package/es/plus/pisellSalesGrid/serve.d.ts +19 -0
- package/es/plus/pisellSalesGrid/serve.js +151 -0
- package/es/plus/pisellSalesGrid/types.d.ts +170 -0
- package/es/plus/pisellSalesGrid/types.js +1 -0
- package/es/plus/pisellSalesManagement/components/BookingFormsPreview.d.ts +15 -0
- package/es/plus/pisellSalesManagement/components/BookingFormsPreview.js +211 -0
- package/es/plus/pisellSalesManagement/components/BookingNotesPreview.d.ts +19 -0
- package/es/plus/pisellSalesManagement/components/BookingNotesPreview.js +167 -0
- package/es/plus/pisellSalesManagement/components/ResourceSelector.d.ts +9 -0
- package/es/plus/pisellSalesManagement/components/ResourceSelector.js +102 -0
- package/es/plus/pisellSalesManagement/config/booking.d.ts +185 -0
- package/es/plus/pisellSalesManagement/config/booking.js +380 -0
- package/es/plus/pisellSalesManagement/config/index.d.ts +2 -0
- package/es/plus/pisellSalesManagement/config/index.js +11 -0
- package/es/plus/pisellSalesManagement/config/order.d.ts +172 -0
- package/es/plus/pisellSalesManagement/config/order.js +460 -0
- package/es/plus/pisellSalesManagement/hooks/perspectiveUtils.d.ts +15 -0
- package/es/plus/pisellSalesManagement/hooks/perspectiveUtils.js +66 -0
- package/es/plus/pisellSalesManagement/hooks/useBookingPerspective.d.ts +2 -0
- package/es/plus/pisellSalesManagement/hooks/useBookingPerspective.js +651 -0
- package/es/plus/pisellSalesManagement/hooks/useOrderPerspective.d.ts +2 -0
- package/es/plus/pisellSalesManagement/hooks/useOrderPerspective.js +656 -0
- package/es/plus/pisellSalesManagement/hooks/usePerspectives.d.ts +5 -0
- package/es/plus/pisellSalesManagement/hooks/usePerspectives.js +12 -0
- package/es/plus/pisellSalesManagement/index.d.ts +10 -0
- package/es/plus/pisellSalesManagement/index.js +84 -0
- package/es/plus/pisellSalesManagement/locales.d.ts +303 -0
- package/es/plus/pisellSalesManagement/locales.js +302 -0
- package/es/plus/pisellSalesManagement/serve.d.ts +26 -0
- package/es/plus/pisellSalesManagement/serve.js +222 -0
- package/es/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
- package/es/plus/walletPassGallery/components/passDetail/index.d.ts +0 -1
- package/es/plus/walletPassGallery/components/passDetail/index.js +2 -26
- package/es/plus/walletPassGallery/components/passList/index.js +8 -1
- package/es/plus/walletPassGallery/index.js +0 -31
- package/es/pro/Selector/Selector.d.ts +1 -1
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/lib/components/booking/notes/NoteBlock/index.js +2 -1
- package/lib/components/booking/utils.d.ts +2 -2
- package/lib/components/eftpos/hooks.d.ts +0 -1
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/app.d.ts +1 -1
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +2 -2
- package/lib/components/eftposPay/store/index.d.ts +6 -6
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
- package/lib/hooks/usePaymentLogger.d.ts +0 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +8 -2
- package/lib/plus/contactInfo/components/SwipeAction/index.js +23 -23
- package/lib/plus/orderList/components/HandleActions.d.ts +1 -0
- package/lib/plus/orderList/components/HandleActions.js +2 -2
- package/lib/plus/orderList/components/Toolbar.d.ts +1 -0
- package/lib/plus/orderList/components/Toolbar.js +2 -2
- package/lib/plus/orderList/index.d.ts +1 -0
- package/lib/plus/orderList/index.js +3 -3
- package/lib/plus/pisellSalesGrid/PisellSalesGrid.d.ts +5 -0
- package/lib/plus/pisellSalesGrid/PisellSalesGrid.js +339 -0
- package/lib/plus/pisellSalesGrid/PisellSalesGrid.less +16 -0
- package/lib/plus/pisellSalesGrid/PisellSalesGrid.stories.d.ts +14 -0
- package/lib/plus/pisellSalesGrid/PisellSalesGrid.stories.js +455 -0
- package/lib/plus/pisellSalesGrid/hooks/useActions.d.ts +19 -0
- package/lib/plus/pisellSalesGrid/hooks/useActions.js +545 -0
- package/lib/plus/pisellSalesGrid/index.d.ts +4 -0
- package/lib/plus/pisellSalesGrid/index.js +42 -0
- package/lib/plus/pisellSalesGrid/locales.d.ts +9 -0
- package/lib/plus/pisellSalesGrid/locales.js +29 -0
- package/lib/plus/pisellSalesGrid/serve.d.ts +19 -0
- package/lib/plus/pisellSalesGrid/serve.js +142 -0
- package/lib/plus/pisellSalesGrid/types.d.ts +170 -0
- package/lib/plus/pisellSalesGrid/types.js +17 -0
- package/lib/plus/pisellSalesManagement/components/BookingFormsPreview.d.ts +15 -0
- package/lib/plus/pisellSalesManagement/components/BookingFormsPreview.js +250 -0
- package/lib/plus/pisellSalesManagement/components/BookingNotesPreview.d.ts +19 -0
- package/lib/plus/pisellSalesManagement/components/BookingNotesPreview.js +193 -0
- package/lib/plus/pisellSalesManagement/components/ResourceSelector.d.ts +9 -0
- package/lib/plus/pisellSalesManagement/components/ResourceSelector.js +106 -0
- package/lib/plus/pisellSalesManagement/config/booking.d.ts +185 -0
- package/lib/plus/pisellSalesManagement/config/booking.js +500 -0
- package/lib/plus/pisellSalesManagement/config/index.d.ts +2 -0
- package/lib/plus/pisellSalesManagement/config/index.js +43 -0
- package/lib/plus/pisellSalesManagement/config/order.d.ts +172 -0
- package/lib/plus/pisellSalesManagement/config/order.js +492 -0
- package/lib/plus/pisellSalesManagement/hooks/perspectiveUtils.d.ts +15 -0
- package/lib/plus/pisellSalesManagement/hooks/perspectiveUtils.js +113 -0
- package/lib/plus/pisellSalesManagement/hooks/useBookingPerspective.d.ts +2 -0
- package/lib/plus/pisellSalesManagement/hooks/useBookingPerspective.js +699 -0
- package/lib/plus/pisellSalesManagement/hooks/useOrderPerspective.d.ts +2 -0
- package/lib/plus/pisellSalesManagement/hooks/useOrderPerspective.js +700 -0
- package/lib/plus/pisellSalesManagement/hooks/usePerspectives.d.ts +5 -0
- package/lib/plus/pisellSalesManagement/hooks/usePerspectives.js +42 -0
- package/lib/plus/pisellSalesManagement/index.d.ts +10 -0
- package/lib/plus/pisellSalesManagement/index.js +113 -0
- package/lib/plus/pisellSalesManagement/locales.d.ts +303 -0
- package/lib/plus/pisellSalesManagement/locales.js +326 -0
- package/lib/plus/pisellSalesManagement/serve.d.ts +26 -0
- package/lib/plus/pisellSalesManagement/serve.js +120 -0
- package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
- package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
- package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +0 -1
- package/lib/plus/walletPassGallery/components/passDetail/index.js +1 -16
- package/lib/plus/walletPassGallery/components/passList/index.js +9 -3
- package/lib/plus/walletPassGallery/index.js +0 -29
- package/lib/pro/Selector/Selector.d.ts +1 -1
- package/lowcode/eco-cup-list/meta.ts +1 -1
- package/lowcode/eco-customer-list/meta.ts +1 -1
- package/lowcode/pisell-sales-management/meta.ts +88 -0
- package/package.json +4 -4
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
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."); }
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
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; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
import React, { useMemo, useState } from 'react';
|
|
15
|
+
import { PisellSalesGrid } from "./index";
|
|
16
|
+
|
|
17
|
+
/** 列配置与 RecordBoard 的 columns 兼容 */
|
|
18
|
+
|
|
19
|
+
var meta = {
|
|
20
|
+
title: 'Pro Components/PisellSalesGrid',
|
|
21
|
+
component: PisellSalesGrid,
|
|
22
|
+
parameters: {
|
|
23
|
+
layout: 'padded',
|
|
24
|
+
docs: {
|
|
25
|
+
description: {
|
|
26
|
+
component: 'RecordBoard 的上层组件,与 RecordBoard 一致采用打散传参(data、loading、total、pagination、onSearch、多选等)。根据 currentPerspective 选择对应的一组 RecordBoard 配置渲染,不提供 Tab 切换 UI。多选通过 props 传入,SalesGrid 会合并进 grid 再传给 RecordBoard。perspective 的 childComponentProps.grid 可含 columns、scroll、onRow、rowClassName 等 Table 透传。'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
tags: ['autodocs'],
|
|
31
|
+
argTypes: {
|
|
32
|
+
currentPerspective: {
|
|
33
|
+
description: '当前 Perspective key',
|
|
34
|
+
control: 'text'
|
|
35
|
+
},
|
|
36
|
+
perspectives: {
|
|
37
|
+
control: false
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export default meta;
|
|
42
|
+
var mockData = Array.from({
|
|
43
|
+
length: 20
|
|
44
|
+
}, function (_, i) {
|
|
45
|
+
return {
|
|
46
|
+
id: "id-".concat(i + 1),
|
|
47
|
+
name: "\u5546\u54C1 ".concat(i + 1),
|
|
48
|
+
sku: "SKU".concat(String(1000 + i).padStart(4, '0')),
|
|
49
|
+
amount: 99 + i * 10,
|
|
50
|
+
status: ['在售', '下架', '待上架'][i % 3],
|
|
51
|
+
updateTime: "2024-02-".concat(String(10 + i % 18).padStart(2, '0'))
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
var columnsFull = [{
|
|
55
|
+
title: '名称',
|
|
56
|
+
dataIndex: 'name',
|
|
57
|
+
key: 'name',
|
|
58
|
+
width: 120
|
|
59
|
+
}, {
|
|
60
|
+
title: 'SKU',
|
|
61
|
+
dataIndex: 'sku',
|
|
62
|
+
key: 'sku',
|
|
63
|
+
width: 100
|
|
64
|
+
}, {
|
|
65
|
+
title: '金额',
|
|
66
|
+
dataIndex: 'amount',
|
|
67
|
+
key: 'amount',
|
|
68
|
+
width: 100,
|
|
69
|
+
type: 'currency',
|
|
70
|
+
fieldProps: {
|
|
71
|
+
currencySymbol: '¥'
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
title: '状态',
|
|
75
|
+
dataIndex: 'status',
|
|
76
|
+
key: 'status',
|
|
77
|
+
width: 90
|
|
78
|
+
}, {
|
|
79
|
+
title: '更新时间',
|
|
80
|
+
dataIndex: 'updateTime',
|
|
81
|
+
key: 'updateTime',
|
|
82
|
+
width: 120
|
|
83
|
+
}];
|
|
84
|
+
var columnsBrief = [{
|
|
85
|
+
title: '名称',
|
|
86
|
+
dataIndex: 'name',
|
|
87
|
+
key: 'name',
|
|
88
|
+
width: 160
|
|
89
|
+
}, {
|
|
90
|
+
title: '金额',
|
|
91
|
+
dataIndex: 'amount',
|
|
92
|
+
key: 'amount',
|
|
93
|
+
width: 120,
|
|
94
|
+
type: 'currency',
|
|
95
|
+
fieldProps: {
|
|
96
|
+
currencySymbol: '¥'
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
title: '状态',
|
|
100
|
+
dataIndex: 'status',
|
|
101
|
+
key: 'status',
|
|
102
|
+
width: 100
|
|
103
|
+
}];
|
|
104
|
+
var perspectives = [{
|
|
105
|
+
key: 'full',
|
|
106
|
+
label: '完整列表',
|
|
107
|
+
childComponentProps: {
|
|
108
|
+
grid: {
|
|
109
|
+
columns: columnsFull
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
key: 'brief',
|
|
114
|
+
label: '简要',
|
|
115
|
+
childComponentProps: {
|
|
116
|
+
grid: {
|
|
117
|
+
columns: columnsBrief
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}];
|
|
121
|
+
function useMockDataSourceProps() {
|
|
122
|
+
var _useState = useState({
|
|
123
|
+
pageNumber: 1,
|
|
124
|
+
pageSize: 10
|
|
125
|
+
}),
|
|
126
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
127
|
+
page = _useState2[0],
|
|
128
|
+
setPage = _useState2[1];
|
|
129
|
+
var _useState3 = useState({}),
|
|
130
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
131
|
+
searchParams = _useState4[0],
|
|
132
|
+
setSearchParams = _useState4[1];
|
|
133
|
+
var _useState5 = useState([]),
|
|
134
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
135
|
+
selectedKeys = _useState6[0],
|
|
136
|
+
setSelectedKeys = _useState6[1];
|
|
137
|
+
var _useState7 = useState([]),
|
|
138
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
139
|
+
selectedRows = _useState8[0],
|
|
140
|
+
setSelectedRows = _useState8[1];
|
|
141
|
+
return useMemo(function () {
|
|
142
|
+
return {
|
|
143
|
+
data: mockData.slice((page.pageNumber - 1) * page.pageSize, page.pageNumber * page.pageSize),
|
|
144
|
+
loading: false,
|
|
145
|
+
total: mockData.length,
|
|
146
|
+
pagination: page,
|
|
147
|
+
onPageChange: function onPageChange(pageNumber, pageSize) {
|
|
148
|
+
return setPage({
|
|
149
|
+
pageNumber: pageNumber,
|
|
150
|
+
pageSize: pageSize
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
searchParams: searchParams,
|
|
154
|
+
onSearch: function onSearch(params) {
|
|
155
|
+
setSearchParams(params);
|
|
156
|
+
setPage(function (p) {
|
|
157
|
+
return _objectSpread(_objectSpread({}, p), {}, {
|
|
158
|
+
pageNumber: 1
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
onReset: function onReset() {
|
|
163
|
+
return setSearchParams({});
|
|
164
|
+
},
|
|
165
|
+
selectedKeys: selectedKeys,
|
|
166
|
+
selectedRows: selectedRows,
|
|
167
|
+
onSelectionChange: function onSelectionChange(keys, rows) {
|
|
168
|
+
setSelectedKeys(keys);
|
|
169
|
+
setSelectedRows(rows);
|
|
170
|
+
},
|
|
171
|
+
rowKey: 'id'
|
|
172
|
+
};
|
|
173
|
+
}, [page, searchParams, selectedKeys, selectedRows]);
|
|
174
|
+
}
|
|
175
|
+
export var CurrentPerspectiveFull = {
|
|
176
|
+
render: function CurrentPerspectiveFullRender() {
|
|
177
|
+
var dataSourceProps = useMockDataSourceProps();
|
|
178
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
179
|
+
style: {
|
|
180
|
+
height: 400
|
|
181
|
+
}
|
|
182
|
+
}, /*#__PURE__*/React.createElement(PisellSalesGrid, _extends({}, dataSourceProps, {
|
|
183
|
+
perspectives: perspectives,
|
|
184
|
+
currentPerspective: "full"
|
|
185
|
+
})));
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
export var CurrentPerspectiveBrief = {
|
|
189
|
+
render: function CurrentPerspectiveBriefRender() {
|
|
190
|
+
var dataSourceProps = useMockDataSourceProps();
|
|
191
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
192
|
+
style: {
|
|
193
|
+
height: 400
|
|
194
|
+
}
|
|
195
|
+
}, /*#__PURE__*/React.createElement(PisellSalesGrid, _extends({}, dataSourceProps, {
|
|
196
|
+
perspectives: perspectives,
|
|
197
|
+
currentPerspective: "brief"
|
|
198
|
+
})));
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
export var SinglePerspective = {
|
|
202
|
+
render: function SinglePerspectiveRender() {
|
|
203
|
+
var dataSourceProps = useMockDataSourceProps();
|
|
204
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
205
|
+
style: {
|
|
206
|
+
height: 400
|
|
207
|
+
}
|
|
208
|
+
}, /*#__PURE__*/React.createElement(PisellSalesGrid, _extends({}, dataSourceProps, {
|
|
209
|
+
perspectives: [perspectives[0]],
|
|
210
|
+
currentPerspective: "full"
|
|
211
|
+
})));
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/** 使用 columnRenderers 覆盖 type 为 currency 的列渲染 */
|
|
216
|
+
var columnRenderers = [{
|
|
217
|
+
type: 'currency',
|
|
218
|
+
render: function render(value) {
|
|
219
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
220
|
+
style: {
|
|
221
|
+
color: '#52c41a',
|
|
222
|
+
fontWeight: 600
|
|
223
|
+
}
|
|
224
|
+
}, "\xA5 ", typeof value === 'number' ? value.toFixed(2) : value);
|
|
225
|
+
}
|
|
226
|
+
}];
|
|
227
|
+
export var WithColumnRenderers = {
|
|
228
|
+
render: function WithColumnRenderersRender() {
|
|
229
|
+
var dataSourceProps = useMockDataSourceProps();
|
|
230
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
231
|
+
style: {
|
|
232
|
+
height: 400
|
|
233
|
+
}
|
|
234
|
+
}, /*#__PURE__*/React.createElement(PisellSalesGrid, _extends({}, dataSourceProps, {
|
|
235
|
+
perspectives: perspectives,
|
|
236
|
+
currentPerspective: "full",
|
|
237
|
+
columnRenderers: columnRenderers
|
|
238
|
+
})));
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
/** 配置默认隐藏列:grid.defaultHiddenColumnKeys 指定列 key,这些列初始为隐藏,用户可在表头设置中重新勾选显示 */
|
|
243
|
+
var perspectivesWithHiddenColumns = [{
|
|
244
|
+
key: 'full',
|
|
245
|
+
label: '完整列表',
|
|
246
|
+
childComponentProps: {
|
|
247
|
+
grid: {
|
|
248
|
+
columns: columnsFull,
|
|
249
|
+
defaultHiddenColumnKeys: ['sku', 'updateTime']
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}];
|
|
253
|
+
export var WithDefaultHiddenColumns = {
|
|
254
|
+
render: function WithDefaultHiddenColumnsRender() {
|
|
255
|
+
var dataSourceProps = useMockDataSourceProps();
|
|
256
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
257
|
+
style: {
|
|
258
|
+
height: 400
|
|
259
|
+
}
|
|
260
|
+
}, /*#__PURE__*/React.createElement(PisellSalesGrid, _extends({}, dataSourceProps, {
|
|
261
|
+
perspectives: perspectivesWithHiddenColumns,
|
|
262
|
+
currentPerspective: "full"
|
|
263
|
+
})));
|
|
264
|
+
},
|
|
265
|
+
parameters: {
|
|
266
|
+
docs: {
|
|
267
|
+
description: {
|
|
268
|
+
story: 'perspectives[].childComponentProps.grid.defaultHiddenColumnKeys 配置默认隐藏的列(如 sku、updateTime),初始加载时这些列不展示,用户可通过工具栏列设置重新勾选显示。'
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* 在 toolbar 里直接配置 sort:childComponentProps.toolBar.sort 传 { list },
|
|
276
|
+
* list 为排序项数组,每项 name(字段 key)、label(展示名)、type('string'|'number'|'date'|'option')。
|
|
277
|
+
* 排序值写入 searchParams.sort,由业务 onSearch 接收后请求带排序参数。
|
|
278
|
+
*/
|
|
279
|
+
var perspectivesWithToolbarSort = [{
|
|
280
|
+
key: 'full',
|
|
281
|
+
label: '完整列表(工具栏配置排序)',
|
|
282
|
+
childComponentProps: {
|
|
283
|
+
grid: {
|
|
284
|
+
columns: columnsFull
|
|
285
|
+
},
|
|
286
|
+
toolBar: {
|
|
287
|
+
sort: {
|
|
288
|
+
list: [{
|
|
289
|
+
name: 'amount',
|
|
290
|
+
label: '按金额',
|
|
291
|
+
type: 'number',
|
|
292
|
+
isCustom: false
|
|
293
|
+
}, {
|
|
294
|
+
name: 'name',
|
|
295
|
+
label: '按名称',
|
|
296
|
+
type: 'string',
|
|
297
|
+
isCustom: false
|
|
298
|
+
}, {
|
|
299
|
+
name: 'updateTime',
|
|
300
|
+
label: '按更新时间',
|
|
301
|
+
type: 'date',
|
|
302
|
+
isCustom: false
|
|
303
|
+
}]
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}];
|
|
308
|
+
export var WithToolbarSort = {
|
|
309
|
+
render: function WithToolbarSortRender() {
|
|
310
|
+
var dataSourceProps = useMockDataSourceProps();
|
|
311
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
312
|
+
style: {
|
|
313
|
+
height: 400
|
|
314
|
+
}
|
|
315
|
+
}, /*#__PURE__*/React.createElement(PisellSalesGrid, _extends({}, dataSourceProps, {
|
|
316
|
+
perspectives: perspectivesWithToolbarSort,
|
|
317
|
+
currentPerspective: "full"
|
|
318
|
+
})));
|
|
319
|
+
},
|
|
320
|
+
parameters: {
|
|
321
|
+
docs: {
|
|
322
|
+
description: {
|
|
323
|
+
story: '通过 perspectives[].childComponentProps.toolBar.sort 直接配置排序:传 { list: [{ name, label, type }] },工具栏展示排序按钮,选择后写入 searchParams.sort,由 onSearch 带回后端。'
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* 自定义排序选项:用 getSortItems(fieldKey) 返回 { key, label }[],
|
|
331
|
+
* 完全自定义每个字段下的排序子项(key 为最终写入 searchParams.sort 的值,label 为展示文案)。
|
|
332
|
+
*/
|
|
333
|
+
var perspectivesWithCustomSortOptions = [{
|
|
334
|
+
key: 'full',
|
|
335
|
+
label: '完整列表(自定义排序文案)',
|
|
336
|
+
childComponentProps: {
|
|
337
|
+
grid: {
|
|
338
|
+
columns: columnsFull
|
|
339
|
+
},
|
|
340
|
+
toolBar: {
|
|
341
|
+
sort: {
|
|
342
|
+
list: [{
|
|
343
|
+
name: 'amount',
|
|
344
|
+
label: '按金额',
|
|
345
|
+
isCustom: true,
|
|
346
|
+
getSortItems: function getSortItems(fieldKey) {
|
|
347
|
+
return [{
|
|
348
|
+
key: "".concat(fieldKey, ":asc"),
|
|
349
|
+
label: '从低到高'
|
|
350
|
+
}, {
|
|
351
|
+
key: "".concat(fieldKey, ":desc"),
|
|
352
|
+
label: '从高到低'
|
|
353
|
+
}];
|
|
354
|
+
}
|
|
355
|
+
}, {
|
|
356
|
+
name: 'name',
|
|
357
|
+
label: '按名称',
|
|
358
|
+
isCustom: true,
|
|
359
|
+
getSortItems: function getSortItems(fieldKey) {
|
|
360
|
+
return [{
|
|
361
|
+
key: "".concat(fieldKey, ":asc"),
|
|
362
|
+
label: 'A → Z'
|
|
363
|
+
}, {
|
|
364
|
+
key: "".concat(fieldKey, ":desc"),
|
|
365
|
+
label: 'Z → A'
|
|
366
|
+
}];
|
|
367
|
+
}
|
|
368
|
+
}]
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}];
|
|
373
|
+
export var WithToolbarSortCustomOptions = {
|
|
374
|
+
render: function WithToolbarSortCustomOptionsRender() {
|
|
375
|
+
var dataSourceProps = useMockDataSourceProps();
|
|
376
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
377
|
+
style: {
|
|
378
|
+
height: 400
|
|
379
|
+
}
|
|
380
|
+
}, /*#__PURE__*/React.createElement(PisellSalesGrid, _extends({}, dataSourceProps, {
|
|
381
|
+
perspectives: perspectivesWithCustomSortOptions,
|
|
382
|
+
currentPerspective: "full"
|
|
383
|
+
})));
|
|
384
|
+
},
|
|
385
|
+
parameters: {
|
|
386
|
+
docs: {
|
|
387
|
+
description: {
|
|
388
|
+
story: '用 toolBar.sort.list[].getSortItems(fieldKey) 自定义排序选项:返回 { key, label }[],key 写入 searchParams.sort,label 为下拉展示文案。可完全自定义文案(如「从低到高」「从高到低」)。'
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* 在 toolbar 里直接配置 filter:childComponentProps.toolBar.filter 传对象,
|
|
396
|
+
* 用 defaultFilterValue 提供筛选项列表(quickFilter / otherFilter 为 FilterItemProps[]),
|
|
397
|
+
* 筛选值写入 searchParams.filter,由 onSearch 接收。
|
|
398
|
+
*/
|
|
399
|
+
var perspectivesWithToolbarFilter = [{
|
|
400
|
+
key: 'full',
|
|
401
|
+
label: '完整列表(工具栏配置筛选)',
|
|
402
|
+
childComponentProps: {
|
|
403
|
+
grid: {
|
|
404
|
+
columns: columnsFull
|
|
405
|
+
},
|
|
406
|
+
toolBar: {
|
|
407
|
+
filter: {
|
|
408
|
+
hiddenQuickFilter: true,
|
|
409
|
+
defaultFilterValue: {
|
|
410
|
+
quickFilter: [],
|
|
411
|
+
otherFilter: [{
|
|
412
|
+
type: 'single',
|
|
413
|
+
key: 'status',
|
|
414
|
+
name: 'status',
|
|
415
|
+
label: '状态',
|
|
416
|
+
props: {
|
|
417
|
+
options: [{
|
|
418
|
+
label: '全部',
|
|
419
|
+
value: 'all'
|
|
420
|
+
}, {
|
|
421
|
+
label: '在售',
|
|
422
|
+
value: '在售'
|
|
423
|
+
}, {
|
|
424
|
+
label: '下架',
|
|
425
|
+
value: '下架'
|
|
426
|
+
}, {
|
|
427
|
+
label: '待上架',
|
|
428
|
+
value: '待上架'
|
|
429
|
+
}]
|
|
430
|
+
},
|
|
431
|
+
other: {}
|
|
432
|
+
}, {
|
|
433
|
+
type: 'input',
|
|
434
|
+
key: 'keyword',
|
|
435
|
+
name: 'keyword',
|
|
436
|
+
label: '关键词',
|
|
437
|
+
props: {
|
|
438
|
+
placeholder: '名称 / SKU'
|
|
439
|
+
},
|
|
440
|
+
other: {}
|
|
441
|
+
}],
|
|
442
|
+
values: {}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}];
|
|
448
|
+
export var WithToolbarFilter = {
|
|
449
|
+
render: function WithToolbarFilterRender() {
|
|
450
|
+
var dataSourceProps = useMockDataSourceProps();
|
|
451
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
452
|
+
style: {
|
|
453
|
+
height: 400
|
|
454
|
+
}
|
|
455
|
+
}, /*#__PURE__*/React.createElement(PisellSalesGrid, _extends({}, dataSourceProps, {
|
|
456
|
+
perspectives: perspectivesWithToolbarFilter,
|
|
457
|
+
currentPerspective: "full"
|
|
458
|
+
})));
|
|
459
|
+
},
|
|
460
|
+
parameters: {
|
|
461
|
+
docs: {
|
|
462
|
+
description: {
|
|
463
|
+
story: '通过 perspectives[].childComponentProps.toolBar.filter 直接配置筛选:传 defaultFilterValue.{ quickFilter, otherFilter, values },otherFilter 为 FilterItemProps[](type: single/input/rangePicker/rangePickerNew 等,key/name/label/props)。选择后写入 searchParams.filter,由 onSearch 带回。'
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* 同一 perspective 的 toolBar 里同时配置 sort 与 filter:
|
|
471
|
+
* toolBar.sort 传 { list },toolBar.filter 传 { defaultFilterValue }。
|
|
472
|
+
*/
|
|
473
|
+
var perspectivesWithToolbarSortAndFilter = [{
|
|
474
|
+
key: 'full',
|
|
475
|
+
label: '完整列表(排序 + 筛选)',
|
|
476
|
+
childComponentProps: {
|
|
477
|
+
grid: {
|
|
478
|
+
columns: columnsFull
|
|
479
|
+
},
|
|
480
|
+
toolBar: {
|
|
481
|
+
sort: {
|
|
482
|
+
list: [{
|
|
483
|
+
name: 'amount',
|
|
484
|
+
label: '按金额',
|
|
485
|
+
type: 'number',
|
|
486
|
+
isCustom: false
|
|
487
|
+
}, {
|
|
488
|
+
name: 'name',
|
|
489
|
+
label: '按名称',
|
|
490
|
+
type: 'string',
|
|
491
|
+
isCustom: false
|
|
492
|
+
}, {
|
|
493
|
+
name: 'updateTime',
|
|
494
|
+
label: '按更新时间',
|
|
495
|
+
type: 'date',
|
|
496
|
+
isCustom: false
|
|
497
|
+
}]
|
|
498
|
+
},
|
|
499
|
+
filter: {
|
|
500
|
+
hiddenQuickFilter: true,
|
|
501
|
+
defaultFilterValue: {
|
|
502
|
+
quickFilter: [],
|
|
503
|
+
otherFilter: [{
|
|
504
|
+
type: 'single',
|
|
505
|
+
key: 'status',
|
|
506
|
+
name: 'status',
|
|
507
|
+
label: '状态',
|
|
508
|
+
props: {
|
|
509
|
+
options: [{
|
|
510
|
+
label: '全部',
|
|
511
|
+
value: 'all'
|
|
512
|
+
}, {
|
|
513
|
+
label: '在售',
|
|
514
|
+
value: '在售'
|
|
515
|
+
}, {
|
|
516
|
+
label: '下架',
|
|
517
|
+
value: '下架'
|
|
518
|
+
}, {
|
|
519
|
+
label: '待上架',
|
|
520
|
+
value: '待上架'
|
|
521
|
+
}]
|
|
522
|
+
},
|
|
523
|
+
other: {}
|
|
524
|
+
}, {
|
|
525
|
+
type: 'input',
|
|
526
|
+
key: 'keyword',
|
|
527
|
+
name: 'keyword',
|
|
528
|
+
label: '关键词',
|
|
529
|
+
props: {
|
|
530
|
+
placeholder: '名称 / SKU'
|
|
531
|
+
},
|
|
532
|
+
other: {}
|
|
533
|
+
}],
|
|
534
|
+
values: {}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}];
|
|
540
|
+
export var WithToolbarSortAndFilter = {
|
|
541
|
+
render: function WithToolbarSortAndFilterRender() {
|
|
542
|
+
var dataSourceProps = useMockDataSourceProps();
|
|
543
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
544
|
+
style: {
|
|
545
|
+
height: 400
|
|
546
|
+
}
|
|
547
|
+
}, /*#__PURE__*/React.createElement(PisellSalesGrid, _extends({}, dataSourceProps, {
|
|
548
|
+
perspectives: perspectivesWithToolbarSortAndFilter,
|
|
549
|
+
currentPerspective: "full"
|
|
550
|
+
})));
|
|
551
|
+
},
|
|
552
|
+
parameters: {
|
|
553
|
+
docs: {
|
|
554
|
+
description: {
|
|
555
|
+
story: '在 toolBar 里同时配置排序与筛选:toolBar.sort 传 { list },toolBar.filter 传 { defaultFilterValue }。排序写入 searchParams.sort,筛选写入 searchParams.filter,均由 onSearch 带回。'
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface UseActionsOptions {
|
|
3
|
+
onRefresh?: () => void;
|
|
4
|
+
onClearSelection?: () => void;
|
|
5
|
+
}
|
|
6
|
+
declare const useActions: (options?: UseActionsOptions) => ({
|
|
7
|
+
key: string;
|
|
8
|
+
label: any;
|
|
9
|
+
icon: string;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
onClick: (keys: React.Key[], rows?: any[]) => Promise<void>;
|
|
12
|
+
} | {
|
|
13
|
+
key: string;
|
|
14
|
+
label: any;
|
|
15
|
+
icon: string;
|
|
16
|
+
onClick: (keys: React.Key[], rows?: any[]) => void;
|
|
17
|
+
loading?: undefined;
|
|
18
|
+
})[];
|
|
19
|
+
export default useActions;
|