@pisell/materials 1.0.459 → 1.0.460

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.
@@ -29,7 +29,7 @@ var Footer = function Footer(_ref) {
29
29
  className: classNames("".concat(prefix, "packages-product-footer"), hideDivider && "".concat(prefix, "packages-product-hide-divider-footer"))
30
30
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, _formatAmount(item === null || item === void 0 ? void 0 : item.total, item === null || item === void 0 ? void 0 : item.symbol)), /*#__PURE__*/React.createElement("span", null, "\xD7".concat(item === null || item === void 0 ? void 0 : item.num)), /*#__PURE__*/React.createElement("span", {
31
31
  className: "".concat(prefix, "packages-product-footer-total")
32
- }, "".concat(item === null || item === void 0 ? void 0 : item.symbol, " ").concat(_formatAmount((item === null || item === void 0 ? void 0 : item.total) * (item === null || item === void 0 ? void 0 : item.num))))), isDiscount ? /*#__PURE__*/React.createElement("div", {
32
+ }, _formatAmount((item === null || item === void 0 ? void 0 : item.total) * (item === null || item === void 0 ? void 0 : item.num), item === null || item === void 0 ? void 0 : item.symbol))), isDiscount ? /*#__PURE__*/React.createElement("div", {
33
33
  className: "".concat(prefix, "packages-product-footer-discount")
34
34
  }, /*#__PURE__*/React.createElement("span", null, _formatAmount(item === null || item === void 0 ? void 0 : item.origin_total, item === null || item === void 0 ? void 0 : item.symbol)), /*#__PURE__*/React.createElement("span", null, _formatAmount((item === null || item === void 0 ? void 0 : item.origin_total) * (item === null || item === void 0 ? void 0 : item.num), item === null || item === void 0 ? void 0 : item.symbol, 2))) : null), isDiscount && (_item$_extend = item._extend) !== null && _item$_extend !== void 0 && _item$_extend.discount_reason && type === 'total' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
35
35
  className: "".concat(prefix, "product-item-discount-reason")
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
- declare const Header: ({ isShowDelete, item, showImage, onDelete }: any) => React.JSX.Element;
3
+ declare const Header: (props: any) => React.JSX.Element;
4
4
  export default Header;
@@ -6,11 +6,13 @@ import { image, formatAmount } from '@pisell/utils';
6
6
  import Options from "../Packages/components/options";
7
7
  import "./index.less";
8
8
  var prefix = 'pisell-lowcode-';
9
- var Header = function Header(_ref) {
10
- var isShowDelete = _ref.isShowDelete,
11
- item = _ref.item,
12
- showImage = _ref.showImage,
13
- onDelete = _ref.onDelete;
9
+ var Header = function Header(props) {
10
+ var isShowDelete = props.isShowDelete,
11
+ item = props.item,
12
+ showImage = props.showImage,
13
+ onDelete = props.onDelete,
14
+ disabledEdit = props.disabledEdit;
15
+
14
16
  /**
15
17
  * @title: 是否显示价格
16
18
  * @description:
@@ -38,7 +40,7 @@ var Header = function Header(_ref) {
38
40
  }, [item === null || item === void 0 ? void 0 : item.options, item === null || item === void 0 ? void 0 : item.product_option_string]);
39
41
  return /*#__PURE__*/React.createElement("div", {
40
42
  className: classNames("".concat(prefix, "product-header"), headerCenterStyle && "".concat(prefix, "product-options-header"))
41
- }, isShowDelete ? /*#__PURE__*/React.createElement("div", {
43
+ }, isShowDelete && !disabledEdit ? /*#__PURE__*/React.createElement("div", {
42
44
  className: "".concat(prefix, "product-delete"),
43
45
  onClick: function onClick(e) {
44
46
  e.stopPropagation();
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
- declare const Note: ({ item, type, openNote }: any) => React.JSX.Element;
3
+ declare const Note: (props: any) => React.JSX.Element | null;
4
4
  export default Note;
@@ -4,21 +4,22 @@ import { locales } from '@pisell/utils';
4
4
  import Divider from "../Divider";
5
5
  import "./index.less";
6
6
  var prefix = 'pisell-lowcode-';
7
- var Note = function Note(_ref) {
8
- var item = _ref.item,
9
- type = _ref.type,
10
- openNote = _ref.openNote;
11
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
7
+ var Note = function Note(props) {
8
+ var item = props.item,
9
+ type = props.type,
10
+ openNote = props.openNote,
11
+ disabledEdit = props.disabledEdit;
12
+ return item !== null && item !== void 0 && item.note || !disabledEdit ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
12
13
  type: type
13
14
  }), /*#__PURE__*/React.createElement("div", {
14
15
  className: classNames("".concat(prefix, "product-note-wrap"))
15
- }, item !== null && item !== void 0 && item.note ? /*#__PURE__*/React.createElement("div", null, locales.getText('pisell2.product.card.discount.note'), ": ", item.note) : null, /*#__PURE__*/React.createElement("span", {
16
+ }, item !== null && item !== void 0 && item.note ? /*#__PURE__*/React.createElement("div", null, locales.getText('pisell2.product.card.discount.note'), ": ", item.note) : null, !disabledEdit ? /*#__PURE__*/React.createElement("span", {
16
17
  className: "".concat(prefix, "product-note-btn"),
17
18
  onClick: function onClick(e) {
18
19
  e.preventDefault();
19
20
  e.stopPropagation();
20
21
  openNote();
21
22
  }
22
- }, item !== null && item !== void 0 && item.note ? locales.getText('pisell2.product.card.discount.edit.note') : locales.getText('pisell2.product.card.discount.add.note'))));
23
+ }, item !== null && item !== void 0 && item.note ? locales.getText('pisell2.product.card.discount.edit.note') : locales.getText('pisell2.product.card.discount.add.note')) : null)) : null;
23
24
  };
24
25
  export default Note;
@@ -1,9 +1,13 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ var _excluded = ["dataSource", "isShowImage", "isShowHolder", "isShowNote", "isShowDelete", "isShowPackageNote", "onAction", "onDelete", "onNote", "onLike", "onCard"];
2
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
+ function _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
6
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
7
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
8
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
9
+ 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; }
10
+ 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; }
7
11
  import React, { useMemo, useRef } from 'react';
