@pisell/materials 6.2.29 → 6.3.1
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 +3 -3
- package/build/lowcode/preview.js +150 -150
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +24 -28
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +25 -29
- package/dist/umd/materials.min.css +1 -0
- package/dist/umd/materials.min.js +1 -0
- package/dist/umd/static/DotsSix.57d66266.svg +1 -0
- package/dist/umd/static/arrow-left.e542294f.svg +1 -0
- package/dist/umd/static/arrow-right.763f03e0.svg +1 -0
- package/dist/umd/static/filter-lines.04a54ae9.svg +1 -0
- package/dist/umd/static/help-circle.31c9be40.svg +1 -0
- package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +1 -0
- package/es/components/DragSortList/index.js +6 -6
- package/es/components/batch-editor/index.d.ts +0 -1
- package/es/components/classicLayout/index.js +5 -4
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +0 -1
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +0 -1
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +0 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +4 -4
- package/es/components/dataSourceComponents/dataSourceWrapper/index.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/index.d.ts +6 -7
- package/es/components/date-picker/index.d.ts +0 -1
- package/es/components/filter/index.d.ts +0 -1
- package/es/components/icon/index.js +5 -5
- package/es/components/iconfont/index.js +1 -1
- package/es/components/list/index.js +6 -6
- package/es/components/page/index.d.ts +0 -1
- package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +0 -1
- package/es/components/pisellGoodPassCard/index.d.ts +0 -1
- package/es/components/pisellGoodPassCard/index.js +5 -17
- package/es/components/pisellInput/index.d.ts +0 -1
- package/es/components/pisellModal/components/IpadModal/index.d.ts +0 -1
- package/es/components/pisellModal/components/MobileModal/index.d.ts +0 -1
- package/es/components/pisellModal/components/index.d.ts +0 -1
- package/es/components/pisellToast/index.js +0 -3
- package/es/components/pisellWalletPassCard/index.d.ts +0 -1
- package/es/components/productCard/components/Header/index.js +8 -21
- package/es/components/productCard/components/Header/index.less +0 -15
- package/es/components/productCard/components/Packages/utils.d.ts +1 -1
- package/es/components/productCard/components/Sales/index.js +2 -2
- package/es/components/productCard/index.d.ts +1 -3
- package/es/components/productCard/index.js +2 -5
- package/es/components/productCard/index.less +0 -6
- package/es/components/qrcode/index.js +1 -1
- package/es/components/select-time/index.d.ts +0 -1
- package/es/components/sort/components/InlineMenu/index.js +1 -1
- package/es/components/table/Actions/component/ButtonIcon/index.js +5 -5
- package/es/components/table/Actions/component/ColumnsSetting/index.d.ts +0 -1
- package/es/components/table/Actions/component/GallerySetting/index.d.ts +0 -1
- package/es/components/table/Actions/component/Group/index.d.ts +0 -1
- package/es/components/table/Actions/component/ViewMode/index.js +1 -1
- package/es/components/table/Actions/index.d.ts +0 -1
- package/es/components/table/Gallery/components/GalleryItem/components/Cover/index.d.ts +0 -1
- package/es/components/table/Gallery/components/GalleryItem/components/RenderFields/index.js +5 -4
- package/es/components/table/Gallery/components/GalleryItem/components/Title/index.d.ts +0 -1
- package/es/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/es/components/table/Header/Buttons/index.js +5 -5
- package/es/components/table/Table/AddFieldModal/index.js +6 -6
- package/es/components/table/Table/SelectField/index.d.ts +0 -1
- package/es/components/table/Table/SelectField/index.js +4 -4
- package/es/components/table/Table/fields/date/Edit/index.js +1 -1
- package/es/components/table/Table/fields/date/index.d.ts +0 -1
- package/es/components/table/Table/fields/image/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/image/index.d.ts +0 -1
- package/es/components/table/Table/fields/index.d.ts +2 -3
- package/es/components/table/Table/fields/link/Edit/index.js +5 -5
- package/es/components/table/Table/fields/link/index.d.ts +0 -1
- package/es/components/table/Table/fields/number/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/number/index.d.ts +0 -1
- package/es/components/table/Table/fields/numberRange/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/numberRange/index.d.ts +0 -1
- package/es/components/table/Table/fields/oldRangePicker/index.d.ts +0 -1
- package/es/components/table/Table/fields/pSwitch/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/pSwitch/index.d.ts +0 -1
- package/es/components/table/Table/fields/rangePicker/filterUtil/index.js +1 -1
- package/es/components/table/Table/fields/rangePicker/index.d.ts +0 -1
- package/es/components/table/Table/fields/search/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/search/filterUtil/index.js +1 -0
- package/es/components/table/Table/fields/search/index.d.ts +0 -1
- package/es/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- package/es/components/table/Table/fields/text/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/text/Show/index.js +4 -4
- package/es/components/table/Table/fields/text/filterUtil/index.js +1 -0
- package/es/components/table/Table/fields/text/index.d.ts +0 -1
- package/es/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
- package/es/components/table/Table/tableConfig/SortRow/index.js +2 -2
- package/es/components/table/Table/tableConfig/body/CellContent/index.js +3 -3
- package/es/components/table/Table/tableConfig/body/CellProvider/index.js +8 -8
- package/es/components/table/Table/utils.d.ts +1 -1
- package/es/components/table/hooks/useMergeColumnSetting.js +2 -1
- package/es/components/table/hooks/useTransDataSourceGroupSetting.js +5 -5
- package/es/components/table/hooks/useTransFilterSetting.js +5 -5
- package/es/components/translation/utils.js +5 -5
- package/es/components/versionSelect/index.d.ts +0 -1
- package/es/components/virtual-keyboard/index.d.ts +0 -11
- package/es/components/virtual-keyboard/index.js +3 -88
- package/es/components/virtual-keyboard/index.less +1 -33
- package/es/hooks/useResponsive.js +2 -2
- package/es/utils/hoc.js +1 -1
- package/es/utils/index.d.ts +1 -1
- package/es/utils/miniRedux.js +9 -8
- package/lib/components/batch-editor/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +4 -4
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/index.d.ts +6 -7
- package/lib/components/date-picker/index.d.ts +0 -1
- package/lib/components/filter/index.d.ts +0 -1
- package/lib/components/iconfont/index.js +1 -1
- package/lib/components/lowCodePage/index.js +2 -1
- package/lib/components/page/index.d.ts +0 -1
- package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +0 -1
- package/lib/components/pisellGoodPassCard/index.d.ts +0 -1
- package/lib/components/pisellGoodPassCard/index.js +4 -31
- package/lib/components/pisellInput/index.d.ts +0 -1
- package/lib/components/pisellModal/components/IpadModal/index.d.ts +0 -1
- package/lib/components/pisellModal/components/MobileModal/index.d.ts +0 -1
- package/lib/components/pisellModal/components/index.d.ts +0 -1
- package/lib/components/pisellToast/index.js +0 -3
- package/lib/components/pisellWalletPassCard/index.d.ts +0 -1
- package/lib/components/productCard/components/Header/index.js +11 -20
- package/lib/components/productCard/components/Header/index.less +0 -15
- package/lib/components/productCard/components/Packages/utils.d.ts +1 -1
- package/lib/components/productCard/components/Sales/index.js +2 -2
- package/lib/components/productCard/index.d.ts +1 -3
- package/lib/components/productCard/index.js +2 -6
- package/lib/components/productCard/index.less +0 -6
- package/lib/components/select-time/index.d.ts +0 -1
- package/lib/components/table/Actions/component/ColumnsSetting/index.d.ts +0 -1
- package/lib/components/table/Actions/component/GallerySetting/index.d.ts +0 -1
- package/lib/components/table/Actions/component/Group/index.d.ts +0 -1
- package/lib/components/table/Actions/index.d.ts +0 -1
- package/lib/components/table/Gallery/components/GalleryItem/components/Cover/index.d.ts +0 -1
- package/lib/components/table/Gallery/components/GalleryItem/components/Title/index.d.ts +0 -1
- package/lib/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/lib/components/table/Table/SelectField/index.d.ts +0 -1
- package/lib/components/table/Table/fields/date/filterUtil/index.js +6 -3
- package/lib/components/table/Table/fields/date/index.d.ts +0 -1
- package/lib/components/table/Table/fields/image/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/image/index.d.ts +0 -1
- package/lib/components/table/Table/fields/index.d.ts +2 -3
- package/lib/components/table/Table/fields/link/index.d.ts +0 -1
- package/lib/components/table/Table/fields/number/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/number/index.d.ts +0 -1
- package/lib/components/table/Table/fields/numberRange/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/numberRange/index.d.ts +0 -1
- package/lib/components/table/Table/fields/oldRangePicker/index.d.ts +0 -1
- package/lib/components/table/Table/fields/pSwitch/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/pSwitch/index.d.ts +0 -1
- package/lib/components/table/Table/fields/rangePicker/filterUtil/index.js +8 -4
- package/lib/components/table/Table/fields/rangePicker/index.d.ts +0 -1
- package/lib/components/table/Table/fields/search/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/search/index.d.ts +0 -1
- package/lib/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- package/lib/components/table/Table/fields/text/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/text/index.d.ts +0 -1
- package/lib/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
- package/lib/components/table/Table/fields/utils/index.js +2 -1
- package/lib/components/table/Table/utils.d.ts +1 -1
- package/lib/components/versionSelect/index.d.ts +0 -1
- package/lib/components/virtual-keyboard/index.d.ts +0 -11
- package/lib/components/virtual-keyboard/index.js +2 -60
- package/lib/components/virtual-keyboard/index.less +1 -33
- package/lib/hooks/useResponsive.js +6 -3
- package/lib/utils/index.d.ts +1 -1
- package/lowcode/_setters/antd-icon-setter/index.tsx +2 -3
- package/lowcode/virtual-keyboard/meta.ts +0 -131
- package/package.json +3 -5
- package/es/components/productCard/cartSkuCard/components/basicInfo/index.d.ts +0 -21
- package/es/components/productCard/cartSkuCard/components/basicInfo/index.js +0 -73
- package/es/components/productCard/cartSkuCard/components/basicInfo/index.less +0 -113
- package/es/components/productCard/cartSkuCard/components/discountReason/index.d.ts +0 -2
- package/es/components/productCard/cartSkuCard/components/discountReason/index.js +0 -51
- package/es/components/productCard/cartSkuCard/components/holders/index.d.ts +0 -4
- package/es/components/productCard/cartSkuCard/components/holders/index.js +0 -32
- package/es/components/productCard/cartSkuCard/components/holders/index.less +0 -32
- package/es/components/productCard/cartSkuCard/components/packages/index.d.ts +0 -10
- package/es/components/productCard/cartSkuCard/components/packages/index.js +0 -52
- package/es/components/productCard/cartSkuCard/components/packages/index.less +0 -22
- package/es/components/productCard/cartSkuCard/components/packages/utils.d.ts +0 -20
- package/es/components/productCard/cartSkuCard/components/packages/utils.js +0 -40
- package/es/components/productCard/cartSkuCard/components/resources/index.d.ts +0 -4
- package/es/components/productCard/cartSkuCard/components/resources/index.js +0 -44
- package/es/components/productCard/cartSkuCard/components/resources/index.less +0 -20
- package/es/components/productCard/cartSkuCard/components/sales/index.d.ts +0 -11
- package/es/components/productCard/cartSkuCard/components/sales/index.js +0 -55
- package/es/components/productCard/cartSkuCard/components/sales/index.less +0 -22
- package/es/components/productCard/cartSkuCard/components/specs/index.d.ts +0 -3
- package/es/components/productCard/cartSkuCard/components/specs/index.js +0 -43
- package/es/components/productCard/cartSkuCard/components/specs/index.less +0 -28
- package/es/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +0 -45
- package/es/components/productCard/cartSkuCard/components/swipeAction/index.js +0 -292
- package/es/components/productCard/cartSkuCard/components/swipeAction/index.less +0 -35
- package/es/components/productCard/cartSkuCard/components/timeRange/index.d.ts +0 -7
- package/es/components/productCard/cartSkuCard/components/timeRange/index.js +0 -53
- package/es/components/productCard/cartSkuCard/components/timeRange/index.less +0 -37
- package/es/components/productCard/cartSkuCard/index.d.ts +0 -10
- package/es/components/productCard/cartSkuCard/index.js +0 -216
- package/es/components/productCard/cartSkuCard/index.less +0 -69
- package/es/components/productCard/cartSkuCard/locales.d.ts +0 -96
- package/es/components/productCard/cartSkuCard/locales.js +0 -30
- package/lib/components/productCard/cartSkuCard/components/basicInfo/index.d.ts +0 -21
- package/lib/components/productCard/cartSkuCard/components/basicInfo/index.js +0 -79
- package/lib/components/productCard/cartSkuCard/components/basicInfo/index.less +0 -113
- package/lib/components/productCard/cartSkuCard/components/discountReason/index.d.ts +0 -2
- package/lib/components/productCard/cartSkuCard/components/discountReason/index.js +0 -70
- package/lib/components/productCard/cartSkuCard/components/holders/index.d.ts +0 -4
- package/lib/components/productCard/cartSkuCard/components/holders/index.js +0 -52
- package/lib/components/productCard/cartSkuCard/components/holders/index.less +0 -32
- package/lib/components/productCard/cartSkuCard/components/packages/index.d.ts +0 -10
- package/lib/components/productCard/cartSkuCard/components/packages/index.js +0 -73
- package/lib/components/productCard/cartSkuCard/components/packages/index.less +0 -22
- package/lib/components/productCard/cartSkuCard/components/packages/utils.d.ts +0 -20
- package/lib/components/productCard/cartSkuCard/components/packages/utils.js +0 -44
- package/lib/components/productCard/cartSkuCard/components/resources/index.d.ts +0 -4
- package/lib/components/productCard/cartSkuCard/components/resources/index.js +0 -73
- package/lib/components/productCard/cartSkuCard/components/resources/index.less +0 -20
- package/lib/components/productCard/cartSkuCard/components/sales/index.d.ts +0 -11
- package/lib/components/productCard/cartSkuCard/components/sales/index.js +0 -76
- package/lib/components/productCard/cartSkuCard/components/sales/index.less +0 -22
- package/lib/components/productCard/cartSkuCard/components/specs/index.d.ts +0 -3
- package/lib/components/productCard/cartSkuCard/components/specs/index.js +0 -65
- package/lib/components/productCard/cartSkuCard/components/specs/index.less +0 -28
- package/lib/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +0 -45
- package/lib/components/productCard/cartSkuCard/components/swipeAction/index.js +0 -339
- package/lib/components/productCard/cartSkuCard/components/swipeAction/index.less +0 -35
- package/lib/components/productCard/cartSkuCard/components/timeRange/index.d.ts +0 -7
- package/lib/components/productCard/cartSkuCard/components/timeRange/index.js +0 -67
- package/lib/components/productCard/cartSkuCard/components/timeRange/index.less +0 -37
- package/lib/components/productCard/cartSkuCard/index.d.ts +0 -10
- package/lib/components/productCard/cartSkuCard/index.js +0 -234
- package/lib/components/productCard/cartSkuCard/index.less +0 -69
- package/lib/components/productCard/cartSkuCard/locales.d.ts +0 -96
- package/lib/components/productCard/cartSkuCard/locales.js +0 -61
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
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."); }
|
|
5
|
-
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); }
|
|
6
|
-
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; }
|
|
7
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
-
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; }
|
|
12
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
13
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
|
-
import { animated, useSpring } from '@react-spring/web';
|
|
15
|
-
import { useDrag } from '@use-gesture/react/dist/use-gesture-react.cjs';
|
|
16
|
-
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
17
|
-
// 本地实现的工具函数和类型
|
|
18
|
-
|
|
19
|
-
// withNativeProps 工具函数
|
|
20
|
-
function withNativeProps(props, element) {
|
|
21
|
-
var p = _objectSpread({}, element.props);
|
|
22
|
-
if (props.className) {
|
|
23
|
-
p.className = props.className + (element.props.className ? " ".concat(element.props.className) : '');
|
|
24
|
-
}
|
|
25
|
-
if (props.style) {
|
|
26
|
-
p.style = _objectSpread(_objectSpread({}, props.style), element.props.style);
|
|
27
|
-
}
|
|
28
|
-
return /*#__PURE__*/React.cloneElement(element, p);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// nearest 工具函数
|
|
32
|
-
function nearest(arr, target) {
|
|
33
|
-
return arr.reduce(function (prev, curr) {
|
|
34
|
-
return Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// mergeProps 工具函数
|
|
39
|
-
function mergeProps(a, b) {
|
|
40
|
-
return _objectSpread(_objectSpread({}, a), b);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// withStopPropagation 工具函数
|
|
44
|
-
function withStopPropagation(events, element) {
|
|
45
|
-
if (!events.includes('click')) {
|
|
46
|
-
return element;
|
|
47
|
-
}
|
|
48
|
-
var onClick = function onClick(e) {
|
|
49
|
-
var _element$props$onClic, _element$props;
|
|
50
|
-
e.stopPropagation();
|
|
51
|
-
(_element$props$onClic = (_element$props = element.props).onClick) === null || _element$props$onClic === void 0 || _element$props$onClic.call(_element$props, e);
|
|
52
|
-
};
|
|
53
|
-
return /*#__PURE__*/React.cloneElement(element, _objectSpread(_objectSpread({}, element.props), {}, {
|
|
54
|
-
onClick: onClick
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Button 组件实现
|
|
59
|
-
|
|
60
|
-
var Button = function Button(_ref) {
|
|
61
|
-
var children = _ref.children,
|
|
62
|
-
className = _ref.className,
|
|
63
|
-
style = _ref.style,
|
|
64
|
-
onClick = _ref.onClick;
|
|
65
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
66
|
-
className: className,
|
|
67
|
-
style: _objectSpread({
|
|
68
|
-
border: 'none',
|
|
69
|
-
background: (style === null || style === void 0 ? void 0 : style['--background-color']) || 'transparent'
|
|
70
|
-
}, style),
|
|
71
|
-
onClick: onClick
|
|
72
|
-
}, children);
|
|
73
|
-
};
|
|
74
|
-
import "./index.less";
|
|
75
|
-
var classPrefix = "pisell-custom-swipe-action";
|
|
76
|
-
var defaultProps = {
|
|
77
|
-
rightActions: [],
|
|
78
|
-
leftActions: [],
|
|
79
|
-
closeOnTouchOutside: true,
|
|
80
|
-
closeOnAction: true,
|
|
81
|
-
stopPropagation: []
|
|
82
|
-
};
|
|
83
|
-
export var SwipeAction = /*#__PURE__*/forwardRef(function (p, ref) {
|
|
84
|
-
var props = mergeProps(defaultProps, p);
|
|
85
|
-
var rootRef = useRef(null);
|
|
86
|
-
var leftRef = useRef(null);
|
|
87
|
-
var rightRef = useRef(null);
|
|
88
|
-
function getWidth(ref) {
|
|
89
|
-
var element = ref.current;
|
|
90
|
-
if (!element) return 0;
|
|
91
|
-
return element.offsetWidth;
|
|
92
|
-
}
|
|
93
|
-
function getLeftWidth() {
|
|
94
|
-
return getWidth(leftRef);
|
|
95
|
-
}
|
|
96
|
-
function getRightWidth() {
|
|
97
|
-
return getWidth(rightRef);
|
|
98
|
-
}
|
|
99
|
-
var _useSpring = useSpring(function () {
|
|
100
|
-
return {
|
|
101
|
-
x: 0,
|
|
102
|
-
config: {
|
|
103
|
-
tension: 200,
|
|
104
|
-
friction: 30
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
}, []),
|
|
108
|
-
_useSpring2 = _slicedToArray(_useSpring, 2),
|
|
109
|
-
x = _useSpring2[0].x,
|
|
110
|
-
api = _useSpring2[1];
|
|
111
|
-
var draggingRef = useRef(false);
|
|
112
|
-
var dragCancelRef = useRef(null);
|
|
113
|
-
function forceCancelDrag() {
|
|
114
|
-
var _dragCancelRef$curren;
|
|
115
|
-
(_dragCancelRef$curren = dragCancelRef.current) === null || _dragCancelRef$curren === void 0 || _dragCancelRef$curren.call(dragCancelRef);
|
|
116
|
-
draggingRef.current = false;
|
|
117
|
-
}
|
|
118
|
-
var bind = useDrag(function (state) {
|
|
119
|
-
dragCancelRef.current = state.cancel;
|
|
120
|
-
if (!state.intentional) return;
|
|
121
|
-
if (state.down) {
|
|
122
|
-
draggingRef.current = true;
|
|
123
|
-
}
|
|
124
|
-
if (!draggingRef.current) return;
|
|
125
|
-
var _state$offset = _slicedToArray(state.offset, 1),
|
|
126
|
-
offsetX = _state$offset[0];
|
|
127
|
-
if (state.last) {
|
|
128
|
-
var leftWidth = getLeftWidth();
|
|
129
|
-
var rightWidth = getRightWidth();
|
|
130
|
-
var position = offsetX + state.velocity[0] * state.direction[0] * 50;
|
|
131
|
-
if (offsetX > 0) {
|
|
132
|
-
position = Math.max(0, position);
|
|
133
|
-
} else if (offsetX < 0) {
|
|
134
|
-
position = Math.min(0, position);
|
|
135
|
-
} else {
|
|
136
|
-
position = 0;
|
|
137
|
-
}
|
|
138
|
-
var targetX = nearest([-rightWidth, 0, leftWidth], position);
|
|
139
|
-
api.start({
|
|
140
|
-
x: targetX
|
|
141
|
-
});
|
|
142
|
-
if (targetX !== 0) {
|
|
143
|
-
var _p$onActionsReveal;
|
|
144
|
-
(_p$onActionsReveal = p.onActionsReveal) === null || _p$onActionsReveal === void 0 || _p$onActionsReveal.call(p, targetX > 0 ? 'left' : 'right');
|
|
145
|
-
}
|
|
146
|
-
window.setTimeout(function () {
|
|
147
|
-
draggingRef.current = false;
|
|
148
|
-
});
|
|
149
|
-
} else {
|
|
150
|
-
api.start({
|
|
151
|
-
x: offsetX,
|
|
152
|
-
immediate: true
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
}, {
|
|
156
|
-
from: function from() {
|
|
157
|
-
return [x.get(), 0];
|
|
158
|
-
},
|
|
159
|
-
bounds: function bounds() {
|
|
160
|
-
var leftWidth = getLeftWidth();
|
|
161
|
-
var rightWidth = getRightWidth();
|
|
162
|
-
return {
|
|
163
|
-
left: -rightWidth,
|
|
164
|
-
right: leftWidth
|
|
165
|
-
};
|
|
166
|
-
},
|
|
167
|
-
axis: 'x',
|
|
168
|
-
preventScroll: true,
|
|
169
|
-
pointer: {
|
|
170
|
-
touch: true
|
|
171
|
-
},
|
|
172
|
-
triggerAllEvents: true
|
|
173
|
-
});
|
|
174
|
-
var close = function close() {
|
|
175
|
-
var _props$onClose;
|
|
176
|
-
api.start({
|
|
177
|
-
x: 0
|
|
178
|
-
});
|
|
179
|
-
forceCancelDrag();
|
|
180
|
-
(_props$onClose = props.onClose) === null || _props$onClose === void 0 || _props$onClose.call(props);
|
|
181
|
-
};
|
|
182
|
-
useImperativeHandle(ref, function () {
|
|
183
|
-
return {
|
|
184
|
-
show: function show() {
|
|
185
|
-
var _p$onActionsReveal2;
|
|
186
|
-
var side = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'right';
|
|
187
|
-
if (side === 'right') {
|
|
188
|
-
api.start({
|
|
189
|
-
x: -getRightWidth()
|
|
190
|
-
});
|
|
191
|
-
} else if (side === 'left') {
|
|
192
|
-
api.start({
|
|
193
|
-
x: getLeftWidth()
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
(_p$onActionsReveal2 = p.onActionsReveal) === null || _p$onActionsReveal2 === void 0 || _p$onActionsReveal2.call(p, side);
|
|
197
|
-
},
|
|
198
|
-
close: close
|
|
199
|
-
};
|
|
200
|
-
});
|
|
201
|
-
useEffect(function () {
|
|
202
|
-
if (!props.closeOnTouchOutside) return;
|
|
203
|
-
function handle(e) {
|
|
204
|
-
// 检查点击的元素或其祖先元素是否有特定 class
|
|
205
|
-
if (e.target && props.escapeDom) {
|
|
206
|
-
var container = document.querySelector(props.escapeDom);
|
|
207
|
-
if (container !== null && container !== void 0 && container.contains(e.target)) return;
|
|
208
|
-
}
|
|
209
|
-
if (x.get() === 0) {
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
var root = rootRef.current;
|
|
213
|
-
if (root && !root.contains(e.target)) {
|
|
214
|
-
close();
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
if ('ontouchstart' in window) {
|
|
218
|
-
document.addEventListener('touchstart', handle);
|
|
219
|
-
} else {
|
|
220
|
-
document.addEventListener('mousedown', handle);
|
|
221
|
-
}
|
|
222
|
-
return function () {
|
|
223
|
-
document.removeEventListener('touchstart', handle);
|
|
224
|
-
document.removeEventListener('mousedown', handle);
|
|
225
|
-
};
|
|
226
|
-
}, [props.closeOnTouchOutside, props.escapeDom]);
|
|
227
|
-
function renderAction(action) {
|
|
228
|
-
var _action$color, _colorRecord$color;
|
|
229
|
-
var color = (_action$color = action.color) !== null && _action$color !== void 0 ? _action$color : 'light';
|
|
230
|
-
var _style = action.style || {};
|
|
231
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
232
|
-
key: action.key,
|
|
233
|
-
className: "".concat(classPrefix, "-action-button"),
|
|
234
|
-
style: _objectSpread({
|
|
235
|
-
'--background-color': (_colorRecord$color = colorRecord[color]) !== null && _colorRecord$color !== void 0 ? _colorRecord$color : color
|
|
236
|
-
}, _style),
|
|
237
|
-
onClick: function onClick(e) {
|
|
238
|
-
var _action$onClick, _props$onAction;
|
|
239
|
-
if (props.closeOnAction) {
|
|
240
|
-
close();
|
|
241
|
-
}
|
|
242
|
-
(_action$onClick = action.onClick) === null || _action$onClick === void 0 || _action$onClick.call(action, e);
|
|
243
|
-
(_props$onAction = props.onAction) === null || _props$onAction === void 0 || _props$onAction.call(props, action, e);
|
|
244
|
-
}
|
|
245
|
-
}, action.text);
|
|
246
|
-
}
|
|
247
|
-
return withNativeProps(props, /*#__PURE__*/React.createElement("div", _extends({
|
|
248
|
-
className: classPrefix
|
|
249
|
-
}, bind(), {
|
|
250
|
-
ref: rootRef,
|
|
251
|
-
onClickCapture: function onClickCapture(e) {
|
|
252
|
-
if (draggingRef.current) {
|
|
253
|
-
e.stopPropagation();
|
|
254
|
-
e.preventDefault();
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}), /*#__PURE__*/React.createElement(animated.div, {
|
|
258
|
-
className: "".concat(classPrefix, "-track"),
|
|
259
|
-
style: {
|
|
260
|
-
x: x
|
|
261
|
-
}
|
|
262
|
-
}, withStopPropagation(props.stopPropagation, /*#__PURE__*/React.createElement("div", {
|
|
263
|
-
className: "".concat(classPrefix, "-actions ").concat(classPrefix, "-actions-left"),
|
|
264
|
-
ref: leftRef
|
|
265
|
-
}, props.leftActions.map(renderAction))), /*#__PURE__*/React.createElement("div", {
|
|
266
|
-
className: "".concat(classPrefix, "-content"),
|
|
267
|
-
onClickCapture: function onClickCapture(e) {
|
|
268
|
-
if (x.goal !== 0) {
|
|
269
|
-
e.preventDefault();
|
|
270
|
-
e.stopPropagation();
|
|
271
|
-
close();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}, /*#__PURE__*/React.createElement(animated.div, {
|
|
275
|
-
style: {
|
|
276
|
-
pointerEvents: x.to(function (v) {
|
|
277
|
-
return v !== 0 && x.goal !== 0 ? 'none' : 'auto';
|
|
278
|
-
})
|
|
279
|
-
}
|
|
280
|
-
}, props.children)), withStopPropagation(props.stopPropagation, /*#__PURE__*/React.createElement("div", {
|
|
281
|
-
className: "".concat(classPrefix, "-actions ").concat(classPrefix, "-actions-right"),
|
|
282
|
-
ref: rightRef
|
|
283
|
-
}, props.rightActions.map(renderAction))))));
|
|
284
|
-
});
|
|
285
|
-
var colorRecord = {
|
|
286
|
-
light: '#ccc',
|
|
287
|
-
weak: '#999',
|
|
288
|
-
primary: '#1677ff',
|
|
289
|
-
success: '#00b578',
|
|
290
|
-
warning: '#ff8f1f',
|
|
291
|
-
danger: '#ff3141'
|
|
292
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
.pisell-custom-swipe-action {
|
|
2
|
-
cursor: grab;
|
|
3
|
-
overflow: hidden;
|
|
4
|
-
touch-action: pan-y;
|
|
5
|
-
&-track {
|
|
6
|
-
position: relative;
|
|
7
|
-
overflow: visible;
|
|
8
|
-
}
|
|
9
|
-
&-content {
|
|
10
|
-
}
|
|
11
|
-
&-actions {
|
|
12
|
-
position: absolute;
|
|
13
|
-
display: flex;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
align-items: stretch;
|
|
16
|
-
width: auto;
|
|
17
|
-
white-space: nowrap;
|
|
18
|
-
&-right {
|
|
19
|
-
left: 100%;
|
|
20
|
-
top: 0;
|
|
21
|
-
height: 100%;
|
|
22
|
-
}
|
|
23
|
-
&-left {
|
|
24
|
-
right: 100%;
|
|
25
|
-
top: 0;
|
|
26
|
-
height: 100%;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
&-action-button {
|
|
30
|
-
--border-radius: 0;
|
|
31
|
-
--border-width: 0;
|
|
32
|
-
padding-left: 4px;
|
|
33
|
-
padding-right: 4px;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import Iconfont from "../../../../iconfont";
|
|
2
|
-
import React, { useEffect, useMemo } from 'react';
|
|
3
|
-
import { Divider } from 'antd';
|
|
4
|
-
import dayjs from 'dayjs';
|
|
5
|
-
import 'dayjs/locale/zh-cn';
|
|
6
|
-
import 'dayjs/locale/en';
|
|
7
|
-
import 'dayjs/locale/zh-tw';
|
|
8
|
-
import "./index.less";
|
|
9
|
-
import { PREFIX } from "../../index";
|
|
10
|
-
var localeTypes = {
|
|
11
|
-
'en-US': 'en',
|
|
12
|
-
'zh-CN': 'zh-cn',
|
|
13
|
-
'zh-HK': 'zh-tw'
|
|
14
|
-
};
|
|
15
|
-
var TimeRange = function TimeRange(props) {
|
|
16
|
-
var _props$dataSource = props.dataSource,
|
|
17
|
-
dataSource = _props$dataSource === void 0 ? {} : _props$dataSource;
|
|
18
|
-
var start_date = dataSource.start_date,
|
|
19
|
-
end_date = dataSource.end_date,
|
|
20
|
-
_dataSource$locale = dataSource.locale,
|
|
21
|
-
locale = _dataSource$locale === void 0 ? 'en-US' : _dataSource$locale;
|
|
22
|
-
if (!dayjs(start_date).isValid() || !dayjs(end_date).isValid()) return null;
|
|
23
|
-
useEffect(function () {
|
|
24
|
-
dayjs.locale(localeTypes[locale]);
|
|
25
|
-
}, [locale]);
|
|
26
|
-
var isEn = useMemo(function () {
|
|
27
|
-
return locale === 'en-US' || locale === 'en';
|
|
28
|
-
}, [locale]);
|
|
29
|
-
var _format = useMemo(function () {
|
|
30
|
-
return isEn ? 'HH:mm DD/MM/YYYY' : 'YYYY-MM-DD HH:mm';
|
|
31
|
-
}, [isEn]);
|
|
32
|
-
var renderTimeItem = function renderTimeItem(time) {
|
|
33
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
-
className: "time-range-item"
|
|
35
|
-
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
36
|
-
className: "time-icon",
|
|
37
|
-
type: "pisell2-clock"
|
|
38
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
39
|
-
className: "time-str"
|
|
40
|
-
}, dayjs(time).format(_format)));
|
|
41
|
-
};
|
|
42
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
|
|
43
|
-
style: {
|
|
44
|
-
margin: '4px 0'
|
|
45
|
-
}
|
|
46
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
47
|
-
className: "".concat(PREFIX, "__time-range")
|
|
48
|
-
}, renderTimeItem(start_date), /*#__PURE__*/React.createElement(Iconfont, {
|
|
49
|
-
className: "joint-icon",
|
|
50
|
-
type: "pisell2-arrow-right"
|
|
51
|
-
}), renderTimeItem(end_date)));
|
|
52
|
-
};
|
|
53
|
-
export default TimeRange;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
.pisell-cart-sku-card__time-range {
|
|
2
|
-
user-select: none;
|
|
3
|
-
|
|
4
|
-
display: flex;
|
|
5
|
-
align-items: center;
|
|
6
|
-
gap: 8px;
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
|
|
9
|
-
.joint-icon {
|
|
10
|
-
font-size: 16px;
|
|
11
|
-
color: #7f56da;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.time-range-item {
|
|
15
|
-
white-space: nowrap;
|
|
16
|
-
display: flex;
|
|
17
|
-
gap: 8px;
|
|
18
|
-
align-items: center;
|
|
19
|
-
overflow: hidden;
|
|
20
|
-
|
|
21
|
-
.time-icon {
|
|
22
|
-
font-size: 16px;
|
|
23
|
-
color: #7f56da;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.time-str {
|
|
27
|
-
color: #667085;
|
|
28
|
-
font-size: 14px;
|
|
29
|
-
font-weight: 400;
|
|
30
|
-
line-height: 20px;
|
|
31
|
-
display: inline-block;
|
|
32
|
-
white-space: nowrap;
|
|
33
|
-
overflow: hidden;
|
|
34
|
-
text-overflow: ellipsis;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import './index.less';
|
|
2
|
-
import { ProductCardTypes } from '../types';
|
|
3
|
-
interface ISKUCardProps extends ProductCardTypes {
|
|
4
|
-
type: 'a2' | 'a5';
|
|
5
|
-
rightActions: any[];
|
|
6
|
-
escapeDom?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const PREFIX = "pisell-cart-sku-card";
|
|
9
|
-
declare const CartSkuCard: (props: ISKUCardProps) => JSX.Element;
|
|
10
|
-
export default CartSkuCard;
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["dataSource", "isShowImage", "isShowHolder", "isShowNote", "isShowDelete", "isShowPackageNote", "isShowEditProduct", "onEditProduct", "onAction", "onDelete", "onNote", "onLike", "onCard", "onChangeResource", "onChangeHolder", "type", "rightActions", "escapeDom"];
|
|
3
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
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); }
|
|
9
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
-
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."); }
|
|
11
|
-
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); }
|
|
12
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
13
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
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 _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; }
|
|
16
|
-
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; }
|
|
17
|
-
import React, { useMemo, useRef } from 'react';
|
|
18
|
-
import classNames from 'classnames';
|
|
19
|
-
import { image as imageAli, locales } from '@pisell/utils';
|
|
20
|
-
import localeTexts from "./locales";
|
|
21
|
-
import BasicInfo from "./components/basicInfo";
|
|
22
|
-
import DiscountReason from "./components/discountReason";
|
|
23
|
-
import Holders from "./components/holders";
|
|
24
|
-
import TimeRange from "./components/timeRange";
|
|
25
|
-
import Resources from "./components/resources";
|
|
26
|
-
import Packages from "./components/packages";
|
|
27
|
-
import Sales from "./components/sales";
|
|
28
|
-
import { SwipeAction } from "./components/swipeAction";
|
|
29
|
-
import "./index.less";
|
|
30
|
-
import Iconfont from "../../iconfont";
|
|
31
|
-
import useEngineContext from "../../../hooks/useEngineContext";
|
|
32
|
-
import Items from "../components/MultiDay";
|
|
33
|
-
import AmountFooter from "../components/AmountFooter";
|
|
34
|
-
import UseOpenNote from "../hooks/useOpenNote";
|
|
35
|
-
import Note from "../components/Note";
|
|
36
|
-
import Action from "../components/Action";
|
|
37
|
-
import { defaultValue } from "../status";
|
|
38
|
-
export var PREFIX = 'pisell-cart-sku-card';
|
|
39
|
-
var CartSkuCard = function CartSkuCard(props) {
|
|
40
|
-
var _context$appHelper$ut;
|
|
41
|
-
var _props$dataSource = props.dataSource,
|
|
42
|
-
dataSource = _props$dataSource === void 0 ? defaultValue.dataSource : _props$dataSource,
|
|
43
|
-
_props$isShowImage = props.isShowImage,
|
|
44
|
-
isShowImage = _props$isShowImage === void 0 ? defaultValue.isShowImage : _props$isShowImage,
|
|
45
|
-
_props$isShowHolder = props.isShowHolder,
|
|
46
|
-
isShowHolder = _props$isShowHolder === void 0 ? defaultValue.isShowHolder : _props$isShowHolder,
|
|
47
|
-
_props$isShowNote = props.isShowNote,
|
|
48
|
-
isShowNote = _props$isShowNote === void 0 ? defaultValue.isShowNote : _props$isShowNote,
|
|
49
|
-
_props$isShowDelete = props.isShowDelete,
|
|
50
|
-
isShowDelete = _props$isShowDelete === void 0 ? defaultValue.isShowDelete : _props$isShowDelete,
|
|
51
|
-
_props$isShowPackageN = props.isShowPackageNote,
|
|
52
|
-
isShowPackageNote = _props$isShowPackageN === void 0 ? defaultValue.isShowPackageNote : _props$isShowPackageN,
|
|
53
|
-
_props$isShowEditProd = props.isShowEditProduct,
|
|
54
|
-
isShowEditProduct = _props$isShowEditProd === void 0 ? defaultValue.isShowEditProduct : _props$isShowEditProd,
|
|
55
|
-
onEditProduct = props.onEditProduct,
|
|
56
|
-
_onAction = props.onAction,
|
|
57
|
-
onDelete = props.onDelete,
|
|
58
|
-
onNote = props.onNote,
|
|
59
|
-
onLike = props.onLike,
|
|
60
|
-
onCard = props.onCard,
|
|
61
|
-
onChangeResource = props.onChangeResource,
|
|
62
|
-
onChangeHolder = props.onChangeHolder,
|
|
63
|
-
type = props.type,
|
|
64
|
-
_props$rightActions = props.rightActions,
|
|
65
|
-
rightActions = _props$rightActions === void 0 ? [] : _props$rightActions,
|
|
66
|
-
escapeDom = props.escapeDom,
|
|
67
|
-
other = _objectWithoutProperties(props, _excluded);
|
|
68
|
-
var useOpenNoteRef = useRef();
|
|
69
|
-
var context = useEngineContext();
|
|
70
|
-
locales.init(localeTexts, ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut = _context$appHelper$ut.storage) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.get('umi_locale')) || 'en');
|
|
71
|
-
console.log('prodcut props', props);
|
|
72
|
-
var isShowAction = dataSource.isShowAction,
|
|
73
|
-
actionText = dataSource.actionText;
|
|
74
|
-
var _rightActions = useMemo(function () {
|
|
75
|
-
var deleteAction = {
|
|
76
|
-
key: 'delete',
|
|
77
|
-
text: /*#__PURE__*/React.createElement("div", {
|
|
78
|
-
style: {
|
|
79
|
-
display: 'flex',
|
|
80
|
-
justifyContent: 'center',
|
|
81
|
-
alignItems: 'center',
|
|
82
|
-
color: 'white',
|
|
83
|
-
cursor: 'pointer',
|
|
84
|
-
padding: '10px 0px'
|
|
85
|
-
}
|
|
86
|
-
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
87
|
-
type: "pisell2-trash-01",
|
|
88
|
-
style: {
|
|
89
|
-
fontSize: 20,
|
|
90
|
-
marginRight: 4
|
|
91
|
-
}
|
|
92
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
93
|
-
style: {
|
|
94
|
-
fontSize: 12,
|
|
95
|
-
fontWeight: 500
|
|
96
|
-
}
|
|
97
|
-
}, locales.getText('pisell2.cart.sku-card.actions.delete'))),
|
|
98
|
-
color: 'danger',
|
|
99
|
-
onClick: function onClick(e) {
|
|
100
|
-
e.preventDefault();
|
|
101
|
-
e.stopPropagation();
|
|
102
|
-
onDelete === null || onDelete === void 0 || onDelete(dataSource);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
var actions = _toConsumableArray(rightActions);
|
|
106
|
-
if (isShowDelete) {
|
|
107
|
-
actions.unshift(deleteAction);
|
|
108
|
-
}
|
|
109
|
-
return actions;
|
|
110
|
-
}, [dataSource, onDelete, isShowDelete, rightActions]);
|
|
111
|
-
var hideDivider = useMemo(function () {
|
|
112
|
-
var bundle = dataSource.bundle,
|
|
113
|
-
relation_products = dataSource.relation_products;
|
|
114
|
-
return (bundle === null || bundle === void 0 ? void 0 : bundle.length) || (relation_products === null || relation_products === void 0 ? void 0 : relation_products.length);
|
|
115
|
-
}, [dataSource]);
|
|
116
|
-
var renderA2 = function renderA2() {
|
|
117
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BasicInfo, {
|
|
118
|
-
isShowImage: isShowImage,
|
|
119
|
-
dataSource: dataSource,
|
|
120
|
-
isMainProduct: true
|
|
121
|
-
}), /*#__PURE__*/React.createElement(DiscountReason, {
|
|
122
|
-
dataSource: dataSource
|
|
123
|
-
}), isShowNote ? /*#__PURE__*/React.createElement(Note, _extends({}, other, {
|
|
124
|
-
item: dataSource,
|
|
125
|
-
openNote: function openNote() {
|
|
126
|
-
useOpenNoteRef.current.open({
|
|
127
|
-
item: dataSource
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
})) : null);
|
|
131
|
-
};
|
|
132
|
-
var renderA5 = function renderA5() {
|
|
133
|
-
var _dataSource$bundle, _dataSource$items;
|
|
134
|
-
var image = dataSource.image,
|
|
135
|
-
name = dataSource.name;
|
|
136
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, isShowDelete ? /*#__PURE__*/React.createElement("div", {
|
|
137
|
-
className: "".concat(PREFIX, "__delete-btn"),
|
|
138
|
-
onClick: function onClick(e) {
|
|
139
|
-
e.preventDefault();
|
|
140
|
-
e.stopPropagation();
|
|
141
|
-
onDelete === null || onDelete === void 0 || onDelete(dataSource);
|
|
142
|
-
}
|
|
143
|
-
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
144
|
-
type: "pisell2-trash-01"
|
|
145
|
-
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
146
|
-
className: "".concat(PREFIX, "__content")
|
|
147
|
-
}, isShowImage && image && /*#__PURE__*/React.createElement("img", {
|
|
148
|
-
src: imageAli.ali(image, 64),
|
|
149
|
-
className: "product-cover"
|
|
150
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
151
|
-
className: "product-info"
|
|
152
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
153
|
-
className: "product-name"
|
|
154
|
-
}, name), /*#__PURE__*/React.createElement(Holders, {
|
|
155
|
-
dataSource: dataSource
|
|
156
|
-
}))), /*#__PURE__*/React.createElement(TimeRange, {
|
|
157
|
-
dataSource: dataSource
|
|
158
|
-
}), /*#__PURE__*/React.createElement(Resources, {
|
|
159
|
-
dataSource: dataSource
|
|
160
|
-
}), /*#__PURE__*/React.createElement(Packages, {
|
|
161
|
-
dataSource: dataSource,
|
|
162
|
-
isShowImage: isShowImage
|
|
163
|
-
}), /*#__PURE__*/React.createElement(Sales, {
|
|
164
|
-
dataSource: dataSource,
|
|
165
|
-
hideDivider: !!(dataSource !== null && dataSource !== void 0 && (_dataSource$bundle = dataSource.bundle) !== null && _dataSource$bundle !== void 0 && _dataSource$bundle.length)
|
|
166
|
-
}), (_dataSource$items = dataSource.items) !== null && _dataSource$items !== void 0 && _dataSource$items.length ? /*#__PURE__*/React.createElement(Items, {
|
|
167
|
-
dataSource: dataSource,
|
|
168
|
-
hideDivider: hideDivider
|
|
169
|
-
}) : /*#__PURE__*/React.createElement(AmountFooter, {
|
|
170
|
-
item: dataSource,
|
|
171
|
-
hideDivider: hideDivider,
|
|
172
|
-
type: "total"
|
|
173
|
-
}), /*#__PURE__*/React.createElement(DiscountReason, {
|
|
174
|
-
dataSource: dataSource
|
|
175
|
-
}), isShowNote ? /*#__PURE__*/React.createElement(Note, _extends({}, other, {
|
|
176
|
-
item: dataSource,
|
|
177
|
-
openNote: function openNote() {
|
|
178
|
-
useOpenNoteRef.current.open({
|
|
179
|
-
item: dataSource
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
})) : null, isShowAction && actionText ? /*#__PURE__*/React.createElement(Action, {
|
|
183
|
-
item: dataSource,
|
|
184
|
-
onAction: function onAction() {
|
|
185
|
-
return _onAction === null || _onAction === void 0 ? void 0 : _onAction(dataSource);
|
|
186
|
-
}
|
|
187
|
-
}) : null);
|
|
188
|
-
};
|
|
189
|
-
var renderContent = function renderContent() {
|
|
190
|
-
if (type === 'a5') {
|
|
191
|
-
return renderA5();
|
|
192
|
-
}
|
|
193
|
-
return renderA2();
|
|
194
|
-
};
|
|
195
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SwipeAction, {
|
|
196
|
-
closeOnAction: false,
|
|
197
|
-
className: classNames("".concat(PREFIX, "-wrapper")),
|
|
198
|
-
rightActions: _rightActions,
|
|
199
|
-
escapeDom: escapeDom
|
|
200
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
201
|
-
className: classNames(PREFIX, "".concat(PREFIX, "--").concat(type)),
|
|
202
|
-
onClick: function onClick(e) {
|
|
203
|
-
e.preventDefault();
|
|
204
|
-
e.stopPropagation();
|
|
205
|
-
onCard === null || onCard === void 0 || onCard(dataSource);
|
|
206
|
-
}
|
|
207
|
-
}, renderContent())), /*#__PURE__*/React.createElement(UseOpenNote, {
|
|
208
|
-
ref: useOpenNoteRef,
|
|
209
|
-
onNoteChange: function onNoteChange(e) {
|
|
210
|
-
onNote === null || onNote === void 0 || onNote(_objectSpread(_objectSpread({}, dataSource), {}, {
|
|
211
|
-
note: e || ''
|
|
212
|
-
}));
|
|
213
|
-
}
|
|
214
|
-
}));
|
|
215
|
-
};
|
|
216
|
-
export default CartSkuCard;
|