@arim-aisdc/public-components 2.3.9 → 2.3.12

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;
@@ -51,7 +51,7 @@ var RemoteSelect = function RemoteSelect(_ref) {
51
51
  return /*#__PURE__*/_jsx(Select, {
52
52
  className: "customForm-remoteSelect",
53
53
  mode: item.mode ? item.mode : undefined,
54
- showSearch: item.showSearch,
54
+ showSearch: !!item.showSearch,
55
55
  placeholder: item.inputTips,
56
56
  allowClear: item.allowClear,
57
57
  value: value,
@@ -86,7 +86,7 @@ export type CustomSearchFieldType = {
86
86
  max?: number;
87
87
  step?: number;
88
88
  precision?: number;
89
- showSearch?: boolean;
89
+ showSearch?: boolean | Object;
90
90
  handleSearch?: () => void;
91
91
  suffix?: string;
92
92
  isFilter?: boolean;
@@ -51,7 +51,7 @@ var RemoteSelect = function RemoteSelect(_ref) {
51
51
  return /*#__PURE__*/_jsx(Select, {
52
52
  className: "queryFilter-remoteSelect",
53
53
  mode: item.mode ? item.mode : undefined,
54
- showSearch: item.showSearch,
54
+ showSearch: !!item.showSearch,
55
55
  placeholder: item.inputTips,
56
56
  allowClear: item.allowClear,
57
57
  value: value,
@@ -102,7 +102,7 @@ export type searchFieldType = {
102
102
  /**imputnumber 步长 */
103
103
  step?: number;
104
104
  /**是否远程搜索 autocomplete 不需要,select需要 */
105
- showSearch?: boolean;
105
+ showSearch?: boolean | Object;
106
106
  /**自定义节点 label、value、options、groupLabel 的字段 */
107
107
  fieldNames?: {
108
108
  label?: string;
@@ -59,7 +59,7 @@ table {
59
59
 
60
60
  .cell-right {
61
61
  display: flex;
62
- gap: 4px;
62
+ // gap: 4px;
63
63
  align-items: center;
64
64
  }
65
65
 
@@ -105,7 +105,7 @@ table {
105
105
 
106
106
  &:hover {
107
107
  .sort-flag {
108
- display: inline-block;
108
+ display: flex;
109
109
  }
110
110
  .filter-icon {
111
111
  display: inline-block;
@@ -845,23 +845,24 @@ var TableMax = function TableMax(_ref) {
845
845
  // 是否可点击编辑按钮:当且仅当选中一行时可点击编辑按钮
846
846
  var canClickEditIcon = useMemo(function () {
847
847
  var rowObjs = table.getSelectedRowModel().rows;
848
- return !!rowSelectedId || rowObjs.length === 1;
848
+ return !!rowSelectedId || rowObjs.length > 0;
849
849
  }, [rowSelectedId, rowSelection]);
850
850
 
851
851
  // 点击【编辑】图标
852
852
  var editFun = function editFun() {
853
- var _selectedTableRows$, _tableRows$find, _selectedTableRows$2;
853
+ var _selectedTableRows, _tableRows$find, _selectedTableRows2;
854
854
  if (!canClickEditIcon) return;
855
855
  var selectedTableRows = table.getSelectedRowModel().rows;
856
+ var selectedTableRowsLength = selectedTableRows.length;
856
857
  var _table$getRowModel2 = table.getRowModel(),
857
858
  tableRows = _table$getRowModel2.rows;
858
859
  var selectRow =
859
860
  // eslint-disable-next-line eqeqeq
860
- (canSelection ? (_selectedTableRows$ = selectedTableRows[0]) === null || _selectedTableRows$ === void 0 ? void 0 : _selectedTableRows$.original : (_tableRows$find = tableRows.find(function (item) {
861
+ (canSelection ? (_selectedTableRows = selectedTableRows[selectedTableRowsLength - 1]) === null || _selectedTableRows === void 0 ? void 0 : _selectedTableRows.original : (_tableRows$find = tableRows.find(function (item) {
861
862
  return item.id == rowSelectedId;
862
863
  })) === null || _tableRows$find === void 0 ? void 0 : _tableRows$find.original) || {};
863
864
  setFormData(selectRow);
864
- setEditingRowId((canSelection ? (_selectedTableRows$2 = selectedTableRows[0]) === null || _selectedTableRows$2 === void 0 ? void 0 : _selectedTableRows$2.id : rowSelectedId) || '');
865
+ setEditingRowId((canSelection ? (_selectedTableRows2 = selectedTableRows[selectedTableRowsLength - 1]) === null || _selectedTableRows2 === void 0 ? void 0 : _selectedTableRows2.id : rowSelectedId) || '');
865
866
  };
866
867
 
867
868
  // 点击【取消编辑】按钮
@@ -8,6 +8,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  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; }
9
9
  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; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import { useTranslation } from "../../../../hooks/useTranslation";
11
12
  import { AutoComplete, DatePicker, Input, InputNumber } from 'antd';
12
13
  import dayjs from 'dayjs';
13
14
  import { debounce } from 'lodash';
@@ -17,7 +18,6 @@ import { DateRange } from "./DateRange";
17
18
  import MultipleSelect from "./MultipleSelect";
18
19
  import NumberRange from "./NumberRange";
19
20
  import SingleSelect from "./SingleSelect";
20
- import { useTranslation } from "../../../../hooks/useTranslation";
21
21
  import { jsx as _jsx } from "react/jsx-runtime";
22
22
  var Filter = function Filter(_ref) {
23
23
  var column = _ref.column,
@@ -27,7 +27,9 @@ var Filter = function Filter(_ref) {
27
27
  // 筛选组件类型
28
28
  var filterType = columnDef.filterType,
29
29
  filterOptions = columnDef.filterOptions,
30
- getFilterOptionsFn = columnDef.getFilterOptionsFn;
30
+ getFilterOptionsFn = columnDef.getFilterOptionsFn,
31
+ _columnDef$isFilterOp = columnDef.isFilterOptionsFrontSearch,
32
+ isFilterOptionsFrontSearch = _columnDef$isFilterOp === void 0 ? false : _columnDef$isFilterOp;
31
33
 
32
34
  // 获取最新的筛选值
33
35
  var _useState = useState(column.getFilterValue()),
@@ -254,7 +256,7 @@ var Filter = function Filter(_ref) {
254
256
  onChange: handleChangeFilterValue,
255
257
  onSearch: onSearch,
256
258
  options: options,
257
- isRemoteSearch: !!getFilterOptionsFn,
259
+ isFrontSearch: isFilterOptionsFrontSearch,
258
260
  onCloseFilterPanel: onCloseFilterPanel,
259
261
  loading: apiLoading
260
262
  });
@@ -266,7 +268,7 @@ var Filter = function Filter(_ref) {
266
268
  onSearch: onSearch,
267
269
  options: options,
268
270
  loading: apiLoading,
269
- isRemoteSearch: !!getFilterOptionsFn,
271
+ isFrontSearch: isFilterOptionsFrontSearch,
270
272
  onCloseFilterPanel: onCloseFilterPanel
271
273
  });
272
274
  }
@@ -4,9 +4,9 @@ interface IProps {
4
4
  options: any[];
5
5
  onChange: (value: any[]) => void;
6
6
  onSearch: (value: string) => void;
7
- isRemoteSearch: boolean;
7
+ isFrontSearch: boolean;
8
8
  loading: boolean;
9
9
  onCloseFilterPanel: () => void;
10
10
  }
11
- declare const MultipleSelect: ({ value, onChange, options, onSearch, isRemoteSearch, loading, onCloseFilterPanel, }: IProps) => import("react/jsx-runtime").JSX.Element;
11
+ declare const MultipleSelect: ({ value, onChange, options, onSearch, isFrontSearch, loading, onCloseFilterPanel, }: IProps) => import("react/jsx-runtime").JSX.Element;
12
12
  export default MultipleSelect;
@@ -4,11 +4,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
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
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
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useTranslation } from "../../../../../hooks/useTranslation";
7
8
  import { useUpdateEffect } from 'ahooks';
8
9
  import { Button, Checkbox, Input, Spin } from 'antd';
9
10
  import { useMemo, useState } from 'react';
10
11
  import "./index.less";
11
- import { useTranslation } from "../../../../../hooks/useTranslation";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { Fragment as _Fragment } from "react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -19,7 +19,7 @@ var MultipleSelect = function MultipleSelect(_ref) {
19
19
  onChange = _ref.onChange,
20
20
  options = _ref.options,
21
21
  onSearch = _ref.onSearch,
22
- isRemoteSearch = _ref.isRemoteSearch,
22
+ isFrontSearch = _ref.isFrontSearch,
23
23
  loading = _ref.loading,
24
24
  onCloseFilterPanel = _ref.onCloseFilterPanel;
25
25
  // 内部state
@@ -67,7 +67,7 @@ var MultipleSelect = function MultipleSelect(_ref) {
67
67
  };
68
68
  var handleInputChange = function handleInputChange(e) {
69
69
  var value = e.target.value;
70
- if (isRemoteSearch) {
70
+ if (!isFrontSearch) {
71
71
  onSearch(value);
72
72
  } else {
73
73
  setFrontendSearchValue(value);
@@ -76,7 +76,7 @@ var MultipleSelect = function MultipleSelect(_ref) {
76
76
 
77
77
  // 最终的可选值
78
78
  var finalOptions = useMemo(function () {
79
- if (isRemoteSearch) {
79
+ if (!isFrontSearch) {
80
80
  return options;
81
81
  }
82
82
  var input = (frontendSearchValue !== null && frontendSearchValue !== void 0 ? frontendSearchValue : '').toUpperCase().trim();
@@ -89,13 +89,13 @@ var MultipleSelect = function MultipleSelect(_ref) {
89
89
  return /*#__PURE__*/_jsxs("div", {
90
90
  className: "tableMax-filter-multipleSelect",
91
91
  children: [/*#__PURE__*/_jsx("div", {
92
- className: "header",
92
+ className: "tableMax-filter-multipleSelect-header",
93
93
  children: /*#__PURE__*/_jsx(Input, {
94
94
  placeholder: t('global.placeholder.input'),
95
95
  onChange: handleInputChange
96
96
  })
97
97
  }), /*#__PURE__*/_jsx("div", {
98
- className: "body",
98
+ className: "tableMax-filter-multipleSelect-body",
99
99
  children: loading ? /*#__PURE__*/_jsx("div", {
100
100
  className: "loading",
101
101
  children: /*#__PURE__*/_jsx(Spin, {})
@@ -112,7 +112,7 @@ var MultipleSelect = function MultipleSelect(_ref) {
112
112
  })]
113
113
  })
114
114
  }), /*#__PURE__*/_jsxs("div", {
115
- className: "footer",
115
+ className: "tableMax-filter-multipleSelect-footer",
116
116
  children: [/*#__PURE__*/_jsx(Button, {
117
117
  type: "text",
118
118
  onClick: handleReset,
@@ -1,10 +1,10 @@
1
1
  .tableMax-filter-multipleSelect {
2
2
  width: 212px;
3
- .header {
3
+ .tableMax-filter-multipleSelect-header {
4
4
  border-bottom: 1px solid @tableColor7;
5
5
  padding: 8px 12px;
6
6
  }
7
- .body {
7
+ .tableMax-filter-multipleSelect-body {
8
8
  height: 220px;
9
9
  overflow-y: auto;
10
10
  padding: 4px 12px;
@@ -23,7 +23,7 @@
23
23
  }
24
24
  }
25
25
  }
26
- .footer {
26
+ .tableMax-filter-multipleSelect-footer {
27
27
  border-top: 1px solid @tableColor7;
28
28
  padding: 8px 12px;
29
29
  display: flex;
@@ -4,9 +4,9 @@ interface IProps {
4
4
  options: any[];
5
5
  onChange: (value: string | number | undefined) => void;
6
6
  onSearch: (value: string) => void;
7
- isRemoteSearch: boolean;
7
+ isFrontSearch: boolean;
8
8
  loading: boolean;
9
9
  onCloseFilterPanel: () => void;
10
10
  }
11
- declare const SingleSelect: ({ value, onChange, options, onSearch, isRemoteSearch, loading, onCloseFilterPanel, }: IProps) => import("react/jsx-runtime").JSX.Element;
11
+ declare const SingleSelect: ({ value, onChange, options, onSearch, isFrontSearch, loading, onCloseFilterPanel, }: IProps) => import("react/jsx-runtime").JSX.Element;
12
12
  export default SingleSelect;
@@ -4,11 +4,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
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
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
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useTranslation } from "../../../../../hooks/useTranslation";
7
8
  import { useUpdateEffect } from 'ahooks';
8
9
  import { Button, Input, Spin } from 'antd';
9
10
  import { useMemo, useState } from 'react';
10
11
  import "./index.less";
11
- import { useTranslation } from "../../../../../hooks/useTranslation";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
14
  var SingleSelect = function SingleSelect(_ref) {
@@ -17,7 +17,7 @@ var SingleSelect = function SingleSelect(_ref) {
17
17
  onChange = _ref.onChange,
18
18
  options = _ref.options,
19
19
  onSearch = _ref.onSearch,
20
- isRemoteSearch = _ref.isRemoteSearch,
20
+ isFrontSearch = _ref.isFrontSearch,
21
21
  loading = _ref.loading,
22
22
  onCloseFilterPanel = _ref.onCloseFilterPanel;
23
23
  // 内部state
@@ -52,7 +52,7 @@ var SingleSelect = function SingleSelect(_ref) {
52
52
  }, [value]);
53
53
  var handleInputChange = function handleInputChange(e) {
54
54
  var value = e.target.value;
55
- if (isRemoteSearch) {
55
+ if (!isFrontSearch) {
56
56
  onSearch(value);
57
57
  } else {
58
58
  setFrontendSearchValue(value);
@@ -61,7 +61,7 @@ var SingleSelect = function SingleSelect(_ref) {
61
61
 
62
62
  // 最终的可选值
63
63
  var finalOptions = useMemo(function () {
64
- if (isRemoteSearch) {
64
+ if (!isFrontSearch) {
65
65
  return options;
66
66
  }
67
67
  var input = (frontendSearchValue !== null && frontendSearchValue !== void 0 ? frontendSearchValue : '').toUpperCase().trim();
@@ -74,13 +74,13 @@ var SingleSelect = function SingleSelect(_ref) {
74
74
  return /*#__PURE__*/_jsxs("div", {
75
75
  className: "tableMax-filter-singleSelect",
76
76
  children: [/*#__PURE__*/_jsx("div", {
77
- className: "header",
77
+ className: "tableMax-filter-singleSelect-header",
78
78
  children: /*#__PURE__*/_jsx(Input, {
79
79
  placeholder: t('global.placeholder.input'),
80
80
  onChange: handleInputChange
81
81
  })
82
82
  }), /*#__PURE__*/_jsx("div", {
83
- className: "body",
83
+ className: "tableMax-filter-singleSelect-body",
84
84
  children: loading ? /*#__PURE__*/_jsx("div", {
85
85
  className: "loading",
86
86
  children: /*#__PURE__*/_jsx(Spin, {})
@@ -95,7 +95,7 @@ var SingleSelect = function SingleSelect(_ref) {
95
95
  }, option.value);
96
96
  })
97
97
  }), /*#__PURE__*/_jsxs("div", {
98
- className: "footer",
98
+ className: "tableMax-filter-singleSelect-footer",
99
99
  children: [/*#__PURE__*/_jsx(Button, {
100
100
  type: "text",
101
101
  onClick: handleReset,
@@ -1,11 +1,11 @@
1
1
  .tableMax-filter-singleSelect {
2
2
  box-sizing: border-box;
3
3
  width: 212px;
4
- .header {
4
+ .tableMax-filter-singleSelect-header {
5
5
  border-bottom: 1px solid @tableColor7;
6
6
  padding: 8px 12px;
7
7
  }
8
- .body {
8
+ .tableMax-filter-singleSelect-body {
9
9
  height: 220px;
10
10
  overflow-y: auto;
11
11
  padding: 4px 12px;
@@ -34,7 +34,7 @@
34
34
  background-color: @tableColor8;
35
35
  }
36
36
  }
37
- .footer {
37
+ .tableMax-filter-singleSelect-footer {
38
38
  border-top: 1px solid @tableColor7;
39
39
  padding: 8px 12px;
40
40
  display: flex;
@@ -1,13 +1,13 @@
1
1
  import { TableMaxColumnType } from "../../type";
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;
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;
6
6
  declare const customSortFns: {
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;
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;
11
11
  };
12
12
  export default customSortFns;
13
13
  export type SortFnType = keyof typeof customSortFns | undefined;
@@ -1,9 +1,9 @@
1
1
  .sort-flag {
2
- display: flex;
3
2
  justify-content: center;
4
3
  align-items: center;
5
4
  flex-direction: column;
6
5
  width: 16px;
6
+ height: 16px;
7
7
  cursor: pointer;
8
8
  display: none;
9
9
 
@@ -13,7 +13,7 @@
13
13
  height: 0;
14
14
  border-left: 4px solid transparent;
15
15
  border-right: 4px solid transparent;
16
- border-bottom: 6px solid #b4b6bfff;
16
+ border-bottom: 6px solid #fff;
17
17
 
18
18
  &-red {
19
19
  border-bottom: 6px solid #fa541cff;
@@ -27,7 +27,7 @@
27
27
  margin-top: 3px;
28
28
  border-left: 4px solid transparent;
29
29
  border-right: 4px solid transparent;
30
- border-top: 6px solid #b4b6bfff;
30
+ border-top: 6px solid #fff;
31
31
 
32
32
  &-red {
33
33
  border-top: 6px solid #fa541cff;
@@ -36,5 +36,5 @@
36
36
  }
37
37
 
38
38
  .show-sort-flag {
39
- display: inline-block !important;
39
+ display: flex !important;
40
40
  }
@@ -340,6 +340,8 @@ export interface TableMaxColumnType {
340
340
  }[];
341
341
  /**通过该函数获取可选项 */
342
342
  getFilterOptionsFn?: IGetOptionType;
343
+ /** 表头筛选组件SingleSelect/MultiSelect中,输入字符串时对可选项进行过滤,是否前端过滤,默认false */
344
+ isFilterOptionsFrontSearch?: boolean;
343
345
  /**列筛选时 使用的过滤函数 */
344
346
  filterFn?: FilterFnType | ((row: any, columnId: any, filterValue: any) => boolean);
345
347
  /**筛选组件属性配置 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arim-aisdc/public-components",
3
- "version": "2.3.9",
3
+ "version": "2.3.12",
4
4
  "description": "前端组件库",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",