@pisell/materials 1.0.1008 → 1.0.1010

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 (29) 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 +4 -4
  6. package/build/lowcode/preview.js +164 -150
  7. package/build/lowcode/render/default/view.js +39 -26
  8. package/build/lowcode/view.js +39 -26
  9. package/es/components/pisellDataSourceContainer/components/ColumnsSetting/index.d.ts +7 -1
  10. package/es/components/pisellDataSourceContainer/components/ColumnsSetting/index.js +30 -3
  11. package/es/components/pisellDataSourceContainer/components/ColumnsSetting/utils.d.ts +22 -0
  12. package/es/components/pisellDataSourceContainer/components/ColumnsSetting/utils.js +117 -0
  13. package/es/components/pisellDataSourceContainer/components/Pagination/index.js +15 -11
  14. package/es/components/pisellDataSourceContainer/components/Table/index.d.ts +1 -0
  15. package/es/components/pisellDataSourceContainer/components/Table/index.js +5 -3
  16. package/es/components/pisellDataSourceContainer/components/Table/useColumns.d.ts +1 -0
  17. package/es/components/pisellDataSourceContainer/components/Table/useColumns.js +37 -15
  18. package/es/components/pisellWalletPassCard/index.js +10 -4
  19. package/lib/components/pisellDataSourceContainer/components/ColumnsSetting/index.d.ts +7 -1
  20. package/lib/components/pisellDataSourceContainer/components/ColumnsSetting/index.js +18 -2
  21. package/lib/components/pisellDataSourceContainer/components/ColumnsSetting/utils.d.ts +22 -0
  22. package/lib/components/pisellDataSourceContainer/components/ColumnsSetting/utils.js +121 -0
  23. package/lib/components/pisellDataSourceContainer/components/Pagination/index.js +15 -7
  24. package/lib/components/pisellDataSourceContainer/components/Table/index.d.ts +1 -0
  25. package/lib/components/pisellDataSourceContainer/components/Table/index.js +3 -1
  26. package/lib/components/pisellDataSourceContainer/components/Table/useColumns.d.ts +1 -0
  27. package/lib/components/pisellDataSourceContainer/components/Table/useColumns.js +25 -14
  28. package/lib/components/pisellWalletPassCard/index.js +10 -4
  29. package/package.json +2 -2
@@ -44,6 +44,20 @@ var WithPagination = (0, import_react.forwardRef)(
44
44
  ...otherProps
45
45
  } = props;
46
46
  const { pagination, data } = listAction;
