@pisell/private-materials 6.3.103 → 6.3.105
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/notes/NoteBlock/index.js +3 -2
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eventBooking/components/ErrorTip/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/MWCreditCard/List/index.js +32 -16
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +16 -10
- package/es/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/es/hooks/usePaymentLogger.d.ts +1 -0
- 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 +186 -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/lib/components/booking/notes/NoteBlock/index.js +2 -1
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eventBooking/components/ErrorTip/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/MWCreditCard/List/index.js +19 -11
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +21 -22
- package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/lib/hooks/usePaymentLogger.d.ts +1 -0
- 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 +186 -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/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 +3 -3
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
+
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); }
|
|
6
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
+
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."); }
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
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; } }
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
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); }
|
|
13
|
+
import React, { useMemo, useState } from 'react';
|
|
14
|
+
import { PisellModal, Icon } from '@pisell/materials';
|
|
15
|
+
import { locales } from '@pisell/utils';
|
|
16
|
+
import NoteBlock from "../../../components/booking/notes/NoteBlock";
|
|
17
|
+
import { textStyles } from "../hooks/perspectiveUtils";
|
|
18
|
+
var normalizeInternalNotes = function normalizeInternalNotes(value) {
|
|
19
|
+
if (!value) return [];
|
|
20
|
+
if (Array.isArray(value)) {
|
|
21
|
+
return value.map(function (item, index) {
|
|
22
|
+
if (typeof item === 'string' || typeof item === 'number') {
|
|
23
|
+
return {
|
|
24
|
+
id: index,
|
|
25
|
+
content: String(item)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (item && _typeof(item) === 'object') {
|
|
29
|
+
return item;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
id: index,
|
|
33
|
+
content: String(item)
|
|
34
|
+
};
|
|
35
|
+
}).filter(function (item) {
|
|
36
|
+
return (item === null || item === void 0 ? void 0 : item.content) != null && (item === null || item === void 0 ? void 0 : item.content) !== '';
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
40
|
+
return [{
|
|
41
|
+
id: 0,
|
|
42
|
+
content: String(value)
|
|
43
|
+
}];
|
|
44
|
+
}
|
|
45
|
+
return [];
|
|
46
|
+
};
|
|
47
|
+
var BookingNotesPreview = function BookingNotesPreview(props) {
|
|
48
|
+
var dataSource = props.dataSource,
|
|
49
|
+
labels = props.labels,
|
|
50
|
+
style = props.style;
|
|
51
|
+
var orderNote = typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.note) === 'string' ? dataSource.note.trim() : '';
|
|
52
|
+
var internalNotes = useMemo(function () {
|
|
53
|
+
return normalizeInternalNotes(dataSource === null || dataSource === void 0 ? void 0 : dataSource.internalNotes);
|
|
54
|
+
}, [dataSource === null || dataSource === void 0 ? void 0 : dataSource.internalNotes]);
|
|
55
|
+
var displayLines = useMemo(function () {
|
|
56
|
+
var lines = [];
|
|
57
|
+
if (orderNote) {
|
|
58
|
+
lines.push({
|
|
59
|
+
label: (labels === null || labels === void 0 ? void 0 : labels.orderNote) || locales.getText('pisell2.salesManagement.booking.notes.orderNotes'),
|
|
60
|
+
content: orderNote
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
internalNotes.forEach(function (item) {
|
|
64
|
+
var content = typeof (item === null || item === void 0 ? void 0 : item.content) === 'string' ? item.content.trim() : '';
|
|
65
|
+
if (!content) return;
|
|
66
|
+
lines.push({
|
|
67
|
+
label: (labels === null || labels === void 0 ? void 0 : labels.internalNote) || locales.getText('pisell2.salesManagement.booking.notes.internalNotes'),
|
|
68
|
+
content: content
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
return lines;
|
|
72
|
+
}, [orderNote, internalNotes, labels === null || labels === void 0 ? void 0 : labels.orderNote, labels === null || labels === void 0 ? void 0 : labels.internalNote]);
|
|
73
|
+
var visibleLines = displayLines.slice(0, 2);
|
|
74
|
+
var showMore = displayLines.length > 0;
|
|
75
|
+
var _useState = useState(false),
|
|
76
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
77
|
+
modalOpen = _useState2[0],
|
|
78
|
+
setModalOpen = _useState2[1];
|
|
79
|
+
if (!displayLines.length) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
var openNotesModal = function openNotesModal(event) {
|
|
83
|
+
event.stopPropagation();
|
|
84
|
+
setModalOpen(true);
|
|
85
|
+
};
|
|
86
|
+
var orderNotes = orderNote ? [{
|
|
87
|
+
id: 0,
|
|
88
|
+
content: orderNote
|
|
89
|
+
}] : [];
|
|
90
|
+
var isEditable = Boolean(dataSource === null || dataSource === void 0 ? void 0 : dataSource.apis);
|
|
91
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
style: style,
|
|
93
|
+
onClick: function onClick(e) {
|
|
94
|
+
return e.stopPropagation();
|
|
95
|
+
}
|
|
96
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
style: {
|
|
98
|
+
display: 'flex',
|
|
99
|
+
flexDirection: 'column',
|
|
100
|
+
cursor: 'pointer'
|
|
101
|
+
},
|
|
102
|
+
onClick: openNotesModal
|
|
103
|
+
}, visibleLines.map(function (line, index) {
|
|
104
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
105
|
+
key: "".concat(line.label, "-").concat(index),
|
|
106
|
+
style: _objectSpread(_objectSpread({}, textStyles.text), {}, {
|
|
107
|
+
fontSize: 14,
|
|
108
|
+
whiteSpace: 'nowrap',
|
|
109
|
+
overflow: 'hidden',
|
|
110
|
+
textOverflow: 'ellipsis'
|
|
111
|
+
})
|
|
112
|
+
}, /*#__PURE__*/React.createElement("span", null, line.label, ":"), ' ', /*#__PURE__*/React.createElement("span", {
|
|
113
|
+
style: {
|
|
114
|
+
color: '#eaa96f'
|
|
115
|
+
}
|
|
116
|
+
}, line.content));
|
|
117
|
+
}), showMore ? /*#__PURE__*/React.createElement("div", {
|
|
118
|
+
style: {
|
|
119
|
+
color: '#7f56d9',
|
|
120
|
+
display: 'flex',
|
|
121
|
+
alignItems: 'center'
|
|
122
|
+
}
|
|
123
|
+
}, (labels === null || labels === void 0 ? void 0 : labels.more) || locales.getText('pisell2.salesManagement.booking.view-more'), /*#__PURE__*/React.createElement(Icon, {
|
|
124
|
+
size: 20,
|
|
125
|
+
type: "pisell2-chevron-right-double"
|
|
126
|
+
})) : null), /*#__PURE__*/React.createElement(PisellModal, {
|
|
127
|
+
open: modalOpen,
|
|
128
|
+
title: locales.getText('pisell2.salesManagement.booking.notes.title'),
|
|
129
|
+
width: 600,
|
|
130
|
+
footer: null,
|
|
131
|
+
onCancel: function onCancel() {
|
|
132
|
+
return setModalOpen(false);
|
|
133
|
+
},
|
|
134
|
+
destroyOnClose: true,
|
|
135
|
+
bodyStyle: {
|
|
136
|
+
overflowX: 'hidden'
|
|
137
|
+
}
|
|
138
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
139
|
+
style: {
|
|
140
|
+
display: 'flex',
|
|
141
|
+
flexDirection: 'column',
|
|
142
|
+
gap: 16
|
|
143
|
+
}
|
|
144
|
+
}, /*#__PURE__*/React.createElement(NoteBlock, {
|
|
145
|
+
noteType: "order",
|
|
146
|
+
maxLength: 1,
|
|
147
|
+
title: "".concat(locales.getText('pisell2.salesManagement.booking.notes.orderNotes'), ":"),
|
|
148
|
+
describe: "",
|
|
149
|
+
notes: orderNotes,
|
|
150
|
+
apis: dataSource === null || dataSource === void 0 ? void 0 : dataSource.apis,
|
|
151
|
+
placeholder: locales.getText('pisell2.salesManagement.booking.notes.addOrderNotes'),
|
|
152
|
+
isEdit: isEditable,
|
|
153
|
+
onChange: dataSource === null || dataSource === void 0 ? void 0 : dataSource.onChange
|
|
154
|
+
}), (internalNotes.length > 0 || isEditable) && /*#__PURE__*/React.createElement(NoteBlock, {
|
|
155
|
+
maxLength: 99,
|
|
156
|
+
noteType: "internal",
|
|
157
|
+
title: "".concat(locales.getText('pisell2.salesManagement.booking.notes.internalNotes'), ":"),
|
|
158
|
+
describe: locales.getText('pisell2.salesManagement.booking.notes.internalVisibleOnlyTip'),
|
|
159
|
+
placeholder: locales.getText('pisell2.salesManagement.booking.notes.addInternalNotes'),
|
|
160
|
+
notes: internalNotes,
|
|
161
|
+
isEdit: isEditable,
|
|
162
|
+
apis: dataSource === null || dataSource === void 0 ? void 0 : dataSource.apis,
|
|
163
|
+
bookingId: dataSource === null || dataSource === void 0 ? void 0 : dataSource.bookingId,
|
|
164
|
+
onChange: dataSource === null || dataSource === void 0 ? void 0 : dataSource.onChange
|
|
165
|
+
}))));
|
|
166
|
+
};
|
|
167
|
+
export default BookingNotesPreview;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type ResourceSelectorProps = {
|
|
3
|
+
value?: Array<string | number> | string | number;
|
|
4
|
+
onChange?: (value: Array<string | number>) => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
};
|
|
8
|
+
declare const ResourceSelector: (props: ResourceSelectorProps) => React.JSX.Element;
|
|
9
|
+
export default ResourceSelector;
|
|
@@ -0,0 +1,102 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
8
|
+
import { Empty, Spin, TreeSelect } from 'antd';
|
|
9
|
+
import { useRequest } from 'ahooks';
|
|
10
|
+
import { locales } from '@pisell/utils';
|
|
11
|
+
import { getResourceTypes } from "../serve";
|
|
12
|
+
var formatResourceNode = function formatResourceNode(item) {
|
|
13
|
+
var _ref, _ref2, _ref3, _ref4, _ref5, _item$id, _ref6, _item$name, _item$resources;
|
|
14
|
+
var key = (_ref = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_item$id = item.id) !== null && _item$id !== void 0 ? _item$id : item.value) !== null && _ref5 !== void 0 ? _ref5 : item.code) !== null && _ref4 !== void 0 ? _ref4 : item.name) !== null && _ref3 !== void 0 ? _ref3 : item.title) !== null && _ref2 !== void 0 ? _ref2 : item.label) !== null && _ref !== void 0 ? _ref : '';
|
|
15
|
+
return {
|
|
16
|
+
key: key,
|
|
17
|
+
value: key,
|
|
18
|
+
title: (_ref6 = (_item$name = item.name) !== null && _item$name !== void 0 ? _item$name : item.title) !== null && _ref6 !== void 0 ? _ref6 : item.label,
|
|
19
|
+
children: formatResourceNodes((_item$resources = item.resources) !== null && _item$resources !== void 0 ? _item$resources : item.children)
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
var formatResourceNodes = function formatResourceNodes(items) {
|
|
23
|
+
if (!items) return [];
|
|
24
|
+
return items.map(formatResourceNode);
|
|
25
|
+
};
|
|
26
|
+
var buildTreeData = function buildTreeData(list) {
|
|
27
|
+
console.log('xxxxxx', list);
|
|
28
|
+
var formatted = (list || []).map(function (item) {
|
|
29
|
+
var _item$resources2;
|
|
30
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
31
|
+
resources: (_item$resources2 = item.resources) !== null && _item$resources2 !== void 0 ? _item$resources2 : item.children
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
formatted.unshift({
|
|
35
|
+
id: 0,
|
|
36
|
+
name: locales.getText('pisell2.salesManagement.booking.filter.resource.none'),
|
|
37
|
+
resources: []
|
|
38
|
+
});
|
|
39
|
+
return formatResourceNodes(formatted);
|
|
40
|
+
};
|
|
41
|
+
var normalizeValue = function normalizeValue(value) {
|
|
42
|
+
if (Array.isArray(value)) return value;
|
|
43
|
+
if (value === undefined || value === null) return [];
|
|
44
|
+
return [value];
|
|
45
|
+
};
|
|
46
|
+
var extractLeafKeys = function extractLeafKeys(nodes) {
|
|
47
|
+
if (!(nodes !== null && nodes !== void 0 && nodes.length)) return [];
|
|
48
|
+
return nodes.filter(function (node) {
|
|
49
|
+
return !(node !== null && node !== void 0 && node.children) || node.children.length === 0;
|
|
50
|
+
}).map(function (node) {
|
|
51
|
+
var _node$key;
|
|
52
|
+
return (_node$key = node.key) !== null && _node$key !== void 0 ? _node$key : node.value;
|
|
53
|
+
}).filter(function (key) {
|
|
54
|
+
return key !== undefined && key !== null;
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
var ResourceSelector = function ResourceSelector(props) {
|
|
58
|
+
var value = props.value,
|
|
59
|
+
_onChange = props.onChange,
|
|
60
|
+
className = props.className,
|
|
61
|
+
style = props.style;
|
|
62
|
+
var _useRequest = useRequest(getResourceTypes),
|
|
63
|
+
data = _useRequest.data,
|
|
64
|
+
loading = _useRequest.loading;
|
|
65
|
+
var treeData = useMemo(function () {
|
|
66
|
+
return buildTreeData(data || []);
|
|
67
|
+
}, [data]);
|
|
68
|
+
var checkedKeys = useMemo(function () {
|
|
69
|
+
return normalizeValue(value);
|
|
70
|
+
}, [value]);
|
|
71
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
className: className,
|
|
73
|
+
style: style
|
|
74
|
+
}, loading ? /*#__PURE__*/React.createElement(Spin, {
|
|
75
|
+
size: "small"
|
|
76
|
+
}) : treeData.length ? /*#__PURE__*/React.createElement(TreeSelect, {
|
|
77
|
+
maxTagCount: 'responsive',
|
|
78
|
+
value: checkedKeys,
|
|
79
|
+
treeData: treeData,
|
|
80
|
+
treeCheckable: true,
|
|
81
|
+
showCheckedStrategy: TreeSelect.SHOW_CHILD,
|
|
82
|
+
treeNodeFilterProp: "title",
|
|
83
|
+
allowClear: true,
|
|
84
|
+
multiple: true,
|
|
85
|
+
style: {
|
|
86
|
+
width: '100%'
|
|
87
|
+
},
|
|
88
|
+
dropdownStyle: {
|
|
89
|
+
maxHeight: 320,
|
|
90
|
+
overflow: 'auto'
|
|
91
|
+
},
|
|
92
|
+
onChange: function onChange(nextValue, _label, extra) {
|
|
93
|
+
var leafKeys = extractLeafKeys(extra === null || extra === void 0 ? void 0 : extra.allCheckedNodes);
|
|
94
|
+
var normalizedKeys = Array.isArray(nextValue) ? nextValue : nextValue != null ? [nextValue] : [];
|
|
95
|
+
_onChange === null || _onChange === void 0 || _onChange(leafKeys.length ? leafKeys : normalizedKeys);
|
|
96
|
+
},
|
|
97
|
+
placeholder: locales.getText('pisell2.salesManagement.booking.filter.resource.placeholder')
|
|
98
|
+
}) : /*#__PURE__*/React.createElement(Empty, {
|
|
99
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
100
|
+
}));
|
|
101
|
+
};
|
|
102
|
+
export default ResourceSelector;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const getBookingStatusMap: () => Record<string, string>;
|
|
3
|
+
export declare const BOOKING_STATUS_COLOR_MAP: Record<string, string>;
|
|
4
|
+
export declare const getBookingPlatformMap: () => Record<string, string>;
|
|
5
|
+
export declare const getBookingHeaderLabels: () => Record<string, string>;
|
|
6
|
+
export declare const defaultPaymentStatusKeys: string[];
|
|
7
|
+
export declare const getFilterButtonList: () => ({
|
|
8
|
+
name: string;
|
|
9
|
+
type: string;
|
|
10
|
+
key: string;
|
|
11
|
+
label: any;
|
|
12
|
+
other: {
|
|
13
|
+
allowClear: boolean;
|
|
14
|
+
mode: string;
|
|
15
|
+
maxTagCount: string;
|
|
16
|
+
placeholder: any;
|
|
17
|
+
options: {
|
|
18
|
+
label: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}[];
|
|
21
|
+
minInputNumberProps?: undefined;
|
|
22
|
+
maxInputNumberProps?: undefined;
|
|
23
|
+
component?: undefined;
|
|
24
|
+
isSearchServer?: undefined;
|
|
25
|
+
showSearch?: undefined;
|
|
26
|
+
showTime?: undefined;
|
|
27
|
+
};
|
|
28
|
+
sort?: undefined;
|
|
29
|
+
localFilter?: undefined;
|
|
30
|
+
} | {
|
|
31
|
+
name: string;
|
|
32
|
+
type: string;
|
|
33
|
+
key: string;
|
|
34
|
+
label: any;
|
|
35
|
+
other: {
|
|
36
|
+
placeholder: any;
|
|
37
|
+
minInputNumberProps: {
|
|
38
|
+
min: number;
|
|
39
|
+
precision: number;
|
|
40
|
+
};
|
|
41
|
+
maxInputNumberProps: {
|
|
42
|
+
min: number;
|
|
43
|
+
precision: number;
|
|
44
|
+
};
|
|
45
|
+
allowClear?: undefined;
|
|
46
|
+
mode?: undefined;
|
|
47
|
+
maxTagCount?: undefined;
|
|
48
|
+
options?: undefined;
|
|
49
|
+
component?: undefined;
|
|
50
|
+
isSearchServer?: undefined;
|
|
51
|
+
showSearch?: undefined;
|
|
52
|
+
showTime?: undefined;
|
|
53
|
+
};
|
|
54
|
+
sort?: undefined;
|
|
55
|
+
localFilter?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
name: string;
|
|
58
|
+
type: string;
|
|
59
|
+
key: string;
|
|
60
|
+
label: any;
|
|
61
|
+
sort: boolean;
|
|
62
|
+
localFilter: boolean;
|
|
63
|
+
other: {
|
|
64
|
+
allowClear: boolean;
|
|
65
|
+
mode: string;
|
|
66
|
+
maxTagCount: string;
|
|
67
|
+
component: (props: {
|
|
68
|
+
value?: string | number | (string | number)[] | undefined;
|
|
69
|
+
onChange?: ((value: (string | number)[]) => void) | undefined;
|
|
70
|
+
className?: string | undefined;
|
|
71
|
+
style?: import("react").CSSProperties | undefined;
|
|
72
|
+
}) => import("react").JSX.Element;
|
|
73
|
+
placeholder?: undefined;
|
|
74
|
+
options?: undefined;
|
|
75
|
+
minInputNumberProps?: undefined;
|
|
76
|
+
maxInputNumberProps?: undefined;
|
|
77
|
+
isSearchServer?: undefined;
|
|
78
|
+
showSearch?: undefined;
|
|
79
|
+
showTime?: undefined;
|
|
80
|
+
};
|
|
81
|
+
} | {
|
|
82
|
+
name: string;
|
|
83
|
+
type: string;
|
|
84
|
+
key: string;
|
|
85
|
+
label: any;
|
|
86
|
+
other: {
|
|
87
|
+
allowClear: boolean;
|
|
88
|
+
mode: string;
|
|
89
|
+
maxTagCount: string;
|
|
90
|
+
placeholder: any;
|
|
91
|
+
options: () => Promise<any>;
|
|
92
|
+
minInputNumberProps?: undefined;
|
|
93
|
+
maxInputNumberProps?: undefined;
|
|
94
|
+
component?: undefined;
|
|
95
|
+
isSearchServer?: undefined;
|
|
96
|
+
showSearch?: undefined;
|
|
97
|
+
showTime?: undefined;
|
|
98
|
+
};
|
|
99
|
+
sort?: undefined;
|
|
100
|
+
localFilter?: undefined;
|
|
101
|
+
} | {
|
|
102
|
+
name: string;
|
|
103
|
+
type: string;
|
|
104
|
+
key: string;
|
|
105
|
+
label: any;
|
|
106
|
+
other: {
|
|
107
|
+
placeholder: any;
|
|
108
|
+
allowClear?: undefined;
|
|
109
|
+
mode?: undefined;
|
|
110
|
+
maxTagCount?: undefined;
|
|
111
|
+
options?: undefined;
|
|
112
|
+
minInputNumberProps?: undefined;
|
|
113
|
+
maxInputNumberProps?: undefined;
|
|
114
|
+
component?: undefined;
|
|
115
|
+
isSearchServer?: undefined;
|
|
116
|
+
showSearch?: undefined;
|
|
117
|
+
showTime?: undefined;
|
|
118
|
+
};
|
|
119
|
+
sort?: undefined;
|
|
120
|
+
localFilter?: undefined;
|
|
121
|
+
} | {
|
|
122
|
+
name: string;
|
|
123
|
+
type: string;
|
|
124
|
+
key: string;
|
|
125
|
+
label: any;
|
|
126
|
+
other: {
|
|
127
|
+
allowClear: boolean;
|
|
128
|
+
isSearchServer: boolean;
|
|
129
|
+
showSearch: boolean;
|
|
130
|
+
placeholder: any;
|
|
131
|
+
options: (params?: string) => Promise<any>;
|
|
132
|
+
mode?: undefined;
|
|
133
|
+
maxTagCount?: undefined;
|
|
134
|
+
minInputNumberProps?: undefined;
|
|
135
|
+
maxInputNumberProps?: undefined;
|
|
136
|
+
component?: undefined;
|
|
137
|
+
showTime?: undefined;
|
|
138
|
+
};
|
|
139
|
+
sort?: undefined;
|
|
140
|
+
localFilter?: undefined;
|
|
141
|
+
} | {
|
|
142
|
+
name: string;
|
|
143
|
+
type: string;
|
|
144
|
+
key: string;
|
|
145
|
+
label: any;
|
|
146
|
+
other: {
|
|
147
|
+
placeholder: any;
|
|
148
|
+
showTime: boolean;
|
|
149
|
+
allowClear?: undefined;
|
|
150
|
+
mode?: undefined;
|
|
151
|
+
maxTagCount?: undefined;
|
|
152
|
+
options?: undefined;
|
|
153
|
+
minInputNumberProps?: undefined;
|
|
154
|
+
maxInputNumberProps?: undefined;
|
|
155
|
+
component?: undefined;
|
|
156
|
+
isSearchServer?: undefined;
|
|
157
|
+
showSearch?: undefined;
|
|
158
|
+
};
|
|
159
|
+
sort?: undefined;
|
|
160
|
+
localFilter?: undefined;
|
|
161
|
+
})[];
|
|
162
|
+
export declare const getSortList: () => ({
|
|
163
|
+
type: string;
|
|
164
|
+
isCustom: boolean;
|
|
165
|
+
name: string;
|
|
166
|
+
label: any;
|
|
167
|
+
getSortItems: () => {
|
|
168
|
+
key: string;
|
|
169
|
+
label: any;
|
|
170
|
+
}[];
|
|
171
|
+
other?: undefined;
|
|
172
|
+
} | {
|
|
173
|
+
type: string;
|
|
174
|
+
isCustom: boolean;
|
|
175
|
+
name: string;
|
|
176
|
+
label: any;
|
|
177
|
+
getSortItems: () => {
|
|
178
|
+
key: string;
|
|
179
|
+
label: any;
|
|
180
|
+
}[];
|
|
181
|
+
other: {
|
|
182
|
+
style: {
|
|
183
|
+
width: string;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
})[];
|