8
12
  import classNames from 'classnames';
9
13
  import { Alert } from 'antd';
@@ -37,7 +41,8 @@ var ProductCard = function ProductCard(props) {
37
41
  _onDelete = props.onDelete,
38
42
  onNote = props.onNote,
39
43
  _onLike = props.onLike,
40
- onCard = props.onCard;
44
+ onCard = props.onCard,
45
+ other = _objectWithoutProperties(props, _excluded);
41
46
  var useOpenNoteRef = useRef();
42
47
 
43
48
  /**
@@ -73,7 +78,7 @@ var ProductCard = function ProductCard(props) {
73
78
  e.stopPropagation();
74
79
  onCard === null || onCard === void 0 ? void 0 : onCard(dataSource);
75
80
  }
76
- }, /*#__PURE__*/React.createElement(Header, {
81
+ }, /*#__PURE__*/React.createElement(Header, _extends({}, other, {
77
82
  item: dataSource,
78
83
  isShowImage: isShowImage,
79
84
  isShowDelete: isShowDelete,
@@ -81,7 +86,7 @@ var ProductCard = function ProductCard(props) {
81
86
  onDelete: function onDelete() {
82
87
  _onDelete === null || _onDelete === void 0 ? void 0 : _onDelete(dataSource);
83
88
  }
84
- }), dataSource !== null && dataSource !== void 0 && dataSource._extend ? /*#__PURE__*/React.createElement(Time, {
89
+ })), dataSource !== null && dataSource !== void 0 && dataSource._extend ? /*#__PURE__*/React.createElement(Time, {
85
90
  item: dataSource,
86
91
  isShowHolder: isShowHolder,
87
92
  onLike: function onLike(item) {
@@ -97,14 +102,14 @@ var ProductCard = function ProductCard(props) {
97
102
  item: dataSource,
98
103
  hideDivider: hideDivider,
99
104
  type: "total"
100
- }), isShowNote ? /*#__PURE__*/React.createElement(Note, {
105
+ }), isShowNote ? /*#__PURE__*/React.createElement(Note, _extends({}, other, {
101
106
  item: dataSource,
102
107
  openNote: function openNote() {
103
108
  useOpenNoteRef.current.open({
104
109
  item: dataSource
105
110
  });
106
111
  }
107
- }) : null, dataSource !== null && dataSource !== void 0 && dataSource._showAction && dataSource !== null && dataSource !== void 0 && dataSource._actionText ? /*#__PURE__*/React.createElement(Action, {
112
+ })) : null, dataSource !== null && dataSource !== void 0 && dataSource._showAction && dataSource !== null && dataSource !== void 0 && dataSource._actionText ? /*#__PURE__*/React.createElement(Action, {
108
113
  item: dataSource,
109
114
  onAction: function onAction() {
110
115
  return _onAction === null || _onAction === void 0 ? void 0 : _onAction(dataSource);
@@ -0,0 +1,9 @@
1
+ import { ProductCardTypes } from './types';
2
+ /**
3
+ * @title: 默认数据
4
+ * @description:
5
+ * @return {*}
6
+ * @Author: WangHan
7
+ * @Date: 2024-12-12 16:49
8
+ */
9
+ export declare const defaultValue: ProductCardTypes;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @title: 默认数据
3
+ * @description:
4
+ * @return {*}
5
+ * @Author: WangHan
6
+ * @Date: 2024-12-12 16:49
7
+ */
8
+ export var defaultValue = {
9
+ dataSource: {},
10
+ isShowImage: true,
11
+ isShowHolder: true,
12
+ isShowNote: true,
13
+ isShowDelete: true,
14
+ isShowPackageNote: true
15
+ };
@@ -8,6 +8,7 @@ export declare type ProductCardTypes = {
8
8
  isShowNote?: boolean;
9
9
  isShowPackageNote?: boolean;
10
10
  isShowDelete?: boolean;
11
+ disabledEdit?: boolean;
11
12
  onAction?: (val: any) => void;
12
13
  onDelete?: (val: any) => void;
13
14
  onNote?: (val: any) => void;
@@ -54,7 +54,7 @@ var Footer = ({ item, hideDivider, type }) => {
54
54
  hideDivider && `${prefix}packages-product-hide-divider-footer`
55
55
  )
56
56
  },
57
- /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_utils._formatAmount)(item == null ? void 0 : item.total, item == null ? void 0 : item.symbol)), /* @__PURE__ */ import_react.default.createElement("span", null, `×${item == null ? void 0 : item.num}`), /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefix}packages-product-footer-total` }, `${item == null ? void 0 : item.symbol} ${(0, import_utils._formatAmount)((item == null ? void 0 : item.total) * (item == null ? void 0 : item.num))}`)),
57
+ /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_utils._formatAmount)(item == null ? void 0 : item.total, item == null ? void 0 : item.symbol)), /* @__PURE__ */ import_react.default.createElement("span", null, `×${item == null ? void 0 : item.num}`), /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefix}packages-product-footer-total` }, (0, import_utils._formatAmount)((item == null ? void 0 : item.total) * (item == null ? void 0 : item.num), item == null ? void 0 : item.symbol))),
58
58
  isDiscount ? /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}packages-product-footer-discount` }, /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_utils._formatAmount)(item == null ? void 0 : item.origin_total, item == null ? void 0 : item.symbol)), /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_utils._formatAmount)((item == null ? void 0 : item.origin_total) * (item == null ? void 0 : item.num), item == null ? void 0 : item.symbol, 2))) : null
59
59
  ), isDiscount && ((_a = item._extend) == null ? void 0 : _a.discount_reason) && type === "total" ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_Divider.default, null), /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}product-item-discount-reason` }, /* @__PURE__ */ import_react.default.createElement("span", null, `${import_utils2.locales.getText("pisell2.product.card.discount.reason")}: ${(_b = item._extend) == null ? void 0 : _b.discount_reason}`))) : null);
