@pisell/private-materials 3.0.162 → 3.0.164
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 +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +11 -11
- package/es/components/booking/components/footer/index.js +34 -5
- package/es/components/booking/dashboard/index.d.ts +20 -0
- package/es/components/booking/dashboard/index.js +298 -0
- package/es/components/booking/dashboard/serve.d.ts +1 -0
- package/es/components/booking/dashboard/serve.js +27 -0
- package/es/components/booking/forms/forms.d.ts +1 -0
- package/es/components/booking/forms/forms.js +4 -2
- package/es/components/booking/forms/single/index.d.ts +1 -1
- package/es/components/booking/forms/single/index.js +4 -3
- package/es/components/booking/hooks/useClearCart.d.ts +3 -0
- package/es/components/booking/hooks/useClearCart.js +27 -0
- package/es/components/booking/hooks/useCreateBookingPageHeader.d.ts +6 -0
- package/es/components/booking/hooks/useCreateBookingPageHeader.js +21 -0
- package/es/components/booking/info/addServiceVariant/index.d.ts +7 -0
- package/es/components/booking/info/addServiceVariant/index.js +42 -0
- package/es/components/booking/info/client/index.js +1 -1
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +4 -2
- package/es/components/booking/info/clientVariant/vertical/index.js +6 -5
- package/es/components/booking/info/clientVariant/vertical/index.less +8 -0
- package/es/components/booking/info/index.less +19 -0
- package/es/components/booking/info/main.js +11 -5
- package/es/components/booking/info/pet/index.js +1 -1
- package/es/components/booking/info/service/addService/index.d.ts +9 -3
- package/es/components/booking/info/service/addService/index.js +82 -36
- package/es/components/booking/info/service/addService/index.less +27 -1
- package/es/components/booking/info/service/editService/index.js +11 -13
- package/es/components/booking/info/service/index.js +5 -2
- package/es/components/booking/info/service/index.less +18 -0
- package/es/components/booking/info/service/serviceItem/index.d.ts +3 -3
- package/es/components/booking/info/service/serviceItem/index.js +22 -8
- package/es/components/booking/info/service/serviceItem/index.less +8 -0
- package/es/components/booking/info/service/serviceList/index.js +20 -1
- package/es/components/booking/info2/index.js +9 -3
- package/es/components/booking/info2/service/addService/index.d.ts +8 -2
- package/es/components/booking/info2/service/addService/index.js +82 -36
- package/es/components/booking/info2/service/addTimeModal/index.js +1 -0
- package/es/components/booking/info2/service/editService/index.js +11 -4
- package/es/components/booking/info2/service/index.js +5 -2
- package/es/components/booking/info2/service/serviceItem/index.d.ts +1 -1
- package/es/components/booking/info2/service/serviceItem/index.js +16 -3
- package/es/components/booking/info2/service/serviceList/index.js +20 -1
- package/es/components/booking/info2/utilsByBooking.js +6 -2
- package/es/components/booking/locales.d.ts +60 -0
- package/es/components/booking/locales.js +63 -3
- package/es/components/booking/model.d.ts +2 -0
- package/es/components/booking/utils.d.ts +1 -1
- package/es/components/booking/utils.js +54 -51
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/lib/components/booking/components/footer/index.js +30 -5
- package/lib/components/booking/dashboard/index.d.ts +20 -0
- package/lib/components/booking/dashboard/index.js +279 -0
- package/lib/components/booking/dashboard/serve.d.ts +1 -0
- package/lib/components/booking/dashboard/serve.js +33 -0
- package/lib/components/booking/forms/forms.d.ts +1 -0
- package/lib/components/booking/forms/forms.js +5 -2
- package/lib/components/booking/forms/single/index.d.ts +1 -1
- package/lib/components/booking/forms/single/index.js +4 -2
- package/lib/components/booking/hooks/useClearCart.d.ts +3 -0
- package/lib/components/booking/hooks/useClearCart.js +62 -0
- package/lib/components/booking/hooks/useCreateBookingPageHeader.d.ts +6 -0
- package/lib/components/booking/hooks/useCreateBookingPageHeader.js +53 -0
- package/lib/components/booking/info/addServiceVariant/index.d.ts +7 -0
- package/lib/components/booking/info/addServiceVariant/index.js +70 -0
- package/lib/components/booking/info/client/index.js +1 -1
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +4 -2
- package/lib/components/booking/info/clientVariant/vertical/index.js +88 -76
- package/lib/components/booking/info/clientVariant/vertical/index.less +8 -0
- package/lib/components/booking/info/index.less +19 -0
- package/lib/components/booking/info/main.js +9 -3
- package/lib/components/booking/info/pet/index.js +2 -1
- package/lib/components/booking/info/service/addService/index.d.ts +9 -3
- package/lib/components/booking/info/service/addService/index.js +66 -29
- package/lib/components/booking/info/service/addService/index.less +27 -1
- package/lib/components/booking/info/service/editService/index.js +9 -6
- package/lib/components/booking/info/service/index.js +4 -2
- package/lib/components/booking/info/service/index.less +18 -0
- package/lib/components/booking/info/service/serviceItem/index.d.ts +3 -3
- package/lib/components/booking/info/service/serviceItem/index.js +15 -1
- package/lib/components/booking/info/service/serviceItem/index.less +8 -0
- package/lib/components/booking/info/service/serviceList/index.js +18 -1
- package/lib/components/booking/info2/index.js +8 -2
- package/lib/components/booking/info2/service/addService/index.d.ts +8 -2
- package/lib/components/booking/info2/service/addService/index.js +66 -29
- package/lib/components/booking/info2/service/addTimeModal/index.js +1 -0
- package/lib/components/booking/info2/service/editService/index.js +7 -1
- package/lib/components/booking/info2/service/index.js +4 -2
- package/lib/components/booking/info2/service/serviceItem/index.d.ts +1 -1
- package/lib/components/booking/info2/service/serviceItem/index.js +14 -1
- package/lib/components/booking/info2/service/serviceList/index.js +18 -1
- package/lib/components/booking/info2/utilsByBooking.js +5 -1
- package/lib/components/booking/locales.d.ts +60 -0
- package/lib/components/booking/locales.js +63 -3
- package/lib/components/booking/model.d.ts +2 -0
- package/lib/components/booking/utils.d.ts +1 -1
- package/lib/components/booking/utils.js +57 -22
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -0
- package/lowcode/booking-dashboard/meta.ts +137 -0
- package/lowcode/booking-vertical-add-service/meta.ts +124 -0
- package/lowcode/vertical-add-service/meta.ts +71 -0
- package/package.json +3 -3
|
@@ -792,14 +792,40 @@ var Footer = function Footer(props) {
|
|
|
792
792
|
onClick: handleRefund
|
|
793
793
|
}, locales.getText('pisell2.text.refund'));
|
|
794
794
|
}, []);
|
|
795
|
+
var handleClearAll = function handleClearAll() {
|
|
796
|
+
var _state$clearAllValue;
|
|
797
|
+
state === null || state === void 0 ? void 0 : (_state$clearAllValue = state.clearAllValue) === null || _state$clearAllValue === void 0 ? void 0 : _state$clearAllValue.call(state);
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* @title: 清空按钮
|
|
802
|
+
* @description:
|
|
803
|
+
* @return: *
|
|
804
|
+
* @Author: shengjie.zuo
|
|
805
|
+
* @Date: 2024-10-26 10:52:01
|
|
806
|
+
*/
|
|
807
|
+
var clearAllButton = useMemo(function () {
|
|
808
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
809
|
+
className: "pisell-lowcode__booking-footer-buttons-item",
|
|
810
|
+
type: "default",
|
|
811
|
+
onClick: handleClearAll
|
|
812
|
+
}, locales.getText('pisell2.booking.info.text.clear-all'));
|
|
813
|
+
}, []);
|
|
795
814
|
var buttonMap = {
|
|
796
815
|
checkout: checkoutButton,
|
|
797
816
|
save: saveButton,
|
|
798
817
|
complete: completeButton,
|
|
799
818
|
refund: refundButton,
|
|
800
819
|
paymentLink: paymentLinkButton,
|
|
801
|
-
rebook: rebookButton
|
|
820
|
+
rebook: rebookButton,
|
|
821
|
+
clearAll: clearAllButton
|
|
802
822
|
};
|
|
823
|
+
var isShowClearAll = useMemo(function () {
|
|
824
|
+
// 目前新建状态时展示清除全部按钮
|
|
825
|
+
if (!state.bookingId) {
|
|
826
|
+
return true;
|
|
827
|
+
}
|
|
828
|
+
}, [state.bookingId]);
|
|
803
829
|
|
|
804
830
|
/**
|
|
805
831
|
* @title: 是否可以checkout
|
|
@@ -865,6 +891,9 @@ var Footer = function Footer(props) {
|
|
|
865
891
|
// info
|
|
866
892
|
if (source === 'info') {
|
|
867
893
|
var _arr3 = [];
|
|
894
|
+
if (isShowClearAll) {
|
|
895
|
+
_arr3.push(buttonMap.clearAll);
|
|
896
|
+
}
|
|
868
897
|
// if (state.bookingId && isShowPaymentLink) {
|
|
869
898
|
// arr.push(buttonMap.paymentLink);
|
|
870
899
|
// }
|
|
@@ -898,7 +927,7 @@ var Footer = function Footer(props) {
|
|
|
898
927
|
return _arr4;
|
|
899
928
|
}
|
|
900
929
|
return [];
|
|
901
|
-
}, [buttons, total, isEdit, checkoutLoading, isDisabled, source, buttonMap, loading, isCheckout, state, isTeam]);
|
|
930
|
+
}, [buttons, total, isEdit, checkoutLoading, isDisabled, source, buttonMap, loading, isCheckout, state, isTeam, isShowClearAll]);
|
|
902
931
|
var moreButton = useMemo(function () {
|
|
903
932
|
var arr = [];
|
|
904
933
|
if (!state.bookingId) {
|
|
@@ -920,7 +949,7 @@ var Footer = function Footer(props) {
|
|
|
920
949
|
}
|
|
921
950
|
if (transaction_habit_selection.button_rows == 1) {
|
|
922
951
|
if (state.appointment_status !== 'cancelled') {
|
|
923
|
-
if (!state.disabledEdit) {
|
|
952
|
+
if (!state.disabledEdit && !state.isBookingCreatePage) {
|
|
924
953
|
arr.push(actionMap.sale);
|
|
925
954
|
}
|
|
926
955
|
}
|
|
@@ -1061,7 +1090,7 @@ var Footer = function Footer(props) {
|
|
|
1061
1090
|
if (!state.bookingDetail) {
|
|
1062
1091
|
return true;
|
|
1063
1092
|
}
|
|
1064
|
-
if (!((_state$addons3 = state.addons) !== null && _state$addons3 !== void 0 && _state$addons3.load) && state.renderType !== 'eventBooking') {
|
|
1093
|
+
if (!((_state$addons3 = state.addons) !== null && _state$addons3 !== void 0 && _state$addons3.load) && state.renderType !== 'eventBooking' && !state.isBookingCreatePage) {
|
|
1065
1094
|
return true;
|
|
1066
1095
|
}
|
|
1067
1096
|
}
|
|
@@ -1211,7 +1240,7 @@ var Footer = function Footer(props) {
|
|
|
1211
1240
|
style: {
|
|
1212
1241
|
marginTop: 12
|
|
1213
1242
|
}
|
|
1214
|
-
}, state.appointment_status !== 'cancelled' ? /*#__PURE__*/React.createElement(Button, {
|
|
1243
|
+
}, state.appointment_status !== 'cancelled' && !state.isBookingCreatePage ? /*#__PURE__*/React.createElement(Button, {
|
|
1215
1244
|
onClick: function onClick() {
|
|
1216
1245
|
return handleSale();
|
|
1217
1246
|
},
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface BookingDashboardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
backgroundColors?: string[];
|
|
4
|
+
labelColor?: string;
|
|
5
|
+
valueColor?: string;
|
|
6
|
+
otherParams?: Record<string, any>;
|
|
7
|
+
refreshKey?: string;
|
|
8
|
+
onDataChange?: (data: {
|
|
9
|
+
groupsOnSiteNow: string | number;
|
|
10
|
+
peopleOnSiteNow: string | number;
|
|
11
|
+
totalVisitorsToday: string | number;
|
|
12
|
+
ongoing: string | number;
|
|
13
|
+
upcoming: string | number;
|
|
14
|
+
overdue: string | number;
|
|
15
|
+
completed: string | number;
|
|
16
|
+
departed: string | number;
|
|
17
|
+
}, dataList: string[]) => void;
|
|
18
|
+
}
|
|
19
|
+
declare const BookingDashboard: (props: BookingDashboardProps) => React.JSX.Element;
|
|
20
|
+
export default BookingDashboard;
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["otherParams", "backgroundColors", "labelColor", "valueColor", "refreshKey", "onDataChange"];
|
|
3
|
+
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); }
|
|
4
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
7
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
+
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; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
15
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
16
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
+
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."); }
|
|
18
|
+
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); }
|
|
19
|
+
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; }
|
|
20
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
21
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
24
|
+
import React, { useEffect, useState } from 'react';
|
|
25
|
+
import { PisellStatisticList } from '@pisell/materials';
|
|
26
|
+
import { isArr, locales } from '@pisell/utils';
|
|
27
|
+
import dayjs from 'dayjs';
|
|
28
|
+
import useEngineContext from "../../../hooks/useEngineContext";
|
|
29
|
+
import { request } from "../utils";
|
|
30
|
+
import { getBookingList } from "./serve";
|
|
31
|
+
import localeTexts from "../locales";
|
|
32
|
+
var translationOriginal = function translationOriginal(text) {
|
|
33
|
+
return '';
|
|
34
|
+
};
|
|
35
|
+
var formatCapacityToChildrenData = function formatCapacityToChildrenData(data) {
|
|
36
|
+
var map = {};
|
|
37
|
+
data.forEach(function (item) {
|
|
38
|
+
if (!map[item.id]) {
|
|
39
|
+
map[item.id] = {
|
|
40
|
+
label: !item.id ? locales.getText('pisell2.booking.dashboard.default') : translationOriginal(item.name) || '',
|
|
41
|
+
value: 0
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
map[item.id].value = (map[item.id].value || 0) + (item.value || 0);
|
|
45
|
+
});
|
|
46
|
+
return Object.values(map).sort(function (a, b) {
|
|
47
|
+
return b.label.localeCompare(a.label);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
|
|
51
|
+
var BookingDashboard = function BookingDashboard(props) {
|
|
52
|
+
var _props$otherParams = props.otherParams,
|
|
53
|
+
otherParams = _props$otherParams === void 0 ? {} : _props$otherParams,
|
|
54
|
+
backgroundColors = props.backgroundColors,
|
|
55
|
+
labelColor = props.labelColor,
|
|
56
|
+
valueColor = props.valueColor,
|
|
57
|
+
refreshKey = props.refreshKey,
|
|
58
|
+
onDataChange = props.onDataChange,
|
|
59
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
60
|
+
var context = useEngineContext();
|
|
61
|
+
request.setRequest(context.appHelper.utils.request);
|
|
62
|
+
translationOriginal = context.appHelper.utils.translationOriginal;
|
|
63
|
+
var _useState = useState([
|
|
64
|
+
// 当前在场团体
|
|
65
|
+
{
|
|
66
|
+
label: locales.getText('pisell2.booking.dashboard.groups-on-site-now'),
|
|
67
|
+
value: '-',
|
|
68
|
+
tip: locales.getText('pisell2.booking.dashboard.groups-on-site-now-tip')
|
|
69
|
+
},
|
|
70
|
+
// 当前在场人数
|
|
71
|
+
{
|
|
72
|
+
label: locales.getText('pisell2.booking.dashboard.people-on-site-now'),
|
|
73
|
+
value: '-',
|
|
74
|
+
tip: locales.getText('pisell2.booking.dashboard.people-on-site-now-tip')
|
|
75
|
+
},
|
|
76
|
+
// 今日游客总数
|
|
77
|
+
{
|
|
78
|
+
label: locales.getText('pisell2.booking.dashboard.total-visitors-today'),
|
|
79
|
+
value: '-',
|
|
80
|
+
tip: locales.getText('pisell2.booking.dashboard.total-visitors-today-tip')
|
|
81
|
+
},
|
|
82
|
+
// 正在进行中的游客
|
|
83
|
+
{
|
|
84
|
+
label: locales.getText('pisell2.booking.dashboard.ongoing-visitors'),
|
|
85
|
+
value: '-',
|
|
86
|
+
tip: locales.getText('pisell2.booking.dashboard.ongoing-visitors-tip')
|
|
87
|
+
},
|
|
88
|
+
// 即将到达的游客
|
|
89
|
+
{
|
|
90
|
+
label: locales.getText('pisell2.booking.dashboard.upcoming-visitors'),
|
|
91
|
+
value: '-',
|
|
92
|
+
tip: locales.getText('pisell2.booking.dashboard.upcoming-visitors-tip')
|
|
93
|
+
},
|
|
94
|
+
// 超时的游客
|
|
95
|
+
{
|
|
96
|
+
label: locales.getText('pisell2.booking.dashboard.overdue-visitors'),
|
|
97
|
+
value: '-',
|
|
98
|
+
tip: locales.getText('pisell2.booking.dashboard.overdue-visitors-tip')
|
|
99
|
+
},
|
|
100
|
+
// 已完成的游客
|
|
101
|
+
{
|
|
102
|
+
label: locales.getText('pisell2.booking.dashboard.completed-visitors'),
|
|
103
|
+
value: '-',
|
|
104
|
+
tip: locales.getText('pisell2.booking.dashboard.completed-visitors-tip')
|
|
105
|
+
},
|
|
106
|
+
// 已离场的游客
|
|
107
|
+
{
|
|
108
|
+
label: locales.getText('pisell2.booking.dashboard.departed-visitors'),
|
|
109
|
+
value: '-',
|
|
110
|
+
tip: locales.getText('pisell2.booking.dashboard.departed-visitors-tip')
|
|
111
|
+
}]),
|
|
112
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
113
|
+
data = _useState2[0],
|
|
114
|
+
setData = _useState2[1];
|
|
115
|
+
var _useState3 = useState([]),
|
|
116
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
117
|
+
bookingData = _useState4[0],
|
|
118
|
+
setBookingData = _useState4[1];
|
|
119
|
+
var getData = /*#__PURE__*/function () {
|
|
120
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
121
|
+
var data;
|
|
122
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
123
|
+
while (1) switch (_context.prev = _context.next) {
|
|
124
|
+
case 0:
|
|
125
|
+
_context.next = 2;
|
|
126
|
+
return getBookingList(_objectSpread(_objectSpread({}, otherParams), {}, {
|
|
127
|
+
item_type: 'appointment_booking',
|
|
128
|
+
parent_id: 0,
|
|
129
|
+
with: ['children'],
|
|
130
|
+
child_booking: 0,
|
|
131
|
+
skip: 1,
|
|
132
|
+
num: 1000
|
|
133
|
+
}));
|
|
134
|
+
case 2:
|
|
135
|
+
data = _context.sent;
|
|
136
|
+
setBookingData(data.list);
|
|
137
|
+
case 4:
|
|
138
|
+
case "end":
|
|
139
|
+
return _context.stop();
|
|
140
|
+
}
|
|
141
|
+
}, _callee);
|
|
142
|
+
}));
|
|
143
|
+
return function getData() {
|
|
144
|
+
return _ref.apply(this, arguments);
|
|
145
|
+
};
|
|
146
|
+
}();
|
|
147
|
+
var calcBookingDataCount = function calcBookingDataCount(data) {
|
|
148
|
+
// 当前在场团体
|
|
149
|
+
var groupsOnSiteNow = '-';
|
|
150
|
+
|
|
151
|
+
// 当前在场人数
|
|
152
|
+
var peopleOnSiteNow = '-';
|
|
153
|
+
// 今日游客总数
|
|
154
|
+
var totalVisitorsToday = 0;
|
|
155
|
+
// 今日游客二级数据
|
|
156
|
+
var totalVisitorsTodayChildren = [];
|
|
157
|
+
// 正在进行中的游客
|
|
158
|
+
var ongoing = 0;
|
|
159
|
+
// 正在进行中的游客二级数据
|
|
160
|
+
var ongoingChildren = [];
|
|
161
|
+
// 即将到达的游客
|
|
162
|
+
var upcoming = 0;
|
|
163
|
+
// 即将到达的游客二级数据
|
|
164
|
+
var upcomingChildren = [];
|
|
165
|
+
// 超时的游客
|
|
166
|
+
var overdue = '-';
|
|
167
|
+
// 已完成的游客
|
|
168
|
+
var completed = 0;
|
|
169
|
+
// 已完成的游客二级数据
|
|
170
|
+
var completedChildren = [];
|
|
171
|
+
// 已离场的游客
|
|
172
|
+
var departed = '-';
|
|
173
|
+
data.forEach(function (item) {
|
|
174
|
+
if (isArr(item.children)) {
|
|
175
|
+
item.children.forEach(function (child) {
|
|
176
|
+
var _child$metadata;
|
|
177
|
+
var start = dayjs("".concat(child.start_date, " ").concat(child.start_time));
|
|
178
|
+
var end = dayjs("".concat(child.end_date, " ").concat(child.end_time));
|
|
179
|
+
|
|
180
|
+
// 今日游客总数
|
|
181
|
+
totalVisitorsToday += child.number;
|
|
182
|
+
totalVisitorsTodayChildren.push.apply(totalVisitorsTodayChildren, _toConsumableArray(((_child$metadata = child.metadata) === null || _child$metadata === void 0 ? void 0 : _child$metadata.capacity) || []));
|
|
183
|
+
|
|
184
|
+
// 正在进行中的游客
|
|
185
|
+
if (start < dayjs() && end > dayjs()) {
|
|
186
|
+
var _child$metadata2;
|
|
187
|
+
ongoing += child.number || 1;
|
|
188
|
+
ongoingChildren.push.apply(ongoingChildren, _toConsumableArray(((_child$metadata2 = child.metadata) === null || _child$metadata2 === void 0 ? void 0 : _child$metadata2.capacity) || []));
|
|
189
|
+
}
|
|
190
|
+
// 即将到达的游客
|
|
191
|
+
if (dayjs() < start) {
|
|
192
|
+
var _child$metadata3;
|
|
193
|
+
upcoming += child.number || 1;
|
|
194
|
+
upcomingChildren.push.apply(upcomingChildren, _toConsumableArray(((_child$metadata3 = child.metadata) === null || _child$metadata3 === void 0 ? void 0 : _child$metadata3.capacity) || []));
|
|
195
|
+
}
|
|
196
|
+
// 已完成的游客
|
|
197
|
+
if (dayjs() > end) {
|
|
198
|
+
var _child$metadata4;
|
|
199
|
+
completed += child.number || 1;
|
|
200
|
+
completedChildren.push.apply(completedChildren, _toConsumableArray(((_child$metadata4 = child.metadata) === null || _child$metadata4 === void 0 ? void 0 : _child$metadata4.capacity) || []));
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange({
|
|
206
|
+
groupsOnSiteNow: groupsOnSiteNow,
|
|
207
|
+
peopleOnSiteNow: peopleOnSiteNow,
|
|
208
|
+
totalVisitorsToday: totalVisitorsToday,
|
|
209
|
+
ongoing: ongoing,
|
|
210
|
+
upcoming: upcoming,
|
|
211
|
+
overdue: overdue,
|
|
212
|
+
completed: completed,
|
|
213
|
+
departed: departed
|
|
214
|
+
}, data);
|
|
215
|
+
setData([
|
|
216
|
+
// 当前在场团体
|
|
217
|
+
{
|
|
218
|
+
label: locales.getText('pisell2.booking.dashboard.groups-on-site-now'),
|
|
219
|
+
tip: locales.getText('pisell2.booking.dashboard.groups-on-site-now-tip'),
|
|
220
|
+
value: "".concat(groupsOnSiteNow)
|
|
221
|
+
},
|
|
222
|
+
// 当前在场人数
|
|
223
|
+
{
|
|
224
|
+
label: locales.getText('pisell2.booking.dashboard.people-on-site-now'),
|
|
225
|
+
tip: locales.getText('pisell2.booking.dashboard.people-on-site-now-tip'),
|
|
226
|
+
value: "".concat(peopleOnSiteNow)
|
|
227
|
+
},
|
|
228
|
+
// 今日游客总数
|
|
229
|
+
{
|
|
230
|
+
label: locales.getText('pisell2.booking.dashboard.total-visitors-today'),
|
|
231
|
+
tip: locales.getText('pisell2.booking.dashboard.total-visitors-today-tip'),
|
|
232
|
+
value: "".concat(totalVisitorsToday),
|
|
233
|
+
children: formatCapacityToChildrenData(totalVisitorsTodayChildren)
|
|
234
|
+
},
|
|
235
|
+
// 正在进行中的游客
|
|
236
|
+
{
|
|
237
|
+
label: locales.getText('pisell2.booking.dashboard.ongoing-visitors'),
|
|
238
|
+
tip: locales.getText('pisell2.booking.dashboard.ongoing-visitors-tip'),
|
|
239
|
+
value: "".concat(ongoing),
|
|
240
|
+
children: formatCapacityToChildrenData(ongoingChildren)
|
|
241
|
+
},
|
|
242
|
+
// 即将到达的游客
|
|
243
|
+
{
|
|
244
|
+
label: locales.getText('pisell2.booking.dashboard.upcoming-visitors'),
|
|
245
|
+
tip: locales.getText('pisell2.booking.dashboard.upcoming-visitors-tip'),
|
|
246
|
+
value: "".concat(upcoming),
|
|
247
|
+
children: formatCapacityToChildrenData(upcomingChildren)
|
|
248
|
+
},
|
|
249
|
+
// 超时的游客
|
|
250
|
+
{
|
|
251
|
+
label: locales.getText('pisell2.booking.dashboard.overdue-visitors'),
|
|
252
|
+
tip: locales.getText('pisell2.booking.dashboard.overdue-visitors-tip'),
|
|
253
|
+
value: "".concat(overdue)
|
|
254
|
+
},
|
|
255
|
+
// 已完成的游客
|
|
256
|
+
{
|
|
257
|
+
label: locales.getText('pisell2.booking.dashboard.completed-visitors'),
|
|
258
|
+
tip: locales.getText('pisell2.booking.dashboard.completed-visitors-tip'),
|
|
259
|
+
value: "".concat(completed),
|
|
260
|
+
children: formatCapacityToChildrenData(completedChildren)
|
|
261
|
+
},
|
|
262
|
+
// 已离场的游客
|
|
263
|
+
{
|
|
264
|
+
label: locales.getText('pisell2.booking.dashboard.departed-visitors'),
|
|
265
|
+
tip: locales.getText('pisell2.booking.dashboard.departed-visitors-tip'),
|
|
266
|
+
value: "".concat(departed)
|
|
267
|
+
}]);
|
|
268
|
+
};
|
|
269
|
+
useEffect(function () {
|
|
270
|
+
calcBookingDataCount(bookingData);
|
|
271
|
+
|
|
272
|
+
// 每分钟重新计算预约数据
|
|
273
|
+
var timer = setInterval(function () {
|
|
274
|
+
calcBookingDataCount(bookingData);
|
|
275
|
+
}, 60 * 1000);
|
|
276
|
+
return function () {
|
|
277
|
+
clearInterval(timer);
|
|
278
|
+
};
|
|
279
|
+
}, [bookingData]);
|
|
280
|
+
useEffect(function () {
|
|
281
|
+
getData();
|
|
282
|
+
|
|
283
|
+
// 10分钟更新一次数据
|
|
284
|
+
var timer = setInterval(function () {
|
|
285
|
+
getData();
|
|
286
|
+
}, 10 * 60 * 1000);
|
|
287
|
+
return function () {
|
|
288
|
+
clearInterval(timer);
|
|
289
|
+
};
|
|
290
|
+
}, [JSON.stringify(otherParams), refreshKey]);
|
|
291
|
+
return /*#__PURE__*/React.createElement(PisellStatisticList, _extends({}, others, {
|
|
292
|
+
data: data,
|
|
293
|
+
backgroundColors: backgroundColors,
|
|
294
|
+
labelColor: labelColor,
|
|
295
|
+
valueColor: valueColor
|
|
296
|
+
}));
|
|
297
|
+
};
|
|
298
|
+
export default BookingDashboard;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getBookingList: (params: any) => Promise<any>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
import { request } from "../utils";
|
|
6
|
+
export var getBookingList = /*#__PURE__*/function () {
|
|
7
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
8
|
+
var _yield$request$getReq, data;
|
|
9
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10
|
+
while (1) switch (_context.prev = _context.next) {
|
|
11
|
+
case 0:
|
|
12
|
+
_context.next = 2;
|
|
13
|
+
return request.getRequest().get("/shop/schedule/booking", params);
|
|
14
|
+
case 2:
|
|
15
|
+
_yield$request$getReq = _context.sent;
|
|
16
|
+
data = _yield$request$getReq.data;
|
|
17
|
+
return _context.abrupt("return", data);
|
|
18
|
+
case 5:
|
|
19
|
+
case "end":
|
|
20
|
+
return _context.stop();
|
|
21
|
+
}
|
|
22
|
+
}, _callee);
|
|
23
|
+
}));
|
|
24
|
+
return function getBookingList(_x) {
|
|
25
|
+
return _ref.apply(this, arguments);
|
|
26
|
+
};
|
|
27
|
+
}();
|
|
@@ -43,7 +43,8 @@ var Forms = Provider(function (props) {
|
|
|
43
43
|
addCallback = props.addCallback,
|
|
44
44
|
client = props.client,
|
|
45
45
|
loading = props.loading,
|
|
46
|
-
addButtonProps = props.addButtonProps
|
|
46
|
+
addButtonProps = props.addButtonProps,
|
|
47
|
+
drawerProps = props.drawerProps;
|
|
47
48
|
|
|
48
49
|
// 新增数据
|
|
49
50
|
var onAction = useMemoizedFn( /*#__PURE__*/function () {
|
|
@@ -171,6 +172,7 @@ var Forms = Provider(function (props) {
|
|
|
171
172
|
onChange: function onChange(val) {
|
|
172
173
|
onValueChange(d, val);
|
|
173
174
|
},
|
|
175
|
+
drawerProps: drawerProps,
|
|
174
176
|
onAdd: function onAdd() {
|
|
175
177
|
onAction(d, true);
|
|
176
178
|
},
|
|
@@ -194,6 +196,6 @@ var Forms = Provider(function (props) {
|
|
|
194
196
|
optionRender: optionRender
|
|
195
197
|
})));
|
|
196
198
|
}));
|
|
197
|
-
}, [forms, hideTitle, modalOpen, value, loading, client === null || client === void 0 ? void 0 : client.id, addButtonProps, customSelectProps, optionRender]);
|
|
199
|
+
}, [forms, hideTitle, modalOpen, value, loading, client === null || client === void 0 ? void 0 : client.id, addButtonProps, customSelectProps, optionRender, drawerProps]);
|
|
198
200
|
});
|
|
199
201
|
export default Forms;
|
|
@@ -7,5 +7,5 @@ import "./index.less";
|
|
|
7
7
|
* @Author: zhiwei.Wang
|
|
8
8
|
* @Date: 2024-01-30 17:06
|
|
9
9
|
*/
|
|
10
|
-
declare const Single: ({ value, onChange, form, mode, optionRender, loading, customSelectProps, onAdd, addButtonProps, modalOpen, watch, }: any) => React.JSX.Element;
|
|
10
|
+
declare const Single: ({ value, onChange, form, mode, optionRender, loading, customSelectProps, onAdd, addButtonProps, modalOpen, watch, drawerProps, }: any) => React.JSX.Element;
|
|
11
11
|
export default Single;
|
|
@@ -41,7 +41,8 @@ var Single = function Single(_ref) {
|
|
|
41
41
|
onAdd = _ref.onAdd,
|
|
42
42
|
addButtonProps = _ref.addButtonProps,
|
|
43
43
|
modalOpen = _ref.modalOpen,
|
|
44
|
-
watch = _ref.watch
|
|
44
|
+
watch = _ref.watch,
|
|
45
|
+
drawerProps = _ref.drawerProps;
|
|
45
46
|
// const primaryField = useMemo(() => {
|
|
46
47
|
// return field.field[0]?.key || "";
|
|
47
48
|
// }, [field]);
|
|
@@ -237,10 +238,10 @@ var Single = function Single(_ref) {
|
|
|
237
238
|
},
|
|
238
239
|
name: ((_form$form3 = form.form) === null || _form$form3 === void 0 ? void 0 : _form$form3.title) || "-",
|
|
239
240
|
addButtonProps: _addButtonProps,
|
|
240
|
-
drawerProps: {
|
|
241
|
+
drawerProps: _objectSpread({
|
|
241
242
|
title: "".concat(locales.getText("pisell2.text.select"), " ").concat(((_form$form4 = form.form) === null || _form$form4 === void 0 ? void 0 : _form$form4.title) || "-"),
|
|
242
243
|
destroyOnClose: true
|
|
243
|
-
},
|
|
244
|
+
}, drawerProps || {}),
|
|
244
245
|
optionRender: _optionRender,
|
|
245
246
|
rowKey: "form_record_id"
|
|
246
247
|
}, customSelectProps || {})));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
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; }
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { Iconfont } from '@pisell/materials';
|
|
8
|
+
import { locales } from "@pisell/utils";
|
|
9
|
+
var useClearCart = function useClearCart(state, dispatch) {
|
|
10
|
+
var _state$service, _state$service$value, _state$service2, _state$service2$value;
|
|
11
|
+
var handleClear = function handleClear() {
|
|
12
|
+
// 清除购物车
|
|
13
|
+
dispatch({
|
|
14
|
+
type: 'setService',
|
|
15
|
+
payload: {
|
|
16
|
+
value: []
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
return !!((_state$service = state.service) !== null && _state$service !== void 0 && (_state$service$value = _state$service.value) !== null && _state$service$value !== void 0 && _state$service$value.length) && /*#__PURE__*/React.createElement("span", {
|
|
21
|
+
className: classNames('pisell-lowcode__booking-service-clear-btn', _defineProperty({}, 'pisell-lowcode__booking-service-clear-btn-disabled', !((_state$service2 = state.service) !== null && _state$service2 !== void 0 && (_state$service2$value = _state$service2.value) !== null && _state$service2$value !== void 0 && _state$service2$value.length))),
|
|
22
|
+
onClick: handleClear
|
|
23
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
24
|
+
type: "pisell2-trash-01"
|
|
25
|
+
}), " ", /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.booking.info.text.clear-cart')));
|
|
26
|
+
};
|
|
27
|
+
export default useClearCart;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { locales } from '@pisell/utils';
|
|
3
|
+
var useCreateBookingPageHeader = function useCreateBookingPageHeader(state) {
|
|
4
|
+
var createHeader = useMemo(function () {
|
|
5
|
+
return state.isBookingCreatePage && !state.bookingId && /*#__PURE__*/React.createElement("div", {
|
|
6
|
+
className: "booking-info-create-new"
|
|
7
|
+
}, locales.getText('pisell2.booking.info.text.create-new'));
|
|
8
|
+
}, [state.isBookingCreatePage, state.bookingId]);
|
|
9
|
+
var isBookingCreatePage = useMemo(function () {
|
|
10
|
+
return state.isBookingCreatePage;
|
|
11
|
+
}, [state.isBookingCreatePage]);
|
|
12
|
+
var isBookingCreatePageCreateMode = useMemo(function () {
|
|
13
|
+
return state.isBookingCreatePage && !state.bookingId;
|
|
14
|
+
}, [state.isBookingCreatePage, state.bookingId]);
|
|
15
|
+
return {
|
|
16
|
+
createHeader: createHeader,
|
|
17
|
+
isBookingCreatePage: isBookingCreatePage,
|
|
18
|
+
isBookingCreatePageCreateMode: isBookingCreatePageCreateMode
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export default useCreateBookingPageHeader;
|