@faasjs/ant-design 0.0.2-beta.433 → 0.0.2-beta.435

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.d.ts CHANGED
@@ -137,15 +137,17 @@ declare const DatePicker: antd_es_date_picker_generatePicker_interface.PickerCom
137
137
 
138
138
  declare type ExtendDescriptionTypeProps = {
139
139
  children?: JSX.Element | null;
140
- render?: (value: any, values: any) => ReactNode;
140
+ render?: (value: any, values: any) => ReactNode | JSX.Element;
141
141
  };
142
142
  declare type ExtendDescriptionItemProps = BaseItemProps;
143
143
  declare type DescriptionItemProps<T = any> = {
144
144
  children?: JSX.Element;
145
- render?: (value: T, values: any) => ReactNode;
146
- } & FaasItemProps;
145
+ render?: (value: T, values: any) => ReactNode | JSX.Element;
146
+ } & FaasItemProps & {
147
+ object?: DescriptionItemProps[];
148
+ };
147
149
  declare type DescriptionProps<T = any, ExtendItemProps = any> = {
148
- renderTitle?: ((values: T) => ReactNode);
150
+ renderTitle?: ((values: T) => ReactNode | JSX.Element);
149
151
  items: (DescriptionItemProps | ExtendItemProps)[];
150
152
  extendTypes?: {
151
153
  [key: string]: ExtendDescriptionTypeProps;
@@ -250,7 +252,7 @@ declare type ExtendTypes = {
250
252
  declare type ExtendFormItemProps = BaseItemProps & FormItemProps$1;
251
253
  declare type FormItemProps<T = any> = {
252
254
  children?: ReactNode;
253
- render?: () => ReactNode;
255
+ render?: (value?: any) => ReactNode | JSX.Element;
254
256
  rules?: RuleObject[];
255
257
  label?: string | false;
256
258
  extendTypes?: ExtendTypes;
package/dist/index.js CHANGED
@@ -170,22 +170,23 @@ var import_dayjs3 = __toESM(require("dayjs"));
170
170
  var import_react4 = require("@faasjs/react");
171
171
  var import_jsx_runtime3 = require("react/jsx-runtime");
172
172
  function DescriptionItemContent(props) {
173
+ var _a;
173
174
  const [computedProps, setComputedProps] = (0, import_react3.useState)();
174
175
  (0, import_react3.useEffect)(() => {
175
- var _a, _b;
176
+ var _a2, _b;
176
177
  const propsCopy = { ...props };
177
178
  if (!propsCopy.item.title)
178
179
  propsCopy.item.title = (0, import_lodash4.upperFirst)(propsCopy.item.id);
179
180
  if (!propsCopy.item.type)
180
181
  propsCopy.item.type = "string";
181
- if ((_a = propsCopy.item.options) == null ? void 0 : _a.length) {
182
+ if ((_a2 = propsCopy.item.options) == null ? void 0 : _a2.length) {
182
183
  propsCopy.item.options = transferOptions(propsCopy.item.options);
183
184
  }
184
185
  if (propsCopy.item.options && typeof propsCopy.value !== "undefined" && propsCopy.value !== null) {
185
186
  if (propsCopy.item.type.endsWith("[]"))
186
187
  propsCopy.value = propsCopy.value.map((v) => {
187
- var _a2;
188
- return ((_a2 = propsCopy.item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
188
+ var _a3;
189
+ return ((_a3 = propsCopy.item.options.find((option) => option.value === v)) == null ? void 0 : _a3.label) || v;
189
190
  });
190
191
  else if ([
191
192
  "string",
@@ -252,6 +253,21 @@ function DescriptionItemContent(props) {
252
253
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
253
254
  children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? import_dayjs3.default.unix(computedProps.value).format("YYYY-MM-DD") : (0, import_dayjs3.default)(computedProps.value).format("YYYY-MM-DD")
254
255
  });
256
+ case "object":
257
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Description, {
258
+ items: computedProps.item.object,
259
+ dataSource: computedProps.value
260
+ });
261
+ case "object[]":
262
+ if (!((_a = computedProps.value) == null ? void 0 : _a.length))
263
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Blank, {});
264
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Space, {
265
+ direction: "vertical",
266
+ children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Description, {
267
+ items: computedProps.item.object,
268
+ dataSource: value
269
+ }, index))
270
+ });
255
271
  default:
256
272
  return computedProps.value || null;
257
273
  }
package/dist/index.mjs CHANGED
@@ -119,7 +119,8 @@ var DatePicker = generatePicker(dayjsGenerateConfig2);
119
119
  import { CheckOutlined, CloseOutlined } from "@ant-design/icons";
120
120
  import {
121
121
  Descriptions,
122
- Skeleton
122
+ Skeleton,
123
+ Space
123
124
  } from "antd";
124
125
  import { isFunction, upperFirst as upperFirst2 } from "lodash";
125
126
  import {
@@ -131,22 +132,23 @@ import dayjs from "dayjs";
131
132
  import { FaasDataWrapper } from "@faasjs/react";
132
133
  import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
133
134
  function DescriptionItemContent(props) {
135
+ var _a;
134
136
  const [computedProps, setComputedProps] = useState2();
135
137
  useEffect2(() => {
136
- var _a, _b;
138
+ var _a2, _b;
137
139
  const propsCopy = { ...props };
138
140
  if (!propsCopy.item.title)
139
141
  propsCopy.item.title = upperFirst2(propsCopy.item.id);
140
142
  if (!propsCopy.item.type)
141
143
  propsCopy.item.type = "string";
142
- if ((_a = propsCopy.item.options) == null ? void 0 : _a.length) {
144
+ if ((_a2 = propsCopy.item.options) == null ? void 0 : _a2.length) {
143
145
  propsCopy.item.options = transferOptions(propsCopy.item.options);
144
146
  }
145
147
  if (propsCopy.item.options && typeof propsCopy.value !== "undefined" && propsCopy.value !== null) {
146
148
  if (propsCopy.item.type.endsWith("[]"))
147
149
  propsCopy.value = propsCopy.value.map((v) => {
148
- var _a2;
149
- return ((_a2 = propsCopy.item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
150
+ var _a3;
151
+ return ((_a3 = propsCopy.item.options.find((option) => option.value === v)) == null ? void 0 : _a3.label) || v;
150
152
  });
151
153
  else if ([
152
154
  "string",
@@ -213,6 +215,21 @@ function DescriptionItemContent(props) {
213
215
  return /* @__PURE__ */ jsx3(Fragment, {
214
216
  children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? dayjs.unix(computedProps.value).format("YYYY-MM-DD") : dayjs(computedProps.value).format("YYYY-MM-DD")
215
217
  });
218
+ case "object":
219
+ return /* @__PURE__ */ jsx3(Description, {
220
+ items: computedProps.item.object,
221
+ dataSource: computedProps.value
222
+ });
223
+ case "object[]":
224
+ if (!((_a = computedProps.value) == null ? void 0 : _a.length))
225
+ return /* @__PURE__ */ jsx3(Blank, {});
226
+ return /* @__PURE__ */ jsx3(Space, {
227
+ direction: "vertical",
228
+ children: computedProps.value.map((value, index) => /* @__PURE__ */ jsx3(Description, {
229
+ items: computedProps.item.object,
230
+ dataSource: value
231
+ }, index))
232
+ });
216
233
  default:
217
234
  return computedProps.value || null;
218
235
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.2-beta.433",
3
+ "version": "0.0.2-beta.435",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -28,7 +28,7 @@
28
28
  "lodash": "*",
29
29
  "react": "*",
30
30
  "react-dom": "*",
31
- "@faasjs/react": "^0.0.2-beta.433",
31
+ "@faasjs/react": "^0.0.2-beta.435",
32
32
  "react-router-dom": "*",
33
33
  "dayjs": "*"
34
34
  },