@faasjs/ant-design 0.0.4-beta.9 → 0.0.5-beta.2

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.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { FaasDataWrapper as FaasDataWrapper$1, ErrorBoundary as ErrorBoundary$1, faas } from '@faasjs/react';
1
+ import { ErrorBoundary as ErrorBoundary$1, FaasReactClient, FaasDataWrapper as FaasDataWrapper$1, faas } from '@faasjs/react';
2
2
  export { faas, useFaas } from '@faasjs/react';
3
- import { Form as Form$1, Modal, Drawer, message, notification, ConfigProvider, Typography, Spin, Descriptions, Input, Button, Row, Col, TimePicker, DatePicker, Switch, Select, InputNumber, Radio, Result, Skeleton, Table as Table$1, Tabs as Tabs$1, Space, Alert } from 'antd';
3
+ import { Form as Form$1, Modal, Drawer, message, notification, ConfigProvider as ConfigProvider$1, Typography, Spin, Descriptions, Input, Button, Row, Col, TimePicker, DatePicker, Switch, Select, InputNumber, Radio, Result, Skeleton, Table as Table$1, Tabs as Tabs$1, Alert, Space } from 'antd';
4
4
  export { Drawer, Modal } from 'antd';
5
5
  import { StyleProvider, legacyLogicalPropertiesTransformer } from '@ant-design/cssinjs';
6
- import { createContext, useState, useMemo, useContext, useEffect, cloneElement, useCallback, isValidElement, Suspense } from 'react';
6
+ import { createContext, useState, useEffect, useContext, useMemo, cloneElement, useCallback, isValidElement, Suspense } from 'react';
7
7
  export { lazy } from 'react';
8
8
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
9
  import { BrowserRouter, useNavigate, Link as Link$1, Routes as Routes$1, Route, useLocation } from 'react-router-dom';
@@ -52,57 +52,28 @@ function useDrawer(init) {
52
52
  }
53
53
  };
54
54
  }
55
- var AppContext = createContext({
56
- message: {},
57
- notification: {},
58
- setModalProps: () => void 0,
59
- setDrawerProps: () => void 0
60
- });
61
- function RoutesApp(props) {
62
- const location = useLocation();
63
- const { setDrawerProps, setModalProps } = useApp();
64
- useEffect(() => {
65
- console.debug("location", location);
66
- setDrawerProps({ open: false });
67
- setModalProps({ open: false });
68
- }, [location]);
69
- return /* @__PURE__ */ jsx(Fragment, { children: props.children });
70
- }
71
- function App(props) {
72
- const [messageApi, messageContextHolder] = message.useMessage();
73
- const [notificationApi, notificationContextHolder] = notification.useNotification();
74
- const { modal, setModalProps } = useModal();
75
- const { drawer, setDrawerProps } = useDrawer();
76
- const memoizedContextValue = useMemo(
77
- () => ({
78
- message: messageApi,
79
- notification: notificationApi,
80
- setModalProps,
81
- setDrawerProps
82
- }),
83
- [messageApi, notificationApi, setModalProps, setDrawerProps]
84
- );
55
+ function ErrorChildren(props) {
85
56
  return /* @__PURE__ */ jsx(
86
- StyleProvider,
57
+ Alert,
87
58
  {
88
- ...Object.assign(props.styleProviderProps || {}, {
89
- hashPriority: "high",
90
- transformers: [legacyLogicalPropertiesTransformer]
91
- }),
92
- children: /* @__PURE__ */ jsx(ConfigProvider, { ...props.configProviderProps, children: /* @__PURE__ */ jsx(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsxs(BrowserRouter, { ...props.browserRouterProps, children: [
93
- messageContextHolder,
94
- notificationContextHolder,
95
- modal,
96
- drawer,
97
- /* @__PURE__ */ jsx(RoutesApp, { children: props.children })
98
- ] }) }) })
59
+ type: "error",
60
+ message: props.errorMessage,
61
+ description: /* @__PURE__ */ jsx(
62
+ "pre",
63
+ {
64
+ style: {
65
+ fontSize: "0.9em",
66
+ overflowX: "auto"
67
+ },
68
+ children: props.errorDescription
69
+ }
70
+ )
99
71
  }
100
72
  );
101
73
  }