60
60
  };
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
- declare const Header: ({ isShowDelete, item, showImage, onDelete }: any) => React.JSX.Element;
3
+ declare const Header: (props: any) => React.JSX.Element;
4
4
  export default Header;
@@ -40,7 +40,8 @@ var import_utils = require("@pisell/utils");
40
40
  var import_options = __toESM(require("../Packages/components/options"));
41
41
  var import_index = require("./index.less");
42
42
  var prefix = "pisell-lowcode-";
43
- var Header = ({ isShowDelete, item, showImage, onDelete }) => {
43
+ var Header = (props) => {
44
+ const { isShowDelete, item, showImage, onDelete, disabledEdit } = props;
44
45
  const showPrice = (0, import_react.useMemo)(() => {
45
46
  var _a, _b;
46
47
  return ((_a = item == null ? void 0 : item.bundle) == null ? void 0 : _a.length) > 0 || ((_b = item == null ? void 0 : item.options) == null ? void 0 : _b.length) > 0;
@@ -57,7 +58,7 @@ var Header = ({ isShowDelete, item, showImage, onDelete }) => {
57
58
  headerCenterStyle && `${prefix}product-options-header`
58
59
  )
59
60
  },
60
- isShowDelete ? /* @__PURE__ */ import_react.default.createElement(
61
+ isShowDelete && !disabledEdit ? /* @__PURE__ */ import_react.default.createElement(
61
62
  "div",
62
63
  {
63
64
  className: `${prefix}product-delete`,
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
- declare const Note: ({ item, type, openNote }: any) => React.JSX.Element;
3
+ declare const Note: (props: any) => React.JSX.Element | null;
4
4
  export default Note;
@@ -38,8 +38,9 @@ var import_utils = require("@pisell/utils");
38
38
  var import_Divider = __toESM(require("../Divider"));
39
39
  var import_index = require("./index.less");
40
40
  var prefix = "pisell-lowcode-";
41
- var Note = ({ item, type, openNote }) => {
42
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_Divider.default, { type }), /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(`${prefix}product-note-wrap`) }, (item == null ? void 0 : item.note) ? /* @__PURE__ */ import_react.default.createElement("div", null, import_utils.locales.getText("pisell2.product.card.discount.note"), ": ", item.note) : null, /* @__PURE__ */ import_react.default.createElement(
41
+ var Note = (props) => {
42
+ const { item, type, openNote, disabledEdit } = props;
43
+ return (item == null ? void 0 : item.note) || !disabledEdit ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_Divider.default, { type }), /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(`${prefix}product-note-wrap`) }, (item == null ? void 0 : item.note) ? /* @__PURE__ */ import_react.default.createElement("div", null, import_utils.locales.getText("pisell2.product.card.discount.note"), ": ", item.note) : null, !disabledEdit ? /* @__PURE__ */ import_react.default.createElement(
43
44
  "span",
44
45
  {
45
46
  className: `${prefix}product-note-btn`,
@@ -50,6 +51,6 @@ var Note = ({ item, type, openNote }) => {
50
51
  }
51
52
  },
52
53
  (item == null ? void 0 : item.note) ? import_utils.locales.getText("pisell2.product.card.discount.edit.note") : import_utils.locales.getText("pisell2.product.card.discount.add.note")
53
- )));
54
+ ) : null)) : null;
54
55
  };
