@faasjs/ant-design 0.0.2-beta.338 → 0.0.2-beta.339

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
@@ -25,12 +25,13 @@ declare type FaasItemProps = BaseItemType & {
25
25
 
26
26
  declare type ExtendDescriptionItemProps = {
27
27
  [type: string]: {
28
- children: JSX.Element | null;
28
+ children?: JSX.Element | null;
29
+ render?: (value: any, values: any) => JSX.Element | string | number | boolean | null;
29
30
  };
30
31
  };
31
32
  declare type DescriptionItemProps<T = any> = {
32
33
  children?: JSX.Element;
33
- render?: (value: T, values: any) => JSX.Element | null;
34
+ render?: (value: T, values: any) => JSX.Element | string | number | boolean | null;
34
35
  } & FaasItemProps;
35
36
  declare type DescriptionProps<T = any, ExtendItemProps = any> = {
36
37
  items: (DescriptionItemProps | ExtendItemProps)[];
@@ -75,7 +76,7 @@ declare type OptionsProps<T = any> = {
75
76
  declare type FormItemInputProps<T = any> = StringProps | StringListProps | NumberProps | NumberListProps | BooleanProps | OptionsProps<T>;
76
77
  declare type ExtendFormItemProps = {
77
78
  [type: string]: {
78
- children: JSX.Element | null;
79
+ children?: JSX.Element | null;
79
80
  };
80
81
  };
81
82
  declare type FormItemProps<T = any> = {
@@ -103,7 +104,8 @@ declare namespace Form {
103
104
  declare type TableItemProps<T = any> = FaasItemProps & TableColumnProps<T>;
104
105
  declare type ExtendTableItemProps = {
105
106
  [type: string]: {
106
- children: JSX.Element | null;
107
+ children?: JSX.Element | null;
108
+ render?: (value: any, values: any) => JSX.Element | string | number | boolean | null;
107
109
  };
108
110
  };
109
111
  declare type TableProps<T = any, ExtendTypes = any> = TableProps$1<T> & {
package/dist/index.js CHANGED
@@ -73,10 +73,15 @@ function DescriptionItemContent(props) {
73
73
  if (!computedProps || typeof computedProps.value === "undefined" || computedProps.value === null)
74
74
  return null;
75
75
  if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
76
- return (0, import_react2.cloneElement)(computedProps.extendTypes[computedProps.item.type].children, {
77
- value: computedProps.value,
78
- values: computedProps.values
79
- });
76
+ if (computedProps.extendTypes[computedProps.item.type].children)
77
+ return (0, import_react2.cloneElement)(computedProps.extendTypes[computedProps.item.type].children, {
78
+ value: computedProps.value,
79
+ values: computedProps.values
80
+ });
81
+ else if (computedProps.extendTypes[computedProps.item.type].render)
82
+ return computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values);
83
+ else
84
+ throw Error(computedProps.item.type + " requires children or render");
80
85
  if (computedProps.item.children)
81
86
  return (0, import_react2.cloneElement)(computedProps.item.children, { value: computedProps.value });
82
87
  if (computedProps.item.render)
@@ -301,10 +306,15 @@ function Table(props) {
301
306
  if (item.render)
302
307
  continue;
303
308
  if (props.extendTypes && props.extendTypes[item.type]) {
304
- item.render = (value, values) => (0, import_react4.cloneElement)(props.extendTypes[item.type].children, {
305
- value,
306
- values
307
- });
309
+ if (props.extendTypes[item.type].children) {
310
+ item.render = (value, values) => (0, import_react4.cloneElement)(props.extendTypes[item.type].children, {
311
+ value,
312
+ values
313
+ });
314
+ } else if (props.extendTypes[item.type].render)
315
+ item.render = props.extendTypes[item.type].render;
316
+ else
317
+ throw Error(item.type + " requires children or render");
308
318
  continue;
309
319
  }
310
320
  switch (item.type) {
package/dist/index.mjs CHANGED
@@ -43,10 +43,15 @@ function DescriptionItemContent(props) {
43
43
  if (!computedProps || typeof computedProps.value === "undefined" || computedProps.value === null)
44
44
  return null;
45
45
  if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
46
- return cloneElement(computedProps.extendTypes[computedProps.item.type].children, {
47
- value: computedProps.value,
48
- values: computedProps.values
49
- });
46
+ if (computedProps.extendTypes[computedProps.item.type].children)
47
+ return cloneElement(computedProps.extendTypes[computedProps.item.type].children, {
48
+ value: computedProps.value,
49
+ values: computedProps.values
50
+ });
51
+ else if (computedProps.extendTypes[computedProps.item.type].render)
52
+ return computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values);
53
+ else
54
+ throw Error(computedProps.item.type + " requires children or render");
50
55
  if (computedProps.item.children)
51
56
  return cloneElement(computedProps.item.children, { value: computedProps.value });
52
57
  if (computedProps.item.render)
@@ -292,10 +297,15 @@ function Table(props) {
292
297
  if (item.render)
293
298
  continue;
294
299
  if (props.extendTypes && props.extendTypes[item.type]) {
295
- item.render = (value, values) => cloneElement2(props.extendTypes[item.type].children, {
296
- value,
297
- values
298
- });
300
+ if (props.extendTypes[item.type].children) {
301
+ item.render = (value, values) => cloneElement2(props.extendTypes[item.type].children, {
302
+ value,
303
+ values
304
+ });
305
+ } else if (props.extendTypes[item.type].render)
306
+ item.render = props.extendTypes[item.type].render;
307
+ else
308
+ throw Error(item.type + " requires children or render");
299
309
  continue;
300
310
  }
301
311
  switch (item.type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.2-beta.338",
3
+ "version": "0.0.2-beta.339",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  "lodash": "*",
28
28
  "react": "*",
29
29
  "react-dom": "*",
30
- "@faasjs/react": "^0.0.2-beta.338"
30
+ "@faasjs/react": "^0.0.2-beta.339"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/lodash": "*",