102
- function useApp() {
103
- return useContext(AppContext);
74
+ function ErrorBoundary(props) {
75
+ return /* @__PURE__ */ jsx(ErrorBoundary$1, { errorChildren: /* @__PURE__ */ jsx(ErrorChildren, {}), ...props });
104
76
  }
105
- App.useApp = useApp;
106
77
  var isZH = /^zh/i.test(navigator.language);
107
78
  var zh = {
108
79
  lang: "zh",
@@ -129,8 +100,7 @@ var en = {
129
100
  reset: "Reset"
130
101
  };
131
102
  var common = isZH ? zh : en;
132
- var baseConfig = {
133
- antd: {},
103
+ var baseTheme = {
134
104
  lang: "en",
135
105
  common,
136
106
  Blank: { text: common.blank },
@@ -141,37 +111,92 @@ var baseConfig = {
141
111
  },
142
112
  Link: { style: {} }
143
113
  };
144
- var ConfigContext = createContext(baseConfig);
145
- function ConfigProvider2({
146
- config,
147
- children
148
- }) {
149
- const [values, setValues] = useState(baseConfig);
114
+ var ConfigContext = createContext({
115
+ theme: baseTheme
116
+ });
117
+ function ConfigProvider(props) {
118
+ const [theme, setTheme] = useState();
150
119
  useEffect(() => {
151
- if (config.lang === "zh") {
152
- setValues(
120
+ var _a;
121
+ if (((_a = props.theme) == null ? void 0 : _a.lang) === "zh") {
122
+ setTheme(
153
123
  defaultsDeep(
154
- config,
124
+ props.theme,
155
125
  {
156
126
  lang: "zh",
157
127
  common: zh,
158
128
  Blank: { text: zh.blank },
159
129
  Form: { submit: { text: zh.submit } }
160
130
  },
161
- baseConfig
131
+ baseTheme
162
132
  )
163
133
  );
164
134
  } else
165
- setValues(defaultsDeep(config, values));
166
- }, []);
167
- return /* @__PURE__ */ jsx(ConfigContext.Provider, { value: values, children });
135
+ setTheme(defaultsDeep(props.theme, baseTheme));
136
+ if (props.faasClientOptions)
137
+ FaasReactClient(props.faasClientOptions);
138
+ }, [JSON.stringify(props.theme)]);
139
+ if (!theme)
140
+ return null;
141
+ return /* @__PURE__ */ jsx(ConfigContext.Provider, { value: { theme }, children: props.children });
168
142
  }
169
143
  function useConfigContext() {
170
144
  return useContext(ConfigContext);
171
145
  }
146
+ var AppContext = createContext({
147
+ message: {},
148
+ notification: {},
149
+ setModalProps: () => void 0,
150
+ setDrawerProps: () => void 0
151
+ });
152
+ function RoutesApp(props) {
153
+ const location = useLocation();
154
+ const { setDrawerProps, setModalProps } = useApp();
155
+ useEffect(() => {
156
+ console.debug("location", location);
157
+ setDrawerProps({ open: false });
158
+ setModalProps({ open: false });
159
+ }, [location]);
160
+ return /* @__PURE__ */ jsx(Fragment, { children: props.children });
161
+ }
162
+ function App(props) {
163
+ const [messageApi, messageContextHolder] = message.useMessage();
164
+ const [notificationApi, notificationContextHolder] = notification.useNotification();
165
+ const { modal, setModalProps } = useModal();
166
+ const { drawer, setDrawerProps } = useDrawer();
167
+ const memoizedContextValue = useMemo(
168
+ () => ({
169
+ message: messageApi,
170
+ notification: notificationApi,
171
+ setModalProps,
172
+ setDrawerProps
173
+ }),
174
+ [messageApi, notificationApi, setModalProps, setDrawerProps]
175
+ );
176
+ return /* @__PURE__ */ jsx(
177
+ StyleProvider,
178
+ {
179
+ ...Object.assign(props.styleProviderProps || {}, {
180
+ hashPriority: "high",
181
+ transformers: [legacyLogicalPropertiesTransformer]
182
+ }),
183
+ children: /* @__PURE__ */ jsx(ConfigProvider$1, { ...props.configProviderProps, children: /* @__PURE__ */ jsx(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsx(ConfigProvider, { ...props.faasConfigProviderProps, children: /* @__PURE__ */ jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxs(BrowserRouter, { ...props.browserRouterProps, children: [
184
+ messageContextHolder,
185
+ notificationContextHolder,
186
+ modal,
187
+ drawer,
188
+ /* @__PURE__ */ jsx(RoutesApp, { children: props.children })
189
+ ] }) }) }) }) })
190
+ }
191
+ );
192
+ }
193
+ function useApp() {
194
+ return useContext(AppContext);
195
+ }
196
+ App.useApp = useApp;
172
197
  function Blank(options) {
173
- const { Blank: Blank2 } = useConfigContext();
174
- return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx(Typography.Text, { disabled: true, children: (options == null ? void 0 : options.text) || Blank2.text }) : options.value;
198
+ const { theme } = useConfigContext();
199
+ return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx(Typography.Text, { disabled: true, children: (options == null ? void 0 : options.text) || theme.Blank.text }) : options.value;
175
200
  }
176
201
  function transferOptions(options) {
177
202
  if (!options)
@@ -253,7 +278,7 @@ function DescriptionItemContent(props) {
253
278
  }, [props]);
254
279
  if (!computedProps)
255
280
  return null;
256
- if ((_a = computedProps.extendTypes) == null ? void 0 : _a[computedProps.item.type])
281
+ if ((_a = computedProps.extendTypes) == null ? void 0 : _a[computedProps.item.type]) {
257
282
  if (computedProps.extendTypes[computedProps.item.type].children)
258
283
  return cloneElement(
259
284
  computedProps.extendTypes[computedProps.item.type].children,
@@ -263,15 +288,15 @@ function DescriptionItemContent(props) {
263
288
  values: computedProps.values
264
289
  }
265
290
  );
266
- else if (computedProps.extendTypes[computedProps.item.type].render)
291
+ if (computedProps.extendTypes[computedProps.item.type].render)
267
292
  return /* @__PURE__ */ jsx(Fragment, { children: computedProps.extendTypes[computedProps.item.type].render(
268
293
  computedProps.value,
269
294
  computedProps.values,
270
295
  0,
271
296
  "description"
272
297
  ) });
273
- else
274
- throw Error(`${computedProps.item.type} requires children or render`);
298
+ throw Error(`${computedProps.item.type} requires children or render`);
299
+ }
275
300
  if (computedProps.item.descriptionChildren === null)
276
301
  return null;
277
302
  if (computedProps.item.descriptionChildren)
@@ -393,28 +418,6 @@ function Description(props) {
393
418
  }
394
419
  );