55
56
  var Note_default = Note;
@@ -61,7 +61,8 @@ var ProductCard = (props) => {
61
61
  onDelete,
62
62
  onNote,
63
63
  onLike,
64
- onCard
64
+ onCard,
65
+ ...other
65
66
  } = props;
66
67
  const useOpenNoteRef = (0, import_react.useRef)();
67
68
  const showImage = (0, import_react.useMemo)(() => {
@@ -92,6 +93,7 @@ var ProductCard = (props) => {
92
93
  /* @__PURE__ */ import_react.default.createElement(
93
94
  import_Header.default,
94
95
  {
96
+ ...other,
95
97
  item: dataSource,
96
98
  isShowImage,
97
99
  isShowDelete,
@@ -122,6 +124,7 @@ var ProductCard = (props) => {
122
124
  isShowNote ? /* @__PURE__ */ import_react.default.createElement(
123
125
  import_Note.default,
124
126
  {
127
+ ...other,
125
128
  item: dataSource,
126
129
  openNote: () => {
127
130
  useOpenNoteRef.current.open({
@@ -0,0 +1,9 @@
1
+ import { ProductCardTypes } from './types';
2
+ /**
3
+ * @title: 默认数据
4
+ * @description:
5
+ * @return {*}
6
+ * @Author: WangHan
7
+ * @Date: 2024-12-12 16:49
8
+ */
9
+ export declare const defaultValue: ProductCardTypes;
@@ -0,0 +1,36 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/productCard/status.ts
20
+ var status_exports = {};
21
+ __export(status_exports, {
22
+ defaultValue: () => defaultValue
23
+ });
24
+ module.exports = __toCommonJS(status_exports);
25
+ var defaultValue = {
26
+ dataSource: {},
27
+ isShowImage: true,
28
+ isShowHolder: true,
29
+ isShowNote: true,
30
+ isShowDelete: true,
31
+ isShowPackageNote: true
32
+ };
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ defaultValue
36
+ });
@@ -8,6 +8,7 @@ export declare type ProductCardTypes = {
8
8
  isShowNote?: boolean;
9
9
  isShowPackageNote?: boolean;
10
10
  isShowDelete?: boolean;
11
+ disabledEdit?: boolean;
11
12
  onAction?: (val: any) => void;
12
13
  onDelete?: (val: any) => void;
13
14
  onNote?: (val: any) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.459",
3
+ "version": "1.0.460",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",