@pisell/private-materials 3.0.78 → 3.0.80

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.
Files changed (67) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/booking/components/addButton/index.js +3 -3
  12. package/es/components/booking/components/customSelect/index.d.ts +2 -0
  13. package/es/components/booking/components/customSelect/index.js +6 -1
  14. package/es/components/booking/components/drawer/index.d.ts +1 -0
  15. package/es/components/booking/components/drawer/index.js +4 -2
  16. package/es/components/booking/components/footer/index.js +0 -1
  17. package/es/components/booking/info/client/index.js +3 -0
  18. package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +39 -0
  19. package/es/components/booking/info/clientVariant/hooks/useClientFn.js +378 -0
  20. package/es/components/booking/info/clientVariant/index.d.ts +1 -0
  21. package/es/components/booking/info/clientVariant/index.js +1 -0
  22. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +22 -0
  23. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +321 -0
  24. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.less +66 -0
  25. package/es/components/booking/info/clientVariant/vertical/index.d.ts +8 -0
  26. package/es/components/booking/info/clientVariant/vertical/index.js +205 -0
  27. package/es/components/booking/info/clientVariant/vertical/index.less +61 -0
  28. package/es/components/booking/info/index.js +1 -1
  29. package/es/components/booking/info/pet/index.d.ts +10 -1
  30. package/es/components/booking/info/pet/index.js +22 -14
  31. package/es/components/booking/info/service/addService/index.js +1 -1
  32. package/es/components/booking/info/utils.d.ts +1 -0
  33. package/es/components/booking/info/utils.js +12 -0
  34. package/es/components/booking/locales.d.ts +6 -0
  35. package/es/components/booking/locales.js +9 -3
  36. package/es/components/booking/model.d.ts +2 -0
  37. package/es/index.d.ts +1 -0
  38. package/es/index.js +1 -0
  39. package/lib/components/booking/components/addButton/index.js +2 -2
  40. package/lib/components/booking/components/customSelect/index.d.ts +2 -0
  41. package/lib/components/booking/components/customSelect/index.js +6 -1
  42. package/lib/components/booking/components/drawer/index.d.ts +1 -0
  43. package/lib/components/booking/components/drawer/index.js +2 -2
  44. package/lib/components/booking/components/footer/index.js +0 -1
  45. package/lib/components/booking/info/client/index.js +2 -1
  46. package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +39 -0
  47. package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +308 -0
  48. package/lib/components/booking/info/clientVariant/index.d.ts +1 -0
  49. package/lib/components/booking/info/clientVariant/index.js +39 -0
  50. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +22 -0
  51. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +344 -0
  52. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.less +66 -0
  53. package/lib/components/booking/info/clientVariant/vertical/index.d.ts +8 -0
  54. package/lib/components/booking/info/clientVariant/vertical/index.js +230 -0
  55. package/lib/components/booking/info/clientVariant/vertical/index.less +61 -0
  56. package/lib/components/booking/info/index.js +1 -1
  57. package/lib/components/booking/info/pet/index.d.ts +10 -1
  58. package/lib/components/booking/info/pet/index.js +15 -8
  59. package/lib/components/booking/info/service/addService/index.js +1 -1
  60. package/lib/components/booking/info/utils.d.ts +1 -0
  61. package/lib/components/booking/info/utils.js +16 -2
  62. package/lib/components/booking/locales.d.ts +6 -0
  63. package/lib/components/booking/locales.js +9 -3
  64. package/lib/components/booking/model.d.ts +2 -0
  65. package/lib/index.d.ts +1 -0
  66. package/lib/index.js +5 -2
  67. package/package.json +2 -2
@@ -12,7 +12,7 @@ import PlusCircle from "@pisell/icon/es/PlusCircle";
12
12
  import "./index.less";
13
13
  import classNames from "classnames";
14
14
  import { message, Skeleton } from "antd";
