@pisell/private-materials 3.0.80 → 3.0.82

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 (69) 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 +0 -2
  13. package/es/components/booking/components/customSelect/index.js +1 -6
  14. package/es/components/booking/components/drawer/index.d.ts +0 -1
  15. package/es/components/booking/components/drawer/index.js +2 -4
  16. package/es/components/booking/components/footer/index.js +1 -0
  17. package/es/components/booking/info/client/index.js +0 -3
  18. package/es/components/booking/info/index.js +1 -1
  19. package/es/components/booking/info/pet/index.d.ts +1 -10
  20. package/es/components/booking/info/pet/index.js +14 -22
  21. package/es/components/booking/info/service/addService/index.d.ts +2 -2
  22. package/es/components/booking/info/service/addService/index.js +35 -35
  23. package/es/components/booking/info/utils.d.ts +0 -1
  24. package/es/components/booking/info/utils.js +0 -12
  25. package/es/components/booking/locales.d.ts +0 -6
  26. package/es/components/booking/locales.js +3 -9
  27. package/es/components/booking/model.d.ts +0 -2
  28. package/es/index.d.ts +0 -1
  29. package/es/index.js +0 -1
  30. package/lib/components/booking/components/addButton/index.js +2 -2
  31. package/lib/components/booking/components/customSelect/index.d.ts +0 -2
  32. package/lib/components/booking/components/customSelect/index.js +1 -6
  33. package/lib/components/booking/components/drawer/index.d.ts +0 -1
  34. package/lib/components/booking/components/drawer/index.js +2 -2
  35. package/lib/components/booking/components/footer/index.js +1 -0
  36. package/lib/components/booking/info/client/index.js +1 -2
  37. package/lib/components/booking/info/index.js +1 -1
  38. package/lib/components/booking/info/pet/index.d.ts +1 -10
  39. package/lib/components/booking/info/pet/index.js +8 -15
  40. package/lib/components/booking/info/service/addService/index.d.ts +2 -2
  41. package/lib/components/booking/info/service/addService/index.js +4 -2
  42. package/lib/components/booking/info/utils.d.ts +0 -1
  43. package/lib/components/booking/info/utils.js +2 -16
  44. package/lib/components/booking/locales.d.ts +0 -6
  45. package/lib/components/booking/locales.js +3 -9
  46. package/lib/components/booking/model.d.ts +0 -2
  47. package/lib/index.d.ts +0 -1
  48. package/lib/index.js +2 -5
  49. package/package.json +1 -1
  50. package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -39
  51. package/es/components/booking/info/clientVariant/hooks/useClientFn.js +0 -378
  52. package/es/components/booking/info/clientVariant/index.d.ts +0 -1
  53. package/es/components/booking/info/clientVariant/index.js +0 -1
  54. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +0 -22
  55. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +0 -321
  56. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.less +0 -66
  57. package/es/components/booking/info/clientVariant/vertical/index.d.ts +0 -8
  58. package/es/components/booking/info/clientVariant/vertical/index.js +0 -205
  59. package/es/components/booking/info/clientVariant/vertical/index.less +0 -61
  60. package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -39
  61. package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +0 -308
  62. package/lib/components/booking/info/clientVariant/index.d.ts +0 -1
  63. package/lib/components/booking/info/clientVariant/index.js +0 -39
  64. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +0 -22
  65. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +0 -344
  66. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.less +0 -66
  67. package/lib/components/booking/info/clientVariant/vertical/index.d.ts +0 -8
  68. package/lib/components/booking/info/clientVariant/vertical/index.js +0 -230
  69. package/lib/components/booking/info/clientVariant/vertical/index.less +0 -61
