@rulab/adminjs-components 0.0.9 → 0.0.10

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.
package/dist/index.cjs CHANGED
@@ -109,7 +109,7 @@ var colorStyles = {
109
109
  var ColorStatus = ({ property, record, onChange }) => {
110
110
  const availableValues = property.availableValues;
111
111
  const currentOption = availableValues.find(
112
- (item) => item.value === record.params.colorStatus
112
+ (item) => item.value === record.params[property.path]
113
113
  );
114
114
  const [selectOption, setCurrentOption] = (0, import_react.useState)(currentOption);
115
115
  const handleSelectChange = (option) => {
@@ -138,9 +138,9 @@ var ColorStatusEdit_default = ColorStatus;
138
138
  var import_react2 = __toESM(require("react"), 1);
139
139
  var ColorStatusShow = ({ property, record }) => {
140
140
  const currentOption = property.availableValues?.find(
141
- (item) => item.value === record.params.colorStatus
141
+ (item) => item.value === record.params[property.path]
142
142
  );
143
- return /* @__PURE__ */ import_react2.default.createElement(ColorStatusBadgeWrapper, null, /* @__PURE__ */ import_react2.default.createElement(ShowLabel, null, property.path), /* @__PURE__ */ import_react2.default.createElement(ColorStatusBadge, { color: currentOption.color }, record.params.colorStatus));
143
+ return /* @__PURE__ */ import_react2.default.createElement(ColorStatusBadgeWrapper, null, /* @__PURE__ */ import_react2.default.createElement(ShowLabel, null, property.path), /* @__PURE__ */ import_react2.default.createElement(ColorStatusBadge, { color: currentOption.color }, record.params[property.path]));
144
144
  };
145
145
  var ColorStatusShow_default = ColorStatusShow;
146
146
 
@@ -148,9 +148,11 @@ var ColorStatusShow_default = ColorStatusShow;
148
148
  var import_react3 = __toESM(require("react"), 1);
149
149
  var ColorStatusList = ({ property, record }) => {
150
150
  const currentOption = property.availableValues?.find(
151
- (item) => item.value === record.params.colorStatus
151
+ (item) => item.value === record.params[property.path]
152
152
  );
153
- return /* @__PURE__ */ import_react3.default.createElement(ColorStatusBadge, { color: currentOption.color }, record.params.colorStatus);
153
+ console.log(record, "record");
154
+ console.log(record.params[property.path], "record.params[property.path]");
155
+ return /* @__PURE__ */ import_react3.default.createElement(ColorStatusBadge, { color: currentOption.color }, record.params[property.path]);
154
156
  };
155
157
  var ColorStatusList_default = ColorStatusList;
156
158
 
package/dist/index.js CHANGED
@@ -65,7 +65,7 @@ var colorStyles = {
65
65
  var ColorStatus = ({ property, record, onChange }) => {
66
66
  const availableValues = property.availableValues;
67
67
  const currentOption = availableValues.find(
68
- (item) => item.value === record.params.colorStatus
68
+ (item) => item.value === record.params[property.path]
69
69
  );
70
70
  const [selectOption, setCurrentOption] = useState(currentOption);
71
71
  const handleSelectChange = (option) => {
@@ -94,9 +94,9 @@ var ColorStatusEdit_default = ColorStatus;
94
94
  import React2 from "react";
95
95
  var ColorStatusShow = ({ property, record }) => {
96
96
  const currentOption = property.availableValues?.find(
97
- (item) => item.value === record.params.colorStatus
97
+ (item) => item.value === record.params[property.path]
98
98
  );
99
- return /* @__PURE__ */ React2.createElement(ColorStatusBadgeWrapper, null, /* @__PURE__ */ React2.createElement(ShowLabel, null, property.path), /* @__PURE__ */ React2.createElement(ColorStatusBadge, { color: currentOption.color }, record.params.colorStatus));
99
+ return /* @__PURE__ */ React2.createElement(ColorStatusBadgeWrapper, null, /* @__PURE__ */ React2.createElement(ShowLabel, null, property.path), /* @__PURE__ */ React2.createElement(ColorStatusBadge, { color: currentOption.color }, record.params[property.path]));
100
100
  };
101
101
  var ColorStatusShow_default = ColorStatusShow;
102
102
 
@@ -104,9 +104,11 @@ var ColorStatusShow_default = ColorStatusShow;
104
104
  import React3 from "react";
105
105
  var ColorStatusList = ({ property, record }) => {
106
106
  const currentOption = property.availableValues?.find(
107
- (item) => item.value === record.params.colorStatus
107
+ (item) => item.value === record.params[property.path]
108
108
  );
109
- return /* @__PURE__ */ React3.createElement(ColorStatusBadge, { color: currentOption.color }, record.params.colorStatus);
109
+ console.log(record, "record");
110
+ console.log(record.params[property.path], "record.params[property.path]");
111
+ return /* @__PURE__ */ React3.createElement(ColorStatusBadge, { color: currentOption.color }, record.params[property.path]);
110
112
  };
111
113
  var ColorStatusList_default = ColorStatusList;
112
114
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulab/adminjs-components",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -57,7 +57,7 @@ const ColorStatus: FC<ColorStatusTypes> = ({ property, record, onChange }) => {
57
57
  const availableValues = property.availableValues as AvailableValueType[];
58
58
 
59
59
  const currentOption = availableValues.find(
60
- (item) => item.value === record.params.colorStatus,
60
+ (item) => item.value === record.params[property.path],
61
61
  ) as AvailableValueType;
62
62
 
63
63
  const [selectOption, setCurrentOption] = useState<
@@ -7,12 +7,12 @@ import type { AvailableValueType } from "./types";
7
7
 
8
8
  const ColorStatusList: FC<ShowPropertyProps> = ({ property, record }) => {
9
9
  const currentOption = property.availableValues?.find(
10
- (item) => item.value === record.params.colorStatus,
10
+ (item) => item.value === record.params[property.path],
11
11
  ) as AvailableValueType;
12
12
 
13
13
  return (
14
14
  <ColorStatusBadge color={currentOption.color}>
15
- {record.params.colorStatus}
15
+ {record.params[property.path]}
16
16
  </ColorStatusBadge>
17
17
  );
18
18
  };
@@ -7,14 +7,14 @@ import type { AvailableValueType } from "./types";
7
7
 
8
8
  const ColorStatusShow: FC<ShowPropertyProps> = ({ property, record }) => {
9
9
  const currentOption = property.availableValues?.find(
10
- (item) => item.value === record.params.colorStatus,
10
+ (item) => item.value === record.params[property.path],
11
11
  ) as AvailableValueType;
12
12
 
13
13
  return (
14
14
  <ColorStatusBadgeWrapper>
15
15
  <ShowLabel>{property.path}</ShowLabel>
16
16
  <ColorStatusBadge color={currentOption.color}>
17
- {record.params.colorStatus}
17
+ {record.params[property.path]}
18
18
  </ColorStatusBadge>
19
19
  </ColorStatusBadgeWrapper>
20
20
  );