15
- import { locales } from "@pisell/utils";
15
+ import { isFunction, locales } from "@pisell/utils";
16
16
  var AddButton = function AddButton(_ref) {
17
17
  var onClick = _ref.onClick,
18
18
  showSub = _ref.showSub,
@@ -48,7 +48,7 @@ var AddButton = function AddButton(_ref) {
48
48
  return /*#__PURE__*/React.createElement(React.Fragment, null, showSub ? /*#__PURE__*/React.createElement("div", {
49
49
  className: "pisell-lowcode__booking-add-button-add-row",
50
50
  onClick: _onClick,
51
- style: style
51
+ style: isFunction(style) ? style(showSub) : style
52
52
  }, /*#__PURE__*/React.createElement(PlusCircle, {
53
53
  className: "pisell-lowcode__booking-add-button-add-row-icon"
54
54
  }), /*#__PURE__*/React.createElement("span", {
@@ -58,7 +58,7 @@ var AddButton = function AddButton(_ref) {
58
58
  "pisell-lowcode__booking-add-button-add-disabled": disabled
59
59
  }),
60
60
  onClick: _onClick,
61
- style: style
61
+ style: isFunction(style) ? style(showSub) : style
62
62
  }, /*#__PURE__*/React.createElement("span", {
63
63
  className: "pisell-lowcode__booking-add-button-add-label"
64
64
  }, title), /*#__PURE__*/React.createElement(ChevronRight, {
@@ -29,6 +29,8 @@ interface CustomSelectProps {
29
29
  modalOpen?: boolean;
30
30
  closeCallback?: () => any;
31
31
  autoFocus?: boolean;
32
+ showDropDown?: boolean;
33
+ handleOpenModal: () => void;
32
34
  }
33
35
  declare const _default: React.ForwardRefExoticComponent<CustomSelectProps & React.RefAttributes<unknown>>;
34
36
  export default _default;
@@ -70,7 +70,8 @@ var CustomSelect = function CustomSelect(props, ref) {
70
70
  closeCallback = props.closeCallback,
71
71
  autoFocus = props.autoFocus,
72
72
  _props$showDropDown = props.showDropDown,
73
- showDropDown = _props$showDropDown === void 0 ? true : _props$showDropDown;
73
+ showDropDown = _props$showDropDown === void 0 ? true : _props$showDropDown,
74
+ propsHandleOpenModal = props.handleOpenModal;
74
75
  var searchRef = useRef();
75
76
 
76
77
  // 当前选择的值
@@ -152,6 +153,10 @@ var CustomSelect = function CustomSelect(props, ref) {
152
153
  if (disabled) {
153
154
  return;
154
155
  }
156
+ if (propsHandleOpenModal) {
157
+ propsHandleOpenModal();
158
+ return;
159
+ }
155
160
  if (addButtonProps !== null && addButtonProps !== void 0 && addButtonProps.addCallback) {
156
161
  addButtonProps === null || addButtonProps === void 0 ? void 0 : addButtonProps.addCallback();
157
162
  }
@@ -5,6 +5,7 @@ export interface PisellDrawerProps extends DrawerProps {
5
5
  header?: React.ReactNode;
6
6
  titleNoWrap?: boolean;
7
7
  hideScrollBar?: boolean;
8
+ showGoBack?: boolean;
8
9
  }
9
10
  /**
10
11
  * @title: 自定义抽屉
@@ -14,7 +14,9 @@ import classNames from "classnames";
14
14
  */
15
15
  var Drawer = function Drawer(props) {
16
16
  var _props$hideScrollBar = props.hideScrollBar,
17
- hideScrollBar = _props$hideScrollBar === void 0 ? true : _props$hideScrollBar;
17
+ hideScrollBar = _props$hideScrollBar === void 0 ? true : _props$hideScrollBar,
18
+ _props$showGoBack = props.showGoBack,
19
+ showGoBack = _props$showGoBack === void 0 ? true : _props$showGoBack;
18
20
  return /*#__PURE__*/React.createElement(OriginDrawer, _extends({
19
21
  width: "600px",
20
22
  closable: false,
@@ -31,7 +33,7 @@ var Drawer = function Drawer(props) {
31
33
  mask: false
32
34
  }), /*#__PURE__*/React.createElement("div", {
33
35
  className: classNames("pisell-lowcode__booking-drawer-title-wrap")
34
- }, /*#__PURE__*/React.createElement(ArrowLeft, {
36
+ }, showGoBack && /*#__PURE__*/React.createElement(ArrowLeft, {
35
37
  className: "pisell-lowcode__booking-drawer-back",
36
38
  onClick: function onClick(e) {
37
39
  var _props$onClose;
@@ -547,7 +547,6 @@ var Footer = function Footer(props) {
547
547
  } : state.bookingDetail.customer;
548
548
  case 8:
549
549
  if (e.key === "sendMail") {
550
- console.log(e);
551
550
  state.action({
552
551
  type: "pisell1.sendPayLinkEmail",
553
552
  data: {
@@ -371,6 +371,9 @@ var Info = function Info() {
371
371
  return;
372
372
  }
373
373
  handleOpenClientModal();
374
+ },
375
+ style: state.bookingId ? {} : {
376
+ marginTop: 16
374
377
  }
375
378
  }, /*#__PURE__*/React.createElement(Avatar, {
376
379
  className: "pisell-lowcode__booking-client-list-item-avatar",
@@ -0,0 +1,39 @@
1
+ import React from "react";
2
+ import { FormState } from "../../../model";
3
+ interface useClientFnParams {
4
+ state: any;
5
+ setGlobalState: (val: any) => void;
6
+ modalRef: any;
7
+ }
8
+ declare const useClientFn: (_params: useClientFnParams) => {
9
+ setClient: (client: Partial<FormState["client"]>) => void;
10
+ isWalkIn: boolean;
11
+ handleSelectClient: (value: any) => Promise<unknown>;
12
+ menuChange: (e: any) => void;
13
+ handleViewClient: () => void;
14
+ menus: {
15
+ key: string;
16
+ label: any;
17
+ }[];
18
+ handleCreateItem: () => void;
19
+ getClients: ({ customer_id, ...resetParams }: {
20
+ customer_id?: number | undefined;
21
+ skip?: number | undefined;
22
+ search?: string | undefined;
23
+ with?: string[] | undefined;
24
+ relation_form_id?: number | undefined;
25
+ }) => Promise<{}>;
26
+ params: {
27
+ skip: number;
28
+ num: number;
29
+ total: number;
30
+ search: string;
31
+ with: string[];
32
+ relation_form_id: any;
33
+ };
34
+ searchChange: (search: string) => void;
35
+ loading: boolean;
36
+ loadMore: React.JSX.Element | null;
37
+ handleOpenClientModal: () => void;
38
+ };
39
+ export default useClientFn;
@@ -0,0 +1,378 @@
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 = ["customer_id"];
3
+ 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; }
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 _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; }
9
+ 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; }
10
+ 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); } }
11
+ 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); }); }; }
12
+ 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; }
13
+ 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; }
14
+ 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; }
15
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
16
+ 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); }
17
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
18
+ 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."); }
19
+ 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); }
20
+ 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; }
21
+ 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; } }
22
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
24
+ import { isWalkIn as getIsWalkIn } from "../../../utils";
25
+ import { getFranchiseeCustomerInfo, getFranchiseeCustomerList } from "../../client/serve";
26
+ import { walkInData } from "../../model";
27
+ import { locales } from "@pisell/utils";
28
+ import { Button } from "antd";
29
+ var useClientFn = function useClientFn(_params) {
30
+ var _state$bookingConfig, _state$bookingConfig$, _state$bookingConfig$2, _state$bookingConfig$3, _state$bookingConfig6, _state$bookingConfig7, _state$bookingConfig8, _state$client$value2;
31
+ var state = _params.state,
32
+ setGlobalState = _params.setGlobalState,
33
+ modalRef = _params.modalRef;
34
+ var _useState = useState(false),
35
+ _useState2 = _slicedToArray(_useState, 2),
36
+ loadLoading = _useState2[0],
37
+ setLoadLoading = _useState2[1];
38
+ var _useState3 = useState(false),
39
+ _useState4 = _slicedToArray(_useState3, 2),
40
+ loading = _useState4[0],
41
+ setLoading = _useState4[1];
42
+ var _useState5 = useState(0),
43
+ _useState6 = _slicedToArray(_useState5, 2),
44
+ franchiseeLoading = _useState6[0],
45
+ setFranchiseeLoading = _useState6[1];
46
+ var _useState7 = useState({
47
+ skip: 1,
48
+ num: 50,
49
+ total: 0,
50
+ search: "",
51
+ with: ["formRecord"],
52
+ relation_form_id: state === null || state === void 0 ? void 0 : (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 ? void 0 : (_state$bookingConfig$ = _state$bookingConfig.config) === null || _state$bookingConfig$ === void 0 ? void 0 : (_state$bookingConfig$2 = _state$bookingConfig$.basic) === null || _state$bookingConfig$2 === void 0 ? void 0 : (_state$bookingConfig$3 = _state$bookingConfig$2.appointment_subject) === null || _state$bookingConfig$3 === void 0 ? void 0 : _state$bookingConfig$3.form_id
53
+ }),
54
+ _useState8 = _slicedToArray(_useState7, 2),
55
+ params = _useState8[0],
56
+ setParams = _useState8[1];
57
+ var paramsRef = useRef(params);
58
+ paramsRef.current = params;
59
+ useEffect(function () {
60
+ setParams(function (v) {
61
+ var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$bookingConfig5;
62
+ return _objectSpread(_objectSpread({}, v), {}, {
63
+ relation_form_id: state === null || state === void 0 ? void 0 : (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 ? void 0 : (_state$bookingConfig3 = _state$bookingConfig2.config) === null || _state$bookingConfig3 === void 0 ? void 0 : (_state$bookingConfig4 = _state$bookingConfig3.basic) === null || _state$bookingConfig4 === void 0 ? void 0 : (_state$bookingConfig5 = _state$bookingConfig4.appointment_subject) === null || _state$bookingConfig5 === void 0 ? void 0 : _state$bookingConfig5.form_id
64
+ });
65
+ });
66
+ }, [state === null || state === void 0 ? void 0 : (_state$bookingConfig6 = state.bookingConfig) === null || _state$bookingConfig6 === void 0 ? void 0 : (_state$bookingConfig7 = _state$bookingConfig6.config) === null || _state$bookingConfig7 === void 0 ? void 0 : (_state$bookingConfig8 = _state$bookingConfig7.basic) === null || _state$bookingConfig8 === void 0 ? void 0 : _state$bookingConfig8.appointment_subject]);
67
+ var stateRef = useRef(state);
68
+ stateRef.current = state;
69
+ var isWalkIn = useMemo(function () {
70
+ var _state$client$value;
71
+ return getIsWalkIn((_state$client$value = state.client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.id);
72
+ }, [(_state$client$value2 = state.client.value) === null || _state$client$value2 === void 0 ? void 0 : _state$client$value2.id]);
73
+ var getClients = /*#__PURE__*/function () {
74
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
75
+ var customer_id, resetParams, _setLoading, api, data, list, _payload, customerItem, totalList;
76
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
77
+ while (1) switch (_context.prev = _context.next) {
78
+ case 0:
79
+ customer_id = _ref.customer_id, resetParams = _objectWithoutProperties(_ref, _excluded);
80
+ _setLoading = resetParams.skip === 1 ? setLoading : setLoadLoading;
81
+ _setLoading(true);
82
+ api = state.isFranchisee ? getFranchiseeCustomerList : state.apis.getClients;
83
+ _context.next = 6;
84
+ return api(_objectSpread(_objectSpread({}, resetParams), !state.isFranchisee ? {
85
+ _config: {
86
+ abort: true
87
+ }
88
+ } : {}));
89
+ case 6:
90
+ data = _context.sent;
91
+ list = ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (d) {
92
+ return _objectSpread(_objectSpread({}, d), {}, {
93
+ name: getNickname(d),
94
+ id: d.franchisee_customer_id || d.id,
95
+ form_record: d.form_record.map(function (item) {
96
+ return _objectSpread(_objectSpread(_objectSpread({}, item), item.data), {}, {
97
+ form_record_id: item.id
98
+ });
99
+ })
100
+ });
101
+ });
102
+ _payload = {
103
+ clients: list
104
+ }; // 有传递, 则表示新增客户之后刷新列表的, 应该默认选中
105
+ if (!getIsWalkIn(customer_id)) {
106
+ customerItem = list.find(function (d) {
107
+ return d.id === customer_id;
108
+ });
109
+ if (customerItem) {
110
+ _payload.value = customerItem;
111
+ _payload.edit = true;
112
+ }
113
+ }
114
+ totalList = _toConsumableArray(state.client.clients);
115
+ if (resetParams.skip === 1) {
116
+ totalList = list;
117
+ } else {
118
+ totalList = totalList.concat(list);
119
+ }
120
+ _payload.clients = totalList;
121
+ setParams(_objectSpread(_objectSpread(_objectSpread({}, params), resetParams), {}, {
122
+ total: (data === null || data === void 0 ? void 0 : data.count) || 0
123
+ }));
124
+ setGlobalState({
125
+ client: _objectSpread(_objectSpread({}, stateRef.current.client), _payload)
126
+ });
127
+ _setLoading(false);
128
+ return _context.abrupt("return", {});
129
+ case 17:
130
+ case "end":
131
+ return _context.stop();
132
+ }
133
+ }, _callee);
134
+ }));
135
+ return function getClients(_x2) {
136
+ return _ref2.apply(this, arguments);
137
+ };
138
+ }();
139
+ var handleOpenClientModal = function handleOpenClientModal() {
140
+ var _modalRef$current;
141
+ if (state.disabledEdit) {
142
+ return;
143
+ }
144
+ setClient({
145
+ showModal: true
146
+ });
147
+ getClients(_objectSpread(_objectSpread({}, paramsRef.current), {}, {
148
+ search: "",
149
+ skip: 1
150
+ }));
151
+ (_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 ? void 0 : _modalRef$current.open();
152
+ };
153
+ var handleViewClient = function handleViewClient() {
154
+ state.action({
155
+ type: "pisell1.handleOpenCustomerModal",
156
+ data: {
157
+ id: state.client.value.id
158
+ },
159
+ callback: function callback(data) {
160
+ if (state.disabledEdit) {
161
+ return;
162
+ }
163
+ if (data) {
164
+ handleSelectClient([data]);
165
+ }
166
+ getClients(_objectSpread(_objectSpread({}, state.client.clientsParams), {}, {
167
+ search: "",
168
+ customer_id: data === null || data === void 0 ? void 0 : data.id,
169
+ skip: 1
170
+ }));
171
+ }
172
+ });
173
+ };
174
+ var menus = useMemo(function () {
175
+ var list = [
176
+ // { key: "view", label: locales.getText("pisell2.text.view-profile") },
177
+ {
178
+ key: "change",
179
+ label: locales.getText("pisell2.text.change-customer")
180
+ }, {
181
+ key: "remove",
182
+ label: locales.getText("pisell2.text.remove-customer")
183
+ }];
184
+ if (state.disabledEdit) {
185
+ list = list.filter(function (d) {
186
+ return d.key === "view";
187
+ });
188
+ }
189
+ return list;
190
+ }, [state.disabledEdit]);
191
+ var handleRemoveClient = function handleRemoveClient() {
192
+ if (state.disabledEdit) {
193
+ return;
194
+ }
195
+ handleSelectClient([walkInData]);
196
+ };
197
+ var menuChange = function menuChange(e) {
198
+ e.domEvent.stopPropagation();
199
+ var maps = {
200
+ view: handleViewClient,
201
+ change: handleOpenClientModal,
202
+ remove: handleRemoveClient
203
+ };
204
+ maps[e.key]();
205
+ };
206
+ var setClient = function setClient(client) {
207
+ setGlobalState({
208
+ client: _objectSpread(_objectSpread({}, stateRef.current.client), client)
209
+ });
210
+ };
211
+
212
+ /**
213
+ * @title: 置换客户id到子店铺
214
+ * @description:
215
+ * @param {number} id
216
+ * @return {*}
217
+ * @Author: zhiwei.Wang
218
+ * @Date: 2024-05-29 17:26
219
+ */
220
+ var _getFranchiseeCustomerInfo = /*#__PURE__*/function () {
221
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(customer) {
222
+ var res;
223
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
224
+ while (1) switch (_context2.prev = _context2.next) {
225
+ case 0:
226
+ _context2.prev = 0;
227
+ setFranchiseeLoading(customer.id);
228
+ _context2.next = 4;
229
+ return getFranchiseeCustomerInfo({
230
+ franchisor_customer_id: customer.id
231
+ });
232
+ case 4:
233
+ res = _context2.sent;
234
+ setFranchiseeLoading(0);
235
+ return _context2.abrupt("return", _objectSpread(_objectSpread({}, customer), {}, {
236
+ id: res.franchisee_customer_id
237
+ }));
238
+ case 9:
239
+ _context2.prev = 9;
240
+ _context2.t0 = _context2["catch"](0);
241
+ setFranchiseeLoading(0);
242
+ case 12:
243
+ case "end":
244
+ return _context2.stop();
245
+ }
246
+ }, _callee2, null, [[0, 9]]);
247
+ }));
248
+ return function _getFranchiseeCustomerInfo(_x3) {
249
+ return _ref3.apply(this, arguments);
250
+ };
251
+ }();
252
+ var getNickname = useCallback(function (item) {
253
+ if (getIsWalkIn(item === null || item === void 0 ? void 0 : item.id)) {
254
+ return locales.getText("pisell2.text.select-a-customer");
255
+ }
256
+ return item.name || (item.display_name || "").trim() || (item.nickname || "").trim() || "";
257
+ }, [locales.localeMap]);
258
+ useEffect(function () {
259
+ if (state.action) {
260
+ state.action({
261
+ type: "pisell1.registerPlugin",
262
+ data: {
263
+ pluginList: ["CustomerDetailPlugin"]
264
+ }
265
+ });
266
+ }
267
+ }, []);
268
+ var handleSelectClient = /*#__PURE__*/function () {
269
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(value) {
270
+ var _value;
271
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
272
+ while (1) switch (_context3.prev = _context3.next) {
273
+ case 0:
274
+ _value = (value === null || value === void 0 ? void 0 : value[value.length - 1]) || walkInData;
275
+ if (!_value.loading) {
276
+ _context3.next = 3;
277
+ break;
278
+ }
279
+ return _context3.abrupt("return");
280
+ case 3:
281
+ if (!(state.isFranchisee && _value.franchisee_customer_id === 0)) {
282
+ _context3.next = 14;
283
+ break;
284
+ }
285
+ _context3.prev = 4;
286
+ _context3.next = 7;
287
+ return _getFranchiseeCustomerInfo(_value);
288
+ case 7:
289
+ _value = _context3.sent;
290
+ _context3.next = 12;
291
+ break;
292
+ case 10:
293
+ _context3.prev = 10;
294
+ _context3.t0 = _context3["catch"](4);
295
+ case 12:
296
+ if (_value) {
297
+ _context3.next = 14;
298
+ break;
299
+ }
300
+ return _context3.abrupt("return");
301
+ case 14:
302
+ setClient({
303
+ value: _objectSpread(_objectSpread({}, _value), {}, {
304
+ name: getNickname(_value)
305
+ }),
306
+ edit: true
307
+ });
308
+ return _context3.abrupt("return", new Promise(function (resolve) {
309
+ resolve(0);
310
+ }));
311
+ case 16:
312
+ case "end":
313
+ return _context3.stop();
314
+ }
315
+ }, _callee3, null, [[4, 10]]);
316
+ }));
317
+ return function handleSelectClient(_x4) {
318
+ return _ref4.apply(this, arguments);
319
+ };
320
+ }();
321
+ var handleCreateItem = function handleCreateItem() {
322
+ state.action({
323
+ type: "pisell1.handleOpenAddCustomerModal",
324
+ data: {
325
+ showReceiveAddress: false,
326
+ showAcceptsMarketing: false
327
+ },
328
+ callback: function callback(customer_id) {
329
+ getClients(_objectSpread(_objectSpread({}, state.client.clientsParams), {}, {
330
+ search: "",
331
+ customer_id: customer_id,
332
+ skip: 1
333
+ }));
334
+ }
335
+ });
336
+ };
337
+ var searchChange = function searchChange(search) {
338
+ var _params = _objectSpread(_objectSpread({}, paramsRef.current), {}, {
339
+ skip: 1,
340
+ search: search
341
+ });
342
+ getClients(_objectSpread({}, _params));
343
+ };
344
+ var loadMore = useMemo(function () {
345
+ var show = state.client.clients.length < params.total || 0;
346
+ return show ? /*#__PURE__*/React.createElement("div", {
347
+ className: "",
348
+ style: {
349
+ textAlign: "center",
350
+ padding: "16px 0"
351
+ }
352
+ }, /*#__PURE__*/React.createElement(Button, {
353
+ loading: loadLoading,
354
+ onClick: function onClick() {
355
+ var _params = _objectSpread(_objectSpread({}, params), {}, {
356
+ skip: params.skip + 1
357
+ });
358
+ getClients(_objectSpread({}, _params));
359
+ }
360
+ }, locales.getText("pisell2.text.load-more"))) : null;
361
+ }, [loadLoading, params, state.client.clients.length]);
362
+ return {
363
+ setClient: setClient,
364
+ isWalkIn: isWalkIn,
365
+ handleSelectClient: handleSelectClient,
366
+ menuChange: menuChange,
367
+ handleViewClient: handleViewClient,
368
+ menus: menus,
369
+ handleCreateItem: handleCreateItem,
370
+ getClients: getClients,
371
+ params: params,
372
+ searchChange: searchChange,
373
+ loading: loading,
374
+ loadMore: loadMore,
375
+ handleOpenClientModal: handleOpenClientModal
376
+ };
377
+ };
378
+ export default useClientFn;
@@ -0,0 +1 @@
1
+ export { default as VerticalClient } from './vertical';
@@ -0,0 +1 @@
1
+ export { default as VerticalClient } from "./vertical";
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import "./SelectDrawer.less";
3
+ interface SelectDrawerProps {
4
+ autoFocus?: boolean;
5
+ onClose: () => void;
6
+ handleSelectClient: (val: any) => void;
7
+ handleCreateItem: () => void;
8
+ handleSelectPet: (val: any) => void;
9
+ childrenValue: any[];
10
+ formData: any;
11
+ searchChange: (val: string) => void;
12
+ options: any;
13
+ loading: boolean;
14
+ client: any;
15
+ loadMore: any;
16
+ showPet: boolean;
17
+ holder: any;
18
+ handleAddPet: any;
19
+ modalOpen: boolean;
20
+ }
21
+ declare const _default: React.ForwardRefExoticComponent<SelectDrawerProps & React.RefAttributes<unknown>>;
22
+ export default _default;