@faasjs/ant-design 0.0.2-beta.351 → 0.0.2-beta.352

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
@@ -46,7 +46,7 @@ declare type FaasDataWrapperProps<T = any> = {
46
46
  data?: T;
47
47
  setData?: Dispatch<SetStateAction<T>>;
48
48
  };
49
- render: (args: {
49
+ render?: (args: {
50
50
  data: T;
51
51
  }) => JSX.Element;
52
52
  fallback?: JSX.Element;
@@ -112,6 +112,7 @@ declare type ExtendFormTypeProps = {
112
112
  declare type ExtendFormItemProps = BaseItemProps & FormItemProps$1;
113
113
  declare type FormItemProps<T = any> = {
114
114
  children?: JSX.Element | null;
115
+ render?: () => JSX.Element | null;
115
116
  rules?: RuleObject[];
116
117
  label?: string | false;
117
118
  extendTypes?: {
@@ -140,12 +141,12 @@ declare namespace Form {
140
141
  declare type TableItemProps<T = any> = {
141
142
  /** @deprecated use render */
142
143
  children?: JSX.Element | null;
143
- } & FaasItemProps & TableColumnProps<T>;
144
+ } & FaasItemProps & Omit<TableColumnProps<T>, 'children'>;
144
145
  declare type ExtendTableTypeProps = {
145
146
  children?: JSX.Element | null;
146
- render?: (value: any, values: any) => JSX.Element | string | number | boolean | null;
147
+ render?: (value: any, values: any, index: number) => JSX.Element | string | number | boolean | null;
147
148
  };
148
- declare type ExtendTableItemProps<T = any> = BaseItemProps & TableColumnProps<T>;
149
+ declare type ExtendTableItemProps<T = any> = BaseItemProps & Omit<TableColumnProps<T>, 'children'>;
149
150
  declare type TableProps<T = any, ExtendTypes = any> = {
150
151
  items: (TableItemProps | (ExtendTypes & ExtendTableItemProps))[];
151
152
  extendTypes?: {
package/dist/index.js CHANGED
@@ -267,6 +267,8 @@ function FormItem(props) {
267
267
  return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.extendTypes[computedProps.type].children);
268
268
  if (computedProps.children)
269
269
  return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.children);
270
+ if (computedProps.render)
271
+ return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.render());
270
272
  switch (computedProps.type) {
271
273
  case "string":
272
274
  return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.options ? /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ import_react.default.createElement(import_antd4.Input, __spreadValues({}, computedProps.input)));
@@ -378,6 +380,8 @@ function Form(props) {
378
380
  }
379
381
  setComputedProps(props);
380
382
  }, []);
383
+ if (!computedProps)
384
+ return null;
381
385
  return /* @__PURE__ */ import_react.default.createElement(import_antd5.Form, __spreadValues({}, computedProps), (_a2 = props.items) == null ? void 0 : _a2.map((item) => /* @__PURE__ */ import_react.default.createElement(FormItem, __spreadProps(__spreadValues({
382
386
  key: item.id
383
387
  }, item), {
package/dist/index.mjs CHANGED
@@ -248,6 +248,8 @@ function FormItem(props) {
248
248
  return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), computedProps.extendTypes[computedProps.type].children);
249
249
  if (computedProps.children)
250
250
  return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), computedProps.children);
251
+ if (computedProps.render)
252
+ return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), computedProps.render());
251
253
  switch (computedProps.type) {
252
254
  case "string":
253
255
  return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), computedProps.options ? /* @__PURE__ */ React.createElement(Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ React.createElement(Input, __spreadValues({}, computedProps.input)));
@@ -359,6 +361,8 @@ function Form(props) {
359
361
  }
360
362
  setComputedProps(props);
361
363
  }, []);
364
+ if (!computedProps)
365
+ return null;
362
366
  return /* @__PURE__ */ React.createElement(AntdForm2, __spreadValues({}, computedProps), (_a2 = props.items) == null ? void 0 : _a2.map((item) => /* @__PURE__ */ React.createElement(FormItem, __spreadProps(__spreadValues({
363
367
  key: item.id
364
368
  }, item), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.2-beta.351",
3
+ "version": "0.0.2-beta.352",
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.351"
30
+ "@faasjs/react": "^0.0.2-beta.352"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/lodash": "*",