@pisell/materials 6.2.25 → 6.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +144 -160
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +25 -44
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +30 -49
  11. package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
  12. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +3 -3
  13. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
  14. package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
  15. package/es/components/dataSourceComponents/fields/index.d.ts +8 -8
  16. package/es/components/iconfont/index.d.ts +8 -0
  17. package/es/components/pisellAdjustPrice/status.d.ts +32 -0
  18. package/es/components/pisellAdjustPrice/type.d.ts +20 -0
  19. package/es/components/productCard/cartSkuCard/components/basicInfo/index.js +1 -1
  20. package/es/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +43 -0
  21. package/es/components/productCard/cartSkuCard/components/swipeAction/index.js +282 -0
  22. package/es/components/productCard/cartSkuCard/components/swipeAction/index.less +38 -0
  23. package/es/components/productCard/cartSkuCard/index.d.ts +1 -0
  24. package/es/components/productCard/cartSkuCard/index.js +28 -9
  25. package/es/components/productCard/cartSkuCard/locales.d.ts +96 -0
  26. package/es/components/productCard/locales.d.ts +84 -0
  27. package/es/components/productCard/status.d.ts +32 -0
  28. package/es/components/productCard/types.d.ts +84 -0
  29. package/es/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
  30. package/es/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
  31. package/es/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
  32. package/es/components/table/Table/utils.d.ts +1 -1
  33. package/es/components/virtual-keyboard/Amount/themeConfig.d.ts +32 -0
  34. package/es/components/virtual-keyboard/Keyboard/index.d.ts +21 -0
  35. package/es/components/virtual-keyboard/Number/themeConfig.d.ts +32 -0
  36. package/es/components/virtual-keyboard/Number/types.d.ts +25 -0
  37. package/es/components/virtual-keyboard/VirtualKeyInput/index.d.ts +13 -0
  38. package/es/utils/index.d.ts +1 -1
  39. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
  40. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +3 -3
  41. package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
  42. package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
  43. package/lib/components/dataSourceComponents/fields/index.d.ts +8 -8
  44. package/lib/components/iconfont/index.d.ts +8 -0
  45. package/lib/components/pisellAdjustPrice/status.d.ts +32 -0
  46. package/lib/components/pisellAdjustPrice/type.d.ts +20 -0
  47. package/lib/components/productCard/cartSkuCard/components/basicInfo/index.js +1 -1
  48. package/lib/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +43 -0
  49. package/lib/components/productCard/cartSkuCard/components/swipeAction/index.js +330 -0
  50. package/lib/components/productCard/cartSkuCard/components/swipeAction/index.less +38 -0
  51. package/lib/components/productCard/cartSkuCard/index.d.ts +1 -0
  52. package/lib/components/productCard/cartSkuCard/index.js +29 -13
  53. package/lib/components/productCard/cartSkuCard/locales.d.ts +96 -0
  54. package/lib/components/productCard/locales.d.ts +84 -0
  55. package/lib/components/productCard/status.d.ts +32 -0
  56. package/lib/components/productCard/types.d.ts +84 -0
  57. package/lib/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
  58. package/lib/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
  59. package/lib/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
  60. package/lib/components/table/Table/utils.d.ts +1 -1
  61. package/lib/components/virtual-keyboard/Amount/themeConfig.d.ts +32 -0
  62. package/lib/components/virtual-keyboard/Keyboard/index.d.ts +21 -0
  63. package/lib/components/virtual-keyboard/Number/themeConfig.d.ts +32 -0
  64. package/lib/components/virtual-keyboard/Number/types.d.ts +25 -0
  65. package/lib/components/virtual-keyboard/VirtualKeyInput/index.d.ts +13 -0
  66. package/lib/utils/index.d.ts +1 -1
  67. package/package.json +4 -2
