es-grid-template 1.8.71 → 1.8.72
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/es/grid-component/TempTable.js +2 -1
- package/es/group-component/ColumnsChoose.d.ts +13 -0
- package/es/group-component/ColumnsChoose.js +211 -0
- package/es/group-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/es/group-component/ColumnsGroup/ColumnsGroup.js +230 -0
- package/es/group-component/ColumnsGroup/index.d.ts +1 -0
- package/es/group-component/ColumnsGroup/index.js +1 -0
- package/es/group-component/ContextMenu.d.ts +19 -0
- package/es/group-component/ContextMenu.js +74 -0
- package/es/group-component/InternalTable.d.ts +8 -0
- package/es/group-component/InternalTable.js +224 -0
- package/es/group-component/TableContainer.d.ts +49 -0
- package/es/group-component/TableContainer.js +375 -0
- package/es/group-component/TableContainerEdit.d.ts +48 -0
- package/es/group-component/TableContainerEdit.js +2068 -0
- package/es/group-component/body/EditableCell.d.ts +16 -0
- package/es/group-component/body/EditableCell.js +1066 -0
- package/es/group-component/body/TableBody.d.ts +14 -0
- package/es/group-component/body/TableBody.js +82 -0
- package/es/group-component/body/TableBodyCell.d.ts +12 -0
- package/es/group-component/body/TableBodyCell.js +587 -0
- package/es/group-component/body/TableBodyCellEdit.d.ts +17 -0
- package/es/group-component/body/TableBodyCellEdit.js +1398 -0
- package/es/group-component/body/TableBodyCellEmpty.d.ts +12 -0
- package/es/group-component/body/TableBodyCellEmpty.js +149 -0
- package/es/group-component/body/TableBodyRow.d.ts +21 -0
- package/es/group-component/body/TableBodyRow.js +199 -0
- package/es/group-component/body/TableBodyRowGroupCell.d.ts +12 -0
- package/es/group-component/body/TableBodyRowGroupCell.js +567 -0
- package/es/group-component/components/ControlCheckbox.d.ts +13 -0
- package/es/group-component/components/ControlCheckbox.js +84 -0
- package/es/group-component/components/EditForm/EditForm.d.ts +27 -0
- package/es/group-component/components/EditForm/EditForm.js +394 -0
- package/es/group-component/components/EditForm/index.d.ts +1 -0
- package/es/group-component/components/EditForm/index.js +1 -0
- package/es/group-component/components/InputControl/InputControl.d.ts +27 -0
- package/es/group-component/components/InputControl/InputControl.js +118 -0
- package/es/group-component/components/InputControl/index.d.ts +1 -0
- package/es/group-component/components/InputControl/index.js +1 -0
- package/es/group-component/components/async-select/index.d.ts +11 -0
- package/es/group-component/components/async-select/index.js +38 -0
- package/es/group-component/components/async-table-select/index.d.ts +11 -0
- package/es/group-component/components/async-table-select/index.js +40 -0
- package/es/group-component/components/checkbox-control/index.d.ts +13 -0
- package/es/group-component/components/checkbox-control/index.js +40 -0
- package/es/group-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
- package/es/group-component/components/checkbox-filter/CheckboxFilter.js +258 -0
- package/es/group-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
- package/es/group-component/components/checkbox-filter/FilterSearch.js +36 -0
- package/es/group-component/components/command/Command.d.ts +10 -0
- package/es/group-component/components/command/Command.js +35 -0
- package/es/group-component/components/number/index.d.ts +12 -0
- package/es/group-component/components/number/index.js +42 -0
- package/es/group-component/components/number-range/index.d.ts +13 -0
- package/es/group-component/components/number-range/index.js +79 -0
- package/es/group-component/features/operator.d.ts +24 -0
- package/es/group-component/features/operator.js +62 -0
- package/es/group-component/footer/TableFooter.d.ts +7 -0
- package/es/group-component/footer/TableFooter.js +34 -0
- package/es/group-component/footer/TableFooterCell.d.ts +7 -0
- package/es/group-component/footer/TableFooterCell.js +66 -0
- package/es/group-component/footer/TableFooterRow.d.ts +8 -0
- package/es/group-component/footer/TableFooterRow.js +30 -0
- package/es/group-component/header/TableHead.d.ts +15 -0
- package/es/group-component/header/TableHead.js +98 -0
- package/es/group-component/header/TableHeadCell.d.ts +15 -0
- package/es/group-component/header/TableHeadCell.js +310 -0
- package/es/group-component/header/TableHeadCell2.d.ts +17 -0
- package/es/group-component/header/TableHeadCell2.js +321 -0
- package/es/group-component/header/TableHeadGroupCell.d.ts +17 -0
- package/es/group-component/header/TableHeadGroupCell.js +94 -0
- package/es/group-component/header/TableHeadRow.d.ts +15 -0
- package/es/group-component/header/TableHeadRow.js +52 -0
- package/es/group-component/header/renderFilter.d.ts +20 -0
- package/es/group-component/header/renderFilter.js +291 -0
- package/es/group-component/hook/convert.d.ts +1 -0
- package/es/group-component/hook/convert.js +28 -0
- package/es/group-component/hook/useColumns.d.ts +28 -0
- package/es/group-component/hook/useColumns.js +306 -0
- package/es/group-component/hook/useFilterOperator.d.ts +7 -0
- package/es/group-component/hook/useFilterOperator.js +33 -0
- package/es/group-component/hook/utils.d.ts +220 -0
- package/es/group-component/hook/utils.js +2340 -0
- package/es/group-component/index.d.ts +2 -0
- package/es/group-component/index.js +2 -0
- package/es/group-component/style.d.ts +22 -0
- package/es/group-component/style.js +48 -0
- package/es/group-component/style.scss +1438 -0
- package/es/group-component/table/Grid.d.ts +33 -0
- package/es/group-component/table/Grid.js +438 -0
- package/es/group-component/table/TableWrapper.d.ts +33 -0
- package/es/group-component/table/TableWrapper.js +250 -0
- package/es/group-component/useContext.d.ts +100 -0
- package/es/group-component/useContext.js +21 -0
- package/es/table-component/InternalTable.js +6 -1
- package/es/table-component/TableContainer.js +4 -2
- package/es/table-component/body/TableBodyCell.js +49 -40
- package/es/table-component/body/TableBodyRow.js +4 -1
- package/es/table-component/hook/utils.d.ts +1 -0
- package/es/table-component/hook/utils.js +15 -7
- package/es/table-component/style.js +1 -1
- package/es/table-component/table/Grid.js +3 -0
- package/es/table-component/useContext.d.ts +5 -0
- package/es/table-virtuoso/InternalTable.js +2 -2
- package/es/table-virtuoso/body/TableBodyCell.js +2 -7
- package/es/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
- package/es/table-virtuoso/body/TableBodyCellRowGroup.js +196 -0
- package/es/table-virtuoso/body/TableBodyRow.d.ts +1 -1
- package/es/table-virtuoso/body/TableBodyRow.js +43 -1
- package/es/table-virtuoso/hook/utils.d.ts +1 -0
- package/es/table-virtuoso/hook/utils.js +29 -0
- package/es/table-virtuoso/style.js +3 -1
- package/es/table-virtuoso/table/Grid.js +2 -2
- package/es/table-virtuoso/table/TableWrapper.d.ts +7 -1
- package/es/table-virtuoso/table/TableWrapper.js +24 -5
- package/es/table-virtuoso/useContext.d.ts +6 -3
- package/es/table-virtuoso/useContext.js +18 -0
- package/lib/grid-component/TempTable.js +2 -1
- package/lib/group-component/ColumnsChoose.d.ts +13 -0
- package/lib/group-component/ColumnsChoose.js +221 -0
- package/lib/group-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/lib/group-component/ColumnsGroup/ColumnsGroup.js +241 -0
- package/lib/group-component/ColumnsGroup/index.d.ts +1 -0
- package/lib/group-component/ColumnsGroup/index.js +16 -0
- package/lib/group-component/ContextMenu.d.ts +19 -0
- package/lib/group-component/ContextMenu.js +83 -0
- package/lib/group-component/InternalTable.d.ts +8 -0
- package/lib/group-component/InternalTable.js +233 -0
- package/lib/group-component/TableContainer.d.ts +49 -0
- package/lib/group-component/TableContainer.js +382 -0
- package/lib/group-component/TableContainerEdit.d.ts +48 -0
- package/lib/group-component/TableContainerEdit.js +2075 -0
- package/lib/group-component/body/EditableCell.d.ts +16 -0
- package/lib/group-component/body/EditableCell.js +1075 -0
- package/lib/group-component/body/TableBody.d.ts +14 -0
- package/lib/group-component/body/TableBody.js +91 -0
- package/lib/group-component/body/TableBodyCell.d.ts +12 -0
- package/lib/group-component/body/TableBodyCell.js +595 -0
- package/lib/group-component/body/TableBodyCellEdit.d.ts +17 -0
- package/lib/group-component/body/TableBodyCellEdit.js +1405 -0
- package/lib/group-component/body/TableBodyCellEmpty.d.ts +12 -0
- package/lib/group-component/body/TableBodyCellEmpty.js +156 -0
- package/lib/group-component/body/TableBodyRow.d.ts +21 -0
- package/lib/group-component/body/TableBodyRow.js +206 -0
- package/lib/group-component/body/TableBodyRowGroupCell.d.ts +12 -0
- package/lib/group-component/body/TableBodyRowGroupCell.js +575 -0
- package/lib/group-component/components/ControlCheckbox.d.ts +13 -0
- package/lib/group-component/components/ControlCheckbox.js +92 -0
- package/lib/group-component/components/EditForm/EditForm.d.ts +27 -0
- package/lib/group-component/components/EditForm/EditForm.js +404 -0
- package/lib/group-component/components/EditForm/index.d.ts +1 -0
- package/lib/group-component/components/EditForm/index.js +16 -0
- package/lib/group-component/components/InputControl/InputControl.d.ts +27 -0
- package/lib/group-component/components/InputControl/InputControl.js +127 -0
- package/lib/group-component/components/InputControl/index.d.ts +1 -0
- package/lib/group-component/components/InputControl/index.js +16 -0
- package/lib/group-component/components/async-select/index.d.ts +11 -0
- package/lib/group-component/components/async-select/index.js +47 -0
- package/lib/group-component/components/async-table-select/index.d.ts +11 -0
- package/lib/group-component/components/async-table-select/index.js +49 -0
- package/lib/group-component/components/checkbox-control/index.d.ts +13 -0
- package/lib/group-component/components/checkbox-control/index.js +48 -0
- package/lib/group-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
- package/lib/group-component/components/checkbox-filter/CheckboxFilter.js +267 -0
- package/lib/group-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
- package/lib/group-component/components/checkbox-filter/FilterSearch.js +44 -0
- package/lib/group-component/components/command/Command.d.ts +10 -0
- package/lib/group-component/components/command/Command.js +44 -0
- package/lib/group-component/components/number/index.d.ts +12 -0
- package/lib/group-component/components/number/index.js +50 -0
- package/lib/group-component/components/number-range/index.d.ts +13 -0
- package/lib/group-component/components/number-range/index.js +87 -0
- package/lib/group-component/features/operator.d.ts +24 -0
- package/lib/group-component/features/operator.js +67 -0
- package/lib/group-component/footer/TableFooter.d.ts +7 -0
- package/lib/group-component/footer/TableFooter.js +44 -0
- package/lib/group-component/footer/TableFooterCell.d.ts +7 -0
- package/lib/group-component/footer/TableFooterCell.js +75 -0
- package/lib/group-component/footer/TableFooterRow.d.ts +8 -0
- package/lib/group-component/footer/TableFooterRow.js +37 -0
- package/lib/group-component/header/TableHead.d.ts +15 -0
- package/lib/group-component/header/TableHead.js +107 -0
- package/lib/group-component/header/TableHeadCell.d.ts +15 -0
- package/lib/group-component/header/TableHeadCell.js +319 -0
- package/lib/group-component/header/TableHeadCell2.d.ts +17 -0
- package/lib/group-component/header/TableHeadCell2.js +330 -0
- package/lib/group-component/header/TableHeadGroupCell.d.ts +17 -0
- package/lib/group-component/header/TableHeadGroupCell.js +103 -0
- package/lib/group-component/header/TableHeadRow.d.ts +15 -0
- package/lib/group-component/header/TableHeadRow.js +59 -0
- package/lib/group-component/header/renderFilter.d.ts +20 -0
- package/lib/group-component/header/renderFilter.js +301 -0
- package/lib/group-component/hook/convert.d.ts +1 -0
- package/lib/group-component/hook/convert.js +34 -0
- package/lib/group-component/hook/useColumns.d.ts +28 -0
- package/lib/group-component/hook/useColumns.js +318 -0
- package/lib/group-component/hook/useFilterOperator.d.ts +7 -0
- package/lib/group-component/hook/useFilterOperator.js +40 -0
- package/lib/group-component/hook/utils.d.ts +220 -0
- package/lib/group-component/hook/utils.js +2468 -0
- package/lib/group-component/index.d.ts +2 -0
- package/lib/group-component/index.js +9 -0
- package/lib/group-component/style.d.ts +22 -0
- package/lib/group-component/style.js +55 -0
- package/lib/group-component/style.scss +1438 -0
- package/lib/group-component/table/Grid.d.ts +33 -0
- package/lib/group-component/table/Grid.js +443 -0
- package/lib/group-component/table/TableWrapper.d.ts +33 -0
- package/lib/group-component/table/TableWrapper.js +259 -0
- package/lib/group-component/useContext.d.ts +100 -0
- package/lib/group-component/useContext.js +27 -0
- package/lib/table-component/InternalTable.js +6 -1
- package/lib/table-component/TableContainer.js +4 -2
- package/lib/table-component/body/TableBodyCell.js +49 -40
- package/lib/table-component/body/TableBodyRow.js +4 -1
- package/lib/table-component/hook/utils.d.ts +1 -0
- package/lib/table-component/hook/utils.js +16 -7
- package/lib/table-component/style.js +1 -1
- package/lib/table-component/table/Grid.js +3 -0
- package/lib/table-component/useContext.d.ts +5 -0
- package/lib/table-virtuoso/InternalTable.js +2 -2
- package/lib/table-virtuoso/body/TableBodyCell.js +2 -7
- package/lib/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBodyCellRowGroup.js +203 -0
- package/lib/table-virtuoso/body/TableBodyRow.d.ts +1 -1
- package/lib/table-virtuoso/body/TableBodyRow.js +43 -1
- package/lib/table-virtuoso/hook/utils.d.ts +1 -0
- package/lib/table-virtuoso/hook/utils.js +32 -1
- package/lib/table-virtuoso/style.js +3 -1
- package/lib/table-virtuoso/table/Grid.js +2 -2
- package/lib/table-virtuoso/table/TableWrapper.d.ts +7 -1
- package/lib/table-virtuoso/table/TableWrapper.js +24 -5
- package/lib/table-virtuoso/useContext.d.ts +6 -3
- package/lib/table-virtuoso/useContext.js +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BaseOptionType, DefaultOptionType } from "rc-select/lib/Select";
|
|
3
|
+
import type { TableSelectProps } from "rc-master-ui";
|
|
4
|
+
import type { LoadOptionsArgs } from '../../../grid-component/type';
|
|
5
|
+
export interface DebounceSelectProps<OptionType extends BaseOptionType = DefaultOptionType> extends TableSelectProps {
|
|
6
|
+
loadOptions?: (search: string, callback: (newOptions: OptionType[]) => void, args?: LoadOptionsArgs) => void;
|
|
7
|
+
debounceTimeout?: number;
|
|
8
|
+
defaultOptions?: OptionType[];
|
|
9
|
+
rowData?: any;
|
|
10
|
+
}
|
|
11
|
+
export declare function AsyncTableSelect<OptionType extends BaseOptionType>({ loadOptions, debounceTimeout, defaultOptions, columns, rowData, ...props }: DebounceSelectProps<OptionType>): React.JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.AsyncTableSelect = AsyncTableSelect;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
11
|
+
var _rcMasterUi = require("rc-master-ui");
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
function AsyncTableSelect({
|
|
15
|
+
loadOptions,
|
|
16
|
+
debounceTimeout = 500,
|
|
17
|
+
defaultOptions,
|
|
18
|
+
columns,
|
|
19
|
+
rowData,
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
const [options, setOptions] = (0, _react.useState)(defaultOptions ?? []);
|
|
23
|
+
const debounceFetcher = (0, _react.useMemo)(() => {
|
|
24
|
+
const fetchOptions = value => {
|
|
25
|
+
if (value.trim().length === 0) {
|
|
26
|
+
setOptions(defaultOptions ?? []);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (loadOptions) {
|
|
30
|
+
loadOptions(value, newOptions => {
|
|
31
|
+
setOptions(newOptions);
|
|
32
|
+
}, {
|
|
33
|
+
rowData
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return (0, _debounce.default)(fetchOptions, debounceTimeout);
|
|
38
|
+
}, [debounceTimeout, loadOptions, defaultOptions, rowData]);
|
|
39
|
+
(0, _react.useEffect)(() => {
|
|
40
|
+
setOptions(defaultOptions ?? []);
|
|
41
|
+
}, [defaultOptions]);
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_rcMasterUi.TableSelect, (0, _extends2.default)({}, props, {
|
|
43
|
+
filterOption: loadOptions ? false : props?.filterOption,
|
|
44
|
+
onSearch: debounceFetcher,
|
|
45
|
+
onSelect: () => setOptions(defaultOptions ?? []),
|
|
46
|
+
options: options,
|
|
47
|
+
columns: columns
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type OptionType = {
|
|
3
|
+
value: any;
|
|
4
|
+
label: string;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
type Props<T> = {
|
|
8
|
+
options: T[];
|
|
9
|
+
value: any[];
|
|
10
|
+
onChange?: (value: any[]) => void;
|
|
11
|
+
};
|
|
12
|
+
declare const CheckboxControl: <T extends OptionType>(props: Props<T>) => React.JSX.Element;
|
|
13
|
+
export default CheckboxControl;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _rcMasterUi = require("rc-master-ui");
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
const CheckboxControl = props => {
|
|
12
|
+
const {
|
|
13
|
+
options,
|
|
14
|
+
value,
|
|
15
|
+
onChange
|
|
16
|
+
} = props;
|
|
17
|
+
const selected = (0, _react.useMemo)(() => {
|
|
18
|
+
return value ? value : [];
|
|
19
|
+
}, [value]);
|
|
20
|
+
const list = (0, _react.useMemo)(() => {
|
|
21
|
+
return options ? options : [];
|
|
22
|
+
}, [options]);
|
|
23
|
+
const onChangeValue = val => {
|
|
24
|
+
const findIndex = selected.findIndex(it => it === val);
|
|
25
|
+
if (findIndex > -1) {
|
|
26
|
+
const newVal = selected.filter(it => it !== val);
|
|
27
|
+
onChange?.(newVal);
|
|
28
|
+
} else {
|
|
29
|
+
const newVal = [...selected, val];
|
|
30
|
+
onChange?.(newVal);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
34
|
+
className: "d-flex flex-column gap-50",
|
|
35
|
+
style: {}
|
|
36
|
+
}, list.map((it, index) => {
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
38
|
+
key: index,
|
|
39
|
+
className: "d-flex align-items-center"
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Checkbox, {
|
|
41
|
+
checked: selected.includes(it.value),
|
|
42
|
+
type: "checkbox",
|
|
43
|
+
className: "cursor-pointer me-50",
|
|
44
|
+
onChange: () => onChangeValue(it.value)
|
|
45
|
+
}), /*#__PURE__*/_react.default.createElement("span", null, it.label));
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
var _default = exports.default = CheckboxControl;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { TableLocale } from "rc-master-ui/es/table/interface";
|
|
3
|
+
type Props = {
|
|
4
|
+
options: any[];
|
|
5
|
+
filterSearch?: boolean;
|
|
6
|
+
open?: boolean;
|
|
7
|
+
tablePrefixCls?: string;
|
|
8
|
+
prefixCls?: string;
|
|
9
|
+
dropdownPrefixCls?: string;
|
|
10
|
+
filterMultiple: boolean;
|
|
11
|
+
showFilter?: boolean;
|
|
12
|
+
onSelect?: (value: any) => void;
|
|
13
|
+
selectedKeys: string[];
|
|
14
|
+
locale?: TableLocale;
|
|
15
|
+
filterMode?: 'menu' | 'tree';
|
|
16
|
+
};
|
|
17
|
+
declare const CheckboxFilter: (props: Props) => React.JSX.Element;
|
|
18
|
+
export default CheckboxFilter;
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _rcMasterUi = require("rc-master-ui");
|
|
11
|
+
var _antd = require("antd");
|
|
12
|
+
var _useFilter = require("rc-master-ui/es/table/hooks/useFilter");
|
|
13
|
+
var _FilterSearch = _interopRequireDefault(require("./FilterSearch"));
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function searchValueMatched(searchValue, text) {
|
|
17
|
+
if (typeof text === 'string' || typeof text === 'number') {
|
|
18
|
+
return text?.toString().toLowerCase().includes(searchValue.trim().toLowerCase());
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
function renderFilterItems({
|
|
23
|
+
filters,
|
|
24
|
+
prefixCls,
|
|
25
|
+
filteredKeys,
|
|
26
|
+
filterMultiple,
|
|
27
|
+
searchValue,
|
|
28
|
+
filterSearch
|
|
29
|
+
}) {
|
|
30
|
+
return filters.map((filter, index) => {
|
|
31
|
+
const key = String(filter.value);
|
|
32
|
+
if (filter.children) {
|
|
33
|
+
return {
|
|
34
|
+
key: key || index,
|
|
35
|
+
label: filter.text,
|
|
36
|
+
popupClassName: `${prefixCls}-dropdown-submenu`,
|
|
37
|
+
children: renderFilterItems({
|
|
38
|
+
filters: filter.children,
|
|
39
|
+
prefixCls,
|
|
40
|
+
filteredKeys,
|
|
41
|
+
filterMultiple,
|
|
42
|
+
searchValue,
|
|
43
|
+
filterSearch
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const Component = filterMultiple ? _rcMasterUi.Checkbox : _rcMasterUi.Radio;
|
|
48
|
+
const item = {
|
|
49
|
+
key: filter.value !== undefined ? key : index,
|
|
50
|
+
label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Component, {
|
|
51
|
+
checked: filteredKeys.includes(key)
|
|
52
|
+
}), /*#__PURE__*/React.createElement("span", null, filter.text))
|
|
53
|
+
};
|
|
54
|
+
if (searchValue.trim()) {
|
|
55
|
+
if (typeof filterSearch === 'function') {
|
|
56
|
+
return filterSearch(searchValue, filter) ? item : null;
|
|
57
|
+
}
|
|
58
|
+
return searchValueMatched(searchValue, filter.text) ? item : null;
|
|
59
|
+
}
|
|
60
|
+
return item;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function hasSubMenu(filters) {
|
|
64
|
+
return filters.some(({
|
|
65
|
+
children
|
|
66
|
+
}) => children);
|
|
67
|
+
}
|
|
68
|
+
const CheckboxFilter = props => {
|
|
69
|
+
const {
|
|
70
|
+
// column,
|
|
71
|
+
filterSearch = true,
|
|
72
|
+
tablePrefixCls = 'ui-rc-table',
|
|
73
|
+
prefixCls = 'ui-rc-table-filter',
|
|
74
|
+
dropdownPrefixCls = 'ui-rc-dropdown',
|
|
75
|
+
filterMultiple,
|
|
76
|
+
selectedKeys: propsSelectedKeys,
|
|
77
|
+
locale,
|
|
78
|
+
options,
|
|
79
|
+
filterMode = 'tree',
|
|
80
|
+
// open,
|
|
81
|
+
// searchValue,
|
|
82
|
+
showFilter,
|
|
83
|
+
// setSearchValue,
|
|
84
|
+
onSelect
|
|
85
|
+
} = props;
|
|
86
|
+
const selectedKeys = React.useMemo(() => {
|
|
87
|
+
if (propsSelectedKeys) {
|
|
88
|
+
return propsSelectedKeys.map(it => String(it));
|
|
89
|
+
}
|
|
90
|
+
return [];
|
|
91
|
+
}, [propsSelectedKeys]);
|
|
92
|
+
const [searchValue, setSearchValue] = React.useState('');
|
|
93
|
+
const [openKeys, setOpenKeys] = React.useState([]);
|
|
94
|
+
|
|
95
|
+
// clear search value after close filter dropdown
|
|
96
|
+
// React.useEffect(() => {
|
|
97
|
+
// // if (visible) {
|
|
98
|
+
// setSearchValue('');
|
|
99
|
+
// // }
|
|
100
|
+
// }, [open]);
|
|
101
|
+
|
|
102
|
+
const onOpenChange = keys => {
|
|
103
|
+
setOpenKeys(keys);
|
|
104
|
+
};
|
|
105
|
+
const items = renderFilterItems({
|
|
106
|
+
// filters: column.filters || [],
|
|
107
|
+
filters: options || [],
|
|
108
|
+
filterSearch,
|
|
109
|
+
prefixCls,
|
|
110
|
+
filteredKeys: selectedKeys ?? [],
|
|
111
|
+
filterMultiple,
|
|
112
|
+
searchValue
|
|
113
|
+
});
|
|
114
|
+
const dropdownMenuClass = (0, _classnames.default)({
|
|
115
|
+
// [`${dropdownPrefixCls}-menu-without-submenu`]: !hasSubMenu(column.filters || []),
|
|
116
|
+
[`${dropdownPrefixCls}-menu-without-submenu`]: !hasSubMenu(options || [])
|
|
117
|
+
});
|
|
118
|
+
const empty = /*#__PURE__*/React.createElement(_rcMasterUi.Empty, {
|
|
119
|
+
image: _rcMasterUi.Empty.PRESENTED_IMAGE_SIMPLE,
|
|
120
|
+
description: locale?.filterEmptyText,
|
|
121
|
+
imageStyle: {
|
|
122
|
+
height: 24
|
|
123
|
+
},
|
|
124
|
+
style: {
|
|
125
|
+
margin: 0,
|
|
126
|
+
padding: '16px 0'
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const isEmpty = items.every(item => item === null);
|
|
130
|
+
const onSearch = e => {
|
|
131
|
+
const {
|
|
132
|
+
value
|
|
133
|
+
} = e.target;
|
|
134
|
+
setSearchValue(value);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// if ((column.filters || []).length === 0) {
|
|
138
|
+
// return empty;
|
|
139
|
+
// }
|
|
140
|
+
|
|
141
|
+
const getTreeData = ({
|
|
142
|
+
filters
|
|
143
|
+
}) => (filters || []).map((filter, index) => {
|
|
144
|
+
const key = String(filter.value);
|
|
145
|
+
const item = {
|
|
146
|
+
title: filter.label,
|
|
147
|
+
id: filter.value !== undefined ? filter.value : index,
|
|
148
|
+
key: filter.value !== undefined ? key : String(index)
|
|
149
|
+
};
|
|
150
|
+
if (filter.children) {
|
|
151
|
+
item.children = getTreeData({
|
|
152
|
+
filters: filter.children
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return item;
|
|
156
|
+
});
|
|
157
|
+
const getFilterData = node => ({
|
|
158
|
+
...node,
|
|
159
|
+
text: node.title,
|
|
160
|
+
value: node.key,
|
|
161
|
+
children: node.children?.map(item => getFilterData(item)) || []
|
|
162
|
+
});
|
|
163
|
+
const onCheckAll = e => {
|
|
164
|
+
if (e.target.checked) {
|
|
165
|
+
const allFilterKeys = (0, _useFilter.flattenKeys)(options).map(key => key);
|
|
166
|
+
|
|
167
|
+
// setFilteredKeysSync(allFilterKeys);
|
|
168
|
+
onSelect?.(allFilterKeys);
|
|
169
|
+
} else {
|
|
170
|
+
onSelect?.([]);
|
|
171
|
+
// setFilteredKeysSync([]);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const onCheck = (keys, {
|
|
175
|
+
node,
|
|
176
|
+
checked
|
|
177
|
+
}) => {
|
|
178
|
+
if (!filterMultiple) {
|
|
179
|
+
// onSelectKeys({ selectedKeys: checked && node.key ? [node.key] : [] });
|
|
180
|
+
|
|
181
|
+
onSelect?.(checked && node.key ? [node.id] : []);
|
|
182
|
+
} else {
|
|
183
|
+
if (!checked) {
|
|
184
|
+
const rs = propsSelectedKeys.filter(it => it !== node.id);
|
|
185
|
+
onSelect?.(rs);
|
|
186
|
+
} else {
|
|
187
|
+
const rs = [...propsSelectedKeys, node.id];
|
|
188
|
+
onSelect?.(rs);
|
|
189
|
+
}
|
|
190
|
+
// onSelectKeys({ selectedKeys: keys });
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
if (filterMode === 'tree') {
|
|
194
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, showFilter && /*#__PURE__*/React.createElement(_FilterSearch.default, {
|
|
195
|
+
filterSearch: filterSearch,
|
|
196
|
+
value: searchValue,
|
|
197
|
+
onChange: onSearch,
|
|
198
|
+
tablePrefixCls: tablePrefixCls,
|
|
199
|
+
locale: locale
|
|
200
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
201
|
+
className: `${tablePrefixCls}-filter-dropdown-tree`
|
|
202
|
+
}, filterMultiple && options.length > 0 ? /*#__PURE__*/React.createElement(_rcMasterUi.Checkbox
|
|
203
|
+
// checked={selectedKeys.length === flattenKeys(column.filters).length}
|
|
204
|
+
, {
|
|
205
|
+
checked: selectedKeys.length === (0, _useFilter.flattenKeys)(options).length
|
|
206
|
+
// indeterminate={
|
|
207
|
+
// selectedKeys.length > 0 &&
|
|
208
|
+
// selectedKeys.length < flattenKeys(column.filters).length
|
|
209
|
+
// }
|
|
210
|
+
,
|
|
211
|
+
|
|
212
|
+
indeterminate: selectedKeys.length > 0 && selectedKeys.length < (0, _useFilter.flattenKeys)(options).length,
|
|
213
|
+
className: `${tablePrefixCls}-filter-dropdown-checkall`,
|
|
214
|
+
onChange: onCheckAll
|
|
215
|
+
}, locale?.filterCheckall) : /*#__PURE__*/React.createElement(_rcMasterUi.Empty, null), /*#__PURE__*/React.createElement(_antd.Tree, {
|
|
216
|
+
checkable: true,
|
|
217
|
+
selectable: false,
|
|
218
|
+
blockNode: true,
|
|
219
|
+
multiple: filterMultiple,
|
|
220
|
+
checkStrictly: !filterMultiple,
|
|
221
|
+
className: `${dropdownPrefixCls}-menu`,
|
|
222
|
+
onCheck: onCheck,
|
|
223
|
+
checkedKeys: selectedKeys,
|
|
224
|
+
selectedKeys: selectedKeys,
|
|
225
|
+
showIcon: false
|
|
226
|
+
// treeData={getTreeData({ filters: column.filters })}
|
|
227
|
+
,
|
|
228
|
+
treeData: getTreeData({
|
|
229
|
+
filters: options
|
|
230
|
+
}),
|
|
231
|
+
autoExpandParent: true,
|
|
232
|
+
defaultExpandAll: true,
|
|
233
|
+
filterTreeNode: searchValue.trim() ? node => {
|
|
234
|
+
if (typeof filterSearch === 'function') {
|
|
235
|
+
// @ts-ignore
|
|
236
|
+
return filterSearch(searchValue, getFilterData(node));
|
|
237
|
+
}
|
|
238
|
+
return searchValueMatched(searchValue, node.title);
|
|
239
|
+
} : undefined,
|
|
240
|
+
rootStyle: {
|
|
241
|
+
background: 'none',
|
|
242
|
+
boxShadow: 'none'
|
|
243
|
+
}
|
|
244
|
+
})));
|
|
245
|
+
}
|
|
246
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_FilterSearch.default, {
|
|
247
|
+
filterSearch: filterSearch,
|
|
248
|
+
value: searchValue,
|
|
249
|
+
onChange: onSearch,
|
|
250
|
+
tablePrefixCls: tablePrefixCls,
|
|
251
|
+
locale: locale
|
|
252
|
+
}), isEmpty ? empty : /*#__PURE__*/React.createElement(_rcMasterUi.Menu, {
|
|
253
|
+
selectable: true,
|
|
254
|
+
multiple: filterMultiple,
|
|
255
|
+
prefixCls: `${dropdownPrefixCls}-menu`,
|
|
256
|
+
className: dropdownMenuClass,
|
|
257
|
+
onSelect: onSelect,
|
|
258
|
+
onDeselect: onSelect,
|
|
259
|
+
selectedKeys: selectedKeys
|
|
260
|
+
// getPopupContainer={getPopupContainer}
|
|
261
|
+
,
|
|
262
|
+
openKeys: openKeys,
|
|
263
|
+
onOpenChange: onOpenChange,
|
|
264
|
+
items: items
|
|
265
|
+
}));
|
|
266
|
+
};
|
|
267
|
+
var _default = exports.default = CheckboxFilter;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FilterSearchType, TableLocale } from "antd/es/table/interface";
|
|
3
|
+
import type { AnyObject } from '../../../grid-component/type';
|
|
4
|
+
interface FilterSearchProps<RecordType = AnyObject> {
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
+
filterSearch: FilterSearchType<RecordType>;
|
|
8
|
+
tablePrefixCls: string;
|
|
9
|
+
locale?: TableLocale;
|
|
10
|
+
}
|
|
11
|
+
declare const FilterSearch: <RecordType extends AnyObject = AnyObject>(props: FilterSearchProps<RecordType>) => React.JSX.Element;
|
|
12
|
+
export default FilterSearch;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _SearchOutlined = _interopRequireDefault(require("@ant-design/icons/SearchOutlined"));
|
|
10
|
+
var _rcMasterUi = require("rc-master-ui");
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
// import type {AnyObject} from "./../grid-component/type"
|
|
14
|
+
|
|
15
|
+
const FilterSearch = props => {
|
|
16
|
+
const {
|
|
17
|
+
value,
|
|
18
|
+
filterSearch,
|
|
19
|
+
tablePrefixCls,
|
|
20
|
+
locale,
|
|
21
|
+
onChange
|
|
22
|
+
} = props;
|
|
23
|
+
if (!filterSearch) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: `${tablePrefixCls}-filter-dropdown-search`,
|
|
28
|
+
style: {
|
|
29
|
+
paddingLeft: 0,
|
|
30
|
+
paddingRight: 0
|
|
31
|
+
}
|
|
32
|
+
}, /*#__PURE__*/React.createElement(_rcMasterUi.Input, {
|
|
33
|
+
suffix: /*#__PURE__*/React.createElement(_SearchOutlined.default, null),
|
|
34
|
+
placeholder: locale?.filterSearchPlaceholder,
|
|
35
|
+
onChange: onChange,
|
|
36
|
+
value: value,
|
|
37
|
+
autoFocus: true
|
|
38
|
+
// for skip min-width of input
|
|
39
|
+
,
|
|
40
|
+
htmlSize: 1,
|
|
41
|
+
className: `${tablePrefixCls}-filter-dropdown-search-input`
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
var _default = exports.default = FilterSearch;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CommandItem } from "../../../grid-component/type";
|
|
3
|
+
type Props<T> = {
|
|
4
|
+
id: string;
|
|
5
|
+
record: T;
|
|
6
|
+
item: CommandItem;
|
|
7
|
+
onClick: (e: any) => void;
|
|
8
|
+
};
|
|
9
|
+
declare const Command: <T extends object>(props: Props<T>) => React.JSX.Element;
|
|
10
|
+
export default Command;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
const Command = props => {
|
|
13
|
+
const {
|
|
14
|
+
item,
|
|
15
|
+
onClick,
|
|
16
|
+
record,
|
|
17
|
+
id
|
|
18
|
+
} = props;
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, item.template ? /*#__PURE__*/_react.default.createElement("div", {
|
|
20
|
+
"data-tooltip-id": `${id}-tooltip-content`,
|
|
21
|
+
"data-tooltip-content": item.tooltip || item.title,
|
|
22
|
+
"data-tooltip-delay-show": 500,
|
|
23
|
+
id: item.id,
|
|
24
|
+
onClick: onClick
|
|
25
|
+
}, typeof item.template === 'function' ? item.template(record) : item.template) : /*#__PURE__*/_react.default.createElement("div", {
|
|
26
|
+
tabIndex: -1,
|
|
27
|
+
"data-tooltip-id": `${id}-tooltip-content`,
|
|
28
|
+
"data-tooltip-delay-show": 500,
|
|
29
|
+
"data-tooltip-content": item.tooltip || item.title,
|
|
30
|
+
style: {
|
|
31
|
+
padding: '3px',
|
|
32
|
+
maxWidth: 45,
|
|
33
|
+
height: '100%',
|
|
34
|
+
display: 'flex',
|
|
35
|
+
cursor: 'pointer'
|
|
36
|
+
},
|
|
37
|
+
className: (0, _classnames.default)('command-item', {
|
|
38
|
+
'btn-icon': item.title === ''
|
|
39
|
+
}),
|
|
40
|
+
color: item.color ? item.color : 'primary',
|
|
41
|
+
onClick: onClick
|
|
42
|
+
}, typeof item.icon === 'function' ? item.icon() : item.icon));
|
|
43
|
+
};
|
|
44
|
+
var _default = exports.default = Command;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { KeyboardEventHandler } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { IFormat } from "../../../grid-component/type";
|
|
4
|
+
type Props = {
|
|
5
|
+
t?: any;
|
|
6
|
+
format?: IFormat;
|
|
7
|
+
value: number | string | undefined;
|
|
8
|
+
onChange?: (values: any[]) => void;
|
|
9
|
+
onPressEnter?: KeyboardEventHandler<HTMLInputElement>;
|
|
10
|
+
};
|
|
11
|
+
declare const NumberInput: (props: Props) => React.JSX.Element;
|
|
12
|
+
export default NumberInput;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNumericComponent = require("react-numeric-component");
|
|
9
|
+
var _rcMasterUi = require("rc-master-ui");
|
|
10
|
+
var _utils = require("../../hook/utils");
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
const NumberInput = props => {
|
|
14
|
+
const {
|
|
15
|
+
t,
|
|
16
|
+
value,
|
|
17
|
+
format,
|
|
18
|
+
onChange,
|
|
19
|
+
onPressEnter
|
|
20
|
+
} = props;
|
|
21
|
+
const values = _react.default.useMemo(() => [value], [value]);
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNumericComponent.NumericFormat, {
|
|
23
|
+
value: values[0] ?? ''
|
|
24
|
+
// value={min}
|
|
25
|
+
,
|
|
26
|
+
thousandSeparator: (0, _utils.checkThousandSeparator)(format?.thousandSeparator, format?.decimalSeparator),
|
|
27
|
+
decimalSeparator: (0, _utils.checkDecimalSeparator)(format?.thousandSeparator, format?.decimalSeparator),
|
|
28
|
+
allowNegative: true,
|
|
29
|
+
customInput: _rcMasterUi.Input,
|
|
30
|
+
className: 'input-element',
|
|
31
|
+
classNames: {
|
|
32
|
+
input: 'filter-input'
|
|
33
|
+
},
|
|
34
|
+
onValueChange: vals => {
|
|
35
|
+
// onChangeValueFilter(type, values.floatValue, 'min')
|
|
36
|
+
|
|
37
|
+
// setValues([vals.floatValue, values[1]])
|
|
38
|
+
onChange?.([vals.floatValue]);
|
|
39
|
+
},
|
|
40
|
+
onPressEnter: onPressEnter
|
|
41
|
+
// placeholder={t ? t('Min') : 'Min'}
|
|
42
|
+
,
|
|
43
|
+
placeholder: t ? t('Enter') : 'Enter'
|
|
44
|
+
// autoFocus={true}
|
|
45
|
+
,
|
|
46
|
+
|
|
47
|
+
allowClear: true
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
var _default = exports.default = NumberInput;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { KeyboardEventHandler } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { IFormat } from "../../../grid-component/type";
|
|
4
|
+
type Props = {
|
|
5
|
+
t?: any;
|
|
6
|
+
format?: IFormat;
|
|
7
|
+
min: number | string | undefined;
|
|
8
|
+
max: number | string | undefined;
|
|
9
|
+
onChange?: (values: any[]) => void;
|
|
10
|
+
onPressEnter?: KeyboardEventHandler<HTMLInputElement>;
|
|
11
|
+
};
|
|
12
|
+
declare const NumberRange: (props: Props) => React.JSX.Element;
|
|
13
|
+
export default NumberRange;
|