@pisell/private-materials 3.0.184 → 3.0.186

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 (100) 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 +11 -11
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +11 -11
  11. package/es/components/booking/addons/model.d.ts +2 -1
  12. package/es/components/booking/forms/model.d.ts +2 -1
  13. package/es/components/booking/notes/index.d.ts +1 -1
  14. package/es/components/booking/notes/model.d.ts +2 -1
  15. package/es/components/booking/payments/model.d.ts +2 -1
  16. package/es/components/index.d.ts +2 -1
  17. package/es/components/index.js +2 -1
  18. package/es/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +10 -2
  19. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +17 -1
  20. package/es/components/pay/toC/PaymentMethods/index.js +6 -1
  21. package/es/components/pay/toC/index.js +10 -2
  22. package/es/components/pisellSelectCustomerModal/CustomerCard/index.d.ts +12 -0
  23. package/es/components/pisellSelectCustomerModal/CustomerCard/index.js +71 -0
  24. package/es/components/pisellSelectCustomerModal/CustomerCard/index.less +83 -0
  25. package/es/components/pisellSelectCustomerModal/RightPanel/Add/BirthdayField/index.d.ts +3 -0
  26. package/es/components/pisellSelectCustomerModal/RightPanel/Add/BirthdayField/index.js +277 -0
  27. package/es/components/pisellSelectCustomerModal/RightPanel/Add/GenderField/index.d.ts +3 -0
  28. package/es/components/pisellSelectCustomerModal/RightPanel/Add/GenderField/index.js +17 -0
  29. package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +3 -0
  30. package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.js +57 -0
  31. package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/serve.d.ts +2 -0
  32. package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/serve.js +166 -0
  33. package/es/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +8 -0
  34. package/es/components/pisellSelectCustomerModal/RightPanel/Add/index.js +191 -0
  35. package/es/components/pisellSelectCustomerModal/RightPanel/Add/index.less +35 -0
  36. package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +13 -0
  37. package/es/components/pisellSelectCustomerModal/RightPanel/List/index.js +78 -0
  38. package/es/components/pisellSelectCustomerModal/RightPanel/List/index.less +49 -0
  39. package/es/components/pisellSelectCustomerModal/RightPanel/index.d.ts +15 -0
  40. package/es/components/pisellSelectCustomerModal/RightPanel/index.js +149 -0
  41. package/es/components/pisellSelectCustomerModal/RightPanel/index.less +43 -0
  42. package/es/components/pisellSelectCustomerModal/RightPanel/mock.d.ts +47 -0
  43. package/es/components/pisellSelectCustomerModal/RightPanel/mock.js +115 -0
  44. package/es/components/pisellSelectCustomerModal/RightPanel/serve.d.ts +3 -0
  45. package/es/components/pisellSelectCustomerModal/RightPanel/serve.js +56 -0
  46. package/es/components/pisellSelectCustomerModal/index.d.ts +16 -0
  47. package/es/components/pisellSelectCustomerModal/index.js +221 -0
  48. package/es/components/pisellSelectCustomerModal/index.less +16 -0
  49. package/es/components/pisellSelectCustomerModal/locales.d.ts +75 -0
  50. package/es/components/pisellSelectCustomerModal/locales.js +74 -0
  51. package/es/components/schedules/index.d.ts +1 -1
  52. package/es/components/schedules/model.d.ts +2 -1
  53. package/es/index.d.ts +1 -0
  54. package/es/index.js +2 -1
  55. package/lib/components/booking/addons/model.d.ts +2 -1
  56. package/lib/components/booking/forms/model.d.ts +2 -1
  57. package/lib/components/booking/notes/index.d.ts +1 -1
  58. package/lib/components/booking/notes/model.d.ts +2 -1
  59. package/lib/components/booking/payments/model.d.ts +2 -1
  60. package/lib/components/index.d.ts +2 -1
  61. package/lib/components/index.js +3 -0
  62. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/TDSPay/index.js +18 -3
  63. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +24 -0
  64. package/lib/components/pay/toC/PaymentMethods/index.js +6 -1
  65. package/lib/components/pay/toC/index.js +16 -2
  66. package/lib/components/pisellSelectCustomerModal/CustomerCard/index.d.ts +12 -0
  67. package/lib/components/pisellSelectCustomerModal/CustomerCard/index.js +99 -0
  68. package/lib/components/pisellSelectCustomerModal/CustomerCard/index.less +83 -0
  69. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/BirthdayField/index.d.ts +3 -0
  70. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/BirthdayField/index.js +256 -0
  71. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/GenderField/index.d.ts +3 -0
  72. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/GenderField/index.js +51 -0
  73. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +3 -0
  74. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.js +81 -0
  75. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/serve.d.ts +2 -0
  76. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/serve.js +193 -0
  77. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +8 -0
  78. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/index.js +200 -0
  79. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/index.less +35 -0
  80. package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +13 -0
  81. package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.js +94 -0
  82. package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.less +49 -0
  83. package/lib/components/pisellSelectCustomerModal/RightPanel/index.d.ts +15 -0
  84. package/lib/components/pisellSelectCustomerModal/RightPanel/index.js +150 -0
  85. package/lib/components/pisellSelectCustomerModal/RightPanel/index.less +43 -0
  86. package/lib/components/pisellSelectCustomerModal/RightPanel/mock.d.ts +47 -0
  87. package/lib/components/pisellSelectCustomerModal/RightPanel/mock.js +150 -0
  88. package/lib/components/pisellSelectCustomerModal/RightPanel/serve.d.ts +3 -0
  89. package/lib/components/pisellSelectCustomerModal/RightPanel/serve.js +39 -0
  90. package/lib/components/pisellSelectCustomerModal/index.d.ts +16 -0
  91. package/lib/components/pisellSelectCustomerModal/index.js +230 -0
  92. package/lib/components/pisellSelectCustomerModal/index.less +16 -0
  93. package/lib/components/pisellSelectCustomerModal/locales.d.ts +75 -0
  94. package/lib/components/pisellSelectCustomerModal/locales.js +98 -0
  95. package/lib/components/schedules/index.d.ts +1 -1
  96. package/lib/components/schedules/model.d.ts +2 -1
  97. package/lib/index.d.ts +1 -0
  98. package/lib/index.js +3 -0
  99. package/lowcode/pisell-select-customer-modal/meta.ts +80 -0
  100. package/package.json +3 -3