395
420
  }
396
- function ErrorChildren(props) {
397
- return /* @__PURE__ */ jsx(
398
- Alert,
399
- {
400
- type: "error",
401
- message: props.errorMessage,
402
- description: /* @__PURE__ */ jsx(
403
- "pre",
404
- {
405
- style: {
406
- fontSize: "0.9em",
407
- overflowX: "auto"
408
- },
409
- children: props.errorDescription
410
- }
411
- )
412
- }
413
- );
414
- }
415
- function ErrorBoundary(props) {
416
- return /* @__PURE__ */ jsx(ErrorBoundary$1, { errorChildren: /* @__PURE__ */ jsx(ErrorChildren, {}), ...props });
417
- }
418
421
  function processProps(propsCopy, config) {
419
422
  if (!propsCopy.title)
420
423
  propsCopy.title = upperFirst(propsCopy.id);
@@ -469,7 +472,7 @@ function FormItem(props) {
469
472
  var _a;
470
473
  const [computedProps, setComputedProps] = useState();
471
474
  const [extendTypes, setExtendTypes] = useState();
472
- const { common: common2 } = useConfigContext();
475
+ const { theme } = useConfigContext();
473
476
  const [hidden, setHidden] = useState(props.hidden || false);
474
477
  useEffect(() => {
475
478
  const propsCopy = { ...props };
@@ -490,7 +493,7 @@ function FormItem(props) {
490
493
  delete propsCopy.if;
491
494
  delete propsCopy.hidden;
492
495
  }
493
- setComputedProps(processProps(propsCopy, common2));
496
+ setComputedProps(processProps(propsCopy, theme.common));
494
497
  }, [props]);
495
498
  if (!computedProps)
496
499
  return null;
@@ -670,7 +673,7 @@ function FormItem(props) {
670
673
  danger: true,
671
674
  type: "link",
672
675
  onClick: () => remove(field.name),
673
- children: common2.delete
676
+ children: theme.common.delete
674
677
  }
675
678
  )
676
679
  ] }) }),
@@ -685,7 +688,7 @@ function FormItem(props) {
685
688
  onClick: () => add(),
686
689
  icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
687
690
  children: [
688
- common2.add,
691
+ theme.common.add,
689
692
  " ",
690
693
  computedProps.label
691
694
  ]
@@ -826,7 +829,7 @@ function Form(props) {
826
829
  )
827
830
  ),
828
831
  computedProps.children,
829
- computedProps.submit !== false && /* @__PURE__ */ jsx(Button, { htmlType: "submit", type: "primary", loading, children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text }),
832
+ computedProps.submit !== false && /* @__PURE__ */ jsx(Button, { htmlType: "submit", type: "primary", loading, children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.theme.Form.submit.text }),
830
833
  computedProps.footer
831
834
  ] });
832
835
  }
@@ -838,11 +841,11 @@ Form.List = Form$1.List;
838
841
  Form.ErrorList = Form$1.ErrorList;
839
842
  Form.Provider = Form$1.Provider;
