@arim-aisdc/public-components 2.0.3 → 2.0.5

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.
@@ -17,7 +17,7 @@ export declare const foramtBaseInfoField: (data: any, dataField: BaseInfoFieldTy
17
17
  value: any;
18
18
  field: string;
19
19
  label?: string;
20
- text: string | JSX.Element | Element;
20
+ text: string | Element | JSX.Element;
21
21
  units?: string;
22
22
  width?: string;
23
23
  labelWidth?: string;
@@ -1,3 +1,7 @@
1
- import ColorSelector from './ColorSelector';
2
- export type { ColorSelectorProps } from './ColorSelector';
1
+ import { ColorPickerProps } from 'antd';
2
+ import React from 'react';
3
+ interface ColorSelectorProps {
4
+ onChange?: (value: string) => void;
5
+ }
6
+ declare const ColorSelector: React.FC<ColorPickerProps & ColorSelectorProps>;
3
7
  export default ColorSelector;
@@ -1,2 +1,24 @@
1
- import ColorSelector from "./ColorSelector";
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["onChange"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
+ import { ColorPicker } from 'antd';
11
+ import { debounce } from 'lodash';
12
+ import React, { useCallback } from 'react';
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ var ColorSelector = function ColorSelector(props) {
15
+ var onChange = props.onChange,
16
+ rest = _objectWithoutProperties(props, _excluded);
17
+ var debounceChange = useCallback(debounce(function (_, hex) {
18
+ onChange(hex);
19
+ }, 200), [onChange]);
20
+ return /*#__PURE__*/_jsx(ColorPicker, _objectSpread(_objectSpread({}, rest), {}, {
21
+ onChange: debounceChange
22
+ }));
23
+ };
2
24
  export default ColorSelector;
@@ -612,6 +612,9 @@ var CustomForm = function CustomForm(_ref) {
612
612
  labelAlign: labelAlign,
613
613
  autoComplete: "off",
614
614
  onFinish: onFinish,
615
+ onValuesChange: function onValuesChange(p) {
616
+ return console.log('p :>> ', p);
617
+ },
615
618
  children: /*#__PURE__*/_jsxs(Row, {
616
619
  gutter: {
617
620
  md: 8,
@@ -15,7 +15,7 @@ var DrawerCom = function DrawerCom(_ref) {
15
15
  width = _ref.width,
16
16
  height = _ref.height,
17
17
  _ref$placement = _ref.placement,
18
- placement = _ref$placement === void 0 ? "right" : _ref$placement,
18
+ placement = _ref$placement === void 0 ? 'right' : _ref$placement,
19
19
  renderContent = _ref.renderContent,
20
20
  bodyPadding = _ref.bodyPadding,
21
21
  bodyStyle = _ref.bodyStyle,
@@ -46,8 +46,9 @@ 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
- var _Form$useForm = Form.useForm(),
49
+ renderButton = _ref$renderButton === void 0 ? null : _ref$renderButton,
50
+ initForm = _ref.initForm;
51
+ var _Form$useForm = Form.useForm(initForm),
51
52
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
52
53
  form = _Form$useForm2[0];
53
54
  var Option = Select.Option;
@@ -59,10 +60,6 @@ var QueryFilter = function QueryFilter(_ref) {
59
60
  var displayRender = function displayRender(labels) {
60
61
  return labels[labels.length - 1];
61
62
  };
62
- var _useState3 = useState(false),
63
- _useState4 = _slicedToArray(_useState3, 2),
64
- isCancel = _useState4[0],
65
- setIsCancel = _useState4[1];
66
63
  // 处理初始值格式问题,主要是日期数据的格式,字符串处理为date格式
67
64
  var getHandledInitValues = function getHandledInitValues() {
68
65
  var newFormValues = {};
@@ -82,32 +79,22 @@ var QueryFilter = function QueryFilter(_ref) {
82
79
  var newValues = _objectSpread(_objectSpread({}, values), newFormValues);
83
80
  return newValues;
84
81
  };
82
+ var handledInitValues = getHandledInitValues();
85
83
 
86
84
  /**初始化表单 */
87
85
  var FormRef = useRef(null);
88
- useEffect(function () {
89
- // 修改 重置时set初始值
90
- if (isCancel) {
91
- var handledInitValues = getHandledInitValues();
92
- if (FormRef && FormRef.current) {
93
- FormRef.current.setFieldsValue(handledInitValues);
94
- }
95
- setFormValues(handledInitValues);
96
- setIsCancel(false);
97
- }
98
- }, [isCancel, initialValues]);
99
86
  useEffect(function () {
100
87
  /**回显异步初始值 */
101
88
  // FormRef && FormRef.current && FormRef.current.resetFields();
102
89
  var handledInitValues = getHandledInitValues();
103
- if (FormRef && FormRef.current) {
104
- FormRef.current.setFieldsValue(handledInitValues);
105
- }
90
+ // if (FormRef && FormRef.current) {
91
+ // FormRef.current.setFieldsValue(handledInitValues);
92
+ // }
106
93
  // console.log('handledInitValues :>> ', handledInitValues);
107
94
 
108
95
  // 更新表单数据
109
96
  setFormValues(handledInitValues);
110
- }, []);
97
+ }, [initialValues]);
111
98
 
112
99
  // 表单提交时保留数据
113
100
  var onFinish = function onFinish(values) {
@@ -154,7 +141,7 @@ var QueryFilter = function QueryFilter(_ref) {
154
141
  var _useDebounceFn = useDebounceFn(function (e, item, valueType) {
155
142
  commonChange(e, item, valueType);
156
143
  }, {
157
- wait: 500
144
+ wait: 200
158
145
  }),
159
146
  run = _useDebounceFn.run;
160
147
  var getElement = function getElement(item) {
@@ -219,7 +206,7 @@ var QueryFilter = function QueryFilter(_ref) {
219
206
  onSearch: item.showSearch ? debounce(function (value) {
220
207
  var _item$handleSearch;
221
208
  return (_item$handleSearch = item.handleSearch) === null || _item$handleSearch === void 0 ? void 0 : _item$handleSearch.call(item, value);
222
- }, 500) : undefined,
209
+ }, 200) : undefined,
223
210
  onChange: function onChange(e) {
224
211
  commonChange(e, item);
225
212
  },
@@ -234,7 +221,7 @@ var QueryFilter = function QueryFilter(_ref) {
234
221
  onSelect: item.showSelect ? debounce(function (value) {
235
222
  var _item$handleSelect;
236
223
  return (_item$handleSelect = item.handleSelect) === null || _item$handleSelect === void 0 ? void 0 : _item$handleSelect.call(item, value);
237
- }, 500) : undefined,
224
+ }, 200) : undefined,
238
225
  notFoundContent: ((_item$setting = item.setting) === null || _item$setting === void 0 ? void 0 : _item$setting.length) >= 0 ? null : /*#__PURE__*/_jsx(Spin, {
239
226
  size: "small"
240
227
  }),
@@ -280,7 +267,7 @@ var QueryFilter = function QueryFilter(_ref) {
280
267
  onSearch: debounce(function (value) {
281
268
  var _item$handleSearch3;
282
269
  return (_item$handleSearch3 = item.handleSearch) === null || _item$handleSearch3 === void 0 ? void 0 : _item$handleSearch3.call(item, value, item.isInitGetOptions);
283
- }, 500),
270
+ }, 200),
284
271
  onFocus: function onFocus() {
285
272
  var _item$handleSearch4;
286
273
  return (_item$handleSearch4 = item.handleSearch) === null || _item$handleSearch4 === void 0 ? void 0 : _item$handleSearch4.call(item, '', item.isInitGetOptions);
@@ -462,7 +449,7 @@ var QueryFilter = function QueryFilter(_ref) {
462
449
  onSearch: item.showSearch ? debounce(function (value) {
463
450
  var _item$handleSearch5;
464
451
  return (_item$handleSearch5 = item.handleSearch) === null || _item$handleSearch5 === void 0 ? void 0 : _item$handleSearch5.call(item, value);
465
- }, 500) : undefined,
452
+ }, 200) : undefined,
466
453
  onChange: function onChange(e) {
467
454
  run(e, item, typeList.start);
468
455
  },
@@ -473,7 +460,7 @@ var QueryFilter = function QueryFilter(_ref) {
473
460
  onSelect: item.showSelect ? debounce(function (value) {
474
461
  var _item$handleSelect2;
475
462
  return (_item$handleSelect2 = item.handleSelect) === null || _item$handleSelect2 === void 0 ? void 0 : _item$handleSelect2.call(item, value);
476
- }, 500) : undefined,
463
+ }, 200) : undefined,
477
464
  notFoundContent: ((_item$setting2 = item.setting) === null || _item$setting2 === void 0 ? void 0 : _item$setting2.length) >= 0 ? null : /*#__PURE__*/_jsx(Spin, {
478
465
  size: "small"
479
466
  }),
@@ -509,7 +496,7 @@ var QueryFilter = function QueryFilter(_ref) {
509
496
  onSearch: item.showSearch ? debounce(function (value) {
510
497
  var _item$handleSearch6;
511
498
  return (_item$handleSearch6 = item.handleSearch) === null || _item$handleSearch6 === void 0 ? void 0 : _item$handleSearch6.call(item, value);
512
- }, 500) : undefined,
499
+ }, 200) : undefined,
513
500
  onChange: function onChange(e) {
514
501
  run(e, item, typeList.end);
515
502
  },
@@ -520,7 +507,7 @@ var QueryFilter = function QueryFilter(_ref) {
520
507
  onSelect: item.showSelect ? debounce(function (value) {
521
508
  var _item$handleSelect3;
522
509
  return (_item$handleSelect3 = item.handleSelect) === null || _item$handleSelect3 === void 0 ? void 0 : _item$handleSelect3.call(item, value);
523
- }, 500) : undefined,
510
+ }, 200) : undefined,
524
511
  notFoundContent: ((_item$setting3 = item.setting) === null || _item$setting3 === void 0 ? void 0 : _item$setting3.length) >= 0 ? null : /*#__PURE__*/_jsx(Spin, {
525
512
  size: "small"
526
513
  }),
@@ -581,8 +568,8 @@ var QueryFilter = function QueryFilter(_ref) {
581
568
  ref: FormRef,
582
569
  form: form
583
570
  // name={styles.customForm}
584
- // initialValues={initialValues}
585
571
  ,
572
+ initialValues: handledInitValues,
586
573
  labelAlign: "left",
587
574
  autoComplete: "off",
588
575
  onFinish: onFinish,
@@ -623,10 +610,12 @@ var QueryFilter = function QueryFilter(_ref) {
623
610
  className: "xmTtn xmTtnDefault",
624
611
  onClick: function onClick(e) {
625
612
  handleCancel(e);
626
- form.resetFields();
627
- setIsCancel(true);
628
613
  // 重置后 再次筛选 会带有上一次的记录(修改)
629
- setFormValues({});
614
+ setTimeout(function () {
615
+ form.resetFields();
616
+ // 重置后 再次筛选 会带有上一次的记录(修改)
617
+ setFormValues({});
618
+ }, 200);
630
619
  },
631
620
  children: cancelText
632
621
  }), /*#__PURE__*/_jsx(Button, {
@@ -658,7 +647,7 @@ var QueryFilter = function QueryFilter(_ref) {
658
647
  * @returns
659
648
  */
660
649
  export function useDynamicSearchFiled(searchField, dynamicField) {
661
- var _useState5 = useState(function () {
650
+ var _useState3 = useState(function () {
662
651
  return searchField.map(function (item) {
663
652
  var tartget = dynamicField.find(function (dynamicFieldItem) {
664
653
  return dynamicFieldItem.field === item.field;
@@ -732,9 +721,9 @@ export function useDynamicSearchFiled(searchField, dynamicField) {
732
721
  return item;
733
722
  });
734
723
  }),
735
- _useState6 = _slicedToArray(_useState5, 2),
736
- wrapSearchField = _useState6[0],
737
- setWrapSearchField = _useState6[1];
724
+ _useState4 = _slicedToArray(_useState3, 2),
725
+ wrapSearchField = _useState4[0],
726
+ setWrapSearchField = _useState4[1];
738
727
  return wrapSearchField;
739
728
  }
740
729
  export default /*#__PURE__*/React.memo(QueryFilter);
@@ -1,4 +1,5 @@
1
1
  import { FormProps } from 'antd';
2
+ import { FormInstance } from 'antd/es/form';
2
3
  import { MouseEventHandler } from 'react';
3
4
  export declare enum FormItemType {
4
5
  Text = "text",
@@ -114,4 +115,5 @@ export interface QueryFilterProps {
114
115
  submitLoading?: boolean;
115
116
  buttonRender?: any;
116
117
  renderButton?: any;
118
+ initForm?: FormInstance;
117
119
  }
@@ -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/dist/index.d.ts CHANGED
@@ -27,8 +27,6 @@ export { default as TableMax } from './components/TableMax';
27
27
  export * from './components/ConfigProvider';
28
28
  export * from './components/Filter';
29
29
  export { default as SchemaForm } from './components/SchemaForm';
30
- export * from './components/ColorSelector';
31
- export { default as ColorSelector } from './components/ColorSelector';
32
30
  export * from './hooks/useEventBus';
33
31
  export { default as useEventBus } from './hooks/useEventBus';
34
32
  export { default as usePageCacheState } from './hooks/usePageCacheState';
package/dist/index.js CHANGED
@@ -28,8 +28,6 @@ export { default as TableMax } from "./components/TableMax";
28
28
  export * from "./components/ConfigProvider";
29
29
  export * from "./components/Filter";
30
30
  export { default as SchemaForm } from "./components/SchemaForm";
31
- export * from "./components/ColorSelector";
32
- export { default as ColorSelector } from "./components/ColorSelector";
33
31
 
34
32
  // hooks
35
33
  export * from "./hooks/useEventBus";
package/package.json CHANGED
@@ -1,104 +1,102 @@
1
- {
2
- "name": "@arim-aisdc/public-components",
3
- "version": "2.0.3",
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
- "umi-request": "^1.4.0"
70
- },
71
- "devDependencies": {
72
- "@commitlint/cli": "^17.1.2",
73
- "@commitlint/config-conventional": "^17.1.0",
74
- "@types/react": "^18.0.0",
75
- "@types/react-dom": "^18.0.0",
76
- "@umijs/lint": "^4.0.0",
77
- "babel-plugin-import": "^1.13.8",
78
- "dumi": "^2.2.13",
79
- "eslint": "^8.23.0",
80
- "father": "^4.1.0",
81
- "husky": "^8.0.1",
82
- "less": "^4.1.3",
83
- "less-loader": "^11.1.0",
84
- "less-vars-to-js": "^1.3.0",
85
- "lint-staged": "^13.0.3",
86
- "mockjs": "^1.1.0",
87
- "prettier": "^2.7.1",
88
- "prettier-plugin-organize-imports": "^3.0.0",
89
- "prettier-plugin-packagejson": "^2.2.18",
90
- "stylelint": "^14.9.1"
91
- },
92
- "peerDependencies": {
93
- "antd": "^5.18.3",
94
- "react": ">=17.0.1",
95
- "react-dom": ">=17.0.1",
96
- "umi-request": "^1.4.0"
97
- },
98
- "publishConfig": {
99
- "access": "public"
100
- },
101
- "authors": [
102
- "na.xu2278@foxmail.com"
103
- ]
104
- }
1
+ {
2
+ "name": "@arim-aisdc/public-components",
3
+ "version": "2.0.5",
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,29 +0,0 @@
1
- import React from 'react';
2
- import './ColorSelector.less';
3
- export interface ColorSelectorProps {
4
- /**
5
- * 默认颜色值
6
- */
7
- defaultValue?: string;
8
- /**
9
- * 颜色值
10
- */
11
- value?: string;
12
- /**
13
- * 修改时的回调函数
14
- * @param color 修改后的颜色
15
- * @returns
16
- */
17
- onChange?: (color: string) => void;
18
- /**
19
- * onChange函数是否启用节流,默认启用
20
- * @default true
21
- */
22
- isDebounceChange?: boolean;
23
- /**
24
- * 快捷选择区颜色列表,空数组时不展示快捷选择区
25
- */
26
- presetColors?: string[];
27
- }
28
- declare const ColorSelector: React.FC<ColorSelectorProps>;
29
- export default ColorSelector;
@@ -1,66 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import { Popover } from 'antd';
8
- import { debounce } from 'lodash';
9
- import React, { useCallback, useEffect, useState } from 'react';
10
- import { SketchPicker } from 'react-color';
11
- import "./ColorSelector.less";
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- var defaultPresentColors = ['#D0021B', '#F5A623', '#F8E71C', '#8B572A', '#7ED321', '#417505', '#BD10E0', '#9013FE', '#4A90E2', '#50E3C2', '#B8E986', '#000000', '#4A4A4A', '#9B9B9B', '#FFFFFF'];
14
- var ColorSelector = function ColorSelector(props) {
15
- var value = props.value,
16
- defaultValue = props.defaultValue,
17
- onChange = props.onChange,
18
- _props$isDebounceChan = props.isDebounceChange,
19
- isDebounceChange = _props$isDebounceChan === void 0 ? true : _props$isDebounceChan,
20
- _props$presetColors = props.presetColors,
21
- presetColors = _props$presetColors === void 0 ? defaultPresentColors : _props$presetColors;
22
- var _useState = useState(value || defaultValue || '#ffffff'),
23
- _useState2 = _slicedToArray(_useState, 2),
24
- color = _useState2[0],
25
- setColor = _useState2[1];
26
- useEffect(function () {
27
- if (value && color !== value) {
28
- setColor(value);
29
- }
30
- }, [value]);
31
- var debounceChange = useCallback(debounce(function (newValue) {
32
- onChange(newValue);
33
- }, 500), [onChange]);
34
- var handleChange = useCallback(function (color) {
35
- // console.log('color :>> ', color);
36
- var hex = color.hex || '';
37
- var hexUpperCase = hex.toLocaleUpperCase();
38
- setColor(hexUpperCase);
39
- if (isDebounceChange) {
40
- debounceChange(hexUpperCase);
41
- } else {
42
- onChange(hexUpperCase);
43
- }
44
- }, [debounceChange]);
45
- return /*#__PURE__*/_jsx(Popover, {
46
- content: /*#__PURE__*/_jsx(SketchPicker, {
47
- color: color,
48
- disableAlpha: true,
49
- onChange: handleChange,
50
- width: 220,
51
- presetColors: presetColors
52
- }),
53
- title: null,
54
- overlayClassName: "colorSelectorPopover",
55
- children: /*#__PURE__*/_jsx("div", {
56
- className: 'colorSelectorContent',
57
- children: /*#__PURE__*/_jsx("div", {
58
- className: 'colorBox',
59
- style: {
60
- backgroundColor: color
61
- }
62
- })
63
- })
64
- });
65
- };
66
- export default ColorSelector;
@@ -1,39 +0,0 @@
1
- .colorSelectorContent {
2
- width: 100%;
3
- height: 32px;
4
- padding: 4px;
5
- background: @global-curd-input-background-color;
6
- display: flex;
7
- justify-content: space-between;
8
- align-items: center;
9
- cursor: pointer;
10
-
11
- .colorBox {
12
- width: 100%;
13
- height: 100%;
14
- }
15
- }
16
-
17
- .colorSelectorPopover {
18
- .custom-light-popover-inner-content,
19
- .custom-dark-popover-inner-content,
20
- .ant-popover-inner-content {
21
- padding: 0;
22
- }
23
-
24
- .sketch-picker {
25
- background: transparent !important;
26
-
27
- input {
28
- background-color: @global-curd-input-background-color;
29
- border: 1px solid @tableColor2 !important;
30
- box-shadow: none;
31
- border-radius: 2px;
32
- color: @tableColor1 !important;
33
- }
34
-
35
- label {
36
- color: @tableColor1 !important;
37
- }
38
- }
39
- }