@@ -1,321 +0,0 @@
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
- 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."); }
4
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
10
- function _iterableToArrayLimit(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; } }
11
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
- 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; }
13
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
- 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); }
15
- import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
16
- import Drawer from "../../../components/drawer";
17
- import { Avatar, Button, Checkbox, Empty, Input, Spin } from "antd";
18
- import SearchLg from "@pisell/icon/es/SearchLg";
19
- import { image, locales } from "@pisell/utils";
20
- import Plus from "@pisell/icon/es/Plus";
21
- import User01 from "@pisell/icon/es/User01";
22
- import { isWalkIn as getIsWalkIn } from "../../../utils";
23
- import classNames from "classnames";
24
- import "./SelectDrawer.less";
25
- import { formatAddFormValues } from "../../../forms/format";
26
- import { uniqueByField } from "../../utils";
27
- import PlusCircle from "@pisell/icon/es/PlusCircle";
28
- var ActionItem = function ActionItem(props) {
29
- return /*#__PURE__*/React.createElement("div", {
30
- className: "vertical-client-select-drawer-item-wrap",
31
- onClick: props.onClick
32
- }, /*#__PURE__*/React.createElement("span", {
33
- className: "vertical-client-item-icon-wrap"
34
- }, /*#__PURE__*/React.createElement(Plus, {
35
- style: {
36
- fontSize: 28,
37
- color: "#7F56D9"
38
- }
39
- })), /*#__PURE__*/React.createElement("span", {
40
- className: "vertical-client-item-title"
41
- }, props.title));
42
- };
43
- var Item = function Item(_ref) {
44
- var cover = _ref.cover,
45
- onClick = _ref.onClick,
46
- title = _ref.title,
47
- desc = _ref.desc,
48
- coverSize = _ref.coverSize,
49
- checked = _ref.checked;
50
- return /*#__PURE__*/React.createElement("div", {
51
- className: classNames("vertical-client-select-drawer-item-wrap", _defineProperty({}, "checked", checked)),
52
- onClick: onClick
53
- }, /*#__PURE__*/React.createElement(Avatar, {
54
- className: "pisell-lowcode__booking-client-list-item-avatar",
55
- src: image.ali(cover, 100) || undefined,
56
- size: coverSize || 56,
57
- icon: /*#__PURE__*/React.createElement(User01, {
58
- className: "pisell-lowcode__booking-client-list-item-avatar-icon"
59
- })
60
- }), /*#__PURE__*/React.createElement("div", {
61
- className: "pisell-lowcode__booking-client-list-item-info"
62
- }, /*#__PURE__*/React.createElement("div", {
63
- className: "pisell-lowcode__booking-client-list-item-info-name"
64
- }, title), /*#__PURE__*/React.createElement("div", {
65
- className: "pisell-lowcode__booking-client-list-item-info-desc"
66
- }, (desc || []).map(function (d) {
67
- return /*#__PURE__*/React.createElement("div", {
68
- className: ""
69
- }, d);
70
- }))));
71
- };
72
- var defaultArr = [];
73
- var SelectDrawer = function SelectDrawer(props, ref) {
74
- var autoFocus = props.autoFocus,
75
- onClose = props.onClose,
76
- handleSelectClient = props.handleSelectClient,
77
- handleCreateItem = props.handleCreateItem,
78
- childrenValue = props.childrenValue,
79
- handleSelectPet = props.handleSelectPet,
80
- formData = props.formData,
81
- searchChange = props.searchChange,
82
- options = props.options,
83
- loading = props.loading,
84
- holder = props.holder,
85
- client = props.client,
86
- loadMore = props.loadMore,
87
- showPet = props.showPet,
88
- handleAddPet = props.handleAddPet,
89
- modalOpen = props.modalOpen;
90
- var form = (formData === null || formData === void 0 ? void 0 : formData[0]) || {};
91
- var valList = (childrenValue === null || childrenValue === void 0 ? void 0 : childrenValue[form.id]) || defaultArr;
92
- var _useState = useState(valList),
93
- _useState2 = _slicedToArray(_useState, 2),
94
- _value = _useState2[0],
95
- setValue = _useState2[1];
96
- var clientRef = useRef();
97
- useEffect(function () {
98
- setValue(valList);
99
- }, [valList]);
100
- var searchRef = useRef();
101
-
102
- // 是否打开弹窗
103
- var _useState3 = useState(false),
104
- _useState4 = _slicedToArray(_useState3, 2),
105
- open = _useState4[0],
106
- setOpen = _useState4[1];
107
- var _useState5 = useState(""),
108
- _useState6 = _slicedToArray(_useState5, 2),
109
- search = _useState6[0],
110
- setSearch = _useState6[1];
111
- useEffect(function () {
112
- if (!modalOpen) {
113
- setOpen(false);
114
- }
115
- }, [modalOpen]);
116
- var closeDrawer = function closeDrawer() {
117
- // 关闭
118
- setOpen(false);
119
- // 清空搜索
120
- setSearch("");
121
- onClose === null || onClose === void 0 ? void 0 : onClose();
122
- };
123
- var handleOpenModal = function handleOpenModal() {
124
- setOpen(true);
125
- if (autoFocus) {
126
- setTimeout(function () {
127
- var _searchRef$current, _searchRef$current$fo;
128
- (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : (_searchRef$current$fo = _searchRef$current.focus) === null || _searchRef$current$fo === void 0 ? void 0 : _searchRef$current$fo.call(_searchRef$current);
129
- }, 400);
130
- }
131
- };
132
- useImperativeHandle(ref, function () {
133
- return {
134
- open: handleOpenModal
135
- // setValue: set_value,
136
- };
137
- });
138
-
139
- useEffect(function () {
140
- if (!open) {
141
- clientRef.current = null;
142
- }
143
- }, [open]);
144
- var getNickname = useCallback(function (item) {
145
- if (getIsWalkIn(item === null || item === void 0 ? void 0 : item.id)) {
146
- return locales.getText("pisell2.text.select-a-customer");
147
- }
148
- return item.name || (item.display_name || "").trim() || (item.nickname || "").trim() || "";
149
- }, [locales.localeMap]);
150
- var handleAddClient = function handleAddClient() {
151
- handleCreateItem();
152
- };
153
- var handleChildrenValueChange = function handleChildrenValueChange(value, item) {
154
- if (mode === "single") {
155
- if (!(client !== null && client !== void 0 && client.id) || client.id === 1) {
156
- handleSelectClient([item]);
157
- }
158
- handleSelectPet(_defineProperty({}, form.id, formatAddFormValues({
159
- clientId: item === null || item === void 0 ? void 0 : item.id,
160
- value: [value],
161
- data_range: holder.data_range
162
- })));
163
- setTimeout(function () {
164
- closeDrawer();
165
- });
166
- } else {
167
- var index = _value.findIndex(function (item) {
168
- return item.id === value.id || item.form_record_id === value.id;
169
- });
170
- if (!clientRef.current) {
171
- clientRef.current = item;
172
- }
173
- if (index >= 0) {
174
- var newList = _toConsumableArray(_value);
175
- newList.splice(index, 1);
176
- setValue(formatAddFormValues({
177
- clientId: item === null || item === void 0 ? void 0 : item.id,
178
- value: newList,
179
- data_range: holder.data_range
180
- }));
181
- } else {
182
- setValue(formatAddFormValues({
183
- clientId: item === null || item === void 0 ? void 0 : item.id,
184
- value: [].concat(_toConsumableArray(_value), [value]),
185
- data_range: holder.data_range
186
- }));
187
- }
188
- }
189
- };
190
- var mode = useMemo(function () {
191
- if (["form"].includes(holder === null || holder === void 0 ? void 0 : holder.type)) {
192
- return "single";
193
- }
194
- if (["table"].includes(holder === null || holder === void 0 ? void 0 : holder.type)) {
195
- return "multiple";
196
- }
197
- return holder === null || holder === void 0 ? void 0 : holder.type;
198
- }, [holder === null || holder === void 0 ? void 0 : holder.type]);
199
- var handleOk = function handleOk() {
200
- var _holder$form;
201
- if (!(client !== null && client !== void 0 && client.id)) {
202
- handleSelectClient([clientRef.current]);
203
- }
204
- handleSelectPet(_defineProperty({}, holder === null || holder === void 0 ? void 0 : (_holder$form = holder.form) === null || _holder$form === void 0 ? void 0 : _holder$form.id, _value));
205
- closeDrawer();
206
- };
207
- var handleClientClick = function handleClientClick(item) {
208
- handleSelectClient([item]);
209
- if (mode === "multiple") {
210
- var isHasChildren = _value.some(function (val) {
211
- return item.form_record.some(function (f) {
212
- return f.id || f.form_record_id === val.id || val.form_record_id;
213
- });
214
- });
215
- handleSelectPet(_defineProperty({}, form.id, uniqueByField([].concat(_toConsumableArray(_value), _toConsumableArray(isHasChildren ? [] : formatAddFormValues({
216
- clientId: item.id,
217
- data_range: holder.data_range,
218
- value: item.form_record
219
- }))), "id")));
220
- }
221
- closeDrawer();
222
- };
223
- return /*#__PURE__*/React.createElement(Drawer, {
224
- title: locales.getText("pisell2.text.select-customer"),
225
- open: open,
226
- onClose: closeDrawer,
227
- header: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Input, {
228
- ref: searchRef,
229
- prefix: /*#__PURE__*/React.createElement(SearchLg, null),
230
- style: {
231
- margin: "16px 0",
232
- height: 44
233
- },
234
- placeholder: locales.getText("pisell2.text.search"),
235
- value: search,
236
- allowClear: true,
237
- onChange: function onChange(e) {
238
- setSearch(e.target.value);
239
- if (searchChange) {
240
- searchChange(e.target.value);
241
- }
242
- }
243
- })),
244
- width: 300
245
- // titleNoWrap={true}
246
- ,
247
- getContainer: false,
248
- destroyOnClose: true,
249
- push: {
250
- distance: 180
251
- },
252
- footer: mode === "multiple" && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
253
- block: true,
254
- type: "primary",
255
- onClick: handleOk
256
- }, locales.getText("pisell2.text.apply")))
257
- }, /*#__PURE__*/React.createElement(Spin, {
258
- spinning: loading
259
- }, /*#__PURE__*/React.createElement("div", {
260
- className: "vertical-client-select-drawer-content-wrap"
261
- }, /*#__PURE__*/React.createElement("div", {
262
- className: "vertical-client-select-drawer-top"
263
- }, /*#__PURE__*/React.createElement(ActionItem, {
264
- title: locales.getText("pisell2.text.create-new-customer"),
265
- onClick: handleAddClient
266
- }), /*#__PURE__*/React.createElement(ActionItem, {
267
- title: "Walk-In",
268
- onClick: function onClick() {
269
- handleSelectClient([]);
270
- closeDrawer();
271
- }
272
- })), !!options.length ? options.map(function (item) {
273
- var _holder$form2;
274
- return /*#__PURE__*/React.createElement("div", {
275
- className: "vertical-client-select-drawer-content-item",
276
- key: item.id
277
- }, /*#__PURE__*/React.createElement(Item, {
278
- onClick: function onClick() {
279
- return handleClientClick(item);
280
- },
281
- cover: item.cover,
282
- title: getNickname(item),
283
- desc: [item.email, item.phone],
284
- checked: item.id === client.id
285
- }), showPet && /*#__PURE__*/React.createElement("div", {
286
- className: "vertical-client-select-drawer-content-item-children"
287
- }, ((item === null || item === void 0 ? void 0 : item.form_record) || []).map(function (f) {
288
- var checked = _value.some(function (item) {
289
- return item.id === f.id || item.form_record_id === f.id;
290
- });
291
- return /*#__PURE__*/React.createElement("div", {
292
- onClick: function onClick() {
293
- handleChildrenValueChange(f, item);
294
- },
295
- id: "".concat(f.id),
296
- key: f.id,
297
- className: classNames("vertical-client-select-drawer-content-item-children-item", _defineProperty({}, "checked", checked))
298
- }, mode === "multiple" && /*#__PURE__*/React.createElement(Checkbox, {
299
- checked: checked
300
- }), /*#__PURE__*/React.createElement(Item, {
301
- coverSize: 48,
302
- title: f.main_field
303
- }));
304
- }), /*#__PURE__*/React.createElement("div", {
305
- className: "pisell-lowcode__custom-select-create",
306
- onClick: function onClick() {
307
- handleAddPet === null || handleAddPet === void 0 ? void 0 : handleAddPet(item);
308
- },
309
- style: {
310
- padding: 16
311
- }
312
- }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PlusCircle, {
313
- className: "pisell-lowcode__custom-select-create-icon"
314
- }), /*#__PURE__*/React.createElement("span", {
315
- className: "pisell-lowcode__custom-select-create-txt"
316
- }, "".concat(locales.getText("pisell2.text.create-new"), " ").concat(((_holder$form2 = holder.form) === null || _holder$form2 === void 0 ? void 0 : _holder$form2.title) || "-")))), /*#__PURE__*/React.createElement("div", null)));
317
- }) : /*#__PURE__*/React.createElement(Empty, {
318
- image: Empty.PRESENTED_IMAGE_SIMPLE
319
- }), /*#__PURE__*/React.createElement("div", null, loadMore))));
320
- };
321
- export default /*#__PURE__*/forwardRef(SelectDrawer);
@@ -1,66 +0,0 @@
1
- .vertical-client-select-drawer-content-wrap {
2
- padding:0 12px 12px;
3
- }
4
- .vertical-client-select-drawer-top {
5
- display: flex;
6
- flex-direction: column;
7
- gap: 24px;
8
- padding: 0 0 12px;
9
- border-bottom: 1px solid var(--Gray-200, #eaecf0);
10
- }
11
-
12
- .vertical-client-select-drawer-item-wrap {
13
- display: flex;
14
- padding: 8px 12px;
15
- align-items: center;
16
- gap: 10px;
17
- align-self: stretch;
18
- cursor: pointer;
19
- border-radius: 8px;
20
- &:checked {
21
- background: var(--Gray-true-50, #fafafa);
22
- }
23
- &:hover {
24
- background: var(--Gray-true-50, #fafafa);
25
- }
26
- .vertical-client-item-icon-wrap {
27
- display: flex;
28
- width: 56px;
29
- height: 56px;
30
- justify-content: center;
31
- align-items: center;
32
- gap: 10px;
33
- border-radius: 50px;
34
- background: var(--Primary-100, #f4ebff);
35
- }
36
- .vertical-client-item-title {
37
- color: var(--Text-Text_1, #1B1B1B);
38
- font-size: 16px;
39
- font-style: normal;
40
- font-weight: 600;
41
- line-height: 22px; /* 137.5% */
42
- }
43
- }
44
- .vertical-client-select-drawer-content-item {
45
- border-bottom: 1px solid var(--Gray-200, #eaecf0);
46
- //margin-bottom: 24px;
47
- padding: 24px 0;
48
- }
49
- .vertical-client-select-drawer-content-item-children {
50
- margin-left: 18px;
51
- display: flex;
52
- flex-direction: column;
53
- gap: 16px;
54
- .vertical-client-select-drawer-content-item-children-item {
55
- display: flex;
56
- border-radius: 8px;
57
- padding: 0 12px;
58
- cursor: pointer;
59
- &.checked {
60
- background: var(--Gray-true-50, #fafafa);
61
- }
62
- &:hover {
63
- background: var(--Gray-true-50, #fafafa);
64
- }
65
- }
66
- }
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import "./index.less";
3
- interface VerticalClientProps {
4
- globalState: any;
5
- setGlobalState: any;
6
- }
7
- declare const VerticalClient: (props: VerticalClientProps) => React.JSX.Element;
8
- export default VerticalClient;
@@ -1,205 +0,0 @@
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, { useEffect, useMemo, useRef } from "react";
14
- import User01 from "@pisell/icon/es/User01";
15
- import { Avatar, Button, Dropdown, Space } from "antd";
16
- import { image, locales } from "@pisell/utils";
17
- import { DownOutlined } from "@ant-design/icons";
18
- import useClientFn from "../hooks/useClientFn";
19
- import SelectDrawer from "./SelectDrawer";
20
- import Pet from "../../pet";
21
- import "./index.less";
22
- import useEngineContext from "../../../../../hooks/useEngineContext";
23
- var VerticalClient = function VerticalClient(props) {
24
- var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig8, _state$bookingConfig9, _state$bookingConfig10, _state$bookingConfig11, _state$client$value, _state$client$value2, _state$client$value3, _state$client$value4, _state$client$value5, _state$client$value6, _state$pet, _state$pet$value, _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2, _state$bookingConfig12, _state$client;
25
- var globalState = props.globalState,
26
- setGlobalState = props.setGlobalState;
27
- var modalRef = useRef();
28
- var state = globalState;
29
- var stateRef = useRef(state);
30
- var context = useEngineContext();
31
- stateRef.current = state;
32
- var _useClientFn = useClientFn({
33
- state: state,
34
- setGlobalState: setGlobalState,
35
- modalRef: modalRef
36
- }),
37
- isWalkIn = _useClientFn.isWalkIn,
38
- setClient = _useClientFn.setClient,
39
- handleSelectClient = _useClientFn.handleSelectClient,
40
- menuChange = _useClientFn.menuChange,
41
- handleViewClient = _useClientFn.handleViewClient,
42
- menus = _useClientFn.menus,
43
- handleCreateItem = _useClientFn.handleCreateItem,
44
- getClients = _useClientFn.getClients,
45
- params = _useClientFn.params,
46
- searchChange = _useClientFn.searchChange,
47
- loading = _useClientFn.loading,
48
- loadMore = _useClientFn.loadMore,
49
- handleOpenClientModal = _useClientFn.handleOpenClientModal;
50
- var renderList = useMemo(function () {
51
- var _list = _toConsumableArray(state.client.clients);
52
- return _list;
53
- }, [state.client.clients]);
54
- var handleClose = function handleClose() {
55
- setTimeout(function () {
56
- setClient({
57
- showModal: false
58
- });
59
- });
60
- };
61
- var petDispatch = function petDispatch(_ref) {
62
- var type = _ref.type,
63
- payload = _ref.payload;
64
- if (type === "setPet") {
65
- setGlobalState({
66
- pet: _objectSpread(_objectSpread({}, stateRef.current.pet), payload)
67
- });
68
- }
69
- };
70
- var boardConfig = useMemo(function () {
71
- var _state$bookingConfig, _state$bookingConfig$, _state$bookingConfig$2;
72
- return (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$2.appointment_subject) || {};
73
- }, [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$bookingConfig3.basic]);
74
- useEffect(function () {
75
- var _state$bookingConfig4, _state$bookingConfig5, _state$bookingConfig6, _state$bookingConfig7;
76
- if ((state === null || state === void 0 ? void 0 : (_state$bookingConfig4 = state.bookingConfig) === null || _state$bookingConfig4 === void 0 ? void 0 : (_state$bookingConfig5 = _state$bookingConfig4.config) === null || _state$bookingConfig5 === void 0 ? void 0 : (_state$bookingConfig6 = _state$bookingConfig5.basic) === null || _state$bookingConfig6 === void 0 ? void 0 : (_state$bookingConfig7 = _state$bookingConfig6.appointment_customer) === null || _state$bookingConfig7 === void 0 ? void 0 : _state$bookingConfig7.type) === "customer" && state !== null && state !== void 0 && state.modalOpen && !(state !== null && state !== void 0 && state.bookingId)) {
77
- handleOpenClientModal();
78
- }
79
- }, [state === null || state === void 0 ? void 0 : (_state$bookingConfig8 = state.bookingConfig) === null || _state$bookingConfig8 === void 0 ? void 0 : (_state$bookingConfig9 = _state$bookingConfig8.config) === null || _state$bookingConfig9 === void 0 ? void 0 : (_state$bookingConfig10 = _state$bookingConfig9.basic) === null || _state$bookingConfig10 === void 0 ? void 0 : (_state$bookingConfig11 = _state$bookingConfig10.appointment_customer) === null || _state$bookingConfig11 === void 0 ? void 0 : _state$bookingConfig11.type, state === null || state === void 0 ? void 0 : state.modalOpen]);
80
- var handleSelectPet = function handleSelectPet(val) {
81
- setGlobalState({
82
- pet: _objectSpread(_objectSpread({}, state.pet), {}, {
83
- edit: true,
84
- value: val
85
- })
86
- });
87
- };
88
- var handleOpenModal = function handleOpenModal() {
89
- handleOpenClientModal();
90
- };
91
- var handleAddPet = function handleAddPet(_client) {
92
- var _state$pet$formData;
93
- var _data = {
94
- formDataConfig: _objectSpread({}, ((_state$pet$formData = state.pet.formData) === null || _state$pet$formData === void 0 ? void 0 : _state$pet$formData[0]) || {})
95
- };
96
- _data.customerId = _client.id;
97
- state.action({
98
- type: "pisell1.goCustomFormAddData",
99
- data: _data,
100
- callback: function callback(res) {
101
- var newClients = stateRef.current.client.clients.map(function (item) {
102
- if (item.id === _client.id) {
103
- var newFormRecordObj = res.reduce(function (p, c) {
104
- return _objectSpread(_objectSpread({}, p), {}, _defineProperty({}, c.key, c.value));
105
- }, {});
106
- return _objectSpread(_objectSpread({}, item), {}, {
107
- form_record: [].concat(_toConsumableArray(item.form_record), [_objectSpread(_objectSpread({}, newFormRecordObj), {}, {
108
- id: newFormRecordObj.form_record_id,
109
- data: newFormRecordObj
110
- })])
111
- });
112
- }
113
- return item;
114
- });
115
- setClient({
116
- clients: newClients
117
- });
118
- // getClients(params);
119
- }
120
- });
121
- };
122
-
123
- return /*#__PURE__*/React.createElement("div", {
124
- className: "pisell-lowcode__booking-vertical-client-wrap"
125
- }, /*#__PURE__*/React.createElement("div", {
126
- className: "pisell-lowcode__booking-vertical-client",
127
- onClick: function onClick() {
128
- if (!isWalkIn || state !== null && state !== void 0 && state.disableEventBookingEdit) {
129
- return;
130
- }
131
- handleOpenClientModal();
132
- }
133
- }, /*#__PURE__*/React.createElement(Avatar, {
134
- className: "pisell-lowcode__booking-client-avatar",
135
- src: image.ali((_state$client$value = state.client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.cover, 100),
136
- size: 64,
137
- icon: /*#__PURE__*/React.createElement(User01, {
138
- className: "pisell-lowcode__booking-client-list-item-avatar-icon"
139
- })
140
- }), isWalkIn ? /*#__PURE__*/React.createElement("div", {
141
- className: "pisell-lowcode__booking-client-info-desc"
142
- }, /*#__PURE__*/React.createElement("div", {
143
- className: "pisell-lowcode__booking-client-title"
144
- }, locales.getText("pisell2.text.add-client")), /*#__PURE__*/React.createElement("div", {
145
- className: "pisell-lowcode__booking-client-desc-item"
146
- }, locales.getText("pisell2.text.leave-empty-for-walk-in"))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
147
- className: "pisell-lowcode__booking-client-title"
148
- }, (_state$client$value2 = state.client.value) === null || _state$client$value2 === void 0 ? void 0 : _state$client$value2.name), (_state$client$value3 = state.client.value) !== null && _state$client$value3 !== void 0 && _state$client$value3.email ? /*#__PURE__*/React.createElement("div", {
149
- className: "pisell-lowcode__booking-client-desc-item"
150
- }, (_state$client$value4 = state.client.value) === null || _state$client$value4 === void 0 ? void 0 : _state$client$value4.email) : null, (_state$client$value5 = state.client.value) !== null && _state$client$value5 !== void 0 && _state$client$value5.phone ? /*#__PURE__*/React.createElement("div", {
151
- className: "pisell-lowcode__booking-client-desc-item"
152
- }, (_state$client$value6 = state.client.value) === null || _state$client$value6 === void 0 ? void 0 : _state$client$value6.phone) : null), !isWalkIn && /*#__PURE__*/React.createElement("div", {
153
- className: "pisell-lowcode__booking-client-action-wrap"
154
- }, /*#__PURE__*/React.createElement(Dropdown, {
155
- menu: {
156
- items: menus,
157
- onClick: menuChange
158
- },
159
- placement: "bottomRight"
160
- }, /*#__PURE__*/React.createElement(Button, {
161
- onClick: function onClick(e) {
162
- return e.stopPropagation();
163
- }
164
- }, /*#__PURE__*/React.createElement(Space, null, locales.getText("pisell2.text.actions"), /*#__PURE__*/React.createElement(DownOutlined, null)))), /*#__PURE__*/React.createElement(Button, {
165
- onClick: function onClick(e) {
166
- e.stopPropagation();
167
- handleViewClient();
168
- }
169
- }, locales.getText("pisell2.text.view-profile")))), /*#__PURE__*/React.createElement("div", {
170
- className: "pisell-lowcode__booking-vertical-pet"
171
- }, !(state !== null && state !== void 0 && state.disabledEdit) ? /*#__PURE__*/React.createElement(React.Fragment, null, boardConfig.type === "form" ? /*#__PURE__*/React.createElement(Pet, {
172
- clientChangeNotSetPet: true,
173
- state: state,
174
- dispatch: petDispatch,
175
- hideTitle: !((_state$pet = state.pet) !== null && _state$pet !== void 0 && (_state$pet$value = _state$pet.value) !== null && _state$pet$value !== void 0 && _state$pet$value.length),
176
- handleOpenModal: handleOpenModal,
177
- addButtonProps: {
178
- onClick: handleOpenClientModal,
179
- style: function style(isShowSub) {
180
- return isShowSub ? {} : {
181
- display: "none"
182
- };
183
- }
184
- }
185
- }) : null) : null), /*#__PURE__*/React.createElement(SelectDrawer, {
186
- modalOpen: state.modalOpen,
187
- loading: loading,
188
- autoFocus: !(context !== null && context !== void 0 && (_context$appHelper = context.appHelper) !== null && _context$appHelper !== void 0 && (_context$appHelper$ut = _context$appHelper.utils) !== null && _context$appHelper$ut !== void 0 && (_context$appHelper$ut2 = _context$appHelper$ut.isTerminal) !== null && _context$appHelper$ut2 !== void 0 && _context$appHelper$ut2.call(_context$appHelper$ut)),
189
- ref: modalRef,
190
- onClose: handleClose,
191
- handleSelectClient: handleSelectClient,
192
- handleCreateItem: handleCreateItem,
193
- childrenValue: state.pet.value,
194
- handleSelectPet: handleSelectPet,
195
- formData: state.pet.formData,
196
- searchChange: searchChange,
197
- options: renderList,
198
- holder: state === null || state === void 0 ? void 0 : (_state$bookingConfig12 = state.bookingConfig) === null || _state$bookingConfig12 === void 0 ? void 0 : _state$bookingConfig12.holder,
199
- client: state === null || state === void 0 ? void 0 : (_state$client = state.client) === null || _state$client === void 0 ? void 0 : _state$client.value,
200
- loadMore: loadMore,
201
- showPet: (boardConfig === null || boardConfig === void 0 ? void 0 : boardConfig.type) === "form",
202
- handleAddPet: handleAddPet
203
- }));
204
- };
205
- export default VerticalClient;
@@ -1,61 +0,0 @@
1
- .pisell-lowcode__booking-vertical-client-wrap {
2
- position: relative;
3
- overflow: hidden;
4
- height: 100%;
5
- width: 100%;
6
- border-right: 1px solid var(--Gray-200, #EAECF0);
7
- background: var(--Gray-50, #F9FAFB);
8
- display: flex;
9
- flex-direction: column;
10
- .pisell-lowcode-drawer-content {
11
- border-right: 1px solid var(--Gray-200, #EAECF0);
12
- }
13
- .pisell-lowcode__booking-drawer-title-wrap {
14
- padding: 24px 24px 0;
15
- }
16
- .pisell-lowcode__booking-drawer-back {
17
- margin-right: 6px;
18
- }
19
- .pisell-lowcode__booking-drawer-back, .pisell-lowcode__booking-drawer-title {
20
- font-size: 18px;
21
- }
22
- }
23
- .pisell-lowcode__booking-vertical-client {
24
- padding: 24px 16px;
25
- display: flex;
26
- flex-direction: column;
27
- align-items: center;
28
- width: 100%;
29
- border-bottom: 1px solid var(--Gray-200, #EAECF0);
30
- .pisell-lowcode__booking-client-avatar {
31
- margin-bottom: 16px;
32
- }
33
- .pisell-lowcode__booking-client-title {
34
- color: var(--Gray-900, #101828);
35
- font-size: 16px;
36
- font-style: normal;
37
- font-weight: 600;
38
- line-height: 24px; /* 150% */
39
- text-align: center;
40
- }
41
- .pisell-lowcode__booking-client-desc-item {
42
- color: var(--Gray-400, #98A2B3);
43
- font-size: 14px;
44
- font-style: normal;
45
- font-weight: 400;
46
- line-height: 20px; /* 142.857% */
47
- text-align: center;
48
- }
49
- .pisell-lowcode__booking-client-action-wrap {
50
- display: flex;
51
- gap: 16px;
52
- justify-content: center;
53
- margin-top: 16px;
54
- }
55
- }
56
-
57
- .pisell-lowcode__booking-vertical-pet {
58
- padding: 0 24px 24px;
59
- flex:1;
60
- overflow: auto;
61
- }