@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,363 @@
|
|
|
1
|
+
var _excluded = ["filter"],
|
|
2
|
+
_excluded2 = ["filter"];
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
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."); }
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
|
+
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; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
15
|
+
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); }
|
|
16
|
+
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); }
|
|
17
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
18
|
+
import { PisellRecordBoard } from '@pisell/materials';
|
|
19
|
+
// import PisellRecordBoard from '../../../../materials/src/components/pisellRecordBoard';
|
|
20
|
+
import { useRequest } from 'ahooks';
|
|
21
|
+
import dayjs from 'dayjs';
|
|
22
|
+
import { request } from "../../utils";
|
|
23
|
+
import useEngineContext from "../../hooks/useEngineContext";
|
|
24
|
+
import useActions from "./hooks/useActions";
|
|
25
|
+
import { defaultPaymentStatusKeys } from "../pisellSalesManagement/config/booking";
|
|
26
|
+
import { getOrderList, getBookingList } from "./serve";
|
|
27
|
+
import "./PisellSalesGrid.less";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 根据 currentPerspective 从 perspectives 中取当前 Perspective 配置,未找到时回退到第一项或空配置。
|
|
31
|
+
*/
|
|
32
|
+
function getCurrentPerspectiveConfig(perspectives, currentPerspective) {
|
|
33
|
+
var found = perspectives.find(function (p) {
|
|
34
|
+
return p.key === currentPerspective;
|
|
35
|
+
});
|
|
36
|
+
if (found) return found;
|
|
37
|
+
if (perspectives.length > 0) return perspectives[0];
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
function getDefaultSearchParams(currentPerspective) {
|
|
41
|
+
if (currentPerspective === 'monitor') {
|
|
42
|
+
return {
|
|
43
|
+
filter: {
|
|
44
|
+
values: {
|
|
45
|
+
order_payment_status: defaultPaymentStatusKeys,
|
|
46
|
+
booking_time_start_between: [dayjs().startOf('day'), dayjs().endOf('day')]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
filter: {
|
|
53
|
+
values: {
|
|
54
|
+
payment_status: defaultPaymentStatusKeys,
|
|
55
|
+
orderDate: [dayjs(), dayjs()]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
sort: 'created_at:desc'
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
var SEARCH_PARAMS_STORAGE_PREFIX = 'pisell_sales_grid_search_params_';
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 序列化 searchParams,将 dayjs 对象转换为 ISO 字符串
|
|
65
|
+
*/
|
|
66
|
+
function serializeSearchParams(params) {
|
|
67
|
+
return JSON.stringify(params, function (key, value) {
|
|
68
|
+
if (dayjs.isDayjs(value)) {
|
|
69
|
+
return {
|
|
70
|
+
__isDayjs: true,
|
|
71
|
+
value: value.toISOString()
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return value;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 反序列化 searchParams,将 ISO 字符串还原为 dayjs 对象
|
|
80
|
+
*/
|
|
81
|
+
function deserializeSearchParams(str) {
|
|
82
|
+
return JSON.parse(str, function (key, value) {
|
|
83
|
+
if (value && _typeof(value) === 'object' && value.__isDayjs) {
|
|
84
|
+
return dayjs(value.value);
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 仅保留 filter 的 values 和 quickFilter 用于存储,不存 otherFilter(label/options 等)。
|
|
92
|
+
* 恢复时用当前 perspective 的 otherFilter(当前语言),只还原 values。
|
|
93
|
+
*/
|
|
94
|
+
function normalizeFilterForStorage(filter) {
|
|
95
|
+
var _filter$values;
|
|
96
|
+
if (!filter || _typeof(filter) !== 'object') return filter;
|
|
97
|
+
return {
|
|
98
|
+
values: (_filter$values = filter.values) !== null && _filter$values !== void 0 ? _filter$values : {},
|
|
99
|
+
quickFilter: Array.isArray(filter.quickFilter) ? filter.quickFilter : []
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 默认不持久化筛选条件,只持久化排序、关键词等;筛选项恢复时使用 perspective 默认值。
|
|
105
|
+
* 列显示隐藏由 RecordBoard/Grid 通过 getColumnVisibilityFromLocal 单独持久化。
|
|
106
|
+
*/
|
|
107
|
+
var PERSIST_FILTER_BY_DEFAULT = false;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 从存储还原的 searchParams:filter 只保留 values 和 quickFilter,不保留 otherFilter。
|
|
111
|
+
* 仅当 PERSIST_FILTER_BY_DEFAULT 为 true 时用于还原;否则不还原 filter。
|
|
112
|
+
*/
|
|
113
|
+
function normalizeRestoredSearchParams(params) {
|
|
114
|
+
if (!params || _typeof(params) !== 'object') return params;
|
|
115
|
+
var filter = params.filter;
|
|
116
|
+
if (!filter || _typeof(filter) !== 'object') return params;
|
|
117
|
+
return _objectSpread(_objectSpread({}, params), {}, {
|
|
118
|
+
filter: normalizeFilterForStorage(filter)
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 从 sessionStorage 获取存储的 searchParams。
|
|
124
|
+
* 默认不还原 filter(仅还原 sort、keyword 等),调用方需与 getDefaultSearchParams 合并以得到默认筛选项。
|
|
125
|
+
*/
|
|
126
|
+
function getStoredSearchParams(id) {
|
|
127
|
+
try {
|
|
128
|
+
var stored = sessionStorage.getItem("".concat(SEARCH_PARAMS_STORAGE_PREFIX).concat(id));
|
|
129
|
+
if (stored) {
|
|
130
|
+
var parsed = deserializeSearchParams(stored);
|
|
131
|
+
var normalized = PERSIST_FILTER_BY_DEFAULT ? normalizeRestoredSearchParams(parsed) : parsed;
|
|
132
|
+
if (!PERSIST_FILTER_BY_DEFAULT && normalized && _typeof(normalized) === 'object') {
|
|
133
|
+
var _ref = normalized,
|
|
134
|
+
_f = _ref.filter,
|
|
135
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
136
|
+
return rest;
|
|
137
|
+
}
|
|
138
|
+
return normalized;
|
|
139
|
+
}
|
|
140
|
+
} catch (e) {
|
|
141
|
+
console.warn('Failed to get stored search params:', e);
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 将 searchParams 存储到 sessionStorage。
|
|
148
|
+
* 默认只存排序、关键词等,不存 filter;列显示隐藏由 RecordBoard 侧单独持久化。
|
|
149
|
+
*/
|
|
150
|
+
function saveSearchParams(id, params) {
|
|
151
|
+
try {
|
|
152
|
+
var toStore;
|
|
153
|
+
if (PERSIST_FILTER_BY_DEFAULT) {
|
|
154
|
+
toStore = _objectSpread(_objectSpread({}, params), {}, {
|
|
155
|
+
filter: params.filter ? normalizeFilterForStorage(params.filter) : params.filter
|
|
156
|
+
});
|
|
157
|
+
} else {
|
|
158
|
+
var _f = params.filter,
|
|
159
|
+
rest = _objectWithoutProperties(params, _excluded2);
|
|
160
|
+
toStore = rest;
|
|
161
|
+
}
|
|
162
|
+
sessionStorage.setItem("".concat(SEARCH_PARAMS_STORAGE_PREFIX).concat(id), serializeSearchParams(toStore));
|
|
163
|
+
} catch (e) {
|
|
164
|
+
console.warn('Failed to save search params:', e);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
var PisellSalesGrid = function PisellSalesGrid(props) {
|
|
168
|
+
var _context$appHelper, _getBookingList$data, _getOrderList$data, _getBookingList$data2, _getOrderList$data2, _recordBoardGridProps, _recordBoardGridProps2, _currentConfig$childC2, _currentConfig$childC3, _currentConfig$childC4;
|
|
169
|
+
var perspectives = props.perspectives,
|
|
170
|
+
currentPerspective = props.currentPerspective,
|
|
171
|
+
className = props.className,
|
|
172
|
+
style = props.style,
|
|
173
|
+
extParams = props.extParams,
|
|
174
|
+
__id = props.__id;
|
|
175
|
+
var context = useEngineContext();
|
|
176
|
+
var utils = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
|
|
177
|
+
request.setRequest(utils === null || utils === void 0 ? void 0 : utils.request);
|
|
178
|
+
var _useState = useState([]),
|
|
179
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
180
|
+
selectedKeys = _useState2[0],
|
|
181
|
+
setSelectedKeys = _useState2[1];
|
|
182
|
+
var _useState3 = useState([]),
|
|
183
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
184
|
+
selectedRows = _useState4[0],
|
|
185
|
+
setSelectedRows = _useState4[1];
|
|
186
|
+
var _useState5 = useState({
|
|
187
|
+
pageNumber: 1,
|
|
188
|
+
pageSize: 50
|
|
189
|
+
}),
|
|
190
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
191
|
+
pagination = _useState6[0],
|
|
192
|
+
setPagination = _useState6[1];
|
|
193
|
+
var _useState7 = useState(function () {
|
|
194
|
+
var defaultParams = getDefaultSearchParams(currentPerspective);
|
|
195
|
+
if (__id) {
|
|
196
|
+
var stored = getStoredSearchParams(__id);
|
|
197
|
+
if (stored) {
|
|
198
|
+
return _objectSpread(_objectSpread({}, defaultParams), stored);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return defaultParams;
|
|
202
|
+
}),
|
|
203
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
204
|
+
searchParams = _useState8[0],
|
|
205
|
+
setSearchParams = _useState8[1];
|
|
206
|
+
var onSelectionChange = useCallback(function (keys, rows) {
|
|
207
|
+
setSelectedKeys(keys);
|
|
208
|
+
setSelectedRows(rows);
|
|
209
|
+
}, []);
|
|
210
|
+
var onPageChange = useCallback(function (pageNumber, pageSize) {
|
|
211
|
+
if (pageNumber < 1 || pageSize < 1) return;
|
|
212
|
+
setPagination({
|
|
213
|
+
pageNumber: pageNumber,
|
|
214
|
+
pageSize: pageSize
|
|
215
|
+
});
|
|
216
|
+
}, []);
|
|
217
|
+
var onSearch = useCallback(function (params) {
|
|
218
|
+
setSearchParams(params || {});
|
|
219
|
+
setPagination(function (prev) {
|
|
220
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
221
|
+
pageNumber: 1
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
}, []);
|
|
225
|
+
var onReset = useCallback(function () {
|
|
226
|
+
setSearchParams(getDefaultSearchParams(currentPerspective));
|
|
227
|
+
setPagination(function (prev) {
|
|
228
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
229
|
+
pageNumber: 1
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
}, [currentPerspective]);
|
|
233
|
+
|
|
234
|
+
// 当 searchParams 改变时,存储到 sessionStorage
|
|
235
|
+
useEffect(function () {
|
|
236
|
+
if (__id) {
|
|
237
|
+
saveSearchParams(__id, searchParams);
|
|
238
|
+
}
|
|
239
|
+
}, [__id, searchParams]);
|
|
240
|
+
useEffect(function () {
|
|
241
|
+
document.body.id = 'body';
|
|
242
|
+
}, []);
|
|
243
|
+
var _getBookingList = useRequest(getBookingList, {
|
|
244
|
+
manual: true
|
|
245
|
+
});
|
|
246
|
+
var _getOrderList = useRequest(getOrderList, {
|
|
247
|
+
manual: true
|
|
248
|
+
});
|
|
249
|
+
var requestParams = useMemo(function () {
|
|
250
|
+
var keyword = searchParams.keyword,
|
|
251
|
+
filter = searchParams.filter,
|
|
252
|
+
sort = searchParams.sort;
|
|
253
|
+
var filterVals = (filter === null || filter === void 0 ? void 0 : filter.values) || {};
|
|
254
|
+
return _objectSpread(_objectSpread({
|
|
255
|
+
keyword: keyword,
|
|
256
|
+
sort: sort
|
|
257
|
+
}, filterVals), {}, {
|
|
258
|
+
skip: pagination.pageNumber,
|
|
259
|
+
num: pagination.pageSize
|
|
260
|
+
});
|
|
261
|
+
}, [searchParams, pagination.pageNumber, pagination.pageSize]);
|
|
262
|
+
var initLoad = useCallback(function () {
|
|
263
|
+
if (currentPerspective === 'monitor') {
|
|
264
|
+
_getBookingList.run(_objectSpread(_objectSpread({}, requestParams), (extParams === null || extParams === void 0 ? void 0 : extParams.list) || {}));
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
_getOrderList.run(_objectSpread(_objectSpread({}, requestParams), (extParams === null || extParams === void 0 ? void 0 : extParams.list) || {}));
|
|
268
|
+
}, [currentPerspective, requestParams, _getBookingList, _getOrderList]);
|
|
269
|
+
var onClearSelection = useCallback(function () {
|
|
270
|
+
setSelectedKeys([]);
|
|
271
|
+
setSelectedRows([]);
|
|
272
|
+
}, []);
|
|
273
|
+
var actions = useActions({
|
|
274
|
+
onRefresh: initLoad,
|
|
275
|
+
onClearSelection: onClearSelection
|
|
276
|
+
});
|
|
277
|
+
var batchActionConfig = useMemo(function () {
|
|
278
|
+
return {
|
|
279
|
+
actions: actions
|
|
280
|
+
};
|
|
281
|
+
}, [actions]);
|
|
282
|
+
useEffect(function () {
|
|
283
|
+
if (currentPerspective === 'monitor') {
|
|
284
|
+
_getBookingList.run(_objectSpread(_objectSpread({}, requestParams), (extParams === null || extParams === void 0 ? void 0 : extParams.list) || {}));
|
|
285
|
+
} else {
|
|
286
|
+
_getOrderList.run(_objectSpread(_objectSpread({}, requestParams), (extParams === null || extParams === void 0 ? void 0 : extParams.list) || {}));
|
|
287
|
+
}
|
|
288
|
+
}, [currentPerspective, requestParams]);
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* 运行时上下文:根据当前 perspective 绑定对应的 refresh / refreshAsync,
|
|
292
|
+
* 传入 perspective 的 getChildComponentProps 工厂函数。
|
|
293
|
+
*/
|
|
294
|
+
var runtimeContext = useMemo(function () {
|
|
295
|
+
return {
|
|
296
|
+
refresh: currentPerspective === 'monitor' ? function () {
|
|
297
|
+
return _getBookingList.run(_objectSpread(_objectSpread({}, requestParams), (extParams === null || extParams === void 0 ? void 0 : extParams.list) || {}));
|
|
298
|
+
} : function () {
|
|
299
|
+
return _getOrderList.run(_objectSpread(_objectSpread({}, requestParams), (extParams === null || extParams === void 0 ? void 0 : extParams.list) || {}));
|
|
300
|
+
},
|
|
301
|
+
refreshAsync: currentPerspective === 'monitor' ? function () {
|
|
302
|
+
return _getBookingList.runAsync(_objectSpread(_objectSpread({}, requestParams), (extParams === null || extParams === void 0 ? void 0 : extParams.list) || {}));
|
|
303
|
+
} : function () {
|
|
304
|
+
return _getOrderList.runAsync(_objectSpread(_objectSpread({}, requestParams), (extParams === null || extParams === void 0 ? void 0 : extParams.list) || {}));
|
|
305
|
+
},
|
|
306
|
+
currentPerspective: currentPerspective
|
|
307
|
+
};
|
|
308
|
+
}, [currentPerspective, _getBookingList, _getOrderList, requestParams, extParams]);
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* 解析当前 perspective 配置:
|
|
312
|
+
* - 若 perspective 提供了 getChildComponentProps 工厂,调用它并注入 runtimeContext;
|
|
313
|
+
* - 否则回退到静态 childComponentProps(向后兼容)。
|
|
314
|
+
*/
|
|
315
|
+
var currentConfig = useMemo(function () {
|
|
316
|
+
var raw = getCurrentPerspectiveConfig(perspectives, currentPerspective);
|
|
317
|
+
if (!raw) return undefined;
|
|
318
|
+
if (typeof raw.getChildComponentProps === 'function') {
|
|
319
|
+
return _objectSpread(_objectSpread({}, raw), {}, {
|
|
320
|
+
childComponentProps: raw.getChildComponentProps(runtimeContext)
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
return raw;
|
|
324
|
+
}, [perspectives, currentPerspective, runtimeContext]);
|
|
325
|
+
var recordBoardGridProps = useMemo(function () {
|
|
326
|
+
var _currentConfig$childC;
|
|
327
|
+
var gridConfig = (currentConfig === null || currentConfig === void 0 || (_currentConfig$childC = currentConfig.childComponentProps) === null || _currentConfig$childC === void 0 ? void 0 : _currentConfig$childC.grid) || {};
|
|
328
|
+
return _objectSpread(_objectSpread({}, gridConfig), {}, {
|
|
329
|
+
selectedKeys: selectedKeys,
|
|
330
|
+
selectedRows: selectedRows,
|
|
331
|
+
onSelectionChange: onSelectionChange
|
|
332
|
+
});
|
|
333
|
+
}, [currentConfig, selectedKeys, selectedRows, onSelectionChange]);
|
|
334
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
335
|
+
className: "pisell-sales-grid ".concat(className !== null && className !== void 0 ? className : '').trim(),
|
|
336
|
+
style: _objectSpread({
|
|
337
|
+
height: '100%',
|
|
338
|
+
minHeight: 0,
|
|
339
|
+
display: 'flex',
|
|
340
|
+
flexDirection: 'column'
|
|
341
|
+
}, style)
|
|
342
|
+
}, /*#__PURE__*/React.createElement(PisellRecordBoard, {
|
|
343
|
+
key: currentPerspective,
|
|
344
|
+
__id: __id,
|
|
345
|
+
layoutType: "grid",
|
|
346
|
+
rowKey: 'id',
|
|
347
|
+
data: currentPerspective === 'monitor' ? ((_getBookingList$data = _getBookingList.data) === null || _getBookingList$data === void 0 ? void 0 : _getBookingList$data.list) || [] : ((_getOrderList$data = _getOrderList.data) === null || _getOrderList$data === void 0 ? void 0 : _getOrderList$data.list) || [],
|
|
348
|
+
loading: currentPerspective === 'monitor' ? _getBookingList.loading : _getOrderList.loading,
|
|
349
|
+
total: currentPerspective === 'monitor' ? ((_getBookingList$data2 = _getBookingList.data) === null || _getBookingList$data2 === void 0 ? void 0 : _getBookingList$data2.count) || 0 : ((_getOrderList$data2 = _getOrderList.data) === null || _getOrderList$data2 === void 0 ? void 0 : _getOrderList$data2.count) || 0,
|
|
350
|
+
pagination: pagination,
|
|
351
|
+
onPageChange: onPageChange,
|
|
352
|
+
searchParams: searchParams,
|
|
353
|
+
onSearch: onSearch,
|
|
354
|
+
onReset: onReset,
|
|
355
|
+
fillHeight: (_recordBoardGridProps = (_recordBoardGridProps2 = recordBoardGridProps.scroll) === null || _recordBoardGridProps2 === void 0 ? void 0 : _recordBoardGridProps2.autoCalc) !== null && _recordBoardGridProps !== void 0 ? _recordBoardGridProps : true,
|
|
356
|
+
grid: recordBoardGridProps,
|
|
357
|
+
toolBar: currentConfig === null || currentConfig === void 0 || (_currentConfig$childC2 = currentConfig.childComponentProps) === null || _currentConfig$childC2 === void 0 ? void 0 : _currentConfig$childC2.toolBar,
|
|
358
|
+
search: currentConfig === null || currentConfig === void 0 || (_currentConfig$childC3 = currentConfig.childComponentProps) === null || _currentConfig$childC3 === void 0 ? void 0 : _currentConfig$childC3.search,
|
|
359
|
+
batchActionBar: _objectSpread(_objectSpread({}, batchActionConfig), currentConfig === null || currentConfig === void 0 || (_currentConfig$childC4 = currentConfig.childComponentProps) === null || _currentConfig$childC4 === void 0 ? void 0 : _currentConfig$childC4.batchActionBar)
|
|
360
|
+
}, /*#__PURE__*/React.createElement(PisellRecordBoard.ShellFrame, null, /*#__PURE__*/React.createElement(PisellRecordBoard.GridLayout, null))));
|
|
361
|
+
};
|
|
362
|
+
PisellSalesGrid.displayName = 'PisellSalesGrid';
|
|
363
|
+
export default PisellSalesGrid;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PisellSalesGrid 样式
|
|
3
|
+
* 作用域限定在 .pisell-sales-grid 内,避免污染全局
|
|
4
|
+
*/
|
|
5
|
+
.pisell-sales-grid {
|
|
6
|
+
width: 100%;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
min-height: 0;
|
|
10
|
+
|
|
11
|
+
/* Quick filter 内日期选择器宽度加大 */
|
|
12
|
+
|
|
13
|
+
.record-board-toolbar-quick-filter-form .pisell-date-range-picker {
|
|
14
|
+
min-width: 240px !important;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { PisellSalesGrid } from './index';
|
|
3
|
+
declare const meta: Meta<typeof PisellSalesGrid>;
|
|
4
|
+
export default meta;
|
|
5
|
+
declare type Story = StoryObj<typeof PisellSalesGrid>;
|
|
6
|
+
export declare const CurrentPerspectiveFull: Story;
|
|
7
|
+
export declare const CurrentPerspectiveBrief: Story;
|
|
8
|
+
export declare const SinglePerspective: Story;
|
|
9
|
+
export declare const WithColumnRenderers: Story;
|
|
10
|
+
export declare const WithDefaultHiddenColumns: Story;
|
|
11
|
+
export declare const WithToolbarSort: Story;
|
|
12
|
+
export declare const WithToolbarSortCustomOptions: Story;
|
|
13
|
+
export declare const WithToolbarFilter: Story;
|
|
14
|
+
export declare const WithToolbarSortAndFilter: Story;
|