@arim-aisdc/public-components 2.0.7 → 2.0.8

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.
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
3
  import { CustomFormProps } from './type';
4
- declare const _default: React.NamedExoticComponent<CustomFormProps>;
4
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<CustomFormProps & React.RefAttributes<unknown>>>;
5
5
  export default _default;
@@ -14,7 +14,7 @@ import { useDebounceFn } from 'ahooks';
14
14
  import { AutoComplete, Badge, Button, Cascader, Checkbox, Col, DatePicker, Form, Input, InputNumber, Radio, Row, Select, Spin, Switch } from 'antd';
15
15
  import dayjs from 'dayjs';
16
16
  import { debounce } from 'lodash';
17
- import React, { useEffect, useMemo, useRef, useState } from 'react';
17
+ import React, { forwardRef, useEffect, useMemo, useState } from 'react';
18
18
  import ColorSelector from "../ColorSelector";
19
19
  import "./index.less";
20
20
  import { CustomFormItemType } from "./type";
@@ -74,7 +74,7 @@ var getSpanConfig = function getSpanConfig(layout, width, span) {
74
74
  layout: breakPoint[2]
75
75
  };
76
76
  };
77
- var CustomForm = function CustomForm(_ref) {
77
+ var CustomForm = function CustomForm(_ref, ref) {
78
78
  var data = _ref.data,
79
79
  initialValues = _ref.initialValues,
80
80
  _ref$labelCol = _ref.labelCol,
@@ -117,12 +117,14 @@ var CustomForm = function CustomForm(_ref) {
117
117
  };
118
118
 
119
119
  /**初始化表单 */
120
- var FormRef = useRef(null);
120
+ // const FormRef = useRef<FormInstance>(null);
121
121
  useEffect(function () {
122
+ var _form$resetFields;
122
123
  /**回显异步初始值 */
123
- if (FormRef && FormRef.current) {
124
- FormRef.current.resetFields();
125
- }
124
+ // if (FormRef && FormRef.current) {
125
+ // FormRef.current.resetFields();
126
+ // }
127
+ (_form$resetFields = form.resetFields) === null || _form$resetFields === void 0 || _form$resetFields.call(form);
126
128
 
127
129
  // 更新表单数据
128
130
  setFormValues(initialValues || {});
@@ -373,8 +375,10 @@ var CustomForm = function CustomForm(_ref) {
373
375
  break;
374
376
  case CustomFormItemType.DateTime:
375
377
  element = /*#__PURE__*/_jsx(DatePicker, {
376
- showTime: true,
377
- format: "YYYY-MM-DD HH:mm:ss",
378
+ showTime: true
379
+ // format="YYYY-MM-DD HH:mm:ss"
380
+ ,
381
+ format: (item === null || item === void 0 ? void 0 : item.defaultFormat) || 'YYYY-MM-DD HH:mm:ss',
378
382
  style: {
379
383
  width: '100%'
380
384
  },
@@ -605,7 +609,7 @@ var CustomForm = function CustomForm(_ref) {
605
609
  return /*#__PURE__*/_jsx("div", {
606
610
  id: "CustomForm",
607
611
  children: /*#__PURE__*/_jsx(Form, {
608
- ref: FormRef,
612
+ ref: ref,
609
613
  form: form,
610
614
  layout: layout,
611
615
  name: 'customForm',
@@ -677,4 +681,4 @@ var CustomForm = function CustomForm(_ref) {
677
681
  })
678
682
  });
679
683
  };
680
- export default /*#__PURE__*/React.memo(CustomForm);
684
+ export default /*#__PURE__*/React.memo( /*#__PURE__*/forwardRef(CustomForm));
@@ -85,6 +85,9 @@ export type CustomSearchFieldType = {
85
85
  mode?: 'multiple' | 'tags';
86
86
  maxTagCount?: number | 'responsive';
87
87
  span?: number;
88
+ /**
89
+ * @deprecated 不建议使用,使用required替代
90
+ */
88
91
  is_null?: number;
89
92
  required?: boolean;
90
93
  labelCol?: number;
@@ -101,7 +104,7 @@ export interface CustomFormProps {
101
104
  isOkText?: string;
102
105
  /**取消按钮 text */
103
106
  cancelText?: string;
104
- /**提交方法 */
107
+ /**修改值以及点击提交按钮,都会触发的方法 */
105
108
  handleSubmit: (...args: any[]) => void;
106
109
  /**重置方法 */
107
110
  handleCancel: MouseEventHandler<HTMLElement>;
@@ -23,5 +23,5 @@ export declare function useDynamicSearchFiled(searchField: Array<any>, dynamicFi
23
23
  settingHandler: (items: Array<any>) => Array<any>;
24
24
  params?: any;
25
25
  }>): any[];
26
- declare const _default: React.NamedExoticComponent<QueryFilterProps>;
26
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<QueryFilterProps & React.RefAttributes<unknown>>>;
27
27
  export default _default;
@@ -20,7 +20,7 @@ import { AutoComplete, Badge, Button, Cascader, Checkbox, DatePicker, Form, Inpu
20
20
  import TextArea from 'antd/lib/input/TextArea';
21
21
  import dayjs from 'dayjs';
22
22
  import { debounce } from 'lodash';
23
- import React, { useEffect, useRef, useState } from 'react';
23
+ import React, { forwardRef, useEffect, useState } from 'react';
24
24
  import "./index.less";
25
25
  import { FormItemType, TimeFormatType } from "./type";
26
26
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -31,7 +31,7 @@ export var typeList = {
31
31
  start: 'start',
32
32
  end: 'end'
33
33
  };
34
- var QueryFilter = function QueryFilter(_ref) {
34
+ var QueryFilter = function QueryFilter(_ref, ref) {
35
35
  var data = _ref.data,
36
36
  initialValues = _ref.initialValues,
37
37
  _ref$isOkText = _ref.isOkText,
@@ -46,9 +46,8 @@ var QueryFilter = function QueryFilter(_ref) {
46
46
  _ref$submitLoading = _ref.submitLoading,
47
47
  submitLoading = _ref$submitLoading === void 0 ? false : _ref$submitLoading,
48
48
  _ref$renderButton = _ref.renderButton,
49
- renderButton = _ref$renderButton === void 0 ? null : _ref$renderButton,
50
- initForm = _ref.initForm;
51
- var _Form$useForm = Form.useForm(initForm),
49
+ renderButton = _ref$renderButton === void 0 ? null : _ref$renderButton;
50
+ var _Form$useForm = Form.useForm(),
52
51
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
53
52
  form = _Form$useForm2[0];
54
53
  var Option = Select.Option;
@@ -82,7 +81,8 @@ var QueryFilter = function QueryFilter(_ref) {
82
81
  var handledInitValues = getHandledInitValues();
83
82
 
84
83
  /**初始化表单 */
85
- var FormRef = useRef(null);
84
+ // const FormRef = useRef<FormInstance>(null);
85
+
86
86
  useEffect(function () {
87
87
  /**回显异步初始值 */
88
88
  // FormRef && FormRef.current && FormRef.current.resetFields();
@@ -565,7 +565,7 @@ var QueryFilter = function QueryFilter(_ref) {
565
565
  return /*#__PURE__*/_jsx("div", {
566
566
  id: "QueryFilter",
567
567
  children: /*#__PURE__*/_jsxs(Form, {
568
- ref: FormRef,
568
+ ref: ref,
569
569
  form: form
570
570
  // name={styles.customForm}
571
571
  ,
@@ -725,4 +725,4 @@ export function useDynamicSearchFiled(searchField, dynamicField) {
725
725
  setWrapSearchField = _useState4[1];
726
726
  return wrapSearchField;
727
727
  }
728
- export default /*#__PURE__*/React.memo(QueryFilter);
728
+ export default /*#__PURE__*/React.memo( /*#__PURE__*/forwardRef(QueryFilter));
@@ -1,5 +1,4 @@
1
1
  import { FormProps } from 'antd';
2
- import { FormInstance } from 'antd/es/form';
3
2
  import { MouseEventHandler } from 'react';
4
3
  export declare enum FormItemType {
5
4
  Text = "text",
@@ -100,7 +99,7 @@ export interface QueryFilterProps {
100
99
  isOkText?: string;
101
100
  /**取消按钮 text */
102
101
  cancelText?: string;
103
- /**提交方法 */
102
+ /**修改值以及点击提交按钮,都会触发的方法 */
104
103
  handleSubmit: ({ data }: {
105
104
  data: any;
106
105
  }, item?: fieldType, type?: inputValueType) => void;
@@ -115,5 +114,4 @@ export interface QueryFilterProps {
115
114
  submitLoading?: boolean;
116
115
  buttonRender?: any;
117
116
  renderButton?: any;
118
- initForm?: FormInstance;
119
117
  }
@@ -1,13 +1,13 @@
1
1
  import { TableMaxColumnType } from "../../type";
2
- export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
3
- export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
4
- export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
5
- export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
2
+ export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
3
+ export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
4
+ export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
5
+ export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
6
6
  declare const customSortFns: {
7
- numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
8
- stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
9
- timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
10
- numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
7
+ numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
8
+ stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
9
+ timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
10
+ numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
11
11
  };
12
12
  export default customSortFns;
13
13
  export type SortFnType = keyof typeof customSortFns | undefined;
package/package.json CHANGED
@@ -1,102 +1,103 @@
1
- {
2
- "name": "@arim-aisdc/public-components",
3
- "version": "2.0.7",
4
- "description": "前端组件库",
5
- "license": "MIT",
6
- "main": "dist/index.js",
7
- "module": "dist/index.js",
8
- "types": "dist/index.d.ts",
9
- "files": [
10
- "dist"
11
- ],
12
- "scripts": {
13
- "build": "father build",
14
- "build:watch": "father dev",
15
- "dev": "dumi dev",
16
- "docs:build": "dumi build",
17
- "doctor": "father doctor",
18
- "lint": "npm run lint:es && npm run lint:css",
19
- "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
20
- "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
21
- "local": "dumi dev",
22
- "prepare": "husky install && dumi setup",
23
- "prepublishOnly": "father doctor && npm run build",
24
- "start": "npm run dev"
25
- },
26
- "commitlint": {
27
- "extends": [
28
- "@commitlint/config-conventional"
29
- ]
30
- },
31
- "lint-staged": {
32
- "*.{md,json}": [
33
- "prettier --write --no-error-on-unmatched-pattern"
34
- ],
35
- "*.{css,less}": [
36
- "stylelint --fix",
37
- "prettier --write"
38
- ],
39
- "*.{js,jsx}": [
40
- "eslint --fix",
41
- "prettier --write"
42
- ],
43
- "*.{ts,tsx}": [
44
- "eslint --fix",
45
- "prettier --parser=typescript --write"
46
- ]
47
- },
48
- "dependencies": {
49
- "@ant-design/icons": "^5.3.7",
50
- "@ant-design/pro-components": "^2.7.10",
51
- "@tanstack/match-sorter-utils": "^8.8.4",
52
- "@tanstack/react-table": "^8.9.1",
53
- "ahooks": "^3.7.8",
54
- "classnames": "^2.5.1",
55
- "css-vars-ponyfill": "^2.4.8",
56
- "dayjs": "^1.11.11",
57
- "fs": "^0.0.1-security",
58
- "immer": "^10.0.3",
59
- "jsep": "^1.3.8",
60
- "lodash": "^4.17.21",
61
- "path": "^0.12.7",
62
- "react-color": "^2.19.3",
63
- "react-dnd": "^16.0.1",
64
- "react-dnd-html5-backend": "^16.0.1",
65
- "react-draggable": "^4.4.6",
66
- "react-router-dom": "^6.22.3",
67
- "react-split-pane": "^0.1.92"
68
- },
69
- "devDependencies": {
70
- "@commitlint/cli": "^17.1.2",
71
- "@commitlint/config-conventional": "^17.1.0",
72
- "@types/react": "^18.0.0",
73
- "@types/react-dom": "^18.0.0",
74
- "@umijs/lint": "^4.0.0",
75
- "babel-plugin-import": "^1.13.8",
76
- "dumi": "^2.2.13",
77
- "eslint": "^8.23.0",
78
- "father": "^4.1.0",
79
- "husky": "^8.0.1",
80
- "less": "^4.1.3",
81
- "less-loader": "^11.1.0",
82
- "less-vars-to-js": "^1.3.0",
83
- "lint-staged": "^13.0.3",
84
- "mockjs": "^1.1.0",
85
- "prettier": "^2.7.1",
86
- "prettier-plugin-organize-imports": "^3.0.0",
87
- "prettier-plugin-packagejson": "^2.2.18",
88
- "stylelint": "^14.9.1"
89
- },
90
- "peerDependencies": {
91
- "antd": "^5.18.3",
92
- "react": ">=17.0.1",
93
- "react-dom": ">=17.0.1",
94
- "umi-request": "^1.4.0"
95
- },
96
- "publishConfig": {
97
- "access": "public"
98
- },
99
- "authors": [
100
- "na.xu2278@foxmail.com"
101
- ]
102
- }
1
+ {
2
+ "name": "@arim-aisdc/public-components",
3
+ "version": "2.0.8",
4
+ "description": "前端组件库",
5
+ "license": "MIT",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "build": "father build",
14
+ "build:watch": "father dev",
15
+ "dev": "dumi dev",
16
+ "docs:build": "dumi build",
17
+ "doctor": "father doctor",
18
+ "lint": "npm run lint:es && npm run lint:css",
19
+ "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
20
+ "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
21
+ "local": "dumi dev",
22
+ "prepare": "husky install && dumi setup",
23
+ "prepublishOnly": "father doctor && npm run build",
24
+ "start": "npm run dev"
25
+ },
26
+ "commitlint": {
27
+ "extends": [
28
+ "@commitlint/config-conventional"
29
+ ]
30
+ },
31
+ "lint-staged": {
32
+ "*.{md,json}": [
33
+ "prettier --write --no-error-on-unmatched-pattern"
34
+ ],
35
+ "*.{css,less}": [
36
+ "stylelint --fix",
37
+ "prettier --write"
38
+ ],
39
+ "*.{js,jsx}": [
40
+ "eslint --fix",
41
+ "prettier --write"
42
+ ],
43
+ "*.{ts,tsx}": [
44
+ "eslint --fix",
45
+ "prettier --parser=typescript --write"
46
+ ]
47
+ },
48
+ "dependencies": {
49
+ "@ant-design/icons": "^5.3.7",
50
+ "@ant-design/pro-components": "^2.7.10",
51
+ "@tanstack/match-sorter-utils": "^8.8.4",
52
+ "@tanstack/react-table": "^8.9.1",
53
+ "ahooks": "^3.7.8",
54
+ "antd": "^5.18.3",
55
+ "classnames": "^2.5.1",
56
+ "css-vars-ponyfill": "^2.4.8",
57
+ "dayjs": "^1.11.11",
58
+ "fs": "^0.0.1-security",
59
+ "immer": "^10.0.3",
60
+ "jsep": "^1.3.8",
61
+ "lodash": "^4.17.21",
62
+ "path": "^0.12.7",
63
+ "react-color": "^2.19.3",
64
+ "react-dnd": "^16.0.1",
65
+ "react-dnd-html5-backend": "^16.0.1",
66
+ "react-draggable": "^4.4.6",
67
+ "react-router-dom": "^6.22.3",
68
+ "react-split-pane": "^0.1.92"
69
+ },
70
+ "devDependencies": {
71
+ "@commitlint/cli": "^17.1.2",
72
+ "@commitlint/config-conventional": "^17.1.0",
73
+ "@types/react": "^18.0.0",
74
+ "@types/react-dom": "^18.0.0",
75
+ "@umijs/lint": "^4.0.0",
76
+ "babel-plugin-import": "^1.13.8",
77
+ "dumi": "^2.2.13",
78
+ "eslint": "^8.23.0",
79
+ "father": "^4.1.0",
80
+ "husky": "^8.0.1",
81
+ "less": "^4.1.3",
82
+ "less-loader": "^11.1.0",
83
+ "less-vars-to-js": "^1.3.0",
84
+ "lint-staged": "^13.0.3",
85
+ "mockjs": "^1.1.0",
86
+ "prettier": "^2.7.1",
87
+ "prettier-plugin-organize-imports": "^3.0.0",
88
+ "prettier-plugin-packagejson": "^2.2.18",
89
+ "stylelint": "^14.9.1"
90
+ },
91
+ "peerDependencies": {
92
+ "antd": "^5.18.3",
93
+ "react": ">=17.0.1",
94
+ "react-dom": ">=17.0.1",
95
+ "umi-request": "^1.4.0"
96
+ },
97
+ "publishConfig": {
98
+ "access": "public"
99
+ },
100
+ "authors": [
101
+ "na.xu2278@foxmail.com"
102
+ ]
103
+ }