@faasjs/ant-design 3.2.1 → 3.4.0

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  UI components based on [FaasJS](https://faasjs.com), [Ant Design](https://ant.design) and [React Router](https://reactrouter.com).
4
4
 
5
- [![License: MIT](https://img.shields.io/npm/l/@faasjs/ant-design.svg)](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/ant-design/LICENSE)
5
+ [![License: MIT](https://img.shields.io/npm/l/@faasjs/ant-design.svg)](https://github.com/faasjs/faasjs/blob/main/packages/ant-design/LICENSE)
6
6
  [![NPM Version](https://img.shields.io/npm/v/@faasjs/ant-design.svg)](https://www.npmjs.com/package/@faasjs/ant-design)
7
7
 
8
8
  ## Install
@@ -52,6 +52,7 @@ type FaasItemProps = {
52
52
  - [Title](functions/Title.md)
53
53
  - [transferOptions](functions/transferOptions.md)
54
54
  - [transferValue](functions/transferValue.md)
55
+ - [upperFirst](functions/upperFirst.md)
55
56
  - [useApp](functions/useApp.md)
56
57
  - [useConfigContext](functions/useConfigContext.md)
57
58
  - [useDrawer](functions/useDrawer.md)
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ErrorBoundaryProps, FaasReactClientOptions, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
2
2
  export { ErrorBoundaryProps, faas, useFaas } from '@faasjs/react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { ConfigProviderProps as ConfigProviderProps$1 } from 'antd/es/config-provider';
5
- import { StyleProviderProps } from '@ant-design/cssinjs/lib/StyleContext';
4
+ import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$1, ConfigProviderProps as ConfigProviderProps$1, FormItemProps as FormItemProps$1, FormInstance, InputProps, SelectProps, RadioProps, InputNumberProps, SwitchProps, DatePickerProps, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
5
+ import { StyleProviderProps } from '@ant-design/cssinjs';
6
6
  import { MessageInstance } from 'antd/es/message/interface';
7
7
  import { NotificationInstance } from 'antd/es/notification/interface';
8
8
  import * as antd_es_modal_PurePanel from 'antd/es/modal/PurePanel';
@@ -11,7 +11,6 @@ import * as antd_es_modal_confirm from 'antd/es/modal/confirm';
11
11
  import * as react from 'react';
12
12
  import { Dispatch, SetStateAction, CSSProperties, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
13
13
  export { lazy } from 'react';
14
- import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, FormInstance, InputProps, SelectProps, RadioProps, InputNumberProps, SwitchProps, DatePickerProps, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
15
14
  import { BrowserRouterProps, RouteProps } from 'react-router-dom';
16
15
  import { Dayjs } from 'dayjs';
17
16
  import * as antd_es_form_FormItem from 'antd/es/form/FormItem';
@@ -149,7 +148,7 @@ interface AppProps {
149
148
  /**
150
149
  * `false` to disable StyleProvider.
151
150
  *
152
- * @see https://ant.design/docs/react/compatible-style#styleprovider
151
+ * @see https://github.com/ant-design/cssinjs?tab=readme-ov-file#styleprovider
153
152
  */
154
153
  styleProviderProps?: StyleProviderProps | false;
155
154
  /** @see https://ant.design/components/config-provider/#API */
@@ -520,6 +519,7 @@ interface FaasItemProps extends BaseItemProps {
520
519
  */
521
520
  type?: FaasItemType;
522
521
  }
522
+ declare function upperFirst(str: string): string;
523
523
  /**
524
524
  * convert string[] or number[] to { label, value }[]
525
525
  */
@@ -747,4 +747,4 @@ declare namespace Title {
747
747
  var whyDidYouRender: boolean;
748
748
  }
749
749
 
750
- export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, Drawer, type DrawerProps, ErrorBoundary, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasItemProps, type FaasItemType, type FaasItemTypeValue, Form, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, Link, type LinkProps, Loading, type LoadingProps, Modal, type ModalProps, PageNotFound, Routes, type RoutesProps, type TabProps, Table, type TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, type setDrawerProps, type setModalProps, transferOptions, transferValue, useApp, type useAppProps, useConfigContext, useDrawer, useModal, withFaasData };
750
+ export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, Drawer, type DrawerProps, ErrorBoundary, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasItemProps, type FaasItemType, type FaasItemTypeValue, Form, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, Link, type LinkProps, Loading, type LoadingProps, Modal, type ModalProps, PageNotFound, Routes, type RoutesProps, type TabProps, Table, type TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, type setDrawerProps, type setModalProps, transferOptions, transferValue, upperFirst, useApp, type useAppProps, useConfigContext, useDrawer, useModal, withFaasData };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ErrorBoundaryProps, FaasReactClientOptions, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
2
2
  export { ErrorBoundaryProps, faas, useFaas } from '@faasjs/react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { ConfigProviderProps as ConfigProviderProps$1 } from 'antd/es/config-provider';
5
- import { StyleProviderProps } from '@ant-design/cssinjs/lib/StyleContext';
4
+ import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$1, ConfigProviderProps as ConfigProviderProps$1, FormItemProps as FormItemProps$1, FormInstance, InputProps, SelectProps, RadioProps, InputNumberProps, SwitchProps, DatePickerProps, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
5
+ import { StyleProviderProps } from '@ant-design/cssinjs';
6
6
  import { MessageInstance } from 'antd/es/message/interface';
7
7
  import { NotificationInstance } from 'antd/es/notification/interface';
8
8
  import * as antd_es_modal_PurePanel from 'antd/es/modal/PurePanel';
@@ -11,7 +11,6 @@ import * as antd_es_modal_confirm from 'antd/es/modal/confirm';
11
11
  import * as react from 'react';
12
12
  import { Dispatch, SetStateAction, CSSProperties, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
13
13
  export { lazy } from 'react';
14
- import { ModalProps as ModalProps$1, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, FormInstance, InputProps, SelectProps, RadioProps, InputNumberProps, SwitchProps, DatePickerProps, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, FormProps as FormProps$1, ButtonProps, TabsProps as TabsProps$1 } from 'antd';
15
14
  import { BrowserRouterProps, RouteProps } from 'react-router-dom';
16
15
  import { Dayjs } from 'dayjs';
17
16
  import * as antd_es_form_FormItem from 'antd/es/form/FormItem';
@@ -149,7 +148,7 @@ interface AppProps {
149
148
  /**
150
149
  * `false` to disable StyleProvider.
151
150
  *
152
- * @see https://ant.design/docs/react/compatible-style#styleprovider
151
+ * @see https://github.com/ant-design/cssinjs?tab=readme-ov-file#styleprovider
153
152
  */
154
153
  styleProviderProps?: StyleProviderProps | false;
155
154
  /** @see https://ant.design/components/config-provider/#API */
@@ -520,6 +519,7 @@ interface FaasItemProps extends BaseItemProps {
520
519
  */
521
520
  type?: FaasItemType;
522
521
  }
522
+ declare function upperFirst(str: string): string;
523
523
  /**
524
524
  * convert string[] or number[] to { label, value }[]
525
525
  */
@@ -747,4 +747,4 @@ declare namespace Title {
747
747
  var whyDidYouRender: boolean;
748
748
  }
749
749
 
750
- export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, Drawer, type DrawerProps, ErrorBoundary, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasItemProps, type FaasItemType, type FaasItemTypeValue, Form, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, Link, type LinkProps, Loading, type LoadingProps, Modal, type ModalProps, PageNotFound, Routes, type RoutesProps, type TabProps, Table, type TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, type setDrawerProps, type setModalProps, transferOptions, transferValue, useApp, type useAppProps, useConfigContext, useDrawer, useModal, withFaasData };
750
+ export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, Drawer, type DrawerProps, ErrorBoundary, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasItemProps, type FaasItemType, type FaasItemTypeValue, Form, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, Link, type LinkProps, Loading, type LoadingProps, Modal, type ModalProps, PageNotFound, Routes, type RoutesProps, type TabProps, Table, type TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, type setDrawerProps, type setModalProps, transferOptions, transferValue, upperFirst, useApp, type useAppProps, useConfigContext, useDrawer, useModal, withFaasData };
package/dist/index.js CHANGED
@@ -169,7 +169,7 @@ var AppContext = react.createSplittingContext({
169
169
  function RoutesApp(props) {
170
170
  const location = reactRouterDom.useLocation();
171
171
  const { drawerProps, setDrawerProps, modalProps, setModalProps } = useApp();
172
- react$1.useEffect(() => {
172
+ react.useEqualEffect(() => {
173
173
  console.debug("location", location);
174
174
  if (drawerProps.open) setDrawerProps({ open: false });
175
175
  if (modalProps.open) setModalProps({ open: false });
@@ -181,7 +181,7 @@ function App(props) {
181
181
  const [notificationApi, notificationContextHolder] = antd.notification.useNotification();
182
182
  const { modal, modalProps, setModalProps } = useModal();
183
183
  const { drawer, drawerProps, setDrawerProps } = useDrawer();
184
- const styleProviderProps = react$1.useMemo(
184
+ const styleProviderProps = react.useEqualMemo(
185
185
  () => ({
186
186
  ...props.styleProviderProps,
187
187
  hashPriority: "high",
@@ -239,14 +239,17 @@ App.useApp = useApp;
239
239
  App.whyDidYouRender = true;
240
240
  function Blank(options) {
241
241
  const { theme } = useConfigContext();
242
- return !options || lodashEs.isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { disabled: true, children: options?.text || theme.Blank.text }) : options.value;
242
+ return !options || options.value === void 0 || options.value === null || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { disabled: true, children: options?.text || theme.Blank.text }) : options.value;
243
243
  }
244
244
  Blank.whyDidYouRender = true;
245
+ function upperFirst(str) {
246
+ return str.charAt(0).toUpperCase() + str.slice(1);
247
+ }
245
248
  function transferOptions(options) {
246
249
  if (!options) return [];
247
250
  return options.map(
248
251
  (item) => typeof item === "object" ? item : {
249
- label: lodashEs.upperFirst(item.toString()),
252
+ label: upperFirst(item.toString()),
250
253
  value: item
251
254
  }
252
255
  );
@@ -317,7 +320,7 @@ function DescriptionItemContent(props) {
317
320
  react$1.useEffect(() => {
318
321
  const propsCopy = { ...props };
319
322
  if (!propsCopy.item.title)
320
- propsCopy.item.title = lodashEs.upperFirst(propsCopy.item.id);
323
+ propsCopy.item.title = upperFirst(propsCopy.item.id);
321
324
  if (!propsCopy.item.type) propsCopy.item.type = "string";
322
325
  if (propsCopy.item.options?.length) {
323
326
  propsCopy.item.options = transferOptions(propsCopy.item.options);
@@ -454,11 +457,11 @@ function Description(props) {
454
457
  antd.Descriptions,
455
458
  {
456
459
  ...props,
457
- title: lodashEs.isFunction(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
460
+ title: typeof props.renderTitle === "function" ? props.renderTitle(props.dataSource) : props.title,
458
461
  items: props.items.filter((item) => item && (!item.if || item.if(props.dataSource))).map((item) => ({
459
462
  ...item,
460
463
  key: item.id,
461
- label: item.title || lodashEs.upperFirst(item.id),
464
+ label: item.title || upperFirst(item.id),
462
465
  children: /* @__PURE__ */ jsxRuntime.jsx(
463
466
  DescriptionItemContent,
464
467
  {
@@ -477,7 +480,7 @@ function isOptionsProps(item) {
477
480
  return item && Array.isArray(item.options);
478
481
  }
479
482
  function processProps(propsCopy, config) {
480
- if (!propsCopy.title) propsCopy.title = lodashEs.upperFirst(propsCopy.id);
483
+ if (!propsCopy.title) propsCopy.title = upperFirst(propsCopy.id);
481
484
  if (!propsCopy.label && propsCopy.label !== false)
482
485
  propsCopy.label = propsCopy.title;
483
486
  if (!propsCopy.name) propsCopy.name = propsCopy.id;
@@ -1023,7 +1026,7 @@ function Table(props) {
1023
1026
  for (const item of items) {
1024
1027
  if (!item.key) item.key = item.id;
1025
1028
  if (!item.dataIndex) item.dataIndex = item.id;
1026
- if (!item.title) item.title = lodashEs.upperFirst(item.id);
1029
+ if (!item.title) item.title = upperFirst(item.id);
1027
1030
  if (!item.type) item.type = "string";
1028
1031
  if (item.options?.length) {
1029
1032
  item.options = transferOptions(item.options);
@@ -1578,6 +1581,7 @@ exports.Tabs = Tabs;
1578
1581
  exports.Title = Title;
1579
1582
  exports.transferOptions = transferOptions;
1580
1583
  exports.transferValue = transferValue;
1584
+ exports.upperFirst = upperFirst;
1581
1585
  exports.useApp = useApp;
1582
1586
  exports.useConfigContext = useConfigContext;
1583
1587
  exports.useDrawer = useDrawer;
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
- import { createSplittingContext, useEqualCallback, ErrorBoundary as ErrorBoundary$1, useEqualEffect, FaasReactClient, OptionalWrapper, FaasDataWrapper as FaasDataWrapper$1, withFaasData as withFaasData$1, faas } from '@faasjs/react';
1
+ import { createSplittingContext, useEqualCallback, ErrorBoundary as ErrorBoundary$1, useEqualEffect, FaasReactClient, useEqualMemo, OptionalWrapper, FaasDataWrapper as FaasDataWrapper$1, withFaasData as withFaasData$1, faas } from '@faasjs/react';
2
2
  export { faas, useFaas } from '@faasjs/react';
3
3
  import { Form as Form$1, Modal as Modal$1, Drawer as Drawer$1, message, notification, ConfigProvider as ConfigProvider$1, Typography, Spin, Descriptions, Input, Button, Row, Col, DatePicker, Switch, Select, InputNumber, Radio, Result, Skeleton, Table as Table$1, Tabs as Tabs$1, Alert, Space } from 'antd';
4
4
  import { legacyLogicalPropertiesTransformer, StyleProvider } from '@ant-design/cssinjs';
5
- import { createContext, useState, useContext, useMemo, useEffect, cloneElement, Suspense } from 'react';
5
+ import { createContext, useState, useContext, useEffect, cloneElement, Suspense } from 'react';
6
6
  export { lazy } from 'react';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import { BrowserRouter, useNavigate, Routes as Routes$1, Route, useLocation } from 'react-router-dom';
9
- import { defaultsDeep, isNil, upperFirst, isFunction, cloneDeep, uniqBy } from 'lodash-es';
9
+ import { defaultsDeep, cloneDeep, isNil, uniqBy } from 'lodash-es';
10
10
  import dayjs2 from 'dayjs';
11
11
  import { PlusOutlined, MinusCircleOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons';
12
12
 
@@ -165,7 +165,7 @@ var AppContext = createSplittingContext({
165
165
  function RoutesApp(props) {
166
166
  const location = useLocation();
167
167
  const { drawerProps, setDrawerProps, modalProps, setModalProps } = useApp();
168
- useEffect(() => {
168
+ useEqualEffect(() => {
169
169
  console.debug("location", location);
170
170
  if (drawerProps.open) setDrawerProps({ open: false });
171
171
  if (modalProps.open) setModalProps({ open: false });
@@ -177,7 +177,7 @@ function App(props) {
177
177
  const [notificationApi, notificationContextHolder] = notification.useNotification();
178
178
  const { modal, modalProps, setModalProps } = useModal();
179
179
  const { drawer, drawerProps, setDrawerProps } = useDrawer();
180
- const styleProviderProps = useMemo(
180
+ const styleProviderProps = useEqualMemo(
181
181
  () => ({
182
182
  ...props.styleProviderProps,
183
183
  hashPriority: "high",
@@ -235,9 +235,12 @@ App.useApp = useApp;
235
235
  App.whyDidYouRender = true;
236
236
  function Blank(options) {
237
237
  const { theme } = useConfigContext();
238
- return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx(Typography.Text, { disabled: true, children: options?.text || theme.Blank.text }) : options.value;
238
+ return !options || options.value === void 0 || options.value === null || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx(Typography.Text, { disabled: true, children: options?.text || theme.Blank.text }) : options.value;
239
239
  }
240
240
  Blank.whyDidYouRender = true;
241
+ function upperFirst(str) {
242
+ return str.charAt(0).toUpperCase() + str.slice(1);
243
+ }
241
244
  function transferOptions(options) {
242
245
  if (!options) return [];
243
246
  return options.map(
@@ -450,7 +453,7 @@ function Description(props) {
450
453
  Descriptions,
451
454
  {
452
455
  ...props,
453
- title: isFunction(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
456
+ title: typeof props.renderTitle === "function" ? props.renderTitle(props.dataSource) : props.title,
454
457
  items: props.items.filter((item) => item && (!item.if || item.if(props.dataSource))).map((item) => ({
455
458
  ...item,
456
459
  key: item.id,
@@ -1542,4 +1545,4 @@ function Title(props) {
1542
1545
  }
1543
1546
  Title.whyDidYouRender = true;
1544
1547
 
1545
- export { App, Blank, ConfigContext, ConfigProvider, Description, Drawer, ErrorBoundary, FaasDataWrapper, Form, FormItem, Link, Loading, Modal, PageNotFound, Routes, Table, Tabs, Title, transferOptions, transferValue, useApp, useConfigContext, useDrawer, useModal, withFaasData };
1548
+ export { App, Blank, ConfigContext, ConfigProvider, Description, Drawer, ErrorBoundary, FaasDataWrapper, Form, FormItem, Link, Loading, Modal, PageNotFound, Routes, Table, Tabs, Title, transferOptions, transferValue, upperFirst, useApp, useConfigContext, useDrawer, useModal, withFaasData };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "3.2.1",
3
+ "version": "3.4.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -34,7 +34,7 @@
34
34
  "dist"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@faasjs/react": "3.2.1",
37
+ "@faasjs/react": "3.4.0",
38
38
  "antd": "*",
39
39
  "@ant-design/icons": "*",
40
40
  "lodash-es": "*",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/lodash-es": "*",
47
- "@faasjs/react": "3.2.1",
47
+ "@faasjs/react": "3.4.0",
48
48
  "antd": "*",
49
49
  "@ant-design/icons": "*",
50
50
  "lodash-es": "*",