@pisell/private-materials 3.0.151 → 3.0.152
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 +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +12 -12
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +12 -12
- package/es/components/booking/components/footer/index.js +48 -33
- package/es/components/booking/components/footer/utils.js +35 -4
- package/es/components/booking/index.js +1 -1
- package/es/components/booking/info/index.d.ts +4 -12
- package/es/components/booking/info/index.js +12 -122
- package/es/components/booking/info/main.d.ts +12 -0
- package/es/components/booking/info/main.js +124 -0
- package/es/components/booking/info/model.js +0 -1
- package/es/components/booking/info/service/addTimeModal/index.js +4 -4
- package/es/components/booking/info/utils.d.ts +1 -0
- package/es/components/booking/info/utils.js +7 -0
- package/es/components/booking/info2/index.d.ts +12 -0
- package/es/components/booking/info2/index.js +216 -0
- package/es/components/booking/info2/serve.d.ts +6 -0
- package/es/components/booking/info2/serve.js +79 -0
- package/es/components/booking/info2/service/actions/index.d.ts +6 -0
- package/es/components/booking/info2/service/actions/index.js +86 -0
- package/es/components/booking/info2/service/addService/index.d.ts +6 -0
- package/es/components/booking/info2/service/addService/index.js +404 -0
- package/es/components/booking/info2/service/addService/mock.d.ts +214 -0
- package/es/components/booking/info2/service/addService/mock.js +332 -0
- package/es/components/booking/info2/service/addService/utils.d.ts +71 -0
- package/es/components/booking/info2/service/addService/utils.js +510 -0
- package/es/components/booking/info2/service/addTimeModal/index.d.ts +4 -0
- package/es/components/booking/info2/service/addTimeModal/index.js +681 -0
- package/es/components/booking/info2/service/addTimeModal/serve.d.ts +9 -0
- package/es/components/booking/info2/service/addTimeModal/serve.js +73 -0
- package/es/components/booking/info2/service/addTimeModal/utils.d.ts +31 -0
- package/es/components/booking/info2/service/addTimeModal/utils.js +176 -0
- package/es/components/booking/info2/service/editService/Capacity/index.d.ts +4 -0
- package/es/components/booking/info2/service/editService/Capacity/index.js +121 -0
- package/es/components/booking/info2/service/editService/Capacity/index.less +1 -0
- package/es/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.d.ts +7 -0
- package/es/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.js +28 -0
- package/es/components/booking/info2/service/editService/Resources/index.d.ts +4 -0
- package/es/components/booking/info2/service/editService/Resources/index.js +233 -0
- package/es/components/booking/info2/service/editService/Resources/index.less +21 -0
- package/es/components/booking/info2/service/editService/index.d.ts +7 -0
- package/es/components/booking/info2/service/editService/index.js +617 -0
- package/es/components/booking/info2/service/editService/index.less +99 -0
- package/es/components/booking/info2/service/editService/utils.d.ts +11 -0
- package/es/components/booking/info2/service/editService/utils.js +37 -0
- package/es/components/booking/info2/service/index.d.ts +4 -0
- package/es/components/booking/info2/service/index.js +55 -0
- package/es/components/booking/info2/service/serviceItem/index.d.ts +4 -0
- package/es/components/booking/info2/service/serviceItem/index.js +176 -0
- package/es/components/booking/info2/service/serviceItem/index.less +125 -0
- package/es/components/booking/info2/service/serviceList/index.d.ts +6 -0
- package/es/components/booking/info2/service/serviceList/index.js +106 -0
- package/es/components/booking/info2/service/serviceList/index.less +0 -0
- package/es/components/booking/info2/utilsByBooking.d.ts +34 -0
- package/es/components/booking/info2/utilsByBooking.js +349 -0
- package/es/components/booking/locales.d.ts +3 -0
- package/es/components/booking/locales.js +12 -3
- package/es/components/booking/materiels/resources/index.d.ts +2 -2
- package/es/components/booking/materiels/resources/index.js +11 -11
- package/es/components/booking/mock.d.ts +1 -0
- package/es/components/booking/mock.js +66 -0
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/index.d.ts +1 -1
- package/es/components/index.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/lib/components/booking/components/footer/index.js +28 -5
- package/lib/components/booking/components/footer/utils.js +29 -4
- package/lib/components/booking/index.js +2 -2
- package/lib/components/booking/info/index.d.ts +4 -12
- package/lib/components/booking/info/index.js +14 -115
- package/lib/components/booking/info/main.d.ts +12 -0
- package/lib/components/booking/info/main.js +152 -0
- package/lib/components/booking/info/service/addTimeModal/index.js +1 -0
- package/lib/components/booking/info/utils.d.ts +1 -0
- package/lib/components/booking/info/utils.js +9 -0
- package/lib/components/booking/info2/index.d.ts +12 -0
- package/lib/components/booking/info2/index.js +202 -0
- package/lib/components/booking/info2/serve.d.ts +6 -0
- package/lib/components/booking/info2/serve.js +53 -0
- package/lib/components/booking/info2/service/actions/index.d.ts +6 -0
- package/lib/components/booking/info2/service/actions/index.js +102 -0
- package/lib/components/booking/info2/service/addService/index.d.ts +6 -0
- package/lib/components/booking/info2/service/addService/index.js +356 -0
- package/lib/components/booking/info2/service/addService/mock.d.ts +214 -0
- package/lib/components/booking/info2/service/addService/mock.js +398 -0
- package/lib/components/booking/info2/service/addService/utils.d.ts +71 -0
- package/lib/components/booking/info2/service/addService/utils.js +377 -0
- package/lib/components/booking/info2/service/addTimeModal/index.d.ts +4 -0
- package/lib/components/booking/info2/service/addTimeModal/index.js +558 -0
- package/lib/components/booking/info2/service/addTimeModal/serve.d.ts +9 -0
- package/lib/components/booking/info2/service/addTimeModal/serve.js +45 -0
- package/lib/components/booking/info2/service/addTimeModal/utils.d.ts +31 -0
- package/lib/components/booking/info2/service/addTimeModal/utils.js +157 -0
- package/lib/components/booking/info2/service/editService/Capacity/index.d.ts +4 -0
- package/lib/components/booking/info2/service/editService/Capacity/index.js +97 -0
- package/lib/components/booking/info2/service/editService/Capacity/index.less +1 -0
- package/lib/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.d.ts +7 -0
- package/lib/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.js +54 -0
- package/lib/components/booking/info2/service/editService/Resources/index.d.ts +4 -0
- package/lib/components/booking/info2/service/editService/Resources/index.js +212 -0
- package/lib/components/booking/info2/service/editService/Resources/index.less +21 -0
- package/lib/components/booking/info2/service/editService/index.d.ts +7 -0
- package/lib/components/booking/info2/service/editService/index.js +483 -0
- package/lib/components/booking/info2/service/editService/index.less +99 -0
- package/lib/components/booking/info2/service/editService/utils.d.ts +11 -0
- package/lib/components/booking/info2/service/editService/utils.js +0 -0
- package/lib/components/booking/info2/service/index.d.ts +4 -0
- package/lib/components/booking/info2/service/index.js +75 -0
- package/lib/components/booking/info2/service/serviceItem/index.d.ts +4 -0
- package/lib/components/booking/info2/service/serviceItem/index.js +184 -0
- package/lib/components/booking/info2/service/serviceItem/index.less +125 -0
- package/lib/components/booking/info2/service/serviceList/index.d.ts +6 -0
- package/lib/components/booking/info2/service/serviceList/index.js +130 -0
- package/lib/components/booking/info2/service/serviceList/index.less +0 -0
- package/lib/components/booking/info2/utilsByBooking.d.ts +34 -0
- package/lib/components/booking/info2/utilsByBooking.js +257 -0
- package/lib/components/booking/locales.d.ts +3 -0
- package/lib/components/booking/locales.js +6 -3
- package/lib/components/booking/materiels/resources/index.d.ts +2 -2
- package/lib/components/booking/mock.d.ts +1 -0
- package/lib/components/booking/mock.js +67 -2
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/eftposPay/tyro/index.js +3 -1
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const getAddTimeProducts: (params: any, config: any) => Promise<any>;
|
|
2
|
+
export declare const saveAddTimeProduct: ({ orderId, params }: {
|
|
3
|
+
orderId: number | string;
|
|
4
|
+
params: any;
|
|
5
|
+
}) => Promise<any>;
|
|
6
|
+
export declare const saveAddTimeProduct2: ({ orderId, params }: {
|
|
7
|
+
orderId: number | string;
|
|
8
|
+
params: any;
|
|
9
|
+
}) => Promise<any>;
|
|
@@ -0,0 +1,73 @@
|
|
|
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 getAddTimeProducts = /*#__PURE__*/function () {
|
|
7
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params, config) {
|
|
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().post("/shop/product/query", params, config);
|
|
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 getAddTimeProducts(_x, _x2) {
|
|
25
|
+
return _ref.apply(this, arguments);
|
|
26
|
+
};
|
|
27
|
+
}();
|
|
28
|
+
export var saveAddTimeProduct = /*#__PURE__*/function () {
|
|
29
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
|
|
30
|
+
var orderId, params, _yield$request$getReq2, data;
|
|
31
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
32
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
33
|
+
case 0:
|
|
34
|
+
orderId = _ref2.orderId, params = _ref2.params;
|
|
35
|
+
_context2.next = 3;
|
|
36
|
+
return request.getRequest().put("/shop/order/appointment/child-booking/".concat(orderId), params);
|
|
37
|
+
case 3:
|
|
38
|
+
_yield$request$getReq2 = _context2.sent;
|
|
39
|
+
data = _yield$request$getReq2.data;
|
|
40
|
+
return _context2.abrupt("return", data);
|
|
41
|
+
case 6:
|
|
42
|
+
case "end":
|
|
43
|
+
return _context2.stop();
|
|
44
|
+
}
|
|
45
|
+
}, _callee2);
|
|
46
|
+
}));
|
|
47
|
+
return function saveAddTimeProduct(_x3) {
|
|
48
|
+
return _ref3.apply(this, arguments);
|
|
49
|
+
};
|
|
50
|
+
}();
|
|
51
|
+
export var saveAddTimeProduct2 = /*#__PURE__*/function () {
|
|
52
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
|
|
53
|
+
var orderId, params, _yield$request$getReq3, data;
|
|
54
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
55
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
56
|
+
case 0:
|
|
57
|
+
orderId = _ref4.orderId, params = _ref4.params;
|
|
58
|
+
_context3.next = 3;
|
|
59
|
+
return request.getRequest().put("/shop/v1.1/order/appointment/child-booking/".concat(orderId), params);
|
|
60
|
+
case 3:
|
|
61
|
+
_yield$request$getReq3 = _context3.sent;
|
|
62
|
+
data = _yield$request$getReq3.data;
|
|
63
|
+
return _context3.abrupt("return", data);
|
|
64
|
+
case 6:
|
|
65
|
+
case "end":
|
|
66
|
+
return _context3.stop();
|
|
67
|
+
}
|
|
68
|
+
}, _callee3);
|
|
69
|
+
}));
|
|
70
|
+
return function saveAddTimeProduct2(_x4) {
|
|
71
|
+
return _ref5.apply(this, arguments);
|
|
72
|
+
};
|
|
73
|
+
}();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @title: 根据商品生成加时列表
|
|
3
|
+
* @description:
|
|
4
|
+
* @param {any} config
|
|
5
|
+
* @param {number} price
|
|
6
|
+
* @return {*}
|
|
7
|
+
* @Author: zhiwei.Wang
|
|
8
|
+
* @Date: 2024-07-01 09:34
|
|
9
|
+
*/
|
|
10
|
+
export declare const getAddTimeSplits: (product: any, cacheItem: any) => {
|
|
11
|
+
label: any;
|
|
12
|
+
value: any;
|
|
13
|
+
price: any;
|
|
14
|
+
}[];
|
|
15
|
+
/**
|
|
16
|
+
* @title: 判断当前商品是否可用
|
|
17
|
+
* @description:
|
|
18
|
+
* @param {any} relationProduct
|
|
19
|
+
* @param {any} currentItem
|
|
20
|
+
* @return {*}
|
|
21
|
+
* @Author: zhiwei.Wang
|
|
22
|
+
* @Date: 2024-07-01 09:33
|
|
23
|
+
*/
|
|
24
|
+
export declare const isUsableProduct: (addTime: any, currentItem: any) => any;
|
|
25
|
+
export declare const addTimeRowKey: {
|
|
26
|
+
create: (product_id: number, time: number) => string;
|
|
27
|
+
getValue: (str: string) => {
|
|
28
|
+
product_id: number;
|
|
29
|
+
time: number | string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
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); }
|
|
7
|
+
import dayjs from "dayjs";
|
|
8
|
+
import { getDiscountTime, getEndDate } from "../../../utils";
|
|
9
|
+
import { locales } from '@pisell/utils';
|
|
10
|
+
import { intersectionBy } from 'lodash';
|
|
11
|
+
import { getUsableTime } from "../addService/utils";
|
|
12
|
+
var getIsAddH = function getIsAddH(pre, current) {
|
|
13
|
+
if (current < 60) {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
var preH = Math.floor(pre / 60);
|
|
17
|
+
var currentH = Math.floor(current / 60);
|
|
18
|
+
if (current % 60 !== 0) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
return getDiscountTime(currentH * 60);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @title: 根据商品生成加时列表
|
|
26
|
+
* @description:
|
|
27
|
+
* @param {any} config
|
|
28
|
+
* @param {number} price
|
|
29
|
+
* @return {*}
|
|
30
|
+
* @Author: zhiwei.Wang
|
|
31
|
+
* @Date: 2024-07-01 09:34
|
|
32
|
+
*/
|
|
33
|
+
export var getAddTimeSplits = function getAddTimeSplits(product, cacheItem) {
|
|
34
|
+
var _product$add_time = product.add_time,
|
|
35
|
+
add_time = _product$add_time === void 0 ? {
|
|
36
|
+
calculate_type: "select_quantity",
|
|
37
|
+
// 最大时长
|
|
38
|
+
max_add_time: 30,
|
|
39
|
+
// 最小时长
|
|
40
|
+
min_add_time: 30,
|
|
41
|
+
// 关联产品
|
|
42
|
+
relation_product: {
|
|
43
|
+
type: "product_all",
|
|
44
|
+
products: []
|
|
45
|
+
},
|
|
46
|
+
// 单位切片
|
|
47
|
+
unit_duration: 30
|
|
48
|
+
} : _product$add_time,
|
|
49
|
+
_product$price = product.price,
|
|
50
|
+
price = _product$price === void 0 ? 0 : _product$price;
|
|
51
|
+
|
|
52
|
+
// 灵活时长
|
|
53
|
+
if (add_time.additional_time_options === 'unlimited') {
|
|
54
|
+
var _getUsableTime;
|
|
55
|
+
// 1. 当前服务的时长和结束时间
|
|
56
|
+
// 2. 当前资源的结束时间
|
|
57
|
+
// 3. 当前店铺的结束时间
|
|
58
|
+
var maxEndDate = getEndDate(cacheItem._extend.startDate, 'flexible', (_getUsableTime = getUsableTime(cacheItem)) === null || _getUsableTime === void 0 ? void 0 : _getUsableTime.end_at);
|
|
59
|
+
var _value = maxEndDate.diff(cacheItem._extend.endDate, 'minute');
|
|
60
|
+
// 店铺营业时间大于当前服务的结束时间, 则取店铺营业时间, 否则就不可选
|
|
61
|
+
if (_value > 0) {
|
|
62
|
+
return [{
|
|
63
|
+
label: locales.getText('page.booking.text.unlimited'),
|
|
64
|
+
value: _value,
|
|
65
|
+
price: price
|
|
66
|
+
}];
|
|
67
|
+
} else {
|
|
68
|
+
// 如果当前服务已经选择到了最大时间, 则不可选
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// 开始时间
|
|
74
|
+
var startTime = dayjs().startOf("day");
|
|
75
|
+
|
|
76
|
+
// 最大加时时间
|
|
77
|
+
var endTime = startTime.add(add_time.max_add_time, "minute");
|
|
78
|
+
var timeSlice = (add_time === null || add_time === void 0 ? void 0 : add_time.unit_duration) || 5; // 切片时间间隔(分钟)
|
|
79
|
+
|
|
80
|
+
var arr = [];
|
|
81
|
+
var currentTime = startTime;
|
|
82
|
+
var lastDuration = 0;
|
|
83
|
+
while (currentTime.isBefore(endTime)) {
|
|
84
|
+
var nextTime = currentTime;
|
|
85
|
+
|
|
86
|
+
// 从最小加时时间开始计算
|
|
87
|
+
if (lastDuration === 0) {
|
|
88
|
+
nextTime = nextTime.add(add_time.min_add_time, "minute");
|
|
89
|
+
} else {
|
|
90
|
+
nextTime = currentTime.add(timeSlice, "minute");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// 根据切片生成新的时间
|
|
94
|
+
var durationValue = nextTime.diff(startTime, "minute");
|
|
95
|
+
|
|
96
|
+
// 根据时间 生成label
|
|
97
|
+
var durationLabel = "".concat(durationValue, " ").concat(locales.getText('pisell2.text.min'));
|
|
98
|
+
|
|
99
|
+
// 大于60分钟的格式化成小时
|
|
100
|
+
if (durationValue >= 60) {
|
|
101
|
+
durationLabel = getDiscountTime(durationValue);
|
|
102
|
+
}
|
|
103
|
+
arr.push({
|
|
104
|
+
label: durationLabel,
|
|
105
|
+
value: durationValue,
|
|
106
|
+
price: durationValue / timeSlice * price
|
|
107
|
+
});
|
|
108
|
+
lastDuration = durationValue;
|
|
109
|
+
currentTime = nextTime;
|
|
110
|
+
}
|
|
111
|
+
return arr;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @title: 判断当前商品是否可用
|
|
116
|
+
* @description:
|
|
117
|
+
* @param {any} relationProduct
|
|
118
|
+
* @param {any} currentItem
|
|
119
|
+
* @return {*}
|
|
120
|
+
* @Author: zhiwei.Wang
|
|
121
|
+
* @Date: 2024-07-01 09:33
|
|
122
|
+
*/
|
|
123
|
+
export var isUsableProduct = function isUsableProduct(addTime, currentItem) {
|
|
124
|
+
var _addTime$relation_pro;
|
|
125
|
+
// 商品类型
|
|
126
|
+
var type = (_addTime$relation_pro = addTime.relation_product) === null || _addTime$relation_pro === void 0 ? void 0 : _addTime$relation_pro.type;
|
|
127
|
+
var relationProduct = addTime.relation_product || [];
|
|
128
|
+
if (!currentItem) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
if (addTime.additional_time_options === 'unlimited') {
|
|
132
|
+
var maxEndDate = getEndDate(currentItem._extend.startDate, 'flexible', '');
|
|
133
|
+
// 当前服务的结束时间大于店铺的营业时间, 过滤
|
|
134
|
+
if (currentItem._extend.endDate.isAfter(maxEndDate)) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// 全部商品
|
|
140
|
+
if (type === "product_all") {
|
|
141
|
+
return true;
|
|
142
|
+
} else {
|
|
143
|
+
if (type === "product_collection") {
|
|
144
|
+
return !!intersectionBy(relationProduct.products.map(function (item) {
|
|
145
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
146
|
+
id: item.product_collection_id
|
|
147
|
+
});
|
|
148
|
+
}) || [], currentItem.collection || [], "id").length;
|
|
149
|
+
} else {
|
|
150
|
+
return relationProduct.products.some(function (item) {
|
|
151
|
+
// 判断商品
|
|
152
|
+
if (type === "products") {
|
|
153
|
+
if (item.product_id == currentItem.product_id) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
export var addTimeRowKey = {
|
|
162
|
+
// 创建, 增加前缀
|
|
163
|
+
create: function create(product_id, time) {
|
|
164
|
+
return "".concat(product_id, "_").concat(time);
|
|
165
|
+
},
|
|
166
|
+
// 格式化, 去除前缀
|
|
167
|
+
getValue: function getValue(str) {
|
|
168
|
+
var arr = str.split("_");
|
|
169
|
+
var id = arr[0] || 0;
|
|
170
|
+
var time = arr[1] || 0;
|
|
171
|
+
return {
|
|
172
|
+
product_id: Number(id),
|
|
173
|
+
time: time === 'flexible' ? time : Number(arr[1] || 0)
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
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); }
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
|
+
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; }
|
|
13
|
+
import React, { useMemo, forwardRef } from 'react';
|
|
14
|
+
import { Col, Form, Select } from 'antd';
|
|
15
|
+
import "./index.less";
|
|
16
|
+
|
|
17
|
+
// const data = {
|
|
18
|
+
// type: 'product',
|
|
19
|
+
// custom: [
|
|
20
|
+
// {
|
|
21
|
+
// id: 1,
|
|
22
|
+
// name: {
|
|
23
|
+
// en: '成人',
|
|
24
|
+
// 'zh-CN': '成人',
|
|
25
|
+
// 'zh-HK': '成人',
|
|
26
|
+
// original: '成人',
|
|
27
|
+
// },
|
|
28
|
+
// min: 1,
|
|
29
|
+
// max: 10,
|
|
30
|
+
// },
|
|
31
|
+
// {
|
|
32
|
+
// id: 2,
|
|
33
|
+
// name: {
|
|
34
|
+
// en: '成人',
|
|
35
|
+
// 'zh-CN': '成人',
|
|
36
|
+
// 'zh-HK': '成人',
|
|
37
|
+
// original: '儿童',
|
|
38
|
+
// },
|
|
39
|
+
// min: 1,
|
|
40
|
+
// max: 10,
|
|
41
|
+
// },
|
|
42
|
+
// ],
|
|
43
|
+
// package: {
|
|
44
|
+
// product_ids: [],
|
|
45
|
+
// },
|
|
46
|
+
// };
|
|
47
|
+
|
|
48
|
+
var getName = function getName(name, locale) {
|
|
49
|
+
return name[locale] || name['original'] || name['en'] || '';
|
|
50
|
+
};
|
|
51
|
+
var getSelectOptions = function getSelectOptions(min, max) {
|
|
52
|
+
var arr = [];
|
|
53
|
+
for (var i = min; i <= max; i++) {
|
|
54
|
+
arr.push({
|
|
55
|
+
label: "".concat(i),
|
|
56
|
+
value: i
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return arr;
|
|
60
|
+
};
|
|
61
|
+
var Capacity = function Capacity(_ref, ref) {
|
|
62
|
+
var _cacheItem$_data;
|
|
63
|
+
var state = _ref.state,
|
|
64
|
+
cacheItem = _ref.cacheItem,
|
|
65
|
+
value = _ref.value,
|
|
66
|
+
onChange = _ref.onChange;
|
|
67
|
+
var data = cacheItem === null || cacheItem === void 0 ? void 0 : (_cacheItem$_data = cacheItem._data) === null || _cacheItem$_data === void 0 ? void 0 : _cacheItem$_data.capacitys;
|
|
68
|
+
var _value = useMemo(function () {
|
|
69
|
+
return value || [];
|
|
70
|
+
}, [value]);
|
|
71
|
+
var _onChange = function _onChange(val, index) {
|
|
72
|
+
var _val = _toConsumableArray(_value);
|
|
73
|
+
_val = _val.map(function (item) {
|
|
74
|
+
if (item.id === index) {
|
|
75
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
76
|
+
value: val
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return item;
|
|
80
|
+
});
|
|
81
|
+
console.log(_val);
|
|
82
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_val);
|
|
83
|
+
};
|
|
84
|
+
if ((data === null || data === void 0 ? void 0 : data.type) !== 'custom') {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, data.custom.map(function (item) {
|
|
88
|
+
var _value$find;
|
|
89
|
+
return /*#__PURE__*/React.createElement(Col, {
|
|
90
|
+
span: 24,
|
|
91
|
+
key: item.id
|
|
92
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
93
|
+
label: getName(item.name, state.locale),
|
|
94
|
+
required: true
|
|
95
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
96
|
+
size: "large",
|
|
97
|
+
className: "capacity-select",
|
|
98
|
+
onChange: function onChange(e) {
|
|
99
|
+
_onChange(e, item.id);
|
|
100
|
+
},
|
|
101
|
+
showSearch: !state.isTerminal,
|
|
102
|
+
value: (_value$find = _value.find(function (d) {
|
|
103
|
+
return d.id === item.id;
|
|
104
|
+
})) === null || _value$find === void 0 ? void 0 : _value$find.value,
|
|
105
|
+
options: getSelectOptions(item.min, item.max),
|
|
106
|
+
onSearch: function onSearch(e) {
|
|
107
|
+
if (!e) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
var num = Number(e);
|
|
111
|
+
if (isNaN(num)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (num >= item.min && num <= item.max) {
|
|
115
|
+
_onChange(num, item.id);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
})));
|
|
119
|
+
}));
|
|
120
|
+
};
|
|
121
|
+
export default /*#__PURE__*/forwardRef(Capacity);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.capacity-select {}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectProps } from 'antd';
|
|
3
|
+
interface MaxLengthSelectProps<T> extends SelectProps<T> {
|
|
4
|
+
maxLength: number;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: import("react").ForwardRefExoticComponent<Partial<MaxLengthSelectProps<any>> & import("react").RefAttributes<unknown>>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
import { forwardRef, useImperativeHandle } from 'react';
|
|
3
|
+
import { Select } from 'antd';
|
|
4
|
+
var MaxLengthSelect = function MaxLengthSelect(props, ref) {
|
|
5
|
+
useImperativeHandle(ref, function () {
|
|
6
|
+
return {
|
|
7
|
+
onChange: handleChange
|
|
8
|
+
};
|
|
9
|
+
});
|
|
10
|
+
var handleChange = function handleChange(e, _option) {
|
|
11
|
+
if (props.onChange) {
|
|
12
|
+
if ((props.mode === 'multiple' || props.mode === 'tags') && props.maxLength) {
|
|
13
|
+
if (props.value && props.value.length >= props.maxLength && e.length > props.value.length) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
props.onChange(e, _option);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return /*#__PURE__*/React.createElement(Select, _extends({}, props, {
|
|
21
|
+
onChange: handleChange,
|
|
22
|
+
popupMatchSelectWidth: false,
|
|
23
|
+
getPopupContainer: function getPopupContainer() {
|
|
24
|
+
return document.querySelector('#main') || document.body;
|
|
25
|
+
}
|
|
26
|
+
}), props.children);
|
|
27
|
+
};
|
|
28
|
+
export default /*#__PURE__*/forwardRef(MaxLengthSelect);
|