47
+ const paginationProps = (0, import_react.useMemo)(() => {
48
+ return {
49
+ showTotal: (total) => {
50
+ return (0, import_locales.getText)("table-pagination-total")(
51
+ (pagination == null ? void 0 : pagination.pageNumber) || 1,
52
+ Math.ceil(total / ((pagination == null ? void 0 : pagination.pageSize) || 10))
53
+ );
54
+ },
55
+ total: (data == null ? void 0 : data.count) || 0,
56
+ current: (pagination == null ? void 0 : pagination.pageNumber) || 1,
57
+ pageSize: (pagination == null ? void 0 : pagination.pageSize) || 10,
58
+ onChange: listAction.onPageChange
59
+ };
60
+ }, [pagination == null ? void 0 : pagination.pageNumber, pagination == null ? void 0 : pagination.pageSize, data == null ? void 0 : data.count, listAction.onPageChange]);
47
61
  if (!pagination) {
48
62
  console.error("分页功能未启用");
49
63
  return null;
@@ -51,14 +65,8 @@ var WithPagination = (0, import_react.forwardRef)(
51
65
  return /* @__PURE__ */ import_react.default.createElement(
52
66
  import_Pagination.default,
53
67
  {
54
- showTotal: (total) => {
55
- return (0, import_locales.getText)("table-pagination-total")((pagination == null ? void 0 : pagination.pageNumber) || 1, total);
56
- },
57
68
  ...otherProps,
58
- total: (data == null ? void 0 : data.count) || 0,
59
- current: (pagination == null ? void 0 : pagination.pageNumber) || 1,
60
- pageSize: (pagination == null ? void 0 : pagination.pageSize) || 10,
61
- onChange: listAction.onPageChange
69
+ ...paginationProps
62
70
  }
63
71
  );
64
72
  }
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { DataSourceContainerContextType } from '../../type';
3
3
  declare const _default: React.ForwardRefExoticComponent<Omit<Partial<import("antd").TableProps<any>> & DataSourceContainerContextType & {
4
4
  scopeId?: string | undefined;
5
+ __id?: string | undefined;
5
6
  } & React.RefAttributes<unknown> & {
6
7
  refId?: string | undefined;
7
8
  }, "ref"> & React.RefAttributes<any>>;
@@ -43,13 +43,15 @@ var WithTable = (0, import_react.forwardRef)(
43
43
  refManager,
44
44
  columns,
45
45
  scopeId = "table",
46
+ __id,
46
47
  ...otherProps
47
48
  } = props;
48
49
  const { data, loading } = listAction;
49
50
  const { visibleColumns } = (0, import_useColumns.default)({
50
51
  columns: columns || [],
51
52
  scopeId,
52
- refManager
53
+ refManager,
54
+ __id
53
55
  });
54
56
  return /* @__PURE__ */ import_react.default.createElement(
55
57
  import_antd.Table,
@@ -6,6 +6,7 @@ interface UseColumnsParams {
6
6
  columns: any[];
7
7
  scopeId: string;
8
8
  refManager: RefManagerContextType;
9
+ __id?: string;
9
10
  }
10
11
  declare const useColumns: (params: UseColumnsParams) => {
11
12
  visibleColumns: any[];
@@ -24,18 +24,31 @@ __export(useColumns_exports, {
24
24
  module.exports = __toCommonJS(useColumns_exports);
25
25
  var import_react = require("react");
26
26
  var import_ColumnsSetting = require("../ColumnsSetting");
27
+ var import_utils = require("../ColumnsSetting/utils");
27
28
  var useColumns = (params) => {
28
- const { columns, scopeId, refManager } = params;
29
+ const { columns, scopeId, refManager, __id } = params;
29
30
  const [columnSettings, setColumnSettings] = (0, import_react.useState)([]);
30
31
  (0, import_react.useEffect)(() => {
31
32
  if (!(columns == null ? void 0 : columns.length)) return;
32
- const settings = columns.map((col, index) => ({
33
- key: col.key || col.dataIndex,
33
+ const mergedColumns = (0, import_utils.mergeColumnSettingSimple)({
34
+ columns: columns.map((col, index) => ({
35
+ key: col.key || col.dataIndex,
36
+ dataIndex: col.dataIndex,
37
+ title: col.title,
38
+ titleString: typeof col.title === "string" ? col.title : col.dataIndex,
39
+ isShow: typeof col.isShow === "boolean" ? col.isShow : true,
40
+ sortIndex: index,
41
+ fixed: col.fixed
42
+ })),
43
+ componentId: __id
44
+ });
45
+ const settings = mergedColumns.map((col) => ({
46
+ key: col.key,
34
47
  dataIndex: col.dataIndex,
35
48
  title: col.title,
36
- titleString: typeof col.title === "string" ? col.title : col.dataIndex,
37
- isShow: typeof col.isShow === "boolean" ? col.isShow : true,
38
- sortIndex: index,
49
+ titleString: col.titleString,
50
+ isShow: col.isShow,
51
+ sortIndex: col.sortIndex,
39
52
  fixed: col.fixed
40
53
  }));
41
54
  refManager.setSharedState(
@@ -43,7 +56,7 @@ var useColumns = (params) => {
43
56
  settings
44
57
  );
45
58
  setColumnSettings(settings);
46
- }, [columns, refManager, scopeId]);
59
+ }, [columns, refManager, scopeId, __id]);
47
60
  (0, import_react.useEffect)(() => {
48
61
  const unsubscribe = refManager.subscribeSharedState(
49
62
  import_ColumnsSetting.COLUMNS_SHARED_STATE_KEYS.columnsChange(scopeId),
@@ -51,14 +64,12 @@ var useColumns = (params) => {
51
64
  );
52
65
  return unsubscribe;
53
66
  }, [refManager, scopeId]);
54
- const visibleColumns = (0, import_react.useMemo)(() => {
55
- if (!(columns == null ? void 0 : columns.length)) return [];
56
- if (!(columnSettings == null ? void 0 : columnSettings.length)) return columns;
67
+ return (0, import_react.useMemo)(() => {
68
+ if (!(columns == null ? void 0 : columns.length)) return { visibleColumns: [] };
69
+ if (!(columnSettings == null ? void 0 : columnSettings.length)) return { visibleColumns: columns };
57
70
  const columnMap = new Map(columns.map((col) => [col.dataIndex, col]));
58
- return columnSettings.filter((setting) => setting.isShow).map((setting) => columnMap.get(setting.dataIndex)).filter(Boolean);
71
+ const visibleColumns = columnSettings.filter((setting) => setting.isShow).map((setting) => columnMap.get(setting.dataIndex)).filter(Boolean);
72
+ return { visibleColumns };
59
73
  }, [columns, columnSettings]);
60
- return {
61
- visibleColumns
62
- };
63
74
  };
64
75
  var useColumns_default = useColumns;
@@ -407,7 +407,9 @@ var PisellWalletPassCard = (props) => {
407
407
  className: "pisell-card-amount-item-value",
408
408
  useThousandsSeparator: true,
409
409
  value: balance,
410
- showCurrencySymbol: showBalanceSymbol
410
+ showCurrencySymbol: showBalanceSymbol,
411
+ precision: 2,
412
+ hideDecimalForWholeNumbers: false
411
413
  }
412
414
  );
413
415
  const createOriginalRedeemTitleDom = () => /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-card-amount-item-label-text" }, formatRedeemTitle ? formatRedeemTitle(redeemTitle, {
@@ -421,7 +423,9 @@ var PisellWalletPassCard = (props) => {
421
423
  className: "pisell-card-amount-item-value",
422
424
  useThousandsSeparator: true,
423
425
  value: redeem,
424
- showCurrencySymbol: true
426
+ showCurrencySymbol: true,
427
+ precision: 2,
428
+ hideDecimalForWholeNumbers: false
425
429
  }
426
430
  );
427
431
  const renderRedeemInfo = () => {
@@ -453,9 +457,11 @@ var PisellWalletPassCard = (props) => {
453
457
  }) : createOriginalBalanceDom()), showDiscount && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-card-amount-item pisell-card-amount-item-discount" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-card-amount-item-label" }, (0, import_locales.getText)("pisell-discount-card-title"), ": "), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-card-amount-item-value" }, ((_a = props.metadata) == null ? void 0 : _a.discount_card_type) === "fixed_amount" ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, (0, import_locales.getText)("pisell-discount-card-fixed-amount-prefix"), " ", /* @__PURE__ */ import_react.default.createElement(
454
458
  import_Amount.default,
455
459
  {
456
- className: "pisell-card-amount-item-value",
460
+ className: "pisell-card-amount-item-value test1",
457
461
  useThousandsSeparator: true,
458
- value: discount
462
+ value: discount,
463
+ precision: 2,
464
+ hideDecimalForWholeNumbers: false
459
465
  }
460
466
  )) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, discount, "% ", (0, import_locales.getText)("pisell-discount-card-unit"))))), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-card-code-wrap", style: { marginRight: showQrCode && !isMini ? 60 : 0 } }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-card-code" }, showCode && !isMini && /* @__PURE__ */ import_react.default.createElement("div", null, code), showValidDate && (!isMini || !_showHolderName) && /* @__PURE__ */ import_react.default.createElement("div", null, formatValidDate))));
461
467
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.1008",
3
+ "version": "1.0.1010",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -88,7 +88,7 @@
88
88
  "swiper": "^8.4.7",
89
89
  "antd-mobile": "^5.38.1",
90
90
  "vod-js-sdk-v6": "^1.4.11",
91
- "@pisell/date-picker": "1.0.128",
91
+ "@pisell/date-picker": "1.0.129",
92
92
  "@pisell/icon": "0.0.10",
93
93
  "@pisell/utils": "1.0.56"
94
94
  },