@pisell/materials 6.12.68 → 6.12.69

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.
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { WalletPassValidity } from "@pisell/utils";
2
3
  //#region src/components/pisellWalletPassCard/index.d.ts
3
4
  interface FormatOption {
4
5
  /** 原始 DOM 元素 */
@@ -58,6 +59,8 @@ interface PisellWalletPassCardProps {
58
59
  validDateBySchedule?: boolean;
59
60
  /** 日程列表 */
60
61
  scheduleList?: any[];
62
+ /** 卡自身的原始有效日期,与使用日程共同决定展示范围 */
63
+ walletValidity?: WalletPassValidity;
61
64
  /** 是否展示右上角详情按钮 */
62
65
  showDetail?: boolean;
63
66
  /** 是否展示qrCode */
@@ -39,7 +39,7 @@ const PisellWalletPassCard = (props) => {
39
39
  if (pressTimer) clearTimeout(pressTimer);
40
40
  };
41
41
  }, [pressTimer]);
42
- const { id, type, code, qrCode, balance, formattedBalance, disabledReason, name, storeName, redeem, validDate, disabled, active = false, cover, balanceTitle, redeemTitle, showCover = true, showDetail = true, showBalance = true, showRedeem = true, showName = true, showCode = true, showStoreName = true, showValidDate = true, showQrCode = true, showBalanceSymbol = true, showDisabledReason = true, showDiscount = false, discount, showActions, actions, beforeEdit, onBeforeEditAmount, onConfirmEdit, onConfirmEditAmount, onDetail, useExternalDetail = false, originData, style = {}, mode = "multiple", showActiveIcon, enableEditAmount, showStatus, cardStatus, nameTitleStyle, formatBalance, formatBalanceTitle, formatRedeem, formatRedeemTitle, maxRedeem, showHolderName = true, holder, onSetHolder, validDateBySchedule, scheduleList } = props;
42
+ const { id, type, code, qrCode, balance, formattedBalance, disabledReason, name, storeName, redeem, validDate, disabled, active = false, cover, balanceTitle, redeemTitle, showCover = true, showDetail = true, showBalance = true, showRedeem = true, showName = true, showCode = true, showStoreName = true, showValidDate = true, showQrCode = true, showBalanceSymbol = true, showDisabledReason = true, showDiscount = false, discount, showActions, actions, beforeEdit, onBeforeEditAmount, onConfirmEdit, onConfirmEditAmount, onDetail, useExternalDetail = false, originData, style = {}, mode = "multiple", showActiveIcon, enableEditAmount, showStatus, cardStatus, nameTitleStyle, formatBalance, formatBalanceTitle, formatRedeem, formatRedeemTitle, maxRedeem, showHolderName = true, holder, onSetHolder, validDateBySchedule, scheduleList, walletValidity } = props;
43
43
  useEffect(() => {
44
44
  document.body.id = "body";
45
45
  }, []);
@@ -132,12 +132,22 @@ const PisellWalletPassCard = (props) => {
132
132
  };
133
133
  }();
134
134
  const formatValidDate = useMemo(() => {
135
- if (validDateBySchedule && scheduleList && (scheduleList === null || scheduleList === void 0 ? void 0 : scheduleList.length) > 0) return /* @__PURE__ */ React.createElement(React.Fragment, null, getText("pisell-wallet-pass-card-valid"), " ", getScheduleSummary(scheduleList, config === null || config === void 0 ? void 0 : config.locale) || validDate);
135
+ if (validDateBySchedule && scheduleList && (scheduleList === null || scheduleList === void 0 ? void 0 : scheduleList.length) > 0) {
136
+ var _walletValidity$start, _ref2, _walletValidity$expir, _walletValidity$expir2;
137
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, getText("pisell-wallet-pass-card-valid"), " ", getScheduleSummary(scheduleList, config === null || config === void 0 ? void 0 : config.locale, {
138
+ start_date: (_walletValidity$start = walletValidity === null || walletValidity === void 0 ? void 0 : walletValidity.start_date) !== null && _walletValidity$start !== void 0 ? _walletValidity$start : originData === null || originData === void 0 ? void 0 : originData.start_date,
139
+ expire_date: (_ref2 = (_walletValidity$expir = walletValidity === null || walletValidity === void 0 ? void 0 : walletValidity.expire_date) !== null && _walletValidity$expir !== void 0 ? _walletValidity$expir : originData === null || originData === void 0 ? void 0 : originData.expire_date) !== null && _ref2 !== void 0 ? _ref2 : validDate,
140
+ expire_time: (_walletValidity$expir2 = walletValidity === null || walletValidity === void 0 ? void 0 : walletValidity.expire_time) !== null && _walletValidity$expir2 !== void 0 ? _walletValidity$expir2 : originData === null || originData === void 0 ? void 0 : originData.expire_time
141
+ }) || validDate);
142
+ }
136
143
  return /* @__PURE__ */ React.createElement(React.Fragment, null, getText("pisell-wallet-pass-card-valid-to"), " ", !!validDate ? validDate : getText("pisell-wallet-pass-card-expireDate"));
137
144
  }, [
138
145
  validDateBySchedule,
139
146
  scheduleList,
140
- validDate
147
+ validDate,
148
+ walletValidity,
149
+ originData,
150
+ config === null || config === void 0 ? void 0 : config.locale
141
151
  ]);
