@pisell/materials 1.0.560 → 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.
@@ -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 {
@@ -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 {
@@ -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.560",
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",