@pisell/materials 1.0.559 → 1.0.561

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 (30) 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 +6 -6
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +17 -17
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +16 -16
  11. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -1
  12. package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +1 -0
  13. package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +16 -1
  14. package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +1 -1
  15. package/es/components/organizationTenantSwitcher/index.d.ts +2 -0
  16. package/es/components/organizationTenantSwitcher/index.js +12 -5
  17. package/es/components/organizationTenantSwitcher/index.less +10 -0
  18. package/es/components/productCard/utils.js +5 -4
  19. package/es/components/table/Table/utils.d.ts +1 -1
  20. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -1
  21. package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +1 -0
  22. package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +17 -2
  23. package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +1 -1
  24. package/lib/components/organizationTenantSwitcher/index.d.ts +2 -0
  25. package/lib/components/organizationTenantSwitcher/index.js +11 -5
  26. package/lib/components/organizationTenantSwitcher/index.less +10 -0
  27. package/lib/components/productCard/utils.js +3 -3
  28. package/lib/components/table/Table/utils.d.ts +1 -1
  29. package/lowcode/organization-tenant-switch/meta.ts +7 -0
  30. package/package.json +3 -3
@@ -65,7 +65,7 @@ declare const useTableProps: (props: UseTablePropsProps) => {
65
65
  useCustomAction: boolean;
66
66
  actionType: string;
67
67
  openMode: "modal" | "drawer";
68
- openContentSize: "small" | "large" | "middle";
68
+ openContentSize: "small" | "middle" | "large";
69
69
  openTitle: string;
70
70
  key: string;
71
71
  } | undefined;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { UrlProps } from './type';
3
3
  import './ReadPretty.less';
4
+ export declare const formatUrl: (url: string) => string;
4
5
  declare const UrlReadPretty: (props: UrlProps) => React.JSX.Element;
5
6
  export default UrlReadPretty;
@@ -3,14 +3,29 @@ import { Typography } from 'antd';
3
3
  import classNames from 'classnames';
4
4
  import "./ReadPretty.less";
5
5
  var Link = Typography.Link;
6
+
7
+ // 格式化 url 确保包含协议前缀
8
+ export var formatUrl = function formatUrl(url) {
9
+ if (!url) return '';
10
+
11
+ // 如果已经包含协议前缀,直接返回
12
+ if (url.startsWith('http://') || url.startsWith('https://')) {
13
+ return url;
14
+ }
15
+
16
+ // 默认添加 https:// 前缀
17
+ return "https://".concat(url);
18
+ };
6
19
  var UrlReadPretty = function UrlReadPretty(props) {
7
20
  var value = props.value,
8
21
  renderMode = props.renderMode;
22
+ var formattedUrl = formatUrl(value);
9
23
  return /*#__PURE__*/React.createElement(Link, {
10
24
  className: classNames('pisell-url-read-pretty', {
11
25
  'pisell-url-read-pretty-table-view': renderMode === 'tableView'
12
26
  }),
13
- href: value
27
+ href: formattedUrl,
28
+ target: "_blank"
14
29
  }, value);
15
30
  };
16
31
  export default UrlReadPretty;