@@ -19,7 +19,7 @@ declare const formFieldMap: {
19
19
  Subdomain: import("react").FC<import("antd").InputProps & {
20
20
  onChange: (value: string) => void;
21
21
  onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
22
- rootDomain: "custom" | "xzero" | "saas";
22
+ rootDomain: "custom" | "saas" | "xzero";
23
23
  customDomain?: string | undefined;
24
24
  value?: string | undefined;
25
25
  tenantId: string;
@@ -59,11 +59,13 @@ declare const formFieldMap: {
59
59
  FormItemTranslation: import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
60
60
  FormItemIconSelect: import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
61
61
  };
62
- declare const getFieldComponent: (fieldComponent: string) => import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<{}> & {
62
+ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<any> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | (import("react").FC<{}> & {
63
63
  Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
64
64
  } & {
65
65
  Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
66
- }) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<import("./Input/type").InputProps> & {
66
+ }) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & {
67
+ onChange: (value: string) => void;
68
+ } & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Phone/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Mobile/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<import("./Input/type").InputProps> & {
67
69
  JSON: import("react").FC<any>;
68
70
  Password: import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
69
71
  TextArea: import("react").FC<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
@@ -76,14 +78,14 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
76
78
  Subdomain: import("react").FC<import("antd").InputProps & {
77
79
  onChange: (value: string) => void;
78
80
  onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
79
- rootDomain: "custom" | "xzero" | "saas";
81
+ rootDomain: "custom" | "saas" | "xzero";
80
82
  customDomain?: string | undefined;
81
83
  value?: string | undefined;
82
84
  tenantId: string;
83
85
  name?: string | undefined;
84
86
  fieldKey?: string | undefined;
85
87
  } & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
86
- }) | (import("react").FC<{}> & {
88
+ }) | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | (import("react").FC<{}> & {
87
89
  Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
88
90
  } & {
89
91
  Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
@@ -95,7 +97,5 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
95
97
  extraParams?: Record<string, any> | undefined;
96
98
  } & {
97
99
  dataSource?: any;
98
- }) => JSX.Element) | import("react").FC<any> | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Phone/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Mobile/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & {
99
- onChange: (value: string) => void;
100
- } & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
100
+ }) => JSX.Element) | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
101
101
  export { getFieldComponent, formFieldMap };
@@ -0,0 +1,8 @@
1
+ import { IconComponentProps } from '@ant-design/icons/es/components/Icon';
2
+ import React from 'react';
3
+ interface IconFontProps extends IconComponentProps {
4
+ type: string;
5
+ onClick?: React.MouseEventHandler<HTMLSpanElement>;
6
+ }
7
+ declare const IconFont: React.FC<IconFontProps>;
8
+ export default IconFont;
@@ -0,0 +1,32 @@
1
+ export declare const defaultConfig: {
2
+ dark: {
3
+ backgroundColor: string;
4
+ containerBackgroundColor: string;
5
+ buttonBackgroundColor: string;
6
+ textColor: string;
7
+ resetButtonBackgroundColor: string;
8
+ resetButtonTextColor: string;
9
+ isDoneButtonFollowTheme: boolean;
10
+ doneButtonBackgroundColor: string;
11
+ doneButtonTextColor: string;
12
+ isShowMainText: boolean;
13
+ mainTextColor: string;
14
+ isShowSubText: boolean;
15
+ subTextColor: string;
16
+ };
17
+ light: {
18
+ backgroundColor: string;
19
+ containerBackgroundColor: string;
20
+ buttonBackgroundColor: string;
21
+ textColor: string;
22
+ resetButtonBackgroundColor: string;
23
+ resetButtonTextColor: string;
24
+ isDoneButtonFollowTheme: boolean;
25
+ doneButtonBackgroundColor: string;
26
+ doneButtonTextColor: string;
27
+ isShowMainText: boolean;
28
+ mainTextColor: string;
29
+ isShowSubText: boolean;
30
+ subTextColor: string;
31
+ };
32
+ };
@@ -0,0 +1,20 @@
1
+ export interface PisellAdjustPriceProps {
2
+ value?: number;
3
+ originValue: number;
4
+ defaultValue?: number;
5
+ onChange?: (val: number) => void;
6
+ selectType?: 'light' | 'dark';
7
+ backgroundColor?: string;
8
+ containerBackgroundColor?: string;
9
+ buttonBackgroundColor?: string;
10
+ textColor?: string;
11
+ resetButtonBackgroundColor?: string;
12
+ resetButtonTextColor?: string;
13
+ isDoneButtonFollowTheme?: boolean;
14
+ doneButtonBackgroundColor?: string;
15
+ doneButtonTextColor?: string;
16
+ isShowMainText?: boolean;
17
+ mainTextColor?: string;
18
+ isShowSubText?: boolean;
19
+ subTextColor?: string;
20
+ }
@@ -61,7 +61,7 @@ var BasicInfo = (props) => {
61
61
  "is-main": isMainProduct
62
62
  })
