@creekjs/web-components 1.0.2 → 1.0.3
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/.fatherrc.ts +1 -5
- package/.turbo/turbo-father$colon$build.log +5 -0
- package/.turbo/turbo-father$colon$dev.log +33 -0
- package/dist/creek-config-provider/CreekConfigContext.js +31 -2
- package/dist/creek-config-provider/CreekConfigContext.js.map +7 -0
- package/dist/creek-config-provider/index.js +35 -13
- package/dist/creek-config-provider/index.js.map +7 -0
- package/dist/creek-hooks/index.d.ts +1 -0
- package/dist/creek-hooks/index.js +26 -1
- package/dist/creek-hooks/index.js.map +7 -0
- package/dist/creek-hooks/useApp/DrawerHelper.d.ts +9 -0
- package/dist/creek-hooks/useApp/DrawerHelper.js +62 -0
- package/dist/creek-hooks/useApp/DrawerHelper.js.map +7 -0
- package/dist/creek-hooks/useApp/ModalHelper.d.ts +9 -0
- package/dist/creek-hooks/useApp/ModalHelper.js +62 -0
- package/dist/creek-hooks/useApp/ModalHelper.js.map +7 -0
- package/dist/creek-hooks/useApp/index.d.ts +25 -0
- package/dist/creek-hooks/useApp/index.js +118 -0
- package/dist/creek-hooks/useApp/index.js.map +7 -0
- package/dist/creek-hooks/useApp/types.d.ts +26 -0
- package/dist/creek-hooks/useApp/types.js +18 -0
- package/dist/creek-hooks/useApp/types.js.map +7 -0
- package/dist/creek-hooks/useViewportHeight.js +99 -97
- package/dist/creek-hooks/useViewportHeight.js.map +7 -0
- package/dist/creek-icon/index.js +53 -31
- package/dist/creek-icon/index.js.map +7 -0
- package/dist/creek-keep-alive/index.js +36 -18
- package/dist/creek-keep-alive/index.js.map +7 -0
- package/dist/creek-layout/CollapseButton.js +69 -47
- package/dist/creek-layout/CollapseButton.js.map +7 -0
- package/dist/creek-layout/Exception/NotFound.js +42 -13
- package/dist/creek-layout/Exception/NotFound.js.map +7 -0
- package/dist/creek-layout/Exception/NotFoundPage.js +30 -5
- package/dist/creek-layout/Exception/NotFoundPage.js.map +7 -0
- package/dist/creek-layout/Exception/index.js +37 -8
- package/dist/creek-layout/Exception/index.js.map +7 -0
- package/dist/creek-layout/HeaderContent/FullScreen.js +45 -39
- package/dist/creek-layout/HeaderContent/FullScreen.js.map +7 -0
- package/dist/creek-layout/HeaderContent/UserInfo.js +75 -53
- package/dist/creek-layout/HeaderContent/UserInfo.js.map +7 -0
- package/dist/creek-layout/HeaderContent/index.js +48 -28
- package/dist/creek-layout/HeaderContent/index.js.map +7 -0
- package/dist/creek-layout/index.js +117 -81
- package/dist/creek-layout/index.js.map +7 -0
- package/dist/creek-loading/index.js +55 -48
- package/dist/creek-loading/index.js.map +7 -0
- package/dist/creek-table/SearchTable.js +107 -116
- package/dist/creek-table/SearchTable.js.map +7 -0
- package/dist/creek-table/TableOptionRender.js +69 -60
- package/dist/creek-table/TableOptionRender.js.map +7 -0
- package/dist/creek-table/TableViewContent.js +59 -40
- package/dist/creek-table/TableViewContent.js.map +7 -0
- package/dist/creek-table/hooks/index.d.ts +1 -1
- package/dist/creek-table/hooks/index.js +28 -3
- package/dist/creek-table/hooks/index.js.map +7 -0
- package/dist/creek-table/hooks/useAdaptiveToolBar.js +48 -36
- package/dist/creek-table/hooks/useAdaptiveToolBar.js.map +7 -0
- package/dist/creek-table/hooks/useAutoWidthColumns.d.ts +6 -0
- package/dist/creek-table/hooks/useAutoWidthColumns.js +187 -0
- package/dist/creek-table/hooks/useAutoWidthColumns.js.map +7 -0
- package/dist/creek-table/hooks/useElementDistance.js +51 -39
- package/dist/creek-table/hooks/useElementDistance.js.map +7 -0
- package/dist/creek-table/index.js +35 -25
- package/dist/creek-table/index.js.map +7 -0
- package/dist/creek-table/toolBarRender.js +55 -33
- package/dist/creek-table/toolBarRender.js.map +7 -0
- package/dist/creek-table/type.d.ts +1 -1
- package/dist/creek-table/type.js +18 -1
- package/dist/creek-table/type.js.map +7 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +34 -7
- package/dist/index.js.map +7 -0
- package/package.json +2 -2
- package/src/creek-hooks/index.ts +2 -0
- package/src/creek-hooks/useApp/DrawerHelper.tsx +43 -0
- package/src/creek-hooks/useApp/ModalHelper.tsx +43 -0
- package/src/creek-hooks/useApp/index.tsx +119 -0
- package/src/creek-hooks/useApp/types.ts +25 -0
- package/src/creek-hooks/useViewportHeight.tsx +34 -5
- package/src/creek-table/SearchTable.tsx +16 -37
- package/src/creek-table/TableViewContent.tsx +21 -14
- package/src/creek-table/hooks/index.ts +1 -1
- package/src/creek-table/hooks/useAutoWidthColumns.tsx +212 -0
- package/src/creek-table/index.tsx +1 -5
- package/src/creek-table/type.ts +1 -1
- package/src/index.tsx +2 -2
- package/dist/bg-center/index.d.ts +0 -5
- package/dist/bg-center/index.d.ts.map +0 -1
- package/dist/bg-center/index.js +0 -28
- package/dist/creek-config-provider/CreekConfigContext.d.ts.map +0 -1
- package/dist/creek-config-provider/index.d.ts.map +0 -1
- package/dist/creek-hooks/index.d.ts.map +0 -1
- package/dist/creek-hooks/useViewportHeight.d.ts.map +0 -1
- package/dist/creek-icon/index.d.ts.map +0 -1
- package/dist/creek-keep-alive/index.d.ts.map +0 -1
- package/dist/creek-layout/CollapseButton.d.ts.map +0 -1
- package/dist/creek-layout/Exception/NotFound.d.ts.map +0 -1
- package/dist/creek-layout/Exception/NotFoundPage.d.ts.map +0 -1
- package/dist/creek-layout/Exception/index.d.ts.map +0 -1
- package/dist/creek-layout/HeaderContent/FullScreen.d.ts.map +0 -1
- package/dist/creek-layout/HeaderContent/UserInfo.d.ts.map +0 -1
- package/dist/creek-layout/HeaderContent/index.d.ts.map +0 -1
- package/dist/creek-layout/index.d.ts.map +0 -1
- package/dist/creek-loading/index.d.ts.map +0 -1
- package/dist/creek-search/CreekSearch.d.ts +0 -7
- package/dist/creek-search/CreekSearch.d.ts.map +0 -1
- package/dist/creek-search/CreekSearch.js +0 -51
- package/dist/creek-search/CreekSearchContext.d.ts +0 -54
- package/dist/creek-search/CreekSearchContext.d.ts.map +0 -1
- package/dist/creek-search/CreekSearchContext.js +0 -546
- package/dist/creek-search/CreekSearchFilterDisplay.d.ts +0 -5
- package/dist/creek-search/CreekSearchFilterDisplay.d.ts.map +0 -1
- package/dist/creek-search/CreekSearchFilterDisplay.js +0 -97
- package/dist/creek-search/CreekSearchInput.d.ts +0 -4
- package/dist/creek-search/CreekSearchInput.d.ts.map +0 -1
- package/dist/creek-search/CreekSearchInput.js +0 -96
- package/dist/creek-search/CreekSearchValueSelector.d.ts +0 -5
- package/dist/creek-search/CreekSearchValueSelector.d.ts.map +0 -1
- package/dist/creek-search/CreekSearchValueSelector.js +0 -422
- package/dist/creek-search/index.d.ts +0 -5
- package/dist/creek-search/index.d.ts.map +0 -1
- package/dist/creek-search/index.js +0 -5
- package/dist/creek-search/type.d.ts +0 -8
- package/dist/creek-search/type.d.ts.map +0 -1
- package/dist/creek-search/type.js +0 -1
- package/dist/creek-table/SearchTable.d.ts.map +0 -1
- package/dist/creek-table/TableOptionRender.d.ts.map +0 -1
- package/dist/creek-table/TableViewContent.d.ts.map +0 -1
- package/dist/creek-table/hooks/index.d.ts.map +0 -1
- package/dist/creek-table/hooks/useAdaptiveToolBar.d.ts.map +0 -1
- package/dist/creek-table/hooks/useAutoAddFilterToColumns.d.ts +0 -12
- package/dist/creek-table/hooks/useAutoAddFilterToColumns.d.ts.map +0 -1
- package/dist/creek-table/hooks/useAutoAddFilterToColumns.js +0 -96
- package/dist/creek-table/hooks/useElementDistance.d.ts.map +0 -1
- package/dist/creek-table/index.d.ts.map +0 -1
- package/dist/creek-table/toolBarRender.d.ts.map +0 -1
- package/dist/creek-table/type.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/src/bg-center/index.tsx +0 -26
- package/src/creek-search/CreekSearch.tsx +0 -60
- package/src/creek-search/CreekSearchContext.tsx +0 -593
- package/src/creek-search/CreekSearchFilterDisplay.tsx +0 -84
- package/src/creek-search/CreekSearchInput.tsx +0 -75
- package/src/creek-search/CreekSearchValueSelector.tsx +0 -324
- package/src/creek-search/index.tsx +0 -5
- package/src/creek-search/type.ts +0 -9
- package/src/creek-table/hooks/useAutoAddFilterToColumns.tsx +0 -90
|
@@ -1,96 +0,0 @@
|
|
|
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
|
-
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; }
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
-
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); }
|
|
7
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
-
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."); }
|
|
9
|
-
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); }
|
|
10
|
-
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; }
|
|
11
|
-
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; } }
|
|
12
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import { useMemoizedFn, useSafeState } from 'ahooks';
|
|
14
|
-
import { useMemo } from 'react';
|
|
15
|
-
import { CreekSearchValueSelector, useSearchContext } from "../../creek-search";
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
export var useAutoAddFilterToColumns = function useAutoAddFilterToColumns(_ref) {
|
|
18
|
-
var columns = _ref.columns,
|
|
19
|
-
autoAddFilterForColumn = _ref.autoAddFilterForColumn;
|
|
20
|
-
var _useSearchContext = useSearchContext(),
|
|
21
|
-
hasOptions = _useSearchContext.hasOptions,
|
|
22
|
-
setSelectedColumn = _useSearchContext.setSelectedColumn,
|
|
23
|
-
filters = _useSearchContext.filters,
|
|
24
|
-
filterOptions = _useSearchContext.filterOptions;
|
|
25
|
-
|
|
26
|
-
// 管理每列的下拉框状态
|
|
27
|
-
var _useSafeState = useSafeState({}),
|
|
28
|
-
_useSafeState2 = _slicedToArray(_useSafeState, 2),
|
|
29
|
-
filterOpenMap = _useSafeState2[0],
|
|
30
|
-
setFilterOpenMap = _useSafeState2[1];
|
|
31
|
-
|
|
32
|
-
// 获取列的唯一标识
|
|
33
|
-
var getColumnKey = useMemoizedFn(function (column) {
|
|
34
|
-
return column.dataIndex;
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// 控制特定列的下拉框开关
|
|
38
|
-
var setColumnFilterOpen = useMemoizedFn(function (columnKey, open) {
|
|
39
|
-
setFilterOpenMap(function (prev) {
|
|
40
|
-
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, columnKey, open));
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// 关闭特定列的下拉框
|
|
45
|
-
var closeColumnFilter = useMemoizedFn(function (columnKey) {
|
|
46
|
-
setFilterOpenMap(function (prev) {
|
|
47
|
-
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, columnKey, false));
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// 自动为列添加筛选功能
|
|
52
|
-
var autoAddFilterToColumns = useMemoizedFn(function () {
|
|
53
|
-
var columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
54
|
-
return columns.map(function (column) {
|
|
55
|
-
if (hasOptions(column) && filterOptions !== null && filterOptions !== void 0 && filterOptions.map(function (item) {
|
|
56
|
-
return item.dataIndex;
|
|
57
|
-
}).includes(column.dataIndex)) {
|
|
58
|
-
var newColumn = _objectSpread({}, column);
|
|
59
|
-
var columnKey = getColumnKey(newColumn);
|
|
60
|
-
return _objectSpread(_objectSpread({}, newColumn), {}, {
|
|
61
|
-
filters: (newColumn === null || newColumn === void 0 ? void 0 : newColumn.filters) || true,
|
|
62
|
-
onFilter: (newColumn === null || newColumn === void 0 ? void 0 : newColumn.onFilter) || false,
|
|
63
|
-
filtered: filters.map(function (item) {
|
|
64
|
-
return item.dataIndex;
|
|
65
|
-
}).includes(columnKey),
|
|
66
|
-
filterDropdown: /*#__PURE__*/_jsx(CreekSearchValueSelector, {
|
|
67
|
-
onConfirm: function onConfirm() {
|
|
68
|
-
// 点击确认时关闭当前列的下拉框
|
|
69
|
-
closeColumnFilter(columnKey);
|
|
70
|
-
}
|
|
71
|
-
}),
|
|
72
|
-
filterDropdownProps: {
|
|
73
|
-
open: filterOpenMap[columnKey] || false,
|
|
74
|
-
onOpenChange: function onOpenChange(open) {
|
|
75
|
-
if (open) {
|
|
76
|
-
var selectedColumn = columns.find(function (item) {
|
|
77
|
-
return item.dataIndex === columnKey;
|
|
78
|
-
});
|
|
79
|
-
setSelectedColumn(selectedColumn);
|
|
80
|
-
}
|
|
81
|
-
setColumnFilterOpen(columnKey, open);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
return column;
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
var columnsWithFilter = useMemo(function () {
|
|
90
|
-
return autoAddFilterForColumn ? autoAddFilterToColumns(columns) : columns;
|
|
91
|
-
}, [columns, filters, autoAddFilterToColumns, filterOpenMap]);
|
|
92
|
-
return {
|
|
93
|
-
columnsWithFilter: columnsWithFilter,
|
|
94
|
-
getColumnKey: getColumnKey
|
|
95
|
-
};
|
|
96
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useElementDistance.d.ts","sourceRoot":"","sources":["../../../src/creek-table/hooks/useElementDistance.tsx"],"names":[],"mappings":";AAGA,KAAK,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;AAO/C,UAAU,QAAQ;IAChB,CAAC,EAAE,MAAM,CAAC;CACX;AAeD,eAAO,MAAM,kBAAkB,wDAAuD,QAAQ,GAAG,IAoChG,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/creek-table/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAKxD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC,eAAO,MAAM,UAAU,0EAA2E,gBAAgB,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,4CAQjI,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toolBarRender.d.ts","sourceRoot":"","sources":["../../src/creek-table/toolBarRender.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,YAAa;IAAE,cAAc,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,GAAG,CAAA;CAAE,QAwBjF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/creek-table/type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAAE,SAAS,GAAG,MAAM,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,GAAG;IACzJ,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE;QACtB,+BAA+B;QAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG;QACpD,YAAY,CAAC,EAAE,kBAAkB,CAAC;QAClC,YAAY,CAAC,EAAE,kBAAkB,CAAC;KACnC,CAAC;IAEF,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
|
package/src/bg-center/index.tsx
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createStyles } from 'antd-style';
|
|
2
|
-
|
|
3
|
-
export type BgCenterProps = {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const BgCenter = ({ children }: BgCenterProps) => {
|
|
8
|
-
const useStyles = createStyles(({ token }) => ({
|
|
9
|
-
bgCenterContianer: {
|
|
10
|
-
display: 'flex',
|
|
11
|
-
alignItems: 'center',
|
|
12
|
-
justifyContent: 'center',
|
|
13
|
-
position: 'fixed',
|
|
14
|
-
top: 0,
|
|
15
|
-
left: 0,
|
|
16
|
-
right: 0,
|
|
17
|
-
bottom: 0,
|
|
18
|
-
backgroundColor: 'rgba(255, 255, 255, 0.7)',
|
|
19
|
-
zIndex: token.zIndexBase,
|
|
20
|
-
},
|
|
21
|
-
}));
|
|
22
|
-
|
|
23
|
-
const { styles } = useStyles();
|
|
24
|
-
|
|
25
|
-
return <div className={styles.bgCenterContianer}>{children}</div>;
|
|
26
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { ParamsType, ProColumnType } from '@ant-design/pro-components';
|
|
2
|
-
import { createStyles } from 'antd-style';
|
|
3
|
-
import classnames from 'classnames';
|
|
4
|
-
|
|
5
|
-
import { CreekSearchProvider } from './CreekSearchContext';
|
|
6
|
-
import { CreekFilterDisplay } from './CreekSearchFilterDisplay';
|
|
7
|
-
import { CreekSearchInput } from './CreekSearchInput';
|
|
8
|
-
|
|
9
|
-
const useStyles = createStyles(
|
|
10
|
-
(
|
|
11
|
-
{ token, prefixCls },
|
|
12
|
-
props: {
|
|
13
|
-
justify: 'start' | 'end';
|
|
14
|
-
},
|
|
15
|
-
) => {
|
|
16
|
-
return {
|
|
17
|
-
creekSearchContainer: {
|
|
18
|
-
padding: '20px 20px 0 20px',
|
|
19
|
-
width: '100%',
|
|
20
|
-
display: 'flex',
|
|
21
|
-
flexDirection: 'column',
|
|
22
|
-
alignItems: props.justify === 'end' ? 'flex-end' : 'flex-start',
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
creekSearchContainerEnd: {
|
|
26
|
-
[`& .${prefixCls}-tag`]: {
|
|
27
|
-
marginInlineEnd: 0,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
creekSearchFilterDisplay: {
|
|
32
|
-
marginTop: '10px',
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
export type CreekSearchProps<T> = {
|
|
39
|
-
columns: ProColumnType<T>[];
|
|
40
|
-
onSubmit?: (values: Record<string, any>) => void;
|
|
41
|
-
justify?: 'start' | 'end';
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const CreekSearch = <T extends ParamsType>(props: CreekSearchProps<T>) => {
|
|
45
|
-
const { columns = [], onSubmit, justify = 'start' } = props;
|
|
46
|
-
|
|
47
|
-
const { styles } = useStyles({
|
|
48
|
-
justify,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<CreekSearchProvider columns={columns} onSubmit={onSubmit}>
|
|
54
|
-
<div className={classnames(styles.creekSearchContainer, justify === 'end' && styles.creekSearchContainerEnd)}>
|
|
55
|
-
<CreekSearchInput />
|
|
56
|
-
<CreekFilterDisplay className={styles.creekSearchFilterDisplay} />
|
|
57
|
-
</div>
|
|
58
|
-
</CreekSearchProvider>
|
|
59
|
-
);
|
|
60
|
-
};
|