@pisell/materials 1.0.549 → 1.0.550

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.
@@ -26,7 +26,7 @@
26
26
  .pisell-lowcode-data-source-form-group-content {
27
27
  border: 1px solid var(--Gray-300, #d0d5dd);
28
28
  border-radius: 8px;
29
- padding: 20px;
29
+ padding: 20px 20px 0;
30
30
  }
31
31
  }
32
32
  &-info {
@@ -19,7 +19,8 @@ var Header = function Header(props) {
19
19
  image = item.image,
20
20
  name = item.name,
21
21
  price = item.price,
22
- symbol = item.symbol;
22
+ symbol = item.symbol,
23
+ show_delete = item.show_delete;
23
24
 
24
25
  /**
25
26
  * @title: 是否显示价格
@@ -48,7 +49,7 @@ var Header = function Header(props) {
48
49
  }, [options, product_option_string]);
49
50
  return /*#__PURE__*/React.createElement("div", {
50
51
  className: classNames("".concat(prefix, "product-header"), headerCenterStyle && "".concat(prefix, "product-options-header"))
51
- }, isShowDelete && !disabledEdit ? /*#__PURE__*/React.createElement("div", {
52
+ }, isShowDelete && !disabledEdit || show_delete ? /*#__PURE__*/React.createElement("div", {
52
53
  className: "".concat(prefix, "product-delete"),
53
54
  onClick: function onClick(e) {
54
55
  e.stopPropagation();
@@ -43,7 +43,9 @@ export var defaultProduct = {
43
43
  num: 1,
44
44
  image: '',
45
45
  isShowNote: true,
46
- note: ''
46
+ note: '',
47
+ is_show_duration: true,
48
+ is_show_week: true
47
49
  };
48
50
 
49
51
  /**
@@ -54,6 +54,8 @@ export declare type productType = {
54
54
  holder_title?: string;
55
55
  start_date?: string;
56
56
  end_date?: string;
57
+ is_show_duration?: boolean;
58
+ is_show_week?: boolean;
57
59
  };
58
60
  /**
59
61
  * 排序总配置
@@ -3,6 +3,7 @@ import { locales } from '@pisell/utils';
3
3
  import 'dayjs/locale/zh-cn';
4
4
  import 'dayjs/locale/en';
5
5
  import 'dayjs/locale/zh-tw';
6
+ import useEngineContext from "../../hooks/useEngineContext";
6
7
 
7
8
  /**
8
9
  * @title: 是否英文
@@ -53,8 +54,11 @@ export var formatMultiDayDate = function formatMultiDayDate(item) {
53
54
  * @Date: 2024-04-26 14:04
54
55
  */
55
56
  export var getServiceTime = function getServiceTime(item, currentDate) {
57
+ var _utils$storage;
56
58
  if (!dayjs(currentDate).isValid()) return '';
57
- var locale = (item === null || item === void 0 ? void 0 : item.locale) || 'en-US';
59
+ var context = useEngineContext();
60
+ var utils = context.appHelper.utils || {};
61
+ var locale = (item === null || item === void 0 ? void 0 : item.locale) || (utils === null || utils === void 0 ? void 0 : (_utils$storage = utils.storage) === null || _utils$storage === void 0 ? void 0 : _utils$storage.get('umi_locale')) || 'en-US';
58
62
  var isEn = locale === 'en-US' || locale === 'en';
59
63
  var localeTypes = {
60
64
  'en-US': 'en',
@@ -66,7 +70,17 @@ export var getServiceTime = function getServiceTime(item, currentDate) {
66
70
  var endDate = dayjs(item === null || item === void 0 ? void 0 : item.end_date);
67
71
  var diffInDays = endDate.diff(startDate, 'day');
68
72
  var _format = isEn ? 'ddd, DD/MM/YYYY' : 'YYYY-MM-DD,ddd';
73
+
74
+ // 是否显示周几
75
+ if (item !== null && item !== void 0 && item.hasOwnProperty('is_show_week') && !(item !== null && item !== void 0 && item.is_show_week)) {
76
+ _format = isEn ? 'DD/MM/YYYY' : 'YYYY-MM-DD';
77
+ }
69
78
  var date = "".concat(startDate.format(_format), " ~ ").concat(endDate.format(_format));
70
79
  var duration = "".concat(diffInDays, " ").concat(locales.getText('pisell2.product.card.day')(diffInDays));
80
+
81
+ // 是否显示时长
82
+ if (item !== null && item !== void 0 && item.hasOwnProperty('is_show_duration') && !(item !== null && item !== void 0 && item.is_show_duration)) {
83
+ return date;
84
+ }
71
85
  return "".concat(date, " (").concat(duration, ")");
72
86
  };
@@ -26,7 +26,7 @@
26
26
  .pisell-lowcode-data-source-form-group-content {
27
27
  border: 1px solid var(--Gray-300, #d0d5dd);
28
28
  border-radius: 8px;
29
- padding: 20px;
29
+ padding: 20px 20px 0;
30
30
  }
31
31
  }
32
32
  &-info {
@@ -50,7 +50,8 @@ var Header = (props) => {
50
50
  image,
51
51
  name,
52
52
  price,
53
- symbol
53
+ symbol,
54
+ show_delete
54
55
  } = item;
55
56
  const showPrice = (0, import_react.useMemo)(() => {
56
57
  return (bundle == null ? void 0 : bundle.length) > 0 || (options == null ? void 0 : options.length) > 0;
@@ -66,7 +67,7 @@ var Header = (props) => {
66
67
  headerCenterStyle && `${prefix}product-options-header`
67
68
  )
68
69
  },
69
- isShowDelete && !disabledEdit ? /* @__PURE__ */ import_react.default.createElement(
70
+ isShowDelete && !disabledEdit || show_delete ? /* @__PURE__ */ import_react.default.createElement(
70
71
  "div",
71
72
  {
72
73
  className: `${prefix}product-delete`,
@@ -48,7 +48,9 @@ var defaultProduct = {
48
48
  num: 1,
49
49
  image: "",
50
50
  isShowNote: true,
51
- note: ""
51
+ note: "",
52
+ is_show_duration: true,
53
+ is_show_week: true
52
54
  };
53
55
  var defaultValue = {
54
56
  dataSource: defaultProduct,
@@ -54,6 +54,8 @@ export declare type productType = {
54
54
  holder_title?: string;
55
55
  start_date?: string;
56
56
  end_date?: string;
57
+ is_show_duration?: boolean;
58
+ is_show_week?: boolean;
57
59
  };
58
60
  /**
59
61
  * 排序总配置
@@ -39,6 +39,7 @@ var import_utils = require("@pisell/utils");
39
39
  var import_zh_cn = require("dayjs/locale/zh-cn");
40
40
  var import_en = require("dayjs/locale/en");
41
41
  var import_zh_tw = require("dayjs/locale/zh-tw");
42
+ var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
42
43
  var isEn = (item) => {
43
44
  const locale = (item == null ? void 0 : item.locale) || "en-US";
44
45
  const _isEn = locale === "en-US" || locale === "en";
@@ -59,9 +60,12 @@ var formatMultiDayDate = (item) => {
59
60
  return date;
60
61
  };
61
62
  var getServiceTime = (item, currentDate) => {
63
+ var _a;
62
64
  if (!(0, import_dayjs.default)(currentDate).isValid())
63
65
  return "";
64
- const locale = (item == null ? void 0 : item.locale) || "en-US";
66
+ const context = (0, import_useEngineContext.default)();
67
+ const utils = context.appHelper.utils || {};
68
+ const locale = (item == null ? void 0 : item.locale) || ((_a = utils == null ? void 0 : utils.storage) == null ? void 0 : _a.get("umi_locale")) || "en-US";
65
69
  const isEn2 = locale === "en-US" || locale === "en";
66
70
  const localeTypes = {
67
71
  "en-US": "en",
@@ -72,9 +76,15 @@ var getServiceTime = (item, currentDate) => {
72
76
  const startDate = (0, import_dayjs.default)(item == null ? void 0 : item.start_date);
73
77
  const endDate = (0, import_dayjs.default)(item == null ? void 0 : item.end_date);
74
78
  const diffInDays = endDate.diff(startDate, "day");
75
- const _format = isEn2 ? "ddd, DD/MM/YYYY" : "YYYY-MM-DD,ddd";
79
+ let _format = isEn2 ? "ddd, DD/MM/YYYY" : "YYYY-MM-DD,ddd";
80
+ if ((item == null ? void 0 : item.hasOwnProperty("is_show_week")) && !(item == null ? void 0 : item.is_show_week)) {
81
+ _format = isEn2 ? "DD/MM/YYYY" : "YYYY-MM-DD";
82
+ }
76
83
  const date = `${startDate.format(_format)} ~ ${endDate.format(_format)}`;
77
84
  const duration = `${diffInDays} ${import_utils.locales.getText("pisell2.product.card.day")(diffInDays)}`;
85
+ if ((item == null ? void 0 : item.hasOwnProperty("is_show_duration")) && !(item == null ? void 0 : item.is_show_duration)) {
86
+ return date;
87
+ }
78
88
  return `${date} (${duration})`;
79
89
  };
80
90
  // Annotate the CommonJS export names for ESM import in node:
@@ -164,6 +164,7 @@ const dataSourceForm: MetaType = {
164
164
  title: '字段',
165
165
  display: 'entry',
166
166
  type: 'group',
167
+ name: "_fields1",
167
168
  items: [
168
169
  {
169
170
  title: {
@@ -263,6 +264,7 @@ const dataSourceForm: MetaType = {
263
264
  },
264
265
  {
265
266
  type: 'group',
267
+ name: "_extraParams",
266
268
  title: '额外参数',
267
269
  display: 'entry',
268
270
  items: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.549",
3
+ "version": "1.0.550",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -69,8 +69,8 @@
69
69
  "libphonenumber-js": "^1.11.17",
70
70
  "swiper": "^8.4.7",
71
71
  "react-barcode": "^1.5.3",
72
- "@pisell/icon": "0.0.10",
73
72
  "@pisell/date-picker": "1.0.115",
73
+ "@pisell/icon": "0.0.10",
74
74
  "@pisell/utils": "1.0.43"
75
75
  },
76
76
  "peerDependencies": {