@pisell/materials 2.2.98 → 2.2.99

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.
@@ -37,7 +37,8 @@ var PisellCardList = function PisellCardList(props) {
37
37
  showValidDate = props.showValidDate,
38
38
  empty = props.empty,
39
39
  showEmpty = props.showEmpty,
40
- showBalanceSymbol = props.showBalanceSymbol;
40
+ showBalanceSymbol = props.showBalanceSymbol,
41
+ onChangeDebounce = props.onChangeDebounce;
41
42
  return data.length ? /*#__PURE__*/React.createElement(PisellCheckboxGroup, {
42
43
  options: data,
43
44
  value: value,
@@ -48,6 +49,7 @@ var PisellCardList = function PisellCardList(props) {
48
49
  onChange: onChange,
49
50
  iconPosition: "hide",
50
51
  fullWidth: fullWidth,
52
+ onChangeDebounce: onChangeDebounce,
51
53
  renderOption: function renderOption(item, active, index) {
52
54
  return /*#__PURE__*/React.createElement(PisellWalletPassCard, _extends({}, item, {
53
55
  active: active,
@@ -23,6 +23,7 @@ export interface PisellCheckboxGroupProps extends React.HTMLAttributes<HTMLDivEl
23
23
  iconPosition?: 'left' | 'right' | 'hide';
24
24
  optionClassName?: string;
25
25
  optionActiveClassName?: string;
26
+ onChangeDebounce?: boolean;
26
27
  }
27
28
  /**
28
29
  * @title: PisellCheckboxGroup
@@ -1,5 +1,5 @@
1
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 = ["platform", "gap", "style", "options", "onChange", "value", "renderOption", "padding", "rowKey", "mode", "direction", "fullWidth", "iconPosition", "optionClassName", "optionActiveClassName"];
2
+ var _excluded = ["platform", "gap", "style", "options", "onChange", "value", "renderOption", "padding", "rowKey", "mode", "direction", "fullWidth", "iconPosition", "optionClassName", "optionActiveClassName", "onChangeDebounce"];
3
3
  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); }
4
4
  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; }
5
5
  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; }
@@ -18,6 +18,7 @@ import React, { useEffect, useMemo } from 'react';
18
18
  import usePisellConfig from "../pisell-config-provider/hooks/usePisellConfig";
19
19
  import classNames from 'classnames';
20
20
  import { Checkbox, Radio } from 'antd';
21
+ import { useDebounceFn } from "ahooks";
21
22
  import { isNumber } from '@pisell/utils';
22
23
  import { changeArray } from '@pisell/utils';
23
24
  import "./index.less";
@@ -63,6 +64,7 @@ var PisellCheckboxGroup = function PisellCheckboxGroup(props) {
63
64
  iconPosition = _props$iconPosition === void 0 ? 'left' : _props$iconPosition,
64
65
  optionClassName = props.optionClassName,
65
66
  optionActiveClassName = props.optionActiveClassName,
67
+ onChangeDebounce = props.onChangeDebounce,
66
68
  rest = _objectWithoutProperties(props, _excluded);
67
69
  var _useState = useState([]),
68
70
  _useState2 = _slicedToArray(_useState, 2),
@@ -141,6 +143,14 @@ var PisellCheckboxGroup = function PisellCheckboxGroup(props) {
141
143
  // 单选模式, 只返回第一个值
142
144
  onChange === null || onChange === void 0 || onChange(mode === 'single' ? val[0] : val, item);
143
145
  };
146
+ var _useDebounceFn = useDebounceFn(function (key, item) {
147
+ handleSelectItem(key, item);
148
+ }, {
149
+ wait: 400,
150
+ leading: true,
151
+ trailing: false
152
+ }),
153
+ run = _useDebounceFn.run;
144
154
 
145
155
  /**
146
156
  * @title: 选择
@@ -181,6 +191,10 @@ var PisellCheckboxGroup = function PisellCheckboxGroup(props) {
181
191
  style: rowStyle,
182
192
  onClick: function onClick(e) {
183
193
  if (option.disabled) return;
194
+ if (onChangeDebounce) {
195
+ run(option[rowKey], option);
196
+ return;
197
+ }
184
198
  handleSelectItem(option[rowKey], option);
185
199
  },
186
200
  leftContent: iconPosition === 'left' && /*#__PURE__*/React.createElement(CheckBoxItem, {
@@ -37,9 +37,20 @@ var Guide = function Guide(props) {
37
37
  * @Date: 2025-06-09 14:36
38
38
  */
39
39
  var handleClick = function handleClick(e) {
40
- var _setting$skipLink;
40
+ var _setting$skipLink, _utils$interaction, _utils$interaction$is;
41
41
  e.stopPropagation();
42
42
  if (!(_setting !== null && _setting !== void 0 && (_setting$skipLink = _setting.skipLink) !== null && _setting$skipLink !== void 0 && _setting$skipLink.page)) return;
43
+ if (utils !== null && utils !== void 0 && (_utils$interaction = utils.interaction) !== null && _utils$interaction !== void 0 && (_utils$interaction = _utils$interaction.utils) !== null && _utils$interaction !== void 0 && (_utils$interaction$is = _utils$interaction.isAppEnv) !== null && _utils$interaction$is !== void 0 && _utils$interaction$is.call(_utils$interaction)) {
44
+ var _utils$interaction2, _utils$interaction2$p;
45
+ utils === null || utils === void 0 || (_utils$interaction2 = utils.interaction) === null || _utils$interaction2 === void 0 || (_utils$interaction2 = _utils$interaction2.utils) === null || _utils$interaction2 === void 0 || (_utils$interaction2$p = _utils$interaction2.postMessageToApp) === null || _utils$interaction2$p === void 0 || _utils$interaction2$p.call(_utils$interaction2, {
46
+ module: 'global',
47
+ key: 'openNative',
48
+ data: {
49
+ link: _setting === null || _setting === void 0 ? void 0 : _setting.skipLink
50
+ }
51
+ });
52
+ return;
53
+ }
43
54
  utils === null || utils === void 0 || utils.jumpPageByLink(_setting === null || _setting === void 0 ? void 0 : _setting.skipLink);
44
55
  };
45
56
  return /*#__PURE__*/React.createElement("div", {
@@ -62,7 +62,8 @@ var PisellCardList = (props) => {
62
62
  showValidDate,
63
63
  empty,
64
64
  showEmpty,
65
- showBalanceSymbol
65
+ showBalanceSymbol,
66
+ onChangeDebounce
66
67
  } = props;
67
68
  return data.length ? /* @__PURE__ */ import_react.default.createElement(
68
69
  import_pisellCheckboxGroup.default,
@@ -76,6 +77,7 @@ var PisellCardList = (props) => {
76
77
  onChange,
77
78
  iconPosition: "hide",
78
79
  fullWidth,
80
+ onChangeDebounce,
79
81
  renderOption: (item, active, index) => {
80
82
  return /* @__PURE__ */ import_react.default.createElement(
81
83
  import_pisellWalletPassCard.default,
@@ -23,6 +23,7 @@ export interface PisellCheckboxGroupProps extends React.HTMLAttributes<HTMLDivEl
23
23
  iconPosition?: 'left' | 'right' | 'hide';
24
24
  optionClassName?: string;
25
25
  optionActiveClassName?: string;
26
+ onChangeDebounce?: boolean;
26
27
  }
27
28
  /**
28
29
  * @title: PisellCheckboxGroup
@@ -36,6 +36,7 @@ var import_react = __toESM(require("react"));
36
36
  var import_usePisellConfig = __toESM(require("../pisell-config-provider/hooks/usePisellConfig"));
37
37
  var import_classnames = __toESM(require("classnames"));
38
38
  var import_antd = require("antd");
39
+ var import_ahooks = require("ahooks");
39
40
  var import_utils = require("@pisell/utils");
40
41
  var import_utils2 = require("@pisell/utils");
41
42
  var import_index = require("./index.less");
@@ -62,6 +63,7 @@ var PisellCheckboxGroup = (props) => {
62
63
  iconPosition = "left",
63
64
  optionClassName,
64
65
  optionActiveClassName,
66
+ onChangeDebounce,
65
67
  ...rest
66
68
  } = props;
67
69
  const [_value, set_value] = (0, import_react2.useState)([]);
@@ -112,6 +114,16 @@ var PisellCheckboxGroup = (props) => {
112
114
  const _onChange = (val, item) => {
113
115
  onChange == null ? void 0 : onChange(mode === "single" ? val[0] : val, item);
114
116
  };
117
+ const { run } = (0, import_ahooks.useDebounceFn)(
118
+ (key, item) => {
119
+ handleSelectItem(key, item);
120
+ },
121
+ {
122
+ wait: 400,
123
+ leading: true,
124
+ trailing: false
125
+ }
126
+ );
115
127
  const handleSelectItem = (key, item) => {
116
128
  let newVal = [key];
117
129
  if (mode === "multiple") {
@@ -146,6 +158,10 @@ var PisellCheckboxGroup = (props) => {
146
158
  style: rowStyle,
147
159
  onClick: (e) => {
148
160
  if (option.disabled) return;
161
+ if (onChangeDebounce) {
162
+ run(option[rowKey], option);
163
+ return;
164
+ }
149
165
  handleSelectItem(option[rowKey], option);
150
166
  },
151
167
  leftContent: iconPosition === "left" && /* @__PURE__ */ import_react.default.createElement(
@@ -51,9 +51,19 @@ var Guide = (props) => {
51
51
  return (setting == null ? void 0 : setting.walletGuideConfig) || {};
52
52
  }, [setting == null ? void 0 : setting.walletGuideConfig]);
53
53
  const handleClick = (e) => {
54
- var _a2;
54
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
55
55
  e.stopPropagation();
56
56
  if (!((_a2 = _setting == null ? void 0 : _setting.skipLink) == null ? void 0 : _a2.page)) return;
57
+ if ((_d2 = (_c2 = (_b2 = utils == null ? void 0 : utils.interaction) == null ? void 0 : _b2.utils) == null ? void 0 : _c2.isAppEnv) == null ? void 0 : _d2.call(_c2)) {
58
+ (_g2 = (_f2 = (_e2 = utils == null ? void 0 : utils.interaction) == null ? void 0 : _e2.utils) == null ? void 0 : _f2.postMessageToApp) == null ? void 0 : _g2.call(_f2, {
59
+ module: "global",
60
+ key: "openNative",
61
+ data: {
62
+ link: _setting == null ? void 0 : _setting.skipLink
63
+ }
64
+ });
65
+ return;
66
+ }
57
67
  utils == null ? void 0 : utils.jumpPageByLink(_setting == null ? void 0 : _setting.skipLink);
58
68
  };
59
69
  return /* @__PURE__ */ import_react.default.createElement(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "2.2.98",
3
+ "version": "2.2.99",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -73,8 +73,8 @@
73
73
  "styled-components": "^6.0.0-rc.3",
74
74
  "swiper": "^8.4.7",
75
75
  "vod-js-sdk-v6": "^1.4.11",
76
- "@pisell/icon": "0.0.11",
77
76
  "@pisell/date-picker": "1.0.101",
77
+ "@pisell/icon": "0.0.11",
78
78
  "@pisell/utils": "2.0.1"
79
79
  },
80
80
  "peerDependencies": {