@@ -1,5 +1,5 @@
1
1
  .pisell-url-read-pretty {
2
- color: var(--Gray-900, #101828);
2
+ //color: var(--Gray-900, #101828);
3
3
  font-size: 16px;
4
4
  font-weight: 600;
5
5
  line-height: 24px; /* 150% */
@@ -10,6 +10,8 @@ interface OrganizationTenantSwitcherProps {
10
10
  }[];
11
11
  showLogo?: boolean;
12
12
  showName?: boolean;
13
+ readOnly?: boolean;
14
+ onClick?: React.MouseEventHandler<HTMLDivElement>;
13
15
  }
14
16
  declare const OrganizationTenantSwitcher: React.FC<OrganizationTenantSwitcherProps>;
15
17
  export default OrganizationTenantSwitcher;
@@ -27,7 +27,10 @@ var OrganizationTenantSwitcher = function OrganizationTenantSwitcher(_ref2) {
27
27
  _ref2$showLogo = _ref2.showLogo,
28
28
  showLogo = _ref2$showLogo === void 0 ? true : _ref2$showLogo,
29
29
  _ref2$showName = _ref2.showName,
30
- showName = _ref2$showName === void 0 ? true : _ref2$showName;
30
+ showName = _ref2$showName === void 0 ? true : _ref2$showName,
31
+ _ref2$readOnly = _ref2.readOnly,
32
+ readOnly = _ref2$readOnly === void 0 ? false : _ref2$readOnly,
33
+ onClick = _ref2.onClick;
31
34
  var getCurrentOrg = function getCurrentOrg() {
32
35
  return options.find(function (opt) {
33
36
  return (opt === null || opt === void 0 ? void 0 : opt.value) === value;
@@ -70,19 +73,23 @@ var OrganizationTenantSwitcher = function OrganizationTenantSwitcher(_ref2) {
70
73
  overflow: 'auto'
71
74
  }
72
75
  },
73
- trigger: ['click']
76
+ trigger: readOnly ? [] : ['click'],
77
+ disabled: readOnly
74
78
  }, /*#__PURE__*/React.createElement("div", {
75
- className: "organization-tenant-switcher-switch",
79
+ className: classNames('organization-tenant-switcher-switch', {
80
+ 'organization-tenant-switcher-switch-readonly': readOnly
81
+ }),
76
82
  style: !showLogo ? {
77
83
  paddingLeft: 16
78
- } : {}
84
+ } : {},
85
+ onClick: onClick
79
86
  }, showLogo && /*#__PURE__*/React.createElement(Logo, {
80
87
  logo: currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.logo,
81
88
  className: "organization-tenant-switcher-switch-logo"
82
89
  }), /*#__PURE__*/React.createElement("div", {
83
90
  className: "organization-tenant-switcher-switch-name",
84
91
  title: currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.label
85
- }, showName && (currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.label)), /*#__PURE__*/React.createElement(ChevronDown, {
92
+ }, showName && (currentOrg === null || currentOrg === void 0 ? void 0 : currentOrg.label)), !readOnly && /*#__PURE__*/React.createElement(ChevronDown, {
86
93
  className: "organization-tenant-switcher-switch-chevron"
87
94
  })));
88
95
  };
@@ -17,6 +17,16 @@
17
17
  border-color: var(--Gray-200, #e5e7eb);
18
18
  box-shadow: 0px 2px 4px 0px rgba(16, 24, 40, 0.15);
19
19
  }
20
+
21
+ &-readonly {
22
+ border: none;
23
+ padding-right: 16px;
24
+
25
+ &:hover {
26
+ border: none;
27
+ box-shadow: none;
28
+ }
29
+ }
20
30
  }
21
31
 
22
32
  .organization-tenant-switcher-overlay {
@@ -54,7 +54,7 @@ export var formatMultiDayDate = function formatMultiDayDate(item) {
54
54
  * @Date: 2024-04-26 14:04
55
55
  */
56
56
  export var getServiceTime = function getServiceTime(item, currentDate) {
57
- var _utils$storage;
57
+ var _utils$storage, _item$format;
58
58
  if (!dayjs(currentDate).isValid()) return '';
59
59
  var context = useEngineContext();
60
60
  var utils = context.appHelper.utils || {};
@@ -71,9 +71,10 @@ export var getServiceTime = function getServiceTime(item, currentDate) {
71
71
  var diffInDays = endDate.diff(startDate, 'day');
72
72
  var _format = isEn ? 'ddd, DD/MM/YYYY' : 'YYYY-MM-DD,ddd';
73
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';
74
+ // 是否自定义格式
75
+ if (item !== null && item !== void 0 && item.hasOwnProperty('format') && (item === null || item === void 0 ? void 0 : (_item$format = item.format) === null || _item$format === void 0 ? void 0 : _item$format.length) > 0) {
76
+ var _item$format2, _item$format3;
77
+ _format = isEn ? item === null || item === void 0 ? void 0 : (_item$format2 = item.format) === null || _item$format2 === void 0 ? void 0 : _item$format2[0] : item === null || item === void 0 ? void 0 : (_item$format3 = item.format) === null || _item$format3 === void 0 ? void 0 : _item$format3[1];
77
78
  }
78
79
  var date = "".concat(startDate.format(_format), " ~ ").concat(endDate.format(_format));
79
80
  var duration = "".concat(diffInDays, " ").concat(locales.getText('pisell2.product.card.day')(diffInDays));
@@ -167,7 +167,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
167
167
  sort?: SortType | undefined;
168
168
  mode: "" | "localStorage" | "remote";
169
169
  currentViewMode: ModeType;
170
- }) => ("view_mode" | "column_setting" | "order_by" | "group_by" | "gallery_setting" | "filter_setting")[];
170
+ }) => ("filter_setting" | "column_setting" | "gallery_setting" | "view_mode" | "group_by" | "order_by")[];
171
171
  export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