@@ -1,5 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { FormState } from "../model";
2
- export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
3
4
  state: FormState;
4
5
  } & {
5
6
  dispatch: (params: {
@@ -1,5 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { FormState } from "../model";
2
- export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
3
4
  state: FormState;
4
5
  } & {
5
6
  dispatch: (params: {
@@ -4,5 +4,5 @@ export interface InfoProps {
4
4
  globalState: any;
5
5
  setGlobalState: any;
6
6
  }
7
- declare const Notes: any;
7
+ declare const Notes: (props: any) => any;
8
8
  export default Notes;
@@ -1,5 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { FormState } from "../model";
2
- export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
3
4
  state: FormState;
4
5
  } & {
5
6
  dispatch: (params: {
@@ -1,5 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { FormState } from "../model";
2
- export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
3
4
  state: FormState;
4
5
  } & {
5
6
  dispatch: (params: {
@@ -9,4 +9,5 @@ import ProductExtension from './productExtension';
9
9
  import RuleSetting from './ruleSetting';
10
10
  import TaxSelect from './taxSelect';
11
11
  import ToCPay from './pay/toC';
12
- export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay };
12
+ import PisellSelectCustomerModal from './pisellSelectCustomerModal';
13
+ export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay, PisellSelectCustomerModal };
@@ -9,4 +9,5 @@ import ProductExtension from "./productExtension";
9
9
  import RuleSetting from "./ruleSetting";
10
10
  import TaxSelect from "./taxSelect";
11
11
  import ToCPay from "./pay/toC";
12
- export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay };
12
+ import PisellSelectCustomerModal from "./pisellSelectCustomerModal";
13
+ export { Login, BookingInfo, Booking, BookingNotes, BookingAddons, BookingForms, Schedules, ProductExtension, RuleSetting, TaxSelect, ToCPay, PisellSelectCustomerModal };
@@ -111,6 +111,8 @@ var TDSPay = function TDSPay(props, ref) {
111
111
  payCallback === null || payCallback === void 0 ? void 0 : payCallback({
112
112
  key: 'fail',
113
113
  data: {
114
+ res: res,
115
+ fn: '_fastPayNew1',
114
116
  message: locales.getText('tocPay.text.getParamsFail')
115
117
  }
116
118
  });
@@ -149,7 +151,11 @@ var TDSPay = function TDSPay(props, ref) {
149
151
  // 失败
150
152
  payCallback === null || payCallback === void 0 ? void 0 : payCallback({
151
153
  key: 'fail',
152
- data: _context2.t0
154
+ data: {
155
+ res: res,
156
+ fn: '_fastPayNew2',
157
+ message: locales.getText('tocPay.text.getParamsFail')
158
+ }
153
159
  });
154
160
  case 17:
155
161
  case "end":
@@ -187,7 +193,9 @@ var TDSPay = function TDSPay(props, ref) {
187
193
  payCallback === null || payCallback === void 0 ? void 0 : payCallback({
188
194
  key: 'fail',
189
195
  data: {
190
- message: locales.getText('tocPay.text.getParamsFail')
196
+ _cardInfo: _cardInfo,
197
+ message: locales.getText('tocPay.text.getParamsFail'),
198
+ fn: 'newCardPay'
191
199
  }
192
200
  });
193
201
  return;
@@ -8,6 +8,8 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
8
8
  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); } }
9
9
  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); }); }; }
10
10
  import { request } from "../../../../../utils";
11
+ import dayjs from 'dayjs';
12
+ import { sendWarningLog } from '@pisell/utils';
11
13
  import { PisellToast } from '@pisell/materials';
12
14
  import { setPayNumber } from "../../payGroup";
13
15
  var REACT_APP_API_ENV = process.env.REACT_APP_API_ENV;
@@ -29,7 +31,21 @@ var paymentInfo = {
29
31
  var paymentData = {};
30
32
  var postmessageUrl = 'merchantwarrior';
31
33
  var log = function log(data) {
32
- // warningLog('tds2', data);
34
+ var _template = {
35
+ module: module,
36
+ contents: {
37
+ path: location.href,
38
+ data: data,
39
+ date: dayjs().format('YYYY-MM-DD HH:mm')
40
+ }
41
+ };
42
+ sendWarningLog({
43
+ title: '3ds支付失败',
44
+ content: [{
45
+ key: 'res',
46
+ value: JSON.stringify(_template)
47
+ }]
48
+ });
33
49
  };
34
50
 
35
51
  /**
@@ -78,7 +78,12 @@ var PaymentMethods = function PaymentMethods(props, ref) {
78
78
  _context.prev = 10;
79
79
  _context.t0 = _context["catch"](4);
80
80
  return _context.abrupt("return", props.payCallback({
81
- key: 'fail'
81
+ key: 'fail',
82
+ data: {
83
+ err: _context.t0,
84
+ payGroup: payGroup,
85
+ fn: 'init'
86
+ }
82
87
  }));
83
88
  case 13:
84
89
  if (!(waitAmount <= 0)) {
@@ -221,7 +221,11 @@ var ToCPay = function ToCPay(props, ref) {
221
221
  console.log('err', _context2.t0);
222
222
  payCallback({
223
223
  key: 'fail',
224
- data: {}
224
+ data: {
225
+ err: _context2.t0,
226
+ order: order,
227
+ fn: '_getPaymentsAndWalletPass'
228
+ }
225
229
  });
226
230
  case 15:
227
231
  case "end":
@@ -319,7 +323,11 @@ var ToCPay = function ToCPay(props, ref) {
319
323
  setSubmitLoading(false);
320
324
  payCallback({
321
325
  key: 'fail',
322
- data: {}
326
+ data: {
327
+ err: _context4.t0,
328
+ orderId: orderId,
329
+ fn: 'paymentInit'
330
+ }
323
331
  });
324
332
  case 14:
325
333
  case "end":
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface CustomerCardProps {
4
+ className?: string;
5
+ onClickItem: (value?: any) => void;
6
+ customer?: any;
7
+ showIcon?: boolean;
8
+ onRemove?: (value?: any) => void;
9
+ customIcon?: React.ReactNode;
10
+ }
11
+ declare const CustomerCard: ({ onClickItem, customer, showIcon, customIcon, onRemove, className, }: CustomerCardProps) => React.JSX.Element;
12
+ export default CustomerCard;
@@ -0,0 +1,71 @@
1
+ import React, { useMemo } from 'react';
2
+ import { Avatar } from 'antd';
3
+ import PlusCircle from '@pisell/icon/es/PlusCircle';
4
+ import XCircle from '@pisell/icon/es/XCircle';
5
+ import { image, locales } from '@pisell/utils';
6
+ import "./index.less";
7
+ import classNames from 'classnames';
8
+ var CustomerCard = function CustomerCard(_ref) {
9
+ var onClickItem = _ref.onClickItem,
10
+ customer = _ref.customer,
11
+ _ref$showIcon = _ref.showIcon,
12
+ showIcon = _ref$showIcon === void 0 ? true : _ref$showIcon,
13
+ customIcon = _ref.customIcon,
14
+ onRemove = _ref.onRemove,
15
+ className = _ref.className;
16
+ var username = useMemo(function () {
17
+ if (!customer) {
18
+ return 'Walk-in';
19
+ }
20
+ var firstLastName = customer.first_name || customer.last_name ? "".concat(customer.first_name, " ").concat(customer.last_name) : '';
21
+ return customer.name || (customer.display_name || '').trim() || (customer.nickname || '').trim() || firstLastName.trim() || '';
22
+ }, [customer]);
23
+ var getAvatarName = useMemo(function () {
24
+ if (!username) return '';
25
+ var parts = username.trim().split(/\s+/); // 按空格分割并去掉多余空格
26
+
27
+ if (parts.length === 1) {
28
+ return parts[0].charAt(0); // 如果只有一个部分,返回第一个字符
29
+ }
30
+
31
+ // 如果有多个部分,返回前两个部分的首字符
32
+ return parts[0].charAt(0) + parts[1].charAt(0);
33
+ }, [username]);
34
+ return /*#__PURE__*/React.createElement("div", {
35
+ className: classNames('pisell-lowcode__customer_card', className),
36
+ onClick: function onClick() {
37
+ onClickItem(customer);
38
+ }
39
+ }, /*#__PURE__*/React.createElement(Avatar, {
40
+ className: "pisell-lowcode__customer_card-avatar",
41
+ src: customer !== null && customer !== void 0 && customer.cover ? image.ali(customer === null || customer === void 0 ? void 0 : customer.cover, 100) : undefined
42
+ // icon={<User01 className="pisell-lowcode__customer_card-avatar-icon" />}
43
+ }, getAvatarName), /*#__PURE__*/React.createElement("div", {
44
+ className: "pisell-lowcode__customer_card-info"
45
+ }, /*#__PURE__*/React.createElement("div", {
46
+ className: "pisell-lowcode__customer_card-info-left"
47
+ }, /*#__PURE__*/React.createElement("div", {
48
+ className: "pisell-lowcode__customer_card-info-name"
49
+ }, username), !customer ? /*#__PURE__*/React.createElement("div", {
50
+ className: "pisell-lowcode__customer_card-info-desc"
51
+ }, locales.getText('pisell2.text.leave-empty-for-walk-in')) : /*#__PURE__*/React.createElement(React.Fragment, null, customer !== null && customer !== void 0 && customer.email ? /*#__PURE__*/React.createElement("div", {
52
+ className: "pisell-lowcode__customer_card-info-email"
53
+ }, customer === null || customer === void 0 ? void 0 : customer.email) : null, customer !== null && customer !== void 0 && customer.phone ? /*#__PURE__*/React.createElement("div", {
54
+ className: "pisell-lowcode__customer_card-info-phone"
55
+ }, customer === null || customer === void 0 ? void 0 : customer.phone) : null)), showIcon ? /*#__PURE__*/React.createElement("div", {
56
+ className: "pisell-lowcode__customer_card-info-right",
57
+ onClick: function onClick(e) {
58
+ if (!customer) {
59
+ return;
60
+ }
61
+ e.preventDefault();
62
+ e.stopPropagation();
63
+ onRemove === null || onRemove === void 0 ? void 0 : onRemove();
64
+ }
65
+ }, customIcon ? customIcon : customer ? /*#__PURE__*/React.createElement(XCircle, {
66
+ className: "pisell-lowcode__customer_card-add-icon"
67
+ }) : /*#__PURE__*/React.createElement(PlusCircle, {
68
+ className: "pisell-lowcode__customer_card-add-icon"
69
+ })) : null));
70
+ };
71
+ export default CustomerCard;
@@ -0,0 +1,83 @@
1
+ .pisell-lowcode__customer_card {
2
+ display: flex;
3
+ width: 100%;
4
+ padding: 20px 8px;
5
+ align-items: center;
6
+ gap: 16px;
7
+ border-radius: 8px;
8
+ border: 1px solid #D5D7DA;
9
+ background: var(--base-white, #FFF);
10
+ cursor: pointer;
11
+ position: relative;
12
+ margin-bottom: 0;
13
+
14
+ .pisell-lowcode__customer_card-avatar {
15
+ display: flex;
16
+ width: 48px;
17
+ height: 48px;
18
+ padding: 16px;
19
+ justify-content: center;
20
+ align-items: center;
21
+ border-radius: 200px;
22
+ background: var(--Badge-Blue_Container, #D1E3FF);
23
+ font-weight: 600;
24
+ color: #0B5FDB;
25
+ }
26
+
27
+ .pisell-lowcode__customer_card-avatar-icon {
28
+ font-size: 24px;
29
+ color: #0B5FDB;
30
+ }
31
+
32
+
33
+ .pisell-lowcode__customer_card-info {
34
+ flex: 1;
35
+ display: flex;
36
+ align-items: center;
37
+
38
+ .pisell-lowcode__customer_card-info-left {
39
+ flex: 1;
40
+ width: 0;
41
+
42
+ .pisell-lowcode__customer_card-info-name {
43
+ color: var(--gray-900, #101828);
44
+
45
+
46
+ font-size: 16px;
47
+ font-style: normal;
48
+ font-weight: 600;
49
+ line-height: 24px;
50
+ }
51
+
52
+ .pisell-lowcode__customer_card-info-desc {
53
+ color: var(--gray-400, #98A2B3);
54
+
55
+ font-size: 14px;
56
+ font-style: normal;
57
+ font-weight: 400;
58
+ }
59
+
60
+ .pisell-lowcode__customer_card-info-email,
61
+ .pisell-lowcode__customer_card-info-phone {
62
+ color: var(--gray-400, #98A2B3);
63
+
64
+ font-size: 14px;
65
+ font-style: normal;
66
+ font-weight: 400;
67
+ }
68
+ }
69
+
70
+ .pisell-lowcode__customer_card-info-right {
71
+ width: 40px;
72
+ height: 40px;
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+
77
+ .pisell-lowcode__customer_card-add-icon {
78
+ font-size: 28px;
79
+ color: #475467;
80
+ }
81
+ }
82
+ }
83
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const DateSectionCom: ({ value, onChange, showTime, className, style, useSpace, format, itemStyle, }: any) => React.JSX.Element;
3
+ export default DateSectionCom;
@@ -0,0 +1,277 @@
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ 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."); }
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 _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; }
11
+ 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; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import React, { useEffect, useLayoutEffect, useMemo, useCallback, useState, useRef } from 'react';
14
+ import { Select, Space } from 'antd';
15
+ import debounce from 'lodash/debounce';
16
+ import dayjs from 'dayjs';
17
+ import { getUniqueId, locales } from '@pisell/utils';
18
+ var Option = Select.Option;
19
+ var getSelectInput = function getSelectInput(id) {
20
+ var input = document.getElementById(id);
21
+ if (input) {
22
+ return input;
23
+ }
24
+ };
25
+ var setSelectInputType = function setSelectInputType(_ref) {
26
+ var input = _ref.input,
27
+ type = _ref.type;
28
+ if (input) {
29
+ input.type = type;
30
+ }
31
+ };
32
+ var DateSectionCom = function DateSectionCom(_ref2) {
33
+ var value = _ref2.value,
34
+ onChange = _ref2.onChange,
35
+ showTime = _ref2.showTime,
36
+ _ref2$className = _ref2.className,
37
+ className = _ref2$className === void 0 ? '' : _ref2$className,
38
+ _ref2$style = _ref2.style,
39
+ style = _ref2$style === void 0 ? {} : _ref2$style,
40
+ _ref2$useSpace = _ref2.useSpace,
41
+ useSpace = _ref2$useSpace === void 0 ? true : _ref2$useSpace,
42
+ format = _ref2.format,
43
+ _ref2$itemStyle = _ref2.itemStyle,
44
+ itemStyle = _ref2$itemStyle === void 0 ? {
45
+ width: 100
46
+ } : _ref2$itemStyle;
47
+ var currentYear = dayjs().year();
48
+ var locale = locales.locale;
49
+ var dayRef = useRef(null);
50
+ var monthRef = useRef(null);
51
+ var yearRef = useRef(null);
52
+ var _useState = useState({
53
+ year: value ? dayjs(value).year() : null,
54
+ month: value ? dayjs(value).month() + 1 : null,
55
+ day: value ? dayjs(value).date() : null
56
+ }),
57
+ _useState2 = _slicedToArray(_useState, 2),
58
+ date = _useState2[0],
59
+ setDate = _useState2[1];
60
+ var _useState3 = useState([]),
61
+ _useState4 = _slicedToArray(_useState3, 2),
62
+ dayOptions = _useState4[0],
63
+ setDayOptions = _useState4[1];
64
+ var _useState5 = useState([]),
65
+ _useState6 = _slicedToArray(_useState5, 2),
66
+ monthOptions = _useState6[0],
67
+ setMonthOptions = _useState6[1];
68
+ var _useState7 = useState([]),
69
+ _useState8 = _slicedToArray(_useState7, 2),
70
+ yearOptions = _useState8[0],
71
+ setYearOptions = _useState8[1];
72
+ var localeMap = {
73
+ year: locales.getText('pisell2.text.date-year-text'),
74
+ month: locales.getText('pisell2.text.date-month-text'),
75
+ day: locales.getText('pisell2.text.date-day-text')
76
+ };
77
+ useEffect(function () {
78
+ setDate({
79
+ year: value ? dayjs(value).year() : null,
80
+ month: value ? dayjs(value).month() + 1 : null,
81
+ day: value ? dayjs(value).date() : null
82
+ });
83
+ }, [value]);
84
+ useEffect(function () {
85
+ setMonthOptions(renderOptions('month', 1, 12));
86
+ setYearOptions(renderOptions('year', currentYear - 100, currentYear + 50));
87
+ }, []);
88
+ useEffect(function () {
89
+ setDayOptions(renderOptions('day', 1, date.month ? getDaysInMonth(date.year || currentYear, date.month) : 31));
90
+ }, [date.month, date.year]);
91
+
92
+ /**
93
+ * @title: 下拉框变化
94
+ * @description:
95
+ * @param {any} field
96
+ * @param {any} value
97
+ * @return {*}
98
+ * @Author: chensheng.gu
99
+ * @Date: 2024-03-22 17:49
100
+ */
101
+ var handleDateChange = function handleDateChange(field, value) {
102
+ if (!value) {
103
+ return;
104
+ }
105
+ var newDate = _defineProperty({
106
+ year: date.year,
107
+ month: date.month,
108
+ day: date.day
109
+ }, field, value);
110
+ var foucsList = {
111
+ day: monthRef,
112
+ month: yearRef
113
+ };
114
+
115
+ // 如果是月份需要判断下日期
116
+ if (field === 'month' || field === 'year') {
117
+ var _newDate2, _newDate3, _newDate4;
118
+ var daysInMonth = getDaysInMonth(((_newDate2 = newDate) === null || _newDate2 === void 0 ? void 0 : _newDate2.year) || currentYear, (_newDate3 = newDate) === null || _newDate3 === void 0 ? void 0 : _newDate3.month);
119
+ var newDay = ((_newDate4 = newDate) === null || _newDate4 === void 0 ? void 0 : _newDate4.day) > daysInMonth ? daysInMonth : newDate.day;
120
+ newDate = _objectSpread(_objectSpread({}, newDate), {}, {
121
+ day: newDay
122
+ });
123
+ }
124
+ setDate(newDate);
125
+ if (foucsList[field]) {
126
+ foucsList[field].current.focus();
127
+ } else {
128
+ yearRef.current.blur();
129
+ }
130
+ var _format = format || 'YYYY-MM-DD';
131
+ if (newDate.year && newDate.month && newDate.day) {
132
+ var _date = "".concat(newDate.year, "-").concat(newDate.month.toString().padStart(2, '0'), "-").concat(newDate.day.toString().padStart(2, '0'));
133
+ onChange(dayjs(_date).format(_format));
134
+ }
135
+ };
136
+
137
+ /**
138
+ * @title: 获取日期
139
+ * @description:
140
+ * @param {any} year
141
+ * @param {any} month
142
+ * @return {*}
143
+ * @Author: chensheng.gu
144
+ * @Date: 2024-03-22 17:49
145
+ */
146
+ var getDaysInMonth = function getDaysInMonth(year, month) {
147
+ return dayjs("".concat(year, "-").concat(month), 'YYYY-MM').daysInMonth();
148
+ };
149
+
150
+ /**
151
+ * @title: 渲染下拉框列表
152
+ * @description:
153
+ * @param {any} field
154
+ * @param {any} start
155
+ * @param {any} end
156
+ * @return {*}
157
+ * @Author: chensheng.gu
158
+ * @Date: 2024-03-22 17:50
159
+ */
160
+ var renderOptions = function renderOptions(field, start, end) {
161
+ var options = [];
162
+ var _text = locale !== 'en-US' && locale !== 'en' ? localeMap[field] : '';
163
+ for (var i = start; i <= end; i++) {
164
+ options.push({
165
+ label: "".concat(i).concat(_text),
166
+ value: i
167
+ });
168
+ }
169
+ return options;
170
+ };
171
+ var selectId = useMemo(function () {
172
+ return {
173
+ dayId: getUniqueId('day'),
174
+ monthId: getUniqueId('month'),
175
+ yearId: getUniqueId('year')
176
+ };
177
+ }, []);
178
+ useLayoutEffect(function () {
179
+ setSelectInputType({
180
+ input: getSelectInput(selectId.dayId),
181
+ type: 'number'
182
+ });
183
+ setSelectInputType({
184
+ input: getSelectInput(selectId.monthId),
185
+ type: 'number'
186
+ });
187
+ setSelectInputType({
188
+ input: getSelectInput(selectId.yearId),
189
+ type: 'number'
190
+ });
191
+ }, [selectId]);
192
+ var handleDateSearch = useCallback(debounce(function (field, value) {
193
+ var dateOption = {
194
+ day: dayOptions,
195
+ month: monthOptions,
196
+ year: yearOptions
197
+ };
198
+ var _value = Number(value);
199
+ var index = dateOption[field].findIndex(function (item) {
200
+ return item.value === _value;
201
+ });
202
+ if (index !== -1) {
203
+ handleDateChange(field, _value);
204
+ } else {
205
+ handleDateChange(field, null);
206
+ }
207
+ }, 300), [dayOptions, monthOptions, yearOptions, date]);
208
+ var content = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Select, {
209
+ id: selectId.dayId,
210
+ value: date.day,
211
+ placeholder: locales.getText('pisell2.text.date-day-text'),
212
+ onChange: function onChange(value) {
213
+ return handleDateChange('day', value);
214
+ },
215
+ style: itemStyle,
216
+ showSearch: true,
217
+ onSearch: function onSearch(value) {
218
+ handleDateSearch('day', value);
219
+ },
220
+ ref: dayRef,
221
+ size: "large"
222
+ }, dayOptions.map(function (item) {
223
+ return /*#__PURE__*/React.createElement(Option, {
224
+ key: item.value,
225
+ value: item.value
226
+ }, item.label);
227
+ })), /*#__PURE__*/React.createElement(Select, {
228
+ id: selectId.monthId,
229
+ value: date.month,
230
+ placeholder: locales.getText('pisell2.text.date-month-text'),
231
+ onChange: function onChange(value) {
232
+ return handleDateChange('month', value);
233
+ },
234
+ style: itemStyle,
235
+ showSearch: true,
236
+ onSearch: function onSearch(value) {
237
+ handleDateSearch('month', value);
238
+ },
239
+ ref: monthRef,
240
+ size: "large"
241
+ }, monthOptions.map(function (item) {
242
+ return /*#__PURE__*/React.createElement(Option, {
243
+ key: item.value,
244
+ value: item.value
245
+ }, item.label);
246
+ })), /*#__PURE__*/React.createElement(Select, {
247
+ id: selectId.yearId,
248
+ value: date.year,
249
+ placeholder: locales.getText('pisell2.text.date-year-text'),
250
+ onChange: function onChange(value) {
251
+ return handleDateChange('year', value);
252
+ },
253
+ style: itemStyle,
254
+ showSearch: true,
255
+ onSearch: function onSearch(value) {
256
+ handleDateSearch('year', value);
257
+ },
258
+ ref: yearRef,
259
+ size: "large"
260
+ }, yearOptions.map(function (item) {
261
+ return /*#__PURE__*/React.createElement(Option, {
262
+ key: item.value,
263
+ value: item.value
264
+ }, item.label);
265
+ })));
266
+ if (useSpace) {
267
+ return /*#__PURE__*/React.createElement(Space, {
268
+ className: className || '',
269
+ style: style || {}
270
+ }, content);
271
+ }
272
+ return /*#__PURE__*/React.createElement("div", {
273
+ className: className || '',
274
+ style: style || {}
275
+ }, content);
276
+ };
277
+ export default DateSectionCom;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const GenderField: (props: any) => React.JSX.Element;
3
+ export default GenderField;
@@ -0,0 +1,17 @@
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 React from 'react';
3
+ import { Select } from 'antd';
4
+ import { locales } from '@pisell/utils';
5
+ var GenderField = function GenderField(props) {
6
+ return /*#__PURE__*/React.createElement(Select, _extends({
7
+ size: "large",
8
+ options: [{
9
+ label: locales.getText('pisell2.text.gender.male'),
10
+ value: '1'
11
+ }, {
12
+ label: locales.getText('pisell2.text.gender.female'),
13
+ value: '2'
14
+ }]
15
+ }, props));
16
+ };
17
+ export default GenderField;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const PhoneField: ({ value, onChange }: any) => React.JSX.Element;
3
+ export default PhoneField;