142
152
  const _onConfirmEdit = () => {
143
153
  form.validateFields().then((values) => {
@@ -238,7 +248,7 @@ const PisellWalletPassCard = (props) => {
238
248
  return /* @__PURE__ */ React.createElement("div", { className: classNames("pisell-card-name-info-wrap") }, /* @__PURE__ */ React.createElement("div", { className: "pisell-card-name-wrap" }, showName && name), _showHolderName && /* @__PURE__ */ React.createElement("div", { className: "pisell-card-holder-name" }, holderName), shouldShowStoreName && /* @__PURE__ */ React.createElement("div", { className: "pisell-card-store-name" }, storeName));
239
249
  };
240
250
  const handleEditAmount = function() {
241
- var _ref2 = _asyncToGenerator(function* (e) {
251
+ var _ref3 = _asyncToGenerator(function* (e) {
242
252
  if (active && enableEditAmount) e.stopPropagation();
243
253
  if (!active) return;
244
254
  if (enableEditAmount && !disabled) {
@@ -259,7 +269,7 @@ const PisellWalletPassCard = (props) => {
259
269
  }
260
270
  });
261
271
  return function handleEditAmount(_x) {
262
- return _ref2.apply(this, arguments);
272
+ return _ref3.apply(this, arguments);
263
273
  };
264
274
  }();
265
275
  const createOriginalBalanceTitleDom = () => /* @__PURE__ */ React.createElement("div", { className: "pisell-card-amount-item-label" }, formatBalanceTitle ? formatBalanceTitle(balanceTitle, {
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { WalletPassValidity } from "@pisell/utils";
2
3
  //#region src/components/pisellWalletPassCard/index.d.ts
3
4
  interface FormatOption {
4
5
  /** 原始 DOM 元素 */
@@ -58,6 +59,8 @@ interface PisellWalletPassCardProps {
58
59
  validDateBySchedule?: boolean;
59
60
  /** 日程列表 */
60
61
  scheduleList?: any[];
62
+ /** 卡自身的原始有效日期,与使用日程共同决定展示范围 */
63
+ walletValidity?: WalletPassValidity;
61
64
  /** 是否展示右上角详情按钮 */
62
65
  showDetail?: boolean;
63
66
  /** 是否展示qrCode */
@@ -43,7 +43,7 @@ const PisellWalletPassCard = (props) => {
43
43
  if (pressTimer) clearTimeout(pressTimer);
44
44
  };
45
45
  }, [pressTimer]);
46
- const { id, type, code, qrCode, balance, formattedBalance, disabledReason, name, storeName, redeem, validDate, disabled, active = false, cover, balanceTitle, redeemTitle, showCover = true, showDetail = true, showBalance = true, showRedeem = true, showName = true, showCode = true, showStoreName = true, showValidDate = true, showQrCode = true, showBalanceSymbol = true, showDisabledReason = true, showDiscount = false, discount, showActions, actions, beforeEdit, onBeforeEditAmount, onConfirmEdit, onConfirmEditAmount, onDetail, useExternalDetail = false, originData, style = {}, mode = "multiple", showActiveIcon, enableEditAmount, showStatus, cardStatus, nameTitleStyle, formatBalance, formatBalanceTitle, formatRedeem, formatRedeemTitle, maxRedeem, showHolderName = true, holder, onSetHolder, validDateBySchedule, scheduleList } = props;
46
+ const { id, type, code, qrCode, balance, formattedBalance, disabledReason, name, storeName, redeem, validDate, disabled, active = false, cover, balanceTitle, redeemTitle, showCover = true, showDetail = true, showBalance = true, showRedeem = true, showName = true, showCode = true, showStoreName = true, showValidDate = true, showQrCode = true, showBalanceSymbol = true, showDisabledReason = true, showDiscount = false, discount, showActions, actions, beforeEdit, onBeforeEditAmount, onConfirmEdit, onConfirmEditAmount, onDetail, useExternalDetail = false, originData, style = {}, mode = "multiple", showActiveIcon, enableEditAmount, showStatus, cardStatus, nameTitleStyle, formatBalance, formatBalanceTitle, formatRedeem, formatRedeemTitle, maxRedeem, showHolderName = true, holder, onSetHolder, validDateBySchedule, scheduleList, walletValidity } = props;
47
47
  (0, react.useEffect)(() => {
48
48
  document.body.id = "body";
49
49
  }, []);
@@ -136,12 +136,22 @@ const PisellWalletPassCard = (props) => {
136
136
  };
137
137
  }();
138
138
  const formatValidDate = (0, react.useMemo)(() => {
139
- if (validDateBySchedule && scheduleList && (scheduleList === null || scheduleList === void 0 ? void 0 : scheduleList.length) > 0) return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, require_index.getText("pisell-wallet-pass-card-valid"), " ", (0, _pisell_utils.getScheduleSummary)(scheduleList, config === null || config === void 0 ? void 0 : config.locale) || validDate);
139
+ if (validDateBySchedule && scheduleList && (scheduleList === null || scheduleList === void 0 ? void 0 : scheduleList.length) > 0) {
140
+ var _walletValidity$start, _ref2, _walletValidity$expir, _walletValidity$expir2;
141
+ return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, require_index.getText("pisell-wallet-pass-card-valid"), " ", (0, _pisell_utils.getScheduleSummary)(scheduleList, config === null || config === void 0 ? void 0 : config.locale, {
142
+ start_date: (_walletValidity$start = walletValidity === null || walletValidity === void 0 ? void 0 : walletValidity.start_date) !== null && _walletValidity$start !== void 0 ? _walletValidity$start : originData === null || originData === void 0 ? void 0 : originData.start_date,
143
+ expire_date: (_ref2 = (_walletValidity$expir = walletValidity === null || walletValidity === void 0 ? void 0 : walletValidity.expire_date) !== null && _walletValidity$expir !== void 0 ? _walletValidity$expir : originData === null || originData === void 0 ? void 0 : originData.expire_date) !== null && _ref2 !== void 0 ? _ref2 : validDate,
144
+ expire_time: (_walletValidity$expir2 = walletValidity === null || walletValidity === void 0 ? void 0 : walletValidity.expire_time) !== null && _walletValidity$expir2 !== void 0 ? _walletValidity$expir2 : originData === null || originData === void 0 ? void 0 : originData.expire_time
145
+ }) || validDate);
146
+ }
140
147
  return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, require_index.getText("pisell-wallet-pass-card-valid-to"), " ", !!validDate ? validDate : require_index.getText("pisell-wallet-pass-card-expireDate"));
141
148
  }, [
142
149
  validDateBySchedule,
143
150
  scheduleList,
144
- validDate
151
+ validDate,
152
+ walletValidity,
153
+ originData,
154
+ config === null || config === void 0 ? void 0 : config.locale
145
155
  ]);
146
156
  const _onConfirmEdit = () => {
147
157
  form.validateFields().then((values) => {
@@ -242,7 +252,7 @@ const PisellWalletPassCard = (props) => {
242
252
  return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("pisell-card-name-info-wrap") }, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-card-name-wrap" }, showName && name), _showHolderName && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-card-holder-name" }, holderName), shouldShowStoreName && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-card-store-name" }, storeName));
243
253
  };
244
254
  const handleEditAmount = function() {
245
- var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (e) {
255
+ var _ref3 = require_asyncToGenerator._asyncToGenerator(function* (e) {
246
256
  if (active && enableEditAmount) e.stopPropagation();
247
257
  if (!active) return;
248
258
  if (enableEditAmount && !disabled) {
@@ -263,7 +273,7 @@ const PisellWalletPassCard = (props) => {
263
273
  }
264
274
  });
265
275
  return function handleEditAmount(_x) {
266
- return _ref2.apply(this, arguments);
276
+ return _ref3.apply(this, arguments);
267
277
  };
268
278
  }();
269
279
  const createOriginalBalanceTitleDom = () => /* @__PURE__ */ react.default.createElement("div", { className: "pisell-card-amount-item-label" }, formatBalanceTitle ? formatBalanceTitle(balanceTitle, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "6.12.68",
3
+ "version": "6.12.69",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -95,9 +95,9 @@
95
95
  "swiper": "^8.4.7",
96
96
  "antd-mobile": "^5.38.1",
97
97
  "vod-js-sdk-v6": "^1.4.11",
98
- "@pisell/date-picker": "3.0.10",
99
- "@pisell/icon": "0.0.11",
100
- "@pisell/utils": "3.0.4"
98
+ "@pisell/date-picker": "3.0.12",
99
+ "@pisell/utils": "3.0.7",
100
+ "@pisell/icon": "0.0.11"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "react": "^18.0.0",