kn-hooks 0.0.32 → 0.0.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kn-hooks",
3
- "version": "0.0.32",
3
+ "version": "0.0.34",
4
4
  "scripts": {
5
5
  "dev": "cross-env env_api=dev env_package=dev webpack-dev-server --progress",
6
6
  "build": "cross-env env_api=prod env_package=prod webpack --config webpack.config.js",
@@ -14,7 +14,7 @@ const DEFAULT_CONFIG={
14
14
  * [Demo - CodeSandBox]{@link https://codesandbox.io/s/usedictionary-j7cw8?file=/index.js}
15
15
  *
16
16
  * @param {Object} props
17
- * @param {Api} props.api - 用于获取字典列表的接口
17
+ * @param {Api} [props.api] - 用于获取字典列表的接口
18
18
  * @param {string} [props.idKey='id'] - 字段id的key键值
19
19
  * @param {string} [props.nameKey='name'] - 字段name的key键值
20
20
  * @param {string} [props.labelKey='label'] - 字段label的key键值
@@ -200,7 +200,7 @@ export const SetConfig = ({SelectOption,RadioOption})=>{
200
200
  * @function
201
201
  * @description 创建字典hooks工具
202
202
  * @param {Object} options
203
- * @param {Api} options.api - 用于获取字典列表的接口
203
+ * @param {Api} [options.api] - 用于获取字典列表的接口
204
204
  * @param {string} [options.idKey='id'] - 字段id的key键值
205
205
  * @param {string} [options.nameKey='name'] - 字段name的key键值
206
206
  * @param {string} [options.labelKey='label'] - 字段label的key键值
@@ -356,9 +356,10 @@ export const createDictionary=options=>{
356
356
 
357
357
 
358
358
  /**
359
- * @typedef Api
360
- * @property {Object} params - 调用接口用到的参数
361
- * @returns {Object}
359
+ * @template [T=object]
360
+ * @callback Api
361
+ * @param {Object} params - 调用接口用到的参数
362
+ * @returns {Promise<T>}
362
363
  */
363
364
 
364
365
 
@@ -46,7 +46,7 @@ return(
46
46
  */
47
47
  const usePaginationWithForm = (props) => {
48
48
  const {service,pagination,beforeService=[],...otherProps}= props;
49
- const [form] = useState(props.form);
49
+ const [form,setForm] = useState(props.form);
50
50
  const page = usePagination({service,pagination,...otherProps})
51
51
 
52
52
  useEffect(()=>{
@@ -68,6 +68,9 @@ const usePaginationWithForm = (props) => {
68
68
  }
69
69
  }
70
70
  },[])
71
+ useEffect(()=>{
72
+ setForm(props.form)
73
+ },[props.form])
71
74
 
72
75
  const getSearchValue = async () => {
73
76
  try {
package/src/.DS_Store DELETED
Binary file
package/test/.DS_Store DELETED
Binary file