172
172
  export declare const stringify: (obj: Record<string, any>) => string;
173
173
  export {};
@@ -65,7 +65,7 @@ declare const useTableProps: (props: UseTablePropsProps) => {
65
65
  useCustomAction: boolean;
66
66
  actionType: string;
67
67
  openMode: "modal" | "drawer";
68
- openContentSize: "small" | "large" | "middle";
68
+ openContentSize: "small" | "middle" | "large";
69
69
  openTitle: string;
70
70
  key: string;
71
71
  } | undefined;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { UrlProps } from './type';
3
3
  import './ReadPretty.less';
4
+ export declare const formatUrl: (url: string) => string;
4
5
  declare const UrlReadPretty: (props: UrlProps) => React.JSX.Element;
5
6
  export default UrlReadPretty;
@@ -29,7 +29,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/components/dataSourceComponents/fields/Input.Url/ReadPretty.tsx
30
30
  var ReadPretty_exports = {};
31
31
  __export(ReadPretty_exports, {
32
- default: () => ReadPretty_default
32
+ default: () => ReadPretty_default,
33
+ formatUrl: () => formatUrl
33
34
  });
34
35
  module.exports = __toCommonJS(ReadPretty_exports);
35
36
  var import_react = __toESM(require("react"));
@@ -37,17 +38,31 @@ var import_antd = require("antd");
37
38
  var import_classnames = __toESM(require("classnames"));
38
39
  var import_ReadPretty = require("./ReadPretty.less");
39
40
  var { Link } = import_antd.Typography;
41
+ var formatUrl = (url) => {
42
+ if (!url)
43
+ return "";
44
+ if (url.startsWith("http://") || url.startsWith("https://")) {
45
+ return url;
46
+ }
47
+ return `https://${url}`;
48
+ };
40
49
  var UrlReadPretty = (props) => {
41
50
  const { value, renderMode } = props;
51
+ const formattedUrl = formatUrl(value);
42
52
  return /* @__PURE__ */ import_react.default.createElement(
43
53
  Link,
44
54
  {
45
55
  className: (0, import_classnames.default)("pisell-url-read-pretty", {
46
56
  "pisell-url-read-pretty-table-view": renderMode === "tableView"
47
57
  }),
48
- href: value
58
+ href: formattedUrl,
59
+ target: "_blank"
49
60
  },
50
61
  value
51
62
  );
52
63
  };
53
64
  var ReadPretty_default = UrlReadPretty;
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ formatUrl
68
+ });
@@ -1,5 +1,5 @@
1
1
  .pisell-url-read-pretty {
2
- color: var(--Gray-900, #101828);
2
+ //color: var(--Gray-900, #101828);
3
3
  font-size: 16px;
4
4
  font-weight: 600;
5
5
  line-height: 24px; /* 150% */
@@ -10,6 +10,8 @@ interface OrganizationTenantSwitcherProps {
10
10
  }[];
11
11
  showLogo?: boolean;
12
12
  showName?: boolean;
13
+ readOnly?: boolean;
14
+ onClick?: React.MouseEventHandler<HTMLDivElement>;
13
15
  }
14
16
  declare const OrganizationTenantSwitcher: React.FC<OrganizationTenantSwitcherProps>;
15
17
  export default OrganizationTenantSwitcher;
@@ -57,7 +57,9 @@ var OrganizationTenantSwitcher = ({
57
57
  value,
58
58
  options,
59
59
  showLogo = true,
60
- showName = true
60
+ showName = true,
61
+ readOnly = false,
62
+ onClick
61
63
  }) => {
62
64
  const getCurrentOrg = () => {
63
65
  return options.find((opt) => (opt == null ? void 0 : opt.value) === value);
@@ -90,13 +92,17 @@ var OrganizationTenantSwitcher = ({
90
92
  overflow: "auto"
91
93
  }
92
94
  },
93
- trigger: ["click"]
95
+ trigger: readOnly ? [] : ["click"],
96
+ disabled: readOnly
94
97
  },
95
98
  /* @__PURE__ */ import_react.default.createElement(
96
99
  "div",
97
100
  {
98
- className: "organization-tenant-switcher-switch",
99
- style: !showLogo ? { paddingLeft: 16 } : {}
101
+ className: (0, import_classnames.default)("organization-tenant-switcher-switch", {
102
+ "organization-tenant-switcher-switch-readonly": readOnly
103
+ }),
104
+ style: !showLogo ? { paddingLeft: 16 } : {},
105
+ onClick
100
106
  },
101
107
  showLogo && /* @__PURE__ */ import_react.default.createElement(
102
108
  Logo,
@@ -106,7 +112,7 @@ var OrganizationTenantSwitcher = ({
106
112
  }
107
113
  ),
108
114
  /* @__PURE__ */ import_react.default.createElement("div", { className: "organization-tenant-switcher-switch-name", title: currentOrg == null ? void 0 : currentOrg.label }, showName && (currentOrg == null ? void 0 : currentOrg.label)),
109
- /* @__PURE__ */ import_react.default.createElement(import_ChevronDown.default, { className: "organization-tenant-switcher-switch-chevron" })
115
+ !readOnly && /* @__PURE__ */ import_react.default.createElement(import_ChevronDown.default, { className: "organization-tenant-switcher-switch-chevron" })
110
116
  )
111
117
  );
112
118
  };
@@ -17,6 +17,16 @@
17
17
  border-color: var(--Gray-200, #e5e7eb);
18
18
  box-shadow: 0px 2px 4px 0px rgba(16, 24, 40, 0.15);
19
19
  }
20
+
21
+ &-readonly {
22
+ border: none;
23
+ padding-right: 16px;
24
+
25
+ &:hover {
26
+ border: none;
27
+ box-shadow: none;
28
+ }
29
+ }
20
30
  }