840
843
  function Link(props) {
841
- var _a, _b;
842
- const { Link: Config } = useConfigContext();
844
+ var _a, _b, _c, _d, _e, _f, _g;
845
+ const { theme } = useConfigContext();
843
846
  const navigate = useNavigate();
844
847
  let computedStyle = {
845
- ...Config.style || {},
848
+ ...theme.Link.style || {},
846
849
  cursor: "pointer",
847
850
  ...props.style
848
851
  };
@@ -860,11 +863,11 @@ function Link(props) {
860
863
  Button,
861
864
  {
862
865
  ...props.button,
863
- target: props.target || (Config == null ? void 0 : Config.target) || "_blank",
866
+ target: props.target || ((_a = theme.Link) == null ? void 0 : _a.target) || "_blank",
864
867
  style: computedStyle,
865
868
  href: props.href,
866
869
  onClick: props.onClick,
867
- children: (_a = props.text) != null ? _a : props.children
870
+ children: (_b = props.text) != null ? _b : props.children
868
871
  }
869
872
  );
870
873
  if (props.children)
@@ -874,7 +877,7 @@ function Link(props) {
874
877
  "a",
875
878
  {
876
879
  href: props.href,
877
- target: props.target || (Config == null ? void 0 : Config.target),
880
+ target: props.target || ((_c = theme.Link) == null ? void 0 : _c.target),
878
881
  style: computedStyle,
879
882
  onClick: props.onClick,
880
883
  children: props.children
@@ -885,7 +888,7 @@ function Link(props) {
885
888
  Typography.Link,
886
889
  {
887
890
  href: props.href,
888
- target: props.target || (Config == null ? void 0 : Config.target) || "_blank",
891
+ target: props.target || ((_d = theme.Link) == null ? void 0 : _d.target) || "_blank",
889
892
  style: computedStyle,
890
893
  copyable: props.copyable,
891
894
  onClick: props.onClick,
@@ -899,8 +902,11 @@ function Link(props) {
899
902
  {
900
903
  ...props.button,
901
904
  style: computedStyle,
902
- onClick: (e) => props.onClick ? props.onClick(e) : (props.target || (Config == null ? void 0 : Config.target)) === "_blank" ? window.open(props.href) : navigate(props.href),
903
- children: (_b = props.text) != null ? _b : props.children
905
+ onClick: (e) => {
906
+ var _a2;
907
+ return props.onClick ? props.onClick(e) : (props.target || ((_a2 = theme.Link) == null ? void 0 : _a2.target)) === "_blank" ? window.open(props.href) : navigate(props.href);
908
+ },
909
+ children: (_e = props.text) != null ? _e : props.children
904
910
  }
905
911
  );
906
912
  if (props.children)
@@ -908,7 +914,7 @@ function Link(props) {
908
914
  Link$1,
909
915
  {
910
916
  to: props.href,
911
- target: props.target || (Config == null ? void 0 : Config.target),
917
+ target: props.target || ((_f = theme.Link) == null ? void 0 : _f.target),
912
918
  style: computedStyle,
913
919
  onClick: props.onClick,
914
920
  children: props.children
@@ -918,15 +924,16 @@ function Link(props) {
918
924
  Typography.Link,
919
925
  {
920
926
  href: props.href,
921
- target: props.target || (Config == null ? void 0 : Config.target),
927
+ target: props.target || ((_g = theme.Link) == null ? void 0 : _g.target),
922
928
  style: computedStyle,
923
929
  copyable: props.copyable,
924
930
  onClick: (e) => {
931
+ var _a2;
925
932
  if (props.onClick) {
926
933
  props.onClick(e);
927
934
  return;
928
935
  }
929
- if ((props.target || (Config == null ? void 0 : Config.target)) !== "_blank") {
936
+ if ((props.target || ((_a2 = theme.Link) == null ? void 0 : _a2.target)) !== "_blank") {
930
937
  e.preventDefault();
931
938
  navigate(props.href);
932
939
  }
@@ -936,8 +943,8 @@ function Link(props) {
936
943
  );
937
944
  }
938
945
  function PageNotFound() {
939
- const config = useConfigContext();
940
- return /* @__PURE__ */ jsx(Result, { status: "404", title: config.common.pageNotFound });
946
+ const { theme } = useConfigContext();
947
+ return /* @__PURE__ */ jsx(Result, { status: "404", title: theme.common.pageNotFound });
941
948
  }
942
949
  function Routes(props) {
943
950
  return /* @__PURE__ */ jsxs(Routes$1, { children: [
@@ -984,9 +991,9 @@ function processValue(item, value) {
984
991
  }
985
992
  function Table(props) {
986
993
  const [columns, setColumns] = useState();
987
- const { common: common2 } = useConfigContext();
994
+ const { theme } = useConfigContext();
988
995
  const generateFilterDropdown = (item) => {
989
- if (typeof item.filterDropdown !== "undefined")
996
+ if (item.filterDropdown && item.filterDropdown !== true)
990
997
  return;
991
998
  if (item.options.length < 11) {
992
999
  if (!item.filters)
@@ -1011,7 +1018,7 @@ function Table(props) {
1011
1018
  allowClear: true,
1012
1019
  showSearch: true,
1013
1020
  style: { width: "100%" },
1014
- placeholder: `${common2.search} ${item.title}`,
1021
+ placeholder: `${theme.common.search} ${item.title}`,
1015
1022
  value: selectedKeys,
1016
1023
  onChange: (v) => {
1017
1024
  setSelectedKeys((v == null ? void 0 : v.length) ? v : []);
@@ -1085,146 +1092,146 @@ function Table(props) {
1085
1092
  case "string":
1086
1093
  if (!item.render)
1087
1094
  item.render = (value) => processValue(item, value);
1088
- if (!item.onFilter)
1089
- item.onFilter = (value, row) => {
1090
- if (!value || isNil(value))
1091
- return true;
1092
- if (isNil(row[item.id]))
1093
- return false;
1094
- return row[item.id].trim().toLowerCase().includes(value.trim().toLowerCase());
1095
- };
1096
- if (item.filterDropdown === false || item.filterDropdown)
1097
- break;
1098
- if (!item.filters && item.optionsType !== "auto")
1099
- item.filterDropdown = ({
1100
- setSelectedKeys,
1101
- confirm,
1102
- clearFilters
1103
- }) => /* @__PURE__ */ jsx(
1104
- Input.Search,
1105
- {
1106
- placeholder: `${common2.search} ${item.title}`,
1107
- allowClear: true,
1108
- onSearch: (v) => {
1109
- if (v) {
1110
- setSelectedKeys([v]);
1111
- } else {
1112
- setSelectedKeys([]);
1113
- clearFilters();
1095
+ if (item.filterDropdown !== false) {
1096
+ if (!item.onFilter)
1097
+ item.onFilter = (value, row) => {
1098
+ if (!value || isNil(value))
1099
+ return true;
1100
+ if (isNil(row[item.id]))
1101
+ return false;
1102
+ return row[item.id].trim().toLowerCase().includes(value.trim().toLowerCase());
1103
+ };
1104
+ if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto")
1105
+ item.filterDropdown = ({
1106
+ setSelectedKeys,
1107
+ confirm,
1108
+ clearFilters
1109
+ }) => /* @__PURE__ */ jsx(
1110
+ Input.Search,
1111
+ {
1112
+ placeholder: `${theme.common.search} ${item.title}`,
1113
+ allowClear: true,
1114
+ onSearch: (v) => {
1115
+ if (v) {
1116
+ setSelectedKeys([v]);
1117
+ } else {
1118
+ setSelectedKeys([]);
1119
+ clearFilters();
1120
+ }
1121
+ confirm();
1114
1122
  }
1115
- confirm();
1116
1123
  }
1117
- }
1118
- );
1124
+ );
1125
+ }
1119
1126
  break;
1120
1127
  case "string[]":
1121
1128
  if (!item.render)
1122
1129
  item.render = (value) => processValue(item, value);
1123
- if (!item.onFilter)
1124
- item.onFilter = (value, row) => {
1125
- if (value === null && (!row[item.id] || !row[item.id].length))
1126
- return true;
1127
- if (!row[item.id] || !row[item.id].length || !value)
1128
- return false;
1129
- return row[item.id].some(
1130
- (v) => v.trim().toLowerCase().includes(value.trim().toLowerCase())
1131
- );
1132
- };
1133
- if (item.filterDropdown === false || item.filterDropdown)
1134
- break;
1135
- if (!item.filters && item.optionsType !== "auto")
1136
- item.filterDropdown = ({
1137
- setSelectedKeys,
1138
- confirm,
1139
- clearFilters
1140
- }) => /* @__PURE__ */ jsx(
1141
- Input.Search,
1142
- {
1143
- placeholder: `${common2.search} ${item.title}`,
1144
- allowClear: true,
1145
- onSearch: (v) => {
1146
- if (v) {
1147
- setSelectedKeys([v]);
1148
- } else {
1149
- setSelectedKeys([]);
1150
- clearFilters();
1130
+ if (item.filterDropdown !== false) {
1131
+ if (!item.onFilter)
1132
+ item.onFilter = (value, row) => {
1133
+ if (value === null && (!row[item.id] || !row[item.id].length))
1134
+ return true;
1135
+ if (!row[item.id] || !row[item.id].length || !value)
1136
+ return false;
1137
+ return row[item.id].some(
1138
+ (v) => v.trim().toLowerCase().includes(value.trim().toLowerCase())
1139
+ );
1140
+ };
1141
+ if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto")
1142
+ item.filterDropdown = ({
1143
+ setSelectedKeys,
1144
+ confirm,
1145
+ clearFilters
1146
+ }) => /* @__PURE__ */ jsx(
1147
+ Input.Search,
1148
+ {
1149
+ placeholder: `${theme.common.search} ${item.title}`,
1150
+ allowClear: true,
1151
+ onSearch: (v) => {
1152
+ if (v) {
1153
+ setSelectedKeys([v]);
1154
+ } else {
1155
+ setSelectedKeys([]);
1156
+ clearFilters();
1157
+ }
1158
+ confirm();
1151
1159
  }
1152
- confirm();
1153
1160
  }
1154
- }
1155
- );
1161
+ );
1162
+ }
1156
1163
  break;
1157
1164
  case "number":
1158
1165
  if (!item.render)
1159
1166
  item.render = (value) => processValue(item, value);
1160
- if (!item.sorter)
1167
+ if (typeof item.sorter === "undefined")
1161
1168
  item.sorter = (a, b) => a[item.id] - b[item.id];
1162
- if (!item.onFilter)
1163
- item.onFilter = (value, row) => {
1164
- if (value === null)
1165
- return true;
1166
- if (isNil(row[item.id]))
1167
- return false;
1168
- return value == row[item.id];
1169
- };
1170
- if (item.filterDropdown === false || item.filterDropdown)
1171
- break;
1172
- if (!item.filters)
1173
- item.filterDropdown = ({
1174
- setSelectedKeys,
1175
- confirm,
1176
- clearFilters
1177
- }) => /* @__PURE__ */ jsx(
1178
- Input.Search,
1179
- {
1180
- placeholder: `${common2.search} ${item.title}`,
1181
- allowClear: true,
1182
- onSearch: (v) => {
1183
- if (v) {
1184
- setSelectedKeys([Number(v)]);
1185
- } else {
1186
- setSelectedKeys([]);
1187
- clearFilters();
1169
+ if (item.filterDropdown !== false) {
1170
+ if (!item.onFilter)
1171
+ item.onFilter = (value, row) => {
1172
+ if (value === null)
1173
+ return true;
1174
+ if (isNil(row[item.id]))
1175
+ return false;
1176
+ return value == row[item.id];
1177
+ };
1178
+ if (typeof item.filterDropdown === "undefined" && !item.filters)
1179
+ item.filterDropdown = ({
1180
+ setSelectedKeys,
1181
+ confirm,
1182
+ clearFilters
1183
+ }) => /* @__PURE__ */ jsx(
1184
+ Input.Search,
1185
+ {
1186
+ placeholder: `${theme.common.search} ${item.title}`,
1187
+ allowClear: true,
1188
+ onSearch: (v) => {
1189
+ if (v) {
1190
+ setSelectedKeys([Number(v)]);
1191
+ } else {
1192
+ setSelectedKeys([]);
1193
+ clearFilters();
1194
+ }
1195
+ confirm();
1188
1196
  }
1189
- confirm();
1190
1197
  }
1191
- }
1192
- );
1198
+ );
1199
+ }
1193
1200
  break;
1194
1201
  case "number[]":
1195
1202
  if (!item.render)
1196
1203
  item.render = (value) => processValue(item, value).join(", ");
1197
- if (!item.onFilter)
1198
- item.onFilter = (value, row) => {
1199
- if (value === null && (!row[item.id] || !row[item.id].length))
1200
- return true;
1201
- if (!row[item.id] || !row[item.id].length)
1202
- return false;
1203
- return row[item.id].includes(Number(value));
1204
- };
1205
- if (item.filterDropdown === false || item.filterDropdown)
1206
- break;
1207
- if (!item.filters)
1208
- item.filterDropdown = ({
1209
- setSelectedKeys,
1210
- confirm,
1211
- clearFilters
1212
- }) => /* @__PURE__ */ jsx(
1213
- Input.Search,
1214
- {
1215
- placeholder: `${common2.search} ${item.title}`,
1216
- allowClear: true,
1217
- onSearch: (v) => {
1218
- if (v) {
1219
- setSelectedKeys([Number(v)]);
1220
- } else {
1221
- setSelectedKeys([]);
1222
- clearFilters();
1204
+ if (item.filterDropdown !== false) {
1205
+ if (!item.onFilter)
1206
+ item.onFilter = (value, row) => {
1207
+ if (value === null && (!row[item.id] || !row[item.id].length))
1208
+ return true;
1209
+ if (!row[item.id] || !row[item.id].length)
1210
+ return false;
1211
+ return row[item.id].includes(Number(value));
1212
+ };
1213
+ if (typeof item.filterDropdown === "undefined" && !item.filters)
1214
+ item.filterDropdown = ({
1215
+ setSelectedKeys,
1216
+ confirm,
1217
+ clearFilters
1218
+ }) => /* @__PURE__ */ jsx(
1219
+ Input.Search,
1220
+ {
1221
+ placeholder: `${theme.common.search} ${item.title}`,
1222
+ allowClear: true,
1223
+ onSearch: (v) => {
1224
+ if (v) {
1225
+ setSelectedKeys([Number(v)]);
1226
+ } else {
1227
+ setSelectedKeys([]);
1228
+ clearFilters();
1229
+ }
1230
+ confirm();
1223
1231
  }
1224
- confirm();
1225
1232
  }
1226
- }
1227
- );
1233
+ );
1234
+ }
1228
1235
  break;
1229
1236
  case "boolean":
1230
1237
  if (!item.render)
@@ -1245,68 +1252,70 @@ function Table(props) {
1245
1252
  }
1246
1253
  }
1247
1254
  );
1248
- if (item.filterDropdown !== false)
1249
- item.filterDropdown = ({
1250
- setSelectedKeys,
1251
- selectedKeys,
1252
- confirm
1253
- }) => /* @__PURE__ */ jsxs(
1254
- Radio.Group,
1255
- {
1256
- style: { padding: 8 },
1257
- buttonStyle: "solid",
1258
- value: JSON.stringify(selectedKeys[0]),
1259
- onChange: (e) => {
1260
- const Values = {
1261
- true: true,
1262
- false: false,
1263
- null: null
1264
- };
1265
- setSelectedKeys(
1266
- e.target.value ? [Values[e.target.value]] : []
1267
- );
1268
- confirm();
1269
- },
1270
- children: [
1271
- /* @__PURE__ */ jsx(Radio.Button, { children: common2.all }),
1272
- /* @__PURE__ */ jsx(Radio.Button, { value: "true", children: /* @__PURE__ */ jsx(
1273
- CheckOutlined,
1274
- {
1275
- style: {
1276
- color: "#52c41a",
1277
- verticalAlign: "middle"
1255
+ if (item.filterDropdown !== false) {
1256
+ if (typeof item.filterDropdown === "undefined")
1257
+ item.filterDropdown = ({
1258
+ setSelectedKeys,
1259
+ selectedKeys,
1260
+ confirm
1261
+ }) => /* @__PURE__ */ jsxs(
1262
+ Radio.Group,
1263
+ {
1264
+ style: { padding: 8 },
1265
+ buttonStyle: "solid",
1266
+ value: JSON.stringify(selectedKeys[0]),
1267
+ onChange: (e) => {
1268
+ const Values = {
1269
+ true: true,
1270
+ false: false,
1271
+ null: null
1272
+ };
1273
+ setSelectedKeys(
1274
+ e.target.value ? [Values[e.target.value]] : []
1275
+ );
1276
+ confirm();
1277
+ },
1278
+ children: [
1279
+ /* @__PURE__ */ jsx(Radio.Button, { children: theme.common.all }),
1280
+ /* @__PURE__ */ jsx(Radio.Button, { value: "true", children: /* @__PURE__ */ jsx(
1281
+ CheckOutlined,
1282
+ {
1283
+ style: {
1284
+ color: "#52c41a",
1285
+ verticalAlign: "middle"
1286
+ }
1278
1287
  }
1279
- }
1280
- ) }),
1281
- /* @__PURE__ */ jsx(Radio.Button, { value: "false", children: /* @__PURE__ */ jsx(
1282
- CloseOutlined,
1283
- {
1284
- style: {
1285
- verticalAlign: "middle",
1286
- color: "#ff4d4f"
1288
+ ) }),
1289
+ /* @__PURE__ */ jsx(Radio.Button, { value: "false", children: /* @__PURE__ */ jsx(
1290
+ CloseOutlined,
1291
+ {
1292
+ style: {
1293
+ verticalAlign: "middle",
1294
+ color: "#ff4d4f"
1295
+ }
1287
1296
  }
1288
- }
1289
- ) }),
1290
- /* @__PURE__ */ jsx(Radio.Button, { value: "null", children: common2.blank })
1291
- ]
1292
- }
1293
- );
1294
- if (!item.onFilter)
1295
- item.onFilter = (value, row) => {
1296
- switch (value) {
1297
- case true:
1298
- return !isNil(row[item.id]) && row[item.id] !== false;
1299
- case false:
1300
- return !isNil(row[item.id]) && !row[item.id];
1301
- default:
1302
- return isNil(row[item.id]);
1303
- }
1304
- };
1297
+ ) }),
1298
+ /* @__PURE__ */ jsx(Radio.Button, { value: "null", children: theme.common.blank })
1299
+ ]
1300
+ }
1301
+ );
1302
+ if (!item.onFilter)
1303
+ item.onFilter = (value, row) => {
1304
+ switch (value) {
1305
+ case true:
1306
+ return !isNil(row[item.id]) && row[item.id] !== false;
1307
+ case false:
1308
+ return !isNil(row[item.id]) && !row[item.id];
1309
+ default:
1310
+ return isNil(row[item.id]);
1311
+ }
1312
+ };
1313
+ }
1305
1314
  break;
1306
1315
  case "date":
1307
1316
  if (!item.render)
1308
1317
  item.render = (value) => processValue(item, value);
1309
- if (!item.sorter)
1318
+ if (typeof item.sorter === "undefined")
1310
1319
  item.sorter = (a, b, order) => {
1311
1320
  if (isNil(a[item.id]))
1312
1321
  return order === "ascend" ? 1 : -1;
@@ -1314,36 +1323,38 @@ function Table(props) {
1314
1323
  return order === "ascend" ? -1 : 1;
1315
1324
  return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
1316
1325
  };
1317
- if (!item.filterDropdown)
1318
- item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(
1319
- DatePicker.RangePicker,
1320
- {
1321
- onChange: (dates) => {
1322
- setSelectedKeys(
1323
- (dates == null ? void 0 : dates[0]) && dates[1] ? [
1324
- [
1325
- dates[0].startOf("day").toISOString(),
1326
- dates[1].endOf("day").toISOString()
1327
- ]
1328
- ] : []
1329
- );
1330
- confirm();
1326
+ if (item.filterDropdown !== false) {
1327
+ if (typeof item.filterDropdown === "undefined")
1328
+ item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(
1329
+ DatePicker.RangePicker,
1330
+ {
1331
+ onChange: (dates) => {
1332
+ setSelectedKeys(
1333
+ (dates == null ? void 0 : dates[0]) && dates[1] ? [
1334
+ [
1335
+ dates[0].startOf("day").toISOString(),
1336
+ dates[1].endOf("day").toISOString()
1337
+ ]
1338
+ ] : []
1339
+ );
1340
+ confirm();
1341
+ }
1331
1342
  }
1332
- }
1333
- );
1334
- if (!item.onFilter)
1335
- item.onFilter = (value, row) => {
1336
- if (isNil(value[0]))
1337
- return true;
1338
- if (isNil(row[item.id]))
1339
- return false;
1340
- return dayjs2(row[item.id]) >= dayjs2(value[0]) && dayjs2(row[item.id]) <= dayjs2(value[1]);
1341
- };
1343
+ );
1344
+ if (!item.onFilter)
1345
+ item.onFilter = (value, row) => {
1346
+ if (isNil(value[0]))
1347
+ return true;
1348
+ if (isNil(row[item.id]))
1349
+ return false;
1350
+ return dayjs2(row[item.id]) >= dayjs2(value[0]) && dayjs2(row[item.id]) <= dayjs2(value[1]);
1351
+ };
1352
+ }
1342
1353
  break;
1343
1354
  case "time":
1344
1355
  if (!item.render)
1345
1356
  item.render = (value) => processValue(item, value);
1346
- if (!item.sorter)
1357
+ if (typeof item.sorter === "undefined")
1347
1358
  item.sorter = (a, b, order) => {
1348
1359
  if (isNil(a[item.id]))
1349
1360
  return order === "ascend" ? 1 : -1;
@@ -1351,31 +1362,33 @@ function Table(props) {
1351
1362
  return order === "ascend" ? -1 : 1;
1352
1363
  return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
1353
1364
  };
1354
- if (!item.filterDropdown)
1355
- item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(
1356
- DatePicker.RangePicker,
1357
- {
1358
- onChange: (dates) => {
1359
- setSelectedKeys(
1360
- (dates == null ? void 0 : dates[0]) && dates[1] ? [
1361
- [
1362
- dates[0].startOf("day").toISOString(),
1363
- dates[1].endOf("day").toISOString()
1364
- ]
1365
- ] : []
1366
- );
1367
- confirm();
1365
+ if (item.filterDropdown !== false) {
1366
+ if (typeof item.filterDropdown === "undefined")
1367
+ item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(
1368
+ DatePicker.RangePicker,
1369
+ {
1370
+ onChange: (dates) => {
1371
+ setSelectedKeys(
1372
+ (dates == null ? void 0 : dates[0]) && dates[1] ? [
1373
+ [
1374
+ dates[0].startOf("day").toISOString(),
1375
+ dates[1].endOf("day").toISOString()
1376
+ ]
1377
+ ] : []
1378
+ );
1379
+ confirm();
1380
+ }
1368
1381
  }
1369
- }
1370
- );
1371
- if (!item.onFilter)
1372
- item.onFilter = (value, row) => {
1373
- if (isNil(value[0]))
1374
- return true;
1375
- if (isNil(row[item.id]))
1376
- return false;
1377
- return dayjs2(row[item.id]) >= dayjs2(value[0]) && dayjs2(row[item.id]) <= dayjs2(value[1]);
1378
- };
1382
+ );
1383
+ if (!item.onFilter)
1384
+ item.onFilter = (value, row) => {
1385
+ if (isNil(value[0]))
1386
+ return true;
1387
+ if (isNil(row[item.id]))
1388
+ return false;
1389
+ return dayjs2(row[item.id]) >= dayjs2(value[0]) && dayjs2(row[item.id]) <= dayjs2(value[1]);
1390
+ };
1391
+ }
1379
1392
  break;
1380
1393
  case "object":
1381
1394
  if (!item.render)
@@ -1403,7 +1416,7 @@ function Table(props) {
1403
1416
  default:
1404
1417
  if (!item.render)
1405
1418
  item.render = (value) => processValue(item, value);
1406
- if (!item.onFilter)
1419
+ if (item.filterDropdown !== false && !item.onFilter)
1407
1420
  item.onFilter = (value, row) => {
1408
1421
  if (value === null && isNil(row[item.id]))
1409
1422
  return true;
@@ -1464,8 +1477,8 @@ function FaasDataTable({
1464
1477
  const newColumns = [...prev];
1465
1478
  for (const column of newColumns) {
1466
1479
  if ((_a = data.options) == null ? void 0 : _a[column.id]) {
1467
- column.options = data.options[column.id];
1468
- column.filters = data.options[column.id].map((v) => ({
1480
+ column.options = transferOptions(data.options[column.id]);
1481
+ column.filters = column.options.map((v) => ({
1469
1482
  text: v.label,
1470
1483
  value: v.value
1471
1484
  })).concat({
@@ -1562,10 +1575,10 @@ function Tabs(props) {
1562
1575
  );
1563
1576
  }
1564
1577
  function Title(props) {
1565
- const { Title: Title2 } = useConfigContext();
1578
+ const { theme } = useConfigContext();
1566
1579
  useEffect(() => {
1567
1580
  const title = Array.isArray(props.title) ? props.title : [props.title];
1568
- document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
1581
+ document.title = title.concat(props.suffix || theme.Title.suffix).filter((t) => !!t).join(props.separator || theme.Title.separator);
1569
1582
  }, [props]);
1570
1583
  if (props.h1) {
1571
1584
  if (typeof props.h1 === "boolean")
@@ -1579,4 +1592,4 @@ function Title(props) {
1579
1592
  return null;
1580
1593
  }
1581
1594
 
1582
- export { App, Blank, ConfigContext, ConfigProvider2 as ConfigProvider, Description, ErrorBoundary, FaasDataWrapper, Form, FormItem, Link, Loading, PageNotFound, Routes, Table, Tabs, Title, transferOptions, transferValue, useApp, useConfigContext, useDrawer, useModal };
1595
+ export { App, Blank, ConfigContext, ConfigProvider, Description, ErrorBoundary, FaasDataWrapper, Form, FormItem, Link, Loading, PageNotFound, Routes, Table, Tabs, Title, transferOptions, transferValue, useApp, useConfigContext, useDrawer, useModal };