63
63
  },
64
- num < 99 ? num : "99+"
64
+ num < 100 ? num : "99+"
65
65
  );
66
66
  return null;
67
67
  };
@@ -0,0 +1,43 @@
1
+ import type { ReactNode } from 'react';
2
+ import React from 'react';
3
+ declare type NativeProps<S extends string = never> = {
4
+ className?: string;
5
+ style?: React.CSSProperties & Partial<Record<S, string>>;
6
+ };
7
+ declare type PropagationEvent = 'click';
8
+ import './index.less';
9
+ declare type SideType = 'left' | 'right';
10
+ export declare type SwipeActionRef = {
11
+ close: () => void;
12
+ show: (side?: SideType) => void;
13
+ };
14
+ declare type ActionColor = 'light' | 'weak' | 'primary' | 'success' | 'warning' | 'danger';
15
+ export declare type Action = {
16
+ key: string | number;
17
+ text: ReactNode;
18
+ color?: ActionColor | string;
19
+ onClick?: (e: React.MouseEvent) => void;
20
+ };
21
+ export declare type SwipeActionProps = {
22
+ rightActions?: Action[];
23
+ leftActions?: Action[];
24
+ onAction?: (action: Action, e: React.MouseEvent) => void;
25
+ closeOnTouchOutside?: boolean;
26
+ closeOnAction?: boolean;
27
+ children: ReactNode;
28
+ stopPropagation?: PropagationEvent[];
29
+ onActionsReveal?: (side: SideType) => void;
30
+ onClose?: () => void;
31
+ } & NativeProps<'--background'>;
32
+ export declare const SwipeAction: React.ForwardRefExoticComponent<{
33
+ rightActions?: Action[] | undefined;
34
+ leftActions?: Action[] | undefined;
35
+ onAction?: ((action: Action, e: React.MouseEvent) => void) | undefined;
36
+ closeOnTouchOutside?: boolean | undefined;
37
+ closeOnAction?: boolean | undefined;
38
+ children: ReactNode;
39
+ stopPropagation?: "click"[] | undefined;
40
+ onActionsReveal?: ((side: SideType) => void) | undefined;
41
+ onClose?: (() => void) | undefined;
42
+ } & NativeProps<"--background"> & React.RefAttributes<SwipeActionRef>>;
43
+ export {};
@@ -0,0 +1,330 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/productCard/cartSkuCard/components/swipeAction/index.tsx
30
+ var swipeAction_exports = {};
31
+ __export(swipeAction_exports, {
32
+ SwipeAction: () => SwipeAction
33
+ });
34
+ module.exports = __toCommonJS(swipeAction_exports);
35
+ var import_web = require("@react-spring/web");
36
+ var import_use_gesture_react = require("@use-gesture/react/dist/use-gesture-react.cjs");
37
+ var import_react = __toESM(require("react"));
38
+ var import_index = require("./index.less");
39
+ function withNativeProps(props, element) {
40
+ const p = {
41
+ ...element.props
42
+ };
43
+ if (props.className) {
44
+ p.className = props.className + (element.props.className ? ` ${element.props.className}` : "");
45
+ }
46
+ if (props.style) {
47
+ p.style = {
48
+ ...props.style,
49
+ ...element.props.style
50
+ };
51
+ }
52
+ return import_react.default.cloneElement(element, p);
53
+ }
54
+ function nearest(arr, target) {
55
+ return arr.reduce((prev, curr) => {
56
+ return Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev;
57
+ });
58
+ }
59
+ function mergeProps(a, b) {
60
+ return {
61
+ ...a,
62
+ ...b
63
+ };
64
+ }
65
+ function withStopPropagation(events, element) {
66
+ if (!events.includes("click")) {
67
+ return element;
68
+ }
69
+ const onClick = (e) => {
70
+ var _a, _b;
71
+ e.stopPropagation();
72
+ (_b = (_a = element.props).onClick) == null ? void 0 : _b.call(_a, e);
73
+ };
74
+ return import_react.default.cloneElement(element, {
75
+ ...element.props,
76
+ onClick
77
+ });
78
+ }
79
+ var Button = ({
80
+ children,
81
+ className,
82
+ style,
83
+ onClick
84
+ }) => {
85
+ return /* @__PURE__ */ import_react.default.createElement(
86
+ "button",
87
+ {
88
+ className,
89
+ style: {
90
+ border: "none",
91
+ background: (style == null ? void 0 : style["--background-color"]) || "transparent",
92
+ ...style
93
+ },
94
+ onClick
95
+ },
96
+ children
97
+ );
98
+ };
99
+ var classPrefix = `pisell-swipe-action`;
100
+ var defaultProps = {
101
+ rightActions: [],
102
+ leftActions: [],
103
+ closeOnTouchOutside: true,
104
+ closeOnAction: true,
105
+ stopPropagation: []
106
+ };
107
+ var SwipeAction = (0, import_react.forwardRef)(
108
+ (p, ref) => {
109
+ const props = mergeProps(defaultProps, p);
110
+ const rootRef = (0, import_react.useRef)(null);
111
+ const leftRef = (0, import_react.useRef)(null);
112
+ const rightRef = (0, import_react.useRef)(null);
113
+ function getWidth(ref2) {
114
+ const element = ref2.current;
115
+ if (!element) return 0;
116
+ return element.offsetWidth;
117
+ }
118
+ function getLeftWidth() {
119
+ return getWidth(leftRef);
120
+ }
121
+ function getRightWidth() {
122
+ return getWidth(rightRef);
123
+ }
124
+ const [{ x }, api] = (0, import_web.useSpring)(
125
+ () => ({
126
+ x: 0,
127
+ config: { tension: 200, friction: 30 }
128
+ }),
129
+ []
130
+ );
131
+ const draggingRef = (0, import_react.useRef)(false);
132
+ const dragCancelRef = (0, import_react.useRef)(null);
133
+ function forceCancelDrag() {
134
+ var _a;
135
+ (_a = dragCancelRef.current) == null ? void 0 : _a.call(dragCancelRef);
136
+ draggingRef.current = false;
137
+ }
138
+ const bind = (0, import_use_gesture_react.useDrag)(
139
+ (state) => {
140
+ var _a;
141
+ dragCancelRef.current = state.cancel;
142
+ if (!state.intentional) return;
143
+ if (state.down) {
144
+ draggingRef.current = true;
145
+ }
146
+ if (!draggingRef.current) return;
147
+ const [offsetX] = state.offset;
148
+ if (state.last) {
149
+ const leftWidth = getLeftWidth();
150
+ const rightWidth = getRightWidth();
151
+ let position = offsetX + state.velocity[0] * state.direction[0] * 50;
152
+ if (offsetX > 0) {
153
+ position = Math.max(0, position);
154
+ } else if (offsetX < 0) {
155
+ position = Math.min(0, position);
156
+ } else {
157
+ position = 0;
158
+ }
159
+ const targetX = nearest([-rightWidth, 0, leftWidth], position);
160
+ api.start({
161
+ x: targetX
162
+ });
163
+ if (targetX !== 0) {
164
+ (_a = p.onActionsReveal) == null ? void 0 : _a.call(p, targetX > 0 ? "left" : "right");
165
+ }
166
+ window.setTimeout(() => {
167
+ draggingRef.current = false;
168
+ });
169
+ } else {
170
+ api.start({
171
+ x: offsetX,
172
+ immediate: true
173
+ });
174
+ }
175
+ },
176
+ {
177
+ from: () => [x.get(), 0],
178
+ bounds: () => {
179
+ const leftWidth = getLeftWidth();
180
+ const rightWidth = getRightWidth();
181
+ return {
182
+ left: -rightWidth,
183
+ right: leftWidth
184
+ };
185
+ },
186
+ axis: "x",
187
+ preventScroll: true,
188
+ pointer: { touch: true },
189
+ triggerAllEvents: true
190
+ }
191
+ );
192
+ const close = () => {
193
+ var _a;
194
+ api.start({
195
+ x: 0
196
+ });
197
+ forceCancelDrag();
198
+ (_a = props.onClose) == null ? void 0 : _a.call(props);
199
+ };
200
+ (0, import_react.useImperativeHandle)(ref, () => ({
201
+ show: (side = "right") => {
202
+ var _a;
203
+ if (side === "right") {
204
+ api.start({
205
+ x: -getRightWidth()
206
+ });
207
+ } else if (side === "left") {
208
+ api.start({
209
+ x: getLeftWidth()
210
+ });
211
+ }
212
+ (_a = p.onActionsReveal) == null ? void 0 : _a.call(p, side);
213
+ },
214
+ close
215
+ }));
216
+ (0, import_react.useEffect)(() => {
217
+ if (!props.closeOnTouchOutside) return;
218
+ function handle(e) {
219
+ if (x.get() === 0) {
220
+ return;
221
+ }
222
+ const root = rootRef.current;
223
+ if (root && !root.contains(e.target)) {
224
+ close();
225
+ }
226
+ }
227
+ document.addEventListener("touchstart", handle);
228
+ return () => {
229
+ document.removeEventListener("touchstart", handle);
230
+ };
231
+ }, [props.closeOnTouchOutside]);
232
+ function renderAction(action) {
233
+ const color = action.color ?? "light";
234
+ const _style = action.style || {};
235
+ return /* @__PURE__ */ import_react.default.createElement(
236
+ Button,
237
+ {
238
+ key: action.key,
239
+ className: `${classPrefix}-action-button`,
240
+ style: {
241
+ "--background-color": colorRecord[color] ?? color,
242
+ ..._style
243
+ },
244
+ onClick: (e) => {
245
+ var _a, _b;
246
+ if (props.closeOnAction) {
247
+ close();
248
+ }
249
+ (_a = action.onClick) == null ? void 0 : _a.call(action, e);
250
+ (_b = props.onAction) == null ? void 0 : _b.call(props, action, e);
251
+ }
252
+ },
253
+ action.text
254
+ );
255
+ }
256
+ return withNativeProps(
257
+ props,
258
+ /* @__PURE__ */ import_react.default.createElement(
259
+ "div",
260
+ {
261
+ className: classPrefix,
262
+ ...bind(),
263
+ ref: rootRef,
264
+ onClickCapture: (e) => {
265
+ if (draggingRef.current) {
266
+ e.stopPropagation();
267
+ e.preventDefault();
268
+ }
269
+ }
270
+ },
271
+ /* @__PURE__ */ import_react.default.createElement(import_web.animated.div, { className: `${classPrefix}-track`, style: { x } }, withStopPropagation(
272
+ props.stopPropagation,
273
+ /* @__PURE__ */ import_react.default.createElement(
274
+ "div",
275
+ {
276
+ className: `${classPrefix}-actions ${classPrefix}-actions-left`,
277
+ ref: leftRef
278
+ },
279
+ props.leftActions.map(renderAction)
280
+ )
281
+ ), /* @__PURE__ */ import_react.default.createElement(
282
+ "div",
283
+ {
284
+ className: `${classPrefix}-content`,
285
+ onClickCapture: (e) => {
286
+ if (x.goal !== 0) {
287
+ e.preventDefault();
288
+ e.stopPropagation();
289
+ close();
290
+ }
291
+ }
292
+ },
293
+ /* @__PURE__ */ import_react.default.createElement(
294
+ import_web.animated.div,
295
+ {
296
+ style: {
297
+ pointerEvents: x.to(
298
+ (v) => v !== 0 && x.goal !== 0 ? "none" : "auto"
299
+ )
300
+ }
301
+ },
302
+ props.children
303
+ )
304
+ ), withStopPropagation(
305
+ props.stopPropagation,
306
+ /* @__PURE__ */ import_react.default.createElement(
307
+ "div",
308
+ {
309
+ className: `${classPrefix}-actions ${classPrefix}-actions-right`,
310
+ ref: rightRef
311
+ },
312
+ props.rightActions.map(renderAction)
313
+ )
314
+ ))
315
+ )
316
+ );
317
+ }
318
+ );
319
+ var colorRecord = {
320
+ light: "#ccc",
321
+ weak: "#999",
322
+ primary: "#1677ff",
323
+ success: "#00b578",
324
+ warning: "#ff8f1f",
325
+ danger: "#ff3141"
326
+ };
327
+ // Annotate the CommonJS export names for ESM import in node:
328
+ 0 && (module.exports = {
329
+ SwipeAction
330
+ });
@@ -0,0 +1,38 @@
1
+ .pisell-swipe-action {
2
+ --background: var(--adm-color-background);
3
+ background: var(--background);
4
+ cursor: grab;
5
+ overflow: hidden;
6
+ touch-action: pan-y;
7
+ &-track {
8
+ position: relative;
9
+ overflow: visible;
10
+ }
11
+ &-content {
12
+ }
13
+ &-actions {
14
+ position: absolute;
15
+ display: flex;
16
+ justify-content: center;
17
+ align-items: stretch;
18
+ width: auto;
19
+ white-space: nowrap;
20
+ &-right {
21
+ left: 100%;
22
+ top: 0;
23
+ height: 100%;
24
+ }
25
+ &-left {
26
+ right: 100%;
27
+ top: 0;
28
+ height: 100%;
29
+ }
30
+ }
31
+ &-action-button {
32
+ --border-radius: 0;
33
+ --border-width: 0;
34
+ --text-color: var(--adm-color-text-light-solid);
35
+ padding-left: 4px;
36
+ padding-right: 4px;
37
+ }
38
+ }
@@ -2,6 +2,7 @@ import './index.less';
2
2
  import { ProductCardTypes } from '../types';