21
31
 
22
32
  .organization-tenant-switcher-overlay {
@@ -60,7 +60,7 @@ var formatMultiDayDate = (item) => {
60
60
  return date;
61
61
  };
62
62
  var getServiceTime = (item, currentDate) => {
63
- var _a;
63
+ var _a, _b, _c, _d;
64
64
  if (!(0, import_dayjs.default)(currentDate).isValid())
65
65
  return "";
66
66
  const context = (0, import_useEngineContext.default)();
@@ -77,8 +77,8 @@ var getServiceTime = (item, currentDate) => {
77
77
  const endDate = (0, import_dayjs.default)(item == null ? void 0 : item.end_date);
78
78
  const diffInDays = endDate.diff(startDate, "day");
79
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";
80
+ if ((item == null ? void 0 : item.hasOwnProperty("format")) && ((_b = item == null ? void 0 : item.format) == null ? void 0 : _b.length) > 0) {
81
+ _format = isEn2 ? (_c = item == null ? void 0 : item.format) == null ? void 0 : _c[0] : (_d = item == null ? void 0 : item.format) == null ? void 0 : _d[1];
82
82
  }
83
83
  const date = `${startDate.format(_format)} ~ ${endDate.format(_format)}`;
84
84
  const duration = `${diffInDays} ${import_utils.locales.getText("pisell2.product.card.day")(diffInDays)}`;
@@ -167,7 +167,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
167
167
  sort?: SortType | undefined;
168
168
  mode: "" | "localStorage" | "remote";
169
169
  currentViewMode: ModeType;
170
- }) => ("view_mode" | "column_setting" | "order_by" | "group_by" | "gallery_setting" | "filter_setting")[];
170
+ }) => ("filter_setting" | "column_setting" | "gallery_setting" | "view_mode" | "group_by" | "order_by")[];
171
171
  export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
172
172
  export declare const stringify: (obj: Record<string, any>) => string;
173
173
  export {};
@@ -29,6 +29,13 @@ const DivMeta: ComponentMetadata = {
29
29
  defaultValue: true,
30
30
  supportVariable: true
31
31
  },
32
+ {
33
+ name: "readOnly",
34
+ title: "是否只读",
35
+ setter: "BoolSetter",
36
+ defaultValue: false,
37
+ supportVariable: true
38
+ },
32
39
  /*
33
40
  {
34
41
  name: "options",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.559",
3
+ "version": "1.0.561",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -70,8 +70,8 @@
70
70
  "swiper": "^8.4.7",
71
71
  "react-barcode": "^1.5.3",
72
72
  "@pisell/date-picker": "1.0.115",
73
- "@pisell/utils": "1.0.43",
74
- "@pisell/icon": "0.0.10"
73
+ "@pisell/icon": "0.0.10",
74
+ "@pisell/utils": "1.0.43"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "react": "^18.0.0",