@faasjs/ant-design 0.0.3-beta.47 → 0.0.3-beta.49

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
@@ -4,8 +4,7 @@ import { Dayjs } from 'dayjs';
4
4
  import { FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, DatePickerProps, TimePickerProps, FormInstance, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, DrawerProps as DrawerProps$1, FormProps as FormProps$1, ButtonProps, ModalProps as ModalProps$1 } from 'antd';
5
5
  export { Drawer, Modal } from 'antd';
6
6
  import { RuleObject } from 'rc-field-form/lib/interface';
7
- import { FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
8
- export { FaasDataInjection } from '@faasjs/react';
7
+ import { FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
9
8
  import { FilterValue, SorterResult, TableCurrentDataSource } from 'antd/es/table/interface';
10
9
  import * as antd_es_form_context from 'antd/es/form/context';
11
10
  import * as antd_es_form_ErrorList from 'antd/es/form/ErrorList';
@@ -152,12 +151,25 @@ type LoadingProps = {
152
151
  */
153
152
  declare function Loading(props: LoadingProps): JSX.Element;
154
153
 
154
+ type FaasDataInjection<T = any> = Partial<FaasDataInjection$1<T>>;
155
155
  interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
156
156
  loadingProps?: LoadingProps;
157
157
  loading?: JSX.Element;
158
158
  }
159
159
  /**
160
160
  * FaasDataWrapper component with Loading
161
+ *
162
+ * ```tsx
163
+ * function MyComponent (props: FaasDataInjection) {
164
+ * return <div>{ props.data }</div>
165
+ * }
166
+ *
167
+ * function MyPage () {
168
+ * return <FaasDataWrapper action="test" params={{ a: 1 }}>
169
+ * <MyComponent />
170
+ * </FaasDataWrapper>
171
+ * }
172
+ * ```
161
173
  */
162
174
  declare function FaasDataWrapper<T = any>(props: FaasDataWrapperProps<T>): JSX.Element;
163
175
 
@@ -499,4 +511,4 @@ interface TitleProps {
499
511
  */
500
512
  declare function Title(props: TitleProps): JSX.Element;
501
513
 
502
- export { BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, DrawerProps, ErrorBoundary, ErrorBoundaryProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasDataWrapper, FaasDataWrapperProps, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, ModalProps, PageNotFound, Routes, RoutesProps, Table, TableItemProps, TableProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, setDrawerProps, setModalProps, transferOptions, transferValue, useConfigContext, useDrawer, useModal };
514
+ export { BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, DrawerProps, ErrorBoundary, ErrorBoundaryProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasDataInjection, FaasDataWrapper, FaasDataWrapperProps, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, ModalProps, PageNotFound, Routes, RoutesProps, Table, TableItemProps, TableProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, setDrawerProps, setModalProps, transferOptions, transferValue, useConfigContext, useDrawer, useModal };
package/dist/index.js CHANGED
@@ -1367,9 +1367,15 @@ function Table(props) {
1367
1367
  if (!item.render)
1368
1368
  item.render = (value) => processValue(item, value);
1369
1369
  if (!item.onFilter)
1370
- item.onFilter = (value, row) => (0, import_dayjs2.default)(row[item.id]).isSame((0, import_dayjs2.default)(value));
1370
+ item.onFilter = (value, row) => (0, import_dayjs2.default)(row[item.id]).isSame((0, import_dayjs2.default)(value), "date");
1371
1371
  if (!item.sorter)
1372
- item.sorter = (a, b) => (0, import_dayjs2.default)(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
1372
+ item.sorter = (a, b, order) => {
1373
+ if ((0, import_lodash_es6.isNil)(a[item.id]))
1374
+ return order === "ascend" ? 1 : -1;
1375
+ if ((0, import_lodash_es6.isNil)(b[item.id]))
1376
+ return order === "ascend" ? -1 : 1;
1377
+ return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
1378
+ };
1373
1379
  break;
1374
1380
  case "time":
1375
1381
  if (!item.render)
@@ -1377,7 +1383,13 @@ function Table(props) {
1377
1383
  if (!item.onFilter)
1378
1384
  item.onFilter = (value, row) => (0, import_dayjs2.default)(row[item.id]).isSame((0, import_dayjs2.default)(value));
1379
1385
  if (!item.sorter)
1380
- item.sorter = (a, b) => (0, import_dayjs2.default)(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
1386
+ item.sorter = (a, b, order) => {
1387
+ if ((0, import_lodash_es6.isNil)(a[item.id]))
1388
+ return order === "ascend" ? 1 : -1;
1389
+ if ((0, import_lodash_es6.isNil)(b[item.id]))
1390
+ return order === "ascend" ? -1 : 1;
1391
+ return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
1392
+ };
1381
1393
  break;
1382
1394
  case "object":
1383
1395
  if (!item.render)
package/dist/index.mjs CHANGED
@@ -1367,9 +1367,15 @@ function Table(props) {
1367
1367
  if (!item.render)
1368
1368
  item.render = (value) => processValue(item, value);
1369
1369
  if (!item.onFilter)
1370
- item.onFilter = (value, row) => dayjs2(row[item.id]).isSame(dayjs2(value));
1370
+ item.onFilter = (value, row) => dayjs2(row[item.id]).isSame(dayjs2(value), "date");
1371
1371
  if (!item.sorter)
1372
- item.sorter = (a, b) => dayjs2(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
1372
+ item.sorter = (a, b, order) => {
1373
+ if (isNil2(a[item.id]))
1374
+ return order === "ascend" ? 1 : -1;
1375
+ if (isNil2(b[item.id]))
1376
+ return order === "ascend" ? -1 : 1;
1377
+ return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
1378
+ };
1373
1379
  break;
1374
1380
  case "time":
1375
1381
  if (!item.render)
@@ -1377,7 +1383,13 @@ function Table(props) {
1377
1383
  if (!item.onFilter)
1378
1384
  item.onFilter = (value, row) => dayjs2(row[item.id]).isSame(dayjs2(value));
1379
1385
  if (!item.sorter)
1380
- item.sorter = (a, b) => dayjs2(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
1386
+ item.sorter = (a, b, order) => {
1387
+ if (isNil2(a[item.id]))
1388
+ return order === "ascend" ? 1 : -1;
1389
+ if (isNil2(b[item.id]))
1390
+ return order === "ascend" ? -1 : 1;
1391
+ return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
1392
+ };
1381
1393
  break;
1382
1394
  case "object":
1383
1395
  if (!item.render)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.3-beta.47",
3
+ "version": "0.0.3-beta.49",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",