@pisell/private-materials 3.0.203 → 3.0.205
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +27 -12
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +33 -18
- package/es/components/booking/components/customSelect/index.d.ts +0 -1
- package/es/components/booking/components/customSelect/index.js +2 -6
- package/es/components/booking/components/footer/amount.js +22 -46
- package/es/components/booking/components/footer/index.js +40 -84
- package/es/components/booking/components/footer/utils.js +35 -266
- package/es/components/booking/forms/model.d.ts +1 -1
- package/es/components/booking/info/addServiceVariant/index.js +1 -8
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +0 -1
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +13 -14
- package/es/components/booking/info/clientVariant/vertical/index.js +9 -124
- package/es/components/booking/info/main.js +15 -28
- package/es/components/booking/info/model.js +0 -3
- package/es/components/booking/info/pet/index.js +5 -54
- package/es/components/booking/info/service/addService/index.js +96 -187
- package/es/components/booking/info/service/addService/index.less +3 -13
- package/es/components/booking/info/service/addService/utils.d.ts +2 -12
- package/es/components/booking/info/service/addService/utils.js +26 -103
- package/es/components/booking/info/service/editService/index.js +132 -435
- package/es/components/booking/info/service/editService/index.less +13 -18
- package/es/components/booking/info/service/serve.d.ts +0 -10
- package/es/components/booking/info/service/serve.js +0 -28
- package/es/components/booking/info/utils.d.ts +0 -20
- package/es/components/booking/info/utils.js +0 -37
- package/es/components/booking/locales.d.ts +0 -66
- package/es/components/booking/locales.js +3 -81
- package/es/components/booking/model.d.ts +1 -5
- package/es/components/booking/model.js +2 -4
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +1 -1
- package/es/components/booking/payments/model.d.ts +1 -1
- package/es/components/booking/utils.d.ts +3 -12
- package/es/components/booking/utils.js +26 -143
- package/es/components/eftpos/form/index.js +12 -6
- package/es/components/eftpos/group/index.d.ts +1 -2
- package/es/components/eftpos/group/index.js +1 -2
- package/es/components/eftpos/hooks.d.ts +4 -4
- package/es/components/eftpos/index.js +2 -2
- package/es/components/eftpos/receipt/index.d.ts +24 -0
- package/es/components/eftpos/receipt/index.js +96 -0
- package/es/components/eftposPay/app.d.ts +11 -0
- package/es/components/eftposPay/app.js +173 -0
- package/es/components/eftposPay/component/fail/failCustom.js +1 -0
- package/es/components/eftposPay/component/fail/index.js +1 -0
- package/es/components/eftposPay/component/manual/index.js +4 -1
- package/es/components/eftposPay/component/step/index.d.ts +6 -6
- package/es/components/eftposPay/component/step/step.d.ts +4 -4
- package/es/components/eftposPay/const.d.ts +27 -1
- package/es/components/eftposPay/const.js +22 -0
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/device.js +2 -2
- package/es/components/eftposPay/helper.d.ts +6 -0
- package/es/components/eftposPay/helper.js +24 -4
- package/es/components/eftposPay/hooks.d.ts +2 -1
- package/es/components/eftposPay/hooks.js +22 -16
- package/es/components/eftposPay/index.d.ts +1 -1
- package/es/components/eftposPay/index.js +130 -179
- package/es/components/eftposPay/locales.d.ts +15 -0
- package/es/components/eftposPay/locales.js +15 -0
- package/es/components/eftposPay/payo/config.js +20 -8
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/eftposPay/tip.d.ts +10 -0
- package/es/components/eftposPay/tip.js +177 -0
- package/es/components/eftposPay/tip.less +9 -0
- package/es/components/eftposPay/tyro/hooks.d.ts +2 -2
- package/es/components/eftposPay/tyro/index.js +55 -22
- package/es/components/eftposPay/windcave/helper.d.ts +1 -1
- package/es/components/eftposPay/windcave/windcave.js +17 -6
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -1
- package/es/index.d.ts +0 -1
- package/es/index.js +1 -2
- package/lib/components/booking/components/customSelect/index.d.ts +0 -1
- package/lib/components/booking/components/customSelect/index.js +2 -6
- package/lib/components/booking/components/footer/amount.js +8 -27
- package/lib/components/booking/components/footer/index.js +4 -25
- package/lib/components/booking/components/footer/utils.js +35 -161
- package/lib/components/booking/forms/model.d.ts +1 -1
- package/lib/components/booking/info/addServiceVariant/index.js +0 -5
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +0 -1
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +7 -8
- package/lib/components/booking/info/clientVariant/vertical/index.js +11 -87
- package/lib/components/booking/info/main.js +9 -17
- package/lib/components/booking/info/model.js +0 -3
- package/lib/components/booking/info/pet/index.js +25 -61
- package/lib/components/booking/info/service/addService/index.js +84 -115
- package/lib/components/booking/info/service/addService/index.less +3 -13
- package/lib/components/booking/info/service/addService/utils.d.ts +2 -12
- package/lib/components/booking/info/service/addService/utils.js +10 -58
- package/lib/components/booking/info/service/editService/index.js +182 -425
- package/lib/components/booking/info/service/editService/index.less +13 -18
- package/lib/components/booking/info/service/serve.d.ts +0 -10
- package/lib/components/booking/info/service/serve.js +2 -7
- package/lib/components/booking/info/utils.d.ts +0 -20
- package/lib/components/booking/info/utils.js +0 -41
- package/lib/components/booking/locales.d.ts +0 -66
- package/lib/components/booking/locales.js +3 -69
- package/lib/components/booking/model.d.ts +1 -5
- package/lib/components/booking/model.js +2 -4
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +1 -1
- package/lib/components/booking/payments/model.d.ts +1 -1
- package/lib/components/booking/utils.d.ts +3 -12
- package/lib/components/booking/utils.js +18 -89
- package/lib/components/eftpos/form/index.js +12 -6
- package/lib/components/eftpos/group/index.d.ts +1 -2
- package/lib/components/eftpos/group/index.js +0 -1
- package/lib/components/eftpos/hooks.d.ts +4 -4
- package/lib/components/eftpos/index.js +2 -2
- package/lib/components/eftpos/receipt/index.d.ts +24 -0
- package/lib/components/eftpos/receipt/index.js +88 -0
- package/lib/components/eftposPay/app.d.ts +11 -0
- package/lib/components/eftposPay/app.js +166 -0
- package/lib/components/eftposPay/component/fail/failCustom.js +1 -1
- package/lib/components/eftposPay/component/fail/index.js +1 -1
- package/lib/components/eftposPay/component/manual/index.js +19 -5
- package/lib/components/eftposPay/component/step/index.d.ts +6 -6
- package/lib/components/eftposPay/component/step/step.d.ts +4 -4
- package/lib/components/eftposPay/const.d.ts +27 -1
- package/lib/components/eftposPay/const.js +18 -0
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/device.js +2 -2
- package/lib/components/eftposPay/helper.d.ts +6 -0
- package/lib/components/eftposPay/helper.js +29 -4
- package/lib/components/eftposPay/hooks.d.ts +2 -1
- package/lib/components/eftposPay/hooks.js +8 -2
- package/lib/components/eftposPay/index.d.ts +1 -1
- package/lib/components/eftposPay/index.js +106 -144
- package/lib/components/eftposPay/locales.d.ts +15 -0
- package/lib/components/eftposPay/locales.js +15 -0
- package/lib/components/eftposPay/payo/config.js +33 -9
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/eftposPay/tip.d.ts +10 -0
- package/lib/components/eftposPay/tip.js +159 -0
- package/lib/components/eftposPay/tip.less +9 -0
- package/lib/components/eftposPay/tyro/hooks.d.ts +2 -2
- package/lib/components/eftposPay/tyro/index.js +40 -9
- package/lib/components/eftposPay/windcave/helper.d.ts +1 -1
- package/lib/components/eftposPay/windcave/windcave.js +29 -6
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -3
- package/package.json +5 -5
- package/es/components/booking/components/footer/AppointmentProductModal/index.d.ts +0 -3
- package/es/components/booking/components/footer/AppointmentProductModal/index.js +0 -38
- package/es/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/es/components/booking/info/Provider.d.ts +0 -0
- package/es/components/booking/info/Provider.js +0 -54
- package/es/components/booking/info/dateRange/index.d.ts +0 -5
- package/es/components/booking/info/dateRange/index.js +0 -98
- package/es/components/booking/info/dateRange/index.less +0 -21
- package/es/components/booking/info/pet/ChangePetModal/index.d.ts +0 -4
- package/es/components/booking/info/pet/ChangePetModal/index.js +0 -134
- package/es/components/booking/info/pet/ChangePetModal/index.less +0 -4
- package/es/components/booking/info/service/editService/BookingList/index.d.ts +0 -5
- package/es/components/booking/info/service/editService/BookingList/index.js +0 -39
- package/es/components/booking/info/service/editService/EditTabs/index.d.ts +0 -3
- package/es/components/booking/info/service/editService/EditTabs/index.js +0 -35
- package/es/components/booking/info/service/serviceManager/distributeDiscount.d.ts +0 -11
- package/es/components/booking/info/service/serviceManager/distributeDiscount.js +0 -55
- package/es/components/booking/info/service/serviceManager/index.d.ts +0 -20
- package/es/components/booking/info/service/serviceManager/index.js +0 -277
- package/es/components/booking/info/service/serviceManager/utils.d.ts +0 -0
- package/es/components/booking/info/service/serviceManager/utils.js +0 -0
- package/es/components/booking/info/service2/Group/utils.d.ts +0 -14
- package/es/components/booking/info/service2/Group/utils.js +0 -146
- package/es/components/booking/info/service2/Lists.d.ts +0 -3
- package/es/components/booking/info/service2/Lists.js +0 -152
- package/es/components/booking/info/service2/hooks/useSelectPet.d.ts +0 -6
- package/es/components/booking/info/service2/hooks/useSelectPet.js +0 -54
- package/es/components/booking/info/service2/index.d.ts +0 -6
- package/es/components/booking/info/service2/index.js +0 -57
- package/es/components/booking/info/service2/status.d.ts +0 -31
- package/es/components/booking/info/service2/status.js +0 -78
- package/es/components/booking/info/service2/utils.d.ts +0 -237
- package/es/components/booking/info/service2/utils.js +0 -1064
- package/es/components/booking/materiels/holder/index.d.ts +0 -7
- package/es/components/booking/materiels/holder/index.js +0 -51
- package/es/components/shoppingCart/Provider.d.ts +0 -3
- package/es/components/shoppingCart/Provider.js +0 -86
- package/es/components/shoppingCart/components/Cart/Product.d.ts +0 -4
- package/es/components/shoppingCart/components/Cart/Product.js +0 -68
- package/es/components/shoppingCart/components/Cart/index.d.ts +0 -4
- package/es/components/shoppingCart/components/Cart/index.js +0 -72
- package/es/components/shoppingCart/components/Cart/index.less +0 -68
- package/es/components/shoppingCart/components/Empty/index.d.ts +0 -4
- package/es/components/shoppingCart/components/Empty/index.js +0 -14
- package/es/components/shoppingCart/components/Empty/index.less +0 -19
- package/es/components/shoppingCart/components/Render/index.d.ts +0 -4
- package/es/components/shoppingCart/components/Render/index.js +0 -69
- package/es/components/shoppingCart/components/Render/index.less +0 -2
- package/es/components/shoppingCart/components/SelectHolderModal/index.d.ts +0 -4
- package/es/components/shoppingCart/components/SelectHolderModal/index.js +0 -132
- package/es/components/shoppingCart/components/SelectHolderModal/index.less +0 -32
- package/es/components/shoppingCart/hooks/useAddService.d.ts +0 -3
- package/es/components/shoppingCart/hooks/useAddService.js +0 -23
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +0 -3
- package/es/components/shoppingCart/hooks/useClearCart.js +0 -59
- package/es/components/shoppingCart/hooks/useContext.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useContext.js +0 -5
- package/es/components/shoppingCart/index.d.ts +0 -4
- package/es/components/shoppingCart/index.js +0 -24
- package/es/components/shoppingCart/locales.d.ts +0 -33
- package/es/components/shoppingCart/locales.js +0 -38
- package/es/components/shoppingCart/mock.d.ts +0 -40
- package/es/components/shoppingCart/mock.js +0 -40
- package/es/components/shoppingCart/status.d.ts +0 -2
- package/es/components/shoppingCart/status.js +0 -22
- package/es/components/shoppingCart/type.d.ts +0 -39
- package/es/components/shoppingCart/type.js +0 -1
- package/es/components/shoppingCart/utils.d.ts +0 -63
- package/es/components/shoppingCart/utils.js +0 -116
- package/lib/components/booking/components/footer/AppointmentProductModal/index.d.ts +0 -3
- package/lib/components/booking/components/footer/AppointmentProductModal/index.js +0 -60
- package/lib/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/lib/components/booking/info/Provider.d.ts +0 -0
- package/lib/components/booking/info/Provider.js +0 -0
- package/lib/components/booking/info/dateRange/index.d.ts +0 -5
- package/lib/components/booking/info/dateRange/index.js +0 -111
- package/lib/components/booking/info/dateRange/index.less +0 -21
- package/lib/components/booking/info/pet/ChangePetModal/index.d.ts +0 -4
- package/lib/components/booking/info/pet/ChangePetModal/index.js +0 -121
- package/lib/components/booking/info/pet/ChangePetModal/index.less +0 -4
- package/lib/components/booking/info/service/editService/BookingList/index.d.ts +0 -5
- package/lib/components/booking/info/service/editService/BookingList/index.js +0 -55
- package/lib/components/booking/info/service/editService/EditTabs/index.d.ts +0 -3
- package/lib/components/booking/info/service/editService/EditTabs/index.js +0 -75
- package/lib/components/booking/info/service/serviceManager/distributeDiscount.d.ts +0 -11
- package/lib/components/booking/info/service/serviceManager/distributeDiscount.js +0 -70
- package/lib/components/booking/info/service/serviceManager/index.d.ts +0 -20
- package/lib/components/booking/info/service/serviceManager/index.js +0 -207
- package/lib/components/booking/info/service/serviceManager/utils.d.ts +0 -0
- package/lib/components/booking/info/service/serviceManager/utils.js +0 -0
- package/lib/components/booking/info/service2/Group/utils.d.ts +0 -14
- package/lib/components/booking/info/service2/Group/utils.js +0 -142
- package/lib/components/booking/info/service2/Lists.d.ts +0 -3
- package/lib/components/booking/info/service2/Lists.js +0 -115
- package/lib/components/booking/info/service2/hooks/useSelectPet.d.ts +0 -6
- package/lib/components/booking/info/service2/hooks/useSelectPet.js +0 -50
- package/lib/components/booking/info/service2/index.d.ts +0 -6
- package/lib/components/booking/info/service2/index.js +0 -75
- package/lib/components/booking/info/service2/status.d.ts +0 -31
- package/lib/components/booking/info/service2/status.js +0 -81
- package/lib/components/booking/info/service2/utils.d.ts +0 -237
- package/lib/components/booking/info/service2/utils.js +0 -678
- package/lib/components/booking/materiels/holder/index.d.ts +0 -7
- package/lib/components/booking/materiels/holder/index.js +0 -65
- package/lib/components/shoppingCart/Provider.d.ts +0 -3
- package/lib/components/shoppingCart/Provider.js +0 -110
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +0 -4
- package/lib/components/shoppingCart/components/Cart/Product.js +0 -73
- package/lib/components/shoppingCart/components/Cart/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/Cart/index.js +0 -77
- package/lib/components/shoppingCart/components/Cart/index.less +0 -68
- package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/Empty/index.js +0 -43
- package/lib/components/shoppingCart/components/Empty/index.less +0 -19
- package/lib/components/shoppingCart/components/Render/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/Render/index.js +0 -75
- package/lib/components/shoppingCart/components/Render/index.less +0 -2
- package/lib/components/shoppingCart/components/SelectHolderModal/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/SelectHolderModal/index.js +0 -124
- package/lib/components/shoppingCart/components/SelectHolderModal/index.less +0 -32
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +0 -3
- package/lib/components/shoppingCart/hooks/useAddService.js +0 -55
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +0 -3
- package/lib/components/shoppingCart/hooks/useClearCart.js +0 -66
- package/lib/components/shoppingCart/hooks/useContext.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useContext.js +0 -31
- package/lib/components/shoppingCart/index.d.ts +0 -4
- package/lib/components/shoppingCart/index.js +0 -60
- package/lib/components/shoppingCart/locales.d.ts +0 -33
- package/lib/components/shoppingCart/locales.js +0 -56
- package/lib/components/shoppingCart/mock.d.ts +0 -40
- package/lib/components/shoppingCart/mock.js +0 -76
- package/lib/components/shoppingCart/status.d.ts +0 -2
- package/lib/components/shoppingCart/status.js +0 -60
- package/lib/components/shoppingCart/type.d.ts +0 -39
- package/lib/components/shoppingCart/type.js +0 -17
- package/lib/components/shoppingCart/utils.d.ts +0 -63
- package/lib/components/shoppingCart/utils.js +0 -86
- package/lowcode/shopping-cart/meta.ts +0 -98
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
var _excluded = ["selectProps"];
|
|
2
|
-
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); }
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
import { Select } from 'antd';
|
|
6
|
-
import { Context } from "../../info/model";
|
|
7
|
-
import React, { useCallback, useMemo, useContext } from 'react';
|
|
8
|
-
import useSelectPet from "../../info/service2/hooks/useSelectPet";
|
|
9
|
-
var Holder = function Holder(props) {
|
|
10
|
-
var _state$pet;
|
|
11
|
-
var selectProps = props.selectProps,
|
|
12
|
-
resetProps = _objectWithoutProperties(props, _excluded);
|
|
13
|
-
var _useContext = useContext(Context),
|
|
14
|
-
state = _useContext.state;
|
|
15
|
-
var _useSelectPet = useSelectPet(state),
|
|
16
|
-
holderLists = _useSelectPet.holderLists;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @title: holders数据
|
|
20
|
-
* @description:
|
|
21
|
-
* @param {*} useMemo
|
|
22
|
-
* @return {*}
|
|
23
|
-
* @Author: WangHan
|
|
24
|
-
* @Date: 2024-12-02 22:30
|
|
25
|
-
*/
|
|
26
|
-
var holders = useMemo(function () {
|
|
27
|
-
var lists = holderLists === null || holderLists === void 0 ? void 0 : holderLists.filter(function (d) {
|
|
28
|
-
return (d === null || d === void 0 ? void 0 : d.id) > 0;
|
|
29
|
-
});
|
|
30
|
-
if (!(lists !== null && lists !== void 0 && lists.length)) return [];
|
|
31
|
-
return lists.map(function (d) {
|
|
32
|
-
return {
|
|
33
|
-
value: d === null || d === void 0 ? void 0 : d.id,
|
|
34
|
-
label: d === null || d === void 0 ? void 0 : d.main_field
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
}, [state === null || state === void 0 ? void 0 : (_state$pet = state.pet) === null || _state$pet === void 0 ? void 0 : _state$pet.value]);
|
|
38
|
-
var renderOptions = useCallback(function (array) {
|
|
39
|
-
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value';
|
|
40
|
-
var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'label';
|
|
41
|
-
return array.map(function (d) {
|
|
42
|
-
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
43
|
-
value: d[value],
|
|
44
|
-
key: d[value],
|
|
45
|
-
disabled: d.disabled
|
|
46
|
-
}, d[label]);
|
|
47
|
-
});
|
|
48
|
-
}, []);
|
|
49
|
-
return /*#__PURE__*/React.createElement(Select, _extends({}, selectProps, resetProps), renderOptions(holders));
|
|
50
|
-
};
|
|
51
|
-
export default Holder;
|
|
@@ -1,86 +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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
-
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."); }
|
|
4
|
-
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); }
|
|
5
|
-
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; }
|
|
6
|
-
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; } }
|
|
7
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
-
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; }
|
|
9
|
-
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; }
|
|
10
|
-
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; }
|
|
11
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
-
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); }
|
|
13
|
-
import React, { useState, createContext, useEffect } from 'react';
|
|
14
|
-
import { defaultData } from "./status";
|
|
15
|
-
import { formatState } from "./utils";
|
|
16
|
-
export var CartContext = /*#__PURE__*/createContext({});
|
|
17
|
-
export var CartProvider = function CartProvider(_ref) {
|
|
18
|
-
var children = _ref.children,
|
|
19
|
-
props = _ref.props,
|
|
20
|
-
onCard = _ref.onCard,
|
|
21
|
-
onChange = _ref.onChange,
|
|
22
|
-
onAddProduct = _ref.onAddProduct,
|
|
23
|
-
onActiveKey = _ref.onActiveKey;
|
|
24
|
-
var defaultState = _objectSpread(_objectSpread({}, defaultData), props);
|
|
25
|
-
var _useState = useState(defaultState),
|
|
26
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
-
state = _useState2[0],
|
|
28
|
-
setState = _useState2[1];
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @title: 更新数据
|
|
32
|
-
* @description:
|
|
33
|
-
* @param {any} newState
|
|
34
|
-
* @return {*}
|
|
35
|
-
* @Author: WangHan
|
|
36
|
-
* @Date: 2024-11-28 14:44
|
|
37
|
-
*/
|
|
38
|
-
var updateState = function updateState(newState) {
|
|
39
|
-
console.log(newState, 'wh_new');
|
|
40
|
-
setState(function (prevState) {
|
|
41
|
-
return _objectSpread(_objectSpread({}, prevState), newState);
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @title: 更新配置
|
|
47
|
-
* @description:
|
|
48
|
-
* @return {*}
|
|
49
|
-
* @Author: WangHan
|
|
50
|
-
* @Date: 2024-11-28 18:40
|
|
51
|
-
*/
|
|
52
|
-
useEffect(function () {
|
|
53
|
-
// 对象中是否存在开启分组参数,没有则默认true
|
|
54
|
-
var _isOpenGroup = props === null || props === void 0 ? void 0 : props.hasOwnProperty('isOpenGroup');
|
|
55
|
-
var newState = {};
|
|
56
|
-
if (props !== null && props !== void 0 && props.platform) {
|
|
57
|
-
newState['platform'] = props === null || props === void 0 ? void 0 : props.platform;
|
|
58
|
-
}
|
|
59
|
-
if (_isOpenGroup) {
|
|
60
|
-
newState['isOpenGroup'] = props === null || props === void 0 ? void 0 : props.isOpenGroup;
|
|
61
|
-
}
|
|
62
|
-
if (props !== null && props !== void 0 && props.emptyText) {
|
|
63
|
-
newState['emptyText'] = props === null || props === void 0 ? void 0 : props.emptyText;
|
|
64
|
-
}
|
|
65
|
-
if (props !== null && props !== void 0 && props.productParams) {
|
|
66
|
-
newState = _objectSpread(_objectSpread({}, newState), props === null || props === void 0 ? void 0 : props.productParams);
|
|
67
|
-
}
|
|
68
|
-
if (props !== null && props !== void 0 && props.collapseParams) {
|
|
69
|
-
newState['collapseParams'] = props === null || props === void 0 ? void 0 : props.collapseParams;
|
|
70
|
-
}
|
|
71
|
-
var params = _objectSpread(_objectSpread({}, defaultState), newState);
|
|
72
|
-
var result = _objectSpread(_objectSpread({}, params), formatState(params));
|
|
73
|
-
console.log(result, params, 'result');
|
|
74
|
-
setState(result);
|
|
75
|
-
}, [props === null || props === void 0 ? void 0 : props.platform, props === null || props === void 0 ? void 0 : props.isOpenGroup, props === null || props === void 0 ? void 0 : props.emptyText, props === null || props === void 0 ? void 0 : props.productParams, props === null || props === void 0 ? void 0 : props.collapseParams]);
|
|
76
|
-
return /*#__PURE__*/React.createElement(CartContext.Provider, {
|
|
77
|
-
value: {
|
|
78
|
-
state: state,
|
|
79
|
-
updateState: updateState,
|
|
80
|
-
onCard: onCard,
|
|
81
|
-
onChange: onChange,
|
|
82
|
-
onAddProduct: onAddProduct,
|
|
83
|
-
onActiveKey: onActiveKey
|
|
84
|
-
}
|
|
85
|
-
}, children);
|
|
86
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
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, { useMemo } from 'react';
|
|
3
|
-
import { ProductCard } from '@pisell/materials';
|
|
4
|
-
// import ProductCard from '../../../../../../materials/src/components/productCard';
|
|
5
|
-
import useClearCart from "../../hooks/useClearCart";
|
|
6
|
-
import { useContext } from "../../hooks/useContext";
|
|
7
|
-
import useAddService from "../../hooks/useAddService";
|
|
8
|
-
var Product = function Product(props) {
|
|
9
|
-
var id = props.id,
|
|
10
|
-
lists = props.lists;
|
|
11
|
-
var _useContext = useContext(),
|
|
12
|
-
state = _useContext.state,
|
|
13
|
-
_onAction = _useContext.onAction,
|
|
14
|
-
onChange = _useContext.onChange;
|
|
15
|
-
var disabledEdit = state.disabledEdit,
|
|
16
|
-
isShowPackageNote = state.isShowPackageNote,
|
|
17
|
-
isShowNote = state.isShowNote,
|
|
18
|
-
hideAddBtn = state.hideAddBtn;
|
|
19
|
-
var clearCart = useClearCart(id);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @title: 更新商品数据
|
|
23
|
-
* @description:
|
|
24
|
-
* @param {any} item
|
|
25
|
-
* @return {*}
|
|
26
|
-
* @Author: WangHan
|
|
27
|
-
* @Date: 2024-11-28 22:02
|
|
28
|
-
*/
|
|
29
|
-
var handleChange = function handleChange(item, type, other) {
|
|
30
|
-
if (disabledEdit) return;
|
|
31
|
-
onChange(item, type, other);
|
|
32
|
-
};
|
|
33
|
-
var productParams = useMemo(function () {
|
|
34
|
-
return {
|
|
35
|
-
isShowNote: isShowNote,
|
|
36
|
-
isShowPackageNote: isShowPackageNote,
|
|
37
|
-
disabledEdit: disabledEdit
|
|
38
|
-
};
|
|
39
|
-
}, [isShowNote, isShowPackageNote, disabledEdit]);
|
|
40
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
41
|
-
className: "pisell-lowcode__shopping-cart-content"
|
|
42
|
-
}, clearCart, lists === null || lists === void 0 ? void 0 : lists.map(function (item) {
|
|
43
|
-
return /*#__PURE__*/React.createElement(ProductCard, _extends({
|
|
44
|
-
key: item._id,
|
|
45
|
-
dataSource: item,
|
|
46
|
-
onAction: function onAction(e) {
|
|
47
|
-
return _onAction === null || _onAction === void 0 ? void 0 : _onAction(e);
|
|
48
|
-
},
|
|
49
|
-
onDelete: function onDelete(e) {
|
|
50
|
-
return handleChange(e, 'delete');
|
|
51
|
-
},
|
|
52
|
-
onNote: function onNote(e) {
|
|
53
|
-
return handleChange(e, 'note', {
|
|
54
|
-
note: e.note
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
|
-
onLike: function onLike(e) {
|
|
58
|
-
return handleChange(e, 'like', {
|
|
59
|
-
like_status: e.like_status
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
onCard: function onCard(e) {
|
|
63
|
-
return handleChange === null || handleChange === void 0 ? void 0 : handleChange(e, 'view');
|
|
64
|
-
}
|
|
65
|
-
}, productParams));
|
|
66
|
-
}), !hideAddBtn ? useAddService(id, 'more') : null);
|
|
67
|
-
};
|
|
68
|
-
export default Product;
|
|
@@ -1,72 +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 _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); }
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
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; }
|
|
6
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
-
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); }
|
|
8
|
-
import React, { useMemo } from 'react';
|
|
9
|
-
import classNames from 'classnames';
|
|
10
|
-
import { Collapse } from '@pisell/materials';
|
|
11
|
-
import { locales } from '@pisell/utils';
|
|
12
|
-
import Empty from "../Empty";
|
|
13
|
-
import localeTexts from "../../locales";
|
|
14
|
-
import { useContext } from "../../hooks/useContext";
|
|
15
|
-
import Product from "./Product";
|
|
16
|
-
locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
|
|
17
|
-
import "./index.less";
|
|
18
|
-
var Cart = function Cart() {
|
|
19
|
-
var _useContext = useContext(),
|
|
20
|
-
state = _useContext.state,
|
|
21
|
-
updateState = _useContext.updateState,
|
|
22
|
-
onActiveKey = _useContext.onActiveKey;
|
|
23
|
-
var platform = state.platform,
|
|
24
|
-
carts = state.carts,
|
|
25
|
-
isProductList = state.isProductList,
|
|
26
|
-
collapseParams = state.collapseParams;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @title: 折叠面板
|
|
30
|
-
* @description:
|
|
31
|
-
* @param {*} useMemo
|
|
32
|
-
* @return {*}
|
|
33
|
-
* @Author: WangHan
|
|
34
|
-
* @Date: 2024-11-27 15:01
|
|
35
|
-
*/
|
|
36
|
-
var cartsMap = useMemo(function () {
|
|
37
|
-
return carts === null || carts === void 0 ? void 0 : carts.map(function (item) {
|
|
38
|
-
var _item$products, _item$products2;
|
|
39
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
40
|
-
label: /*#__PURE__*/React.createElement("div", {
|
|
41
|
-
className: "pisell-lowcode__shopping-cart-label"
|
|
42
|
-
}, "".concat(item === null || item === void 0 ? void 0 : item.label, " ").concat(locales.getText('pisell2.text.shopping-cart.item')(item === null || item === void 0 ? void 0 : (_item$products = item.products) === null || _item$products === void 0 ? void 0 : _item$products.length))),
|
|
43
|
-
children: (item === null || item === void 0 ? void 0 : (_item$products2 = item.products) === null || _item$products2 === void 0 ? void 0 : _item$products2.length) > 0 ? /*#__PURE__*/React.createElement(Product, {
|
|
44
|
-
id: item === null || item === void 0 ? void 0 : item.key,
|
|
45
|
-
lists: item === null || item === void 0 ? void 0 : item.products
|
|
46
|
-
}) : /*#__PURE__*/React.createElement(Empty, {
|
|
47
|
-
id: item === null || item === void 0 ? void 0 : item.key
|
|
48
|
-
}),
|
|
49
|
-
showArrow: platform === 'shop'
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}, [carts, platform]);
|
|
53
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: classNames('pisell-lowcode__shopping-cart')
|
|
55
|
-
}, isProductList ? /*#__PURE__*/React.createElement(Product, {
|
|
56
|
-
id: undefined,
|
|
57
|
-
lists: state === null || state === void 0 ? void 0 : state.products
|
|
58
|
-
}) : /*#__PURE__*/React.createElement(Collapse, _extends({
|
|
59
|
-
items: cartsMap,
|
|
60
|
-
showHeader: true,
|
|
61
|
-
panelBackground: "#ffffff",
|
|
62
|
-
collapsible: platform !== 'shop' ? 'disabled' : '-',
|
|
63
|
-
accordion: platform === 'shop',
|
|
64
|
-
onChange: function onChange(key) {
|
|
65
|
-
updateState({
|
|
66
|
-
activeKey: key
|
|
67
|
-
});
|
|
68
|
-
onActiveKey(key);
|
|
69
|
-
}
|
|
70
|
-
}, collapseParams)));
|
|
71
|
-
};
|
|
72
|
-
export default Cart;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
.pisell-lowcode__shopping-cart {
|
|
2
|
-
.pisell-lowcode-collapse-content-box {
|
|
3
|
-
padding: 0 0 16px !important;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.pisell-lowcode-collapse-item {
|
|
7
|
-
.pisell-lowcode-collapse-header {
|
|
8
|
-
padding: 20px 0 !important;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
&:first-child {
|
|
12
|
-
.pisell-lowcode-collapse-header {
|
|
13
|
-
padding: 0 0 20px !important;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.pisell-lowcode__shopping-cart-content {
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
gap: 16px;
|
|
22
|
-
|
|
23
|
-
.pisell-lowcode-product-card {
|
|
24
|
-
margin-bottom: 0;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.pisell-lowcode__shopping-cart-label {
|
|
29
|
-
color: var(--Base-Black, #000);
|
|
30
|
-
font-size: 16px;
|
|
31
|
-
font-style: normal;
|
|
32
|
-
font-weight: 600;
|
|
33
|
-
line-height: 24px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.pisell-lowcode__shopping-cart-clear-btn {
|
|
37
|
-
cursor: pointer;
|
|
38
|
-
color: var(--Blue-700, #175cd3);
|
|
39
|
-
font-weight: 600;
|
|
40
|
-
line-height: 24px; /* 150% */
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
.anticon {
|
|
44
|
-
font-size: 18px;
|
|
45
|
-
margin-right: 6px;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.pisell-lowcode__shopping-cart-clear-btn-empty {
|
|
50
|
-
margin-top: 12px;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.pisell-lowcode__shopping-cart-add-service {
|
|
54
|
-
color: var(--Blue-700, #175cd3);
|
|
55
|
-
font-size: 16px;
|
|
56
|
-
font-style: normal;
|
|
57
|
-
font-weight: 400;
|
|
58
|
-
line-height: 24px;
|
|
59
|
-
display: flex;
|
|
60
|
-
align-items: center;
|
|
61
|
-
gap: 8px;
|
|
62
|
-
cursor: pointer;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.pisell-lowcode__shopping-cart-add-service-products {
|
|
66
|
-
align-items: start;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useContext } from "../../hooks/useContext";
|
|
2
|
-
import useAddService from "../../hooks/useAddService";
|
|
3
|
-
import "./index.less";
|
|
4
|
-
var Empty = function Empty(props) {
|
|
5
|
-
var _useContext = useContext(),
|
|
6
|
-
state = _useContext.state;
|
|
7
|
-
var emptyText = state.emptyText,
|
|
8
|
-
holders = state.holders,
|
|
9
|
-
hideAddBtn = state.hideAddBtn;
|
|
10
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
11
|
-
className: 'pisell-lowcode__shopping-cart-empty'
|
|
12
|
-
}, emptyText, !hideAddBtn ? useAddService(props === null || props === void 0 ? void 0 : props.id) : null);
|
|
13
|
-
};
|
|
14
|
-
export default Empty;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
.pisell-lowcode__shopping-cart-empty {
|
|
2
|
-
color: var(--Gray-500, #667085);
|
|
3
|
-
font-size: 16px;
|
|
4
|
-
font-style: normal;
|
|
5
|
-
font-weight: 400;
|
|
6
|
-
line-height: 24px;
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-direction: column;
|
|
9
|
-
align-items: center;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
// height: 380px;
|
|
12
|
-
height: 40px;
|
|
13
|
-
margin: 16px 20px 20px;
|
|
14
|
-
gap: 10px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.pisell-lowcode__shopping-cart-empty-multiple {
|
|
18
|
-
height: 40px;
|
|
19
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
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."); }
|
|
3
|
-
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); }
|
|
4
|
-
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; }
|
|
5
|
-
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; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
8
|
-
import classNames from 'classnames';
|
|
9
|
-
import { useContext } from "../../hooks/useContext";
|
|
10
|
-
import Empty from "../Empty";
|
|
11
|
-
import { formatService } from "../../utils";
|
|
12
|
-
import SelectHolderModal from "../SelectHolderModal";
|
|
13
|
-
import Cart from "../Cart";
|
|
14
|
-
import "./index.less";
|
|
15
|
-
var Content = function Content() {
|
|
16
|
-
var _useContext = useContext(),
|
|
17
|
-
state = _useContext.state,
|
|
18
|
-
onChange = _useContext.onChange;
|
|
19
|
-
var selectPetRef = useRef();
|
|
20
|
-
var _useState = useState([]),
|
|
21
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
-
pet = _useState2[0],
|
|
23
|
-
setPet = _useState2[1];
|
|
24
|
-
var isEmpty = state.isEmpty,
|
|
25
|
-
className = state.className,
|
|
26
|
-
holders = state.holders,
|
|
27
|
-
products = state.products,
|
|
28
|
-
isEdit = state.isEdit;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @title: 监听holder发生变化
|
|
32
|
-
* @description:
|
|
33
|
-
* @return {*}
|
|
34
|
-
* @Author: WangHan
|
|
35
|
-
* @Date: 2024-12-09 18:06
|
|
36
|
-
*/
|
|
37
|
-
useEffect(function () {
|
|
38
|
-
var _holders = holders === null || holders === void 0 ? void 0 : holders.filter(function (item) {
|
|
39
|
-
return (item === null || item === void 0 ? void 0 : item.key) > 0;
|
|
40
|
-
});
|
|
41
|
-
console.log(isEdit, products, _holders, pet, 'wh_holder');
|
|
42
|
-
|
|
43
|
-
// 不是编辑页面,有选择的holder,没有记录的holder,并且有商品数据
|
|
44
|
-
if (_holders !== null && _holders !== void 0 && _holders.length && !(pet !== null && pet !== void 0 && pet.length) && products !== null && products !== void 0 && products.length && !isEdit) {
|
|
45
|
-
if (_holders.length === 1) {
|
|
46
|
-
var _holders$, _holders$2;
|
|
47
|
-
// const ids = products?.map((item: any) => item?._id);
|
|
48
|
-
onChange(products, 'update_holders', (_holders$ = _holders[0]) === null || _holders$ === void 0 ? void 0 : _holders$.key);
|
|
49
|
-
return;
|
|
50
|
-
var _products = formatService(products, (_holders$2 = _holders[0]) === null || _holders$2 === void 0 ? void 0 : _holders$2.key);
|
|
51
|
-
onChange(_products);
|
|
52
|
-
} else {
|
|
53
|
-
var _selectPetRef$current, _selectPetRef$current2;
|
|
54
|
-
(_selectPetRef$current = selectPetRef.current) === null || _selectPetRef$current === void 0 ? void 0 : (_selectPetRef$current2 = _selectPetRef$current.open) === null || _selectPetRef$current2 === void 0 ? void 0 : _selectPetRef$current2.call(_selectPetRef$current, {
|
|
55
|
-
products: products,
|
|
56
|
-
holders: holders
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
setPet(_holders);
|
|
61
|
-
}, [holders]);
|
|
62
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
63
|
-
className: classNames('pisell-lowcode__shopping-cart-wrap', className)
|
|
64
|
-
}, isEmpty ? /*#__PURE__*/React.createElement(Empty, null) : /*#__PURE__*/React.createElement(Cart, null)), /*#__PURE__*/React.createElement(SelectHolderModal, {
|
|
65
|
-
ref: selectPetRef,
|
|
66
|
-
onChange: onChange
|
|
67
|
-
}));
|
|
68
|
-
};
|
|
69
|
-
export default Content;
|
|
@@ -1,132 +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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
-
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."); }
|
|
13
|
-
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); }
|
|
14
|
-
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; }
|
|
15
|
-
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; } }
|
|
16
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
import React, { forwardRef, useImperativeHandle, useState, useMemo } from 'react';
|
|
18
|
-
import { PisellModal } from '@pisell/materials';
|
|
19
|
-
import { locales } from '@pisell/utils';
|
|
20
|
-
import { formatService } from "../../utils";
|
|
21
|
-
import { Select } from 'antd';
|
|
22
|
-
import "./index.less";
|
|
23
|
-
var SelectPetModal = function SelectPetModal(_ref, ref) {
|
|
24
|
-
var onChange = _ref.onChange;
|
|
25
|
-
var _useState = useState(false),
|
|
26
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
-
open = _useState2[0],
|
|
28
|
-
setOpen = _useState2[1];
|
|
29
|
-
var _useState3 = useState(null),
|
|
30
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
31
|
-
params = _useState4[0],
|
|
32
|
-
setParams = _useState4[1];
|
|
33
|
-
useImperativeHandle(ref, function () {
|
|
34
|
-
return {
|
|
35
|
-
open: function open(_ref2) {
|
|
36
|
-
var _holders$;
|
|
37
|
-
var products = _ref2.products,
|
|
38
|
-
holders = _ref2.holders;
|
|
39
|
-
var _holders = holders === null || holders === void 0 ? void 0 : holders.filter(function (item) {
|
|
40
|
-
return item.key > 0;
|
|
41
|
-
});
|
|
42
|
-
// 将service默认的holder_id设置为当前第一个宠物的id
|
|
43
|
-
var service = formatService(products, _holders === null || _holders === void 0 ? void 0 : (_holders$ = _holders[0]) === null || _holders$ === void 0 ? void 0 : _holders$.key);
|
|
44
|
-
setParams({
|
|
45
|
-
service: service,
|
|
46
|
-
holders: _holders
|
|
47
|
-
});
|
|
48
|
-
setOpen(true);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
var handleChange = function handleChange(e, index) {
|
|
53
|
-
var _lists = _toConsumableArray(params === null || params === void 0 ? void 0 : params.service);
|
|
54
|
-
_lists[index].holder_id = e;
|
|
55
|
-
console.log(e, index, _lists, 'wh79876');
|
|
56
|
-
setParams(_objectSpread(_objectSpread({}, params), {}, {
|
|
57
|
-
service: _lists
|
|
58
|
-
}));
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @title: 弹窗内容
|
|
63
|
-
* @description:
|
|
64
|
-
* @param {*} useMemo
|
|
65
|
-
* @return {*}
|
|
66
|
-
* @Author: WangHan
|
|
67
|
-
* @Date: 2024-12-03 16:26
|
|
68
|
-
*/
|
|
69
|
-
var content = useMemo(function () {
|
|
70
|
-
var _params$holders;
|
|
71
|
-
var services = (params === null || params === void 0 ? void 0 : params.service) || [];
|
|
72
|
-
var options = params === null || params === void 0 ? void 0 : (_params$holders = params.holders) === null || _params$holders === void 0 ? void 0 : _params$holders.map(function (item) {
|
|
73
|
-
return {
|
|
74
|
-
value: item.key,
|
|
75
|
-
label: item.main_field
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
79
|
-
className: "pisell-lowcode__booking-select-pet-content"
|
|
80
|
-
}, services === null || services === void 0 ? void 0 : services.map(function (item, index) {
|
|
81
|
-
var _options$;
|
|
82
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
83
|
-
className: "pisell-lowcode__booking-select-pet-item",
|
|
84
|
-
key: item._id
|
|
85
|
-
}, /*#__PURE__*/React.createElement("span", null, " ", item.name), /*#__PURE__*/React.createElement(Select, {
|
|
86
|
-
defaultValue: (_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.value,
|
|
87
|
-
onChange: function onChange(e) {
|
|
88
|
-
return handleChange(e, index);
|
|
89
|
-
},
|
|
90
|
-
options: options,
|
|
91
|
-
popupMatchSelectWidth: false
|
|
92
|
-
}));
|
|
93
|
-
}));
|
|
94
|
-
}, [params === null || params === void 0 ? void 0 : params.service, params === null || params === void 0 ? void 0 : params.pets]);
|
|
95
|
-
var handleCancel = function handleCancel() {
|
|
96
|
-
setOpen(false);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* @title: 点击确定
|
|
101
|
-
* @description:
|
|
102
|
-
* @return {*}
|
|
103
|
-
* @Author: WangHan
|
|
104
|
-
* @Date: 2024-12-03 17:05
|
|
105
|
-
*/
|
|
106
|
-
var handleOk = function handleOk() {
|
|
107
|
-
var service = params.service;
|
|
108
|
-
var holders = service === null || service === void 0 ? void 0 : service.map(function (item) {
|
|
109
|
-
return {
|
|
110
|
-
_id: item._id,
|
|
111
|
-
holder_id: item.holder_id
|
|
112
|
-
};
|
|
113
|
-
});
|
|
114
|
-
onChange(service, 'update_holders', holders);
|
|
115
|
-
handleCancel();
|
|
116
|
-
};
|
|
117
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PisellModal, {
|
|
118
|
-
platform: 'pc',
|
|
119
|
-
open: open,
|
|
120
|
-
bodyStyle: {
|
|
121
|
-
padding: 0
|
|
122
|
-
},
|
|
123
|
-
title: locales.getText('pisell2.text.shopping-cart.select.holder.modal.title'),
|
|
124
|
-
okText: locales.getText('pisell2.text.shopping-cart.confirm'),
|
|
125
|
-
cancelText: locales.getText('pisell2.text.shopping-cart.cancel'),
|
|
126
|
-
onCancel: handleCancel,
|
|
127
|
-
onOk: handleOk,
|
|
128
|
-
destroyOnClose: true,
|
|
129
|
-
className: "pisell-lowcode__booking-select-pet-modal-wrap"
|
|
130
|
-
}, content));
|
|
131
|
-
};
|
|
132
|
-
export default /*#__PURE__*/forwardRef(SelectPetModal);
|