3
3
  interface ISKUCardProps extends ProductCardTypes {
4
4
  type: 'a2' | 'a5';
5
+ rightActions: any[];
5
6
  }
6
7
  export declare const PREFIX = "pisell-cart-sku-card";
7
8
  declare const CartSkuCard: (props: ISKUCardProps) => JSX.Element;
@@ -35,7 +35,6 @@ __export(cartSkuCard_exports, {
35
35
  module.exports = __toCommonJS(cartSkuCard_exports);
36
36
  var import_react = __toESM(require("react"));
37
37
  var import_classnames = __toESM(require("classnames"));
38
- var import_antd_mobile = require("antd-mobile");
39
38
  var import_utils = require("@pisell/utils");
40
39
  var import_locales = __toESM(require("./locales"));
41
40
  var import_basicInfo = __toESM(require("./components/basicInfo"));
@@ -45,6 +44,7 @@ var import_timeRange = __toESM(require("./components/timeRange"));
45
44
  var import_resources = __toESM(require("./components/resources"));
46
45
  var import_packages = __toESM(require("./components/packages"));
47
46
  var import_sales = __toESM(require("./components/sales"));
47
+ var import_swipeAction = require("./components/swipeAction");
48
48
  var import_index = require("./index.less");
49
49
  var import_iconfont = __toESM(require("../../iconfont"));
50
50
  var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
@@ -74,6 +74,7 @@ var CartSkuCard = (props) => {
74
74
  onChangeResource,
75
75
  onChangeHolder,
76
76
  type,
77
+ rightActions = [],
77
78
  ...other
78
79
  } = props;
79
80
  const useOpenNoteRef = (0, import_react.useRef)();
@@ -84,16 +85,30 @@ var CartSkuCard = (props) => {
84
85
  );
85
86
  console.log("prodcut props", props);
86
87
  const { isShowAction, actionText } = dataSource;
87
- const rightActions = (0, import_react.useMemo)(() => {
88
+ const _rightActions = (0, import_react.useMemo)(() => {
88
89
  const deleteAction = {
89
90
  key: "delete",
90
- text: /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
91
- import_iconfont.default,
91
+ text: /* @__PURE__ */ import_react.default.createElement(
92
+ "div",
92
93
  {
93
- type: "pisell2-trash-01",
94
- style: { fontSize: 20, marginRight: 4 }
95
- }
96
- ), /* @__PURE__ */ import_react.default.createElement("span", { style: { fontSize: 12 } }, import_utils.locales.getText("pisell2.cart.sku-card.actions.delete"))),
94
+ style: {
95
+ display: "flex",
96
+ justifyContent: "center",
97
+ alignItems: "center",
98
+ color: "white",
99
+ cursor: "pointer",
100
+ padding: "10px 0px"
101
+ }
102
+ },
103
+ /* @__PURE__ */ import_react.default.createElement(
104
+ import_iconfont.default,
105
+ {
106
+ type: "pisell2-trash-01",
107
+ style: { fontSize: 20, marginRight: 4 }
108
+ }
109
+ ),
110
+ /* @__PURE__ */ import_react.default.createElement("span", { style: { fontSize: 12, fontWeight: 500 } }, import_utils.locales.getText("pisell2.cart.sku-card.actions.delete"))
111
+ ),
97
112
  color: "danger",
98
113
  onClick: (e) => {
99
114
  e.preventDefault();
@@ -101,12 +116,12 @@ var CartSkuCard = (props) => {
101
116
  onDelete == null ? void 0 : onDelete(dataSource);
102
117
  }
103
118
  };
104
- const actions = [];
119
+ const actions = [...rightActions];
105
120
  if (isShowDelete) {
106
- actions.push(deleteAction);
121
+ actions.unshift(deleteAction);
107
122
  }
108
123
  return actions;
109
- }, [dataSource, onDelete, isShowDelete]);
124
+ }, [dataSource, onDelete, isShowDelete, rightActions]);
110
125
  const hideDivider = (0, import_react.useMemo)(() => {
111
126
  const { bundle, relation_products } = dataSource;
112
127
  return (bundle == null ? void 0 : bundle.length) || (relation_products == null ? void 0 : relation_products.length);
@@ -179,10 +194,11 @@ var CartSkuCard = (props) => {
179
194
  return renderA2();
180
195
  };
181
196
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
182
- import_antd_mobile.SwipeAction,
197
+ import_swipeAction.SwipeAction,
183
198
  {
199
+ closeOnAction: false,
184
200
  className: (0, import_classnames.default)(`${PREFIX}-wrapper`),
185
- rightActions
201
+ rightActions: _rightActions
186
202
  },
187
203
  /* @__PURE__ */ import_react.default.createElement(
188
204
  "div",