@creekjs/web-components 1.0.1 → 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 -96
- 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 -32
- package/dist/creek-layout/HeaderContent/index.js.map +7 -0
- package/dist/creek-layout/index.js +117 -80
- 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 +60 -39
- 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 -3
- package/src/creek-layout/HeaderContent/index.tsx +1 -4
- package/src/creek-layout/index.tsx +7 -6
- package/src/creek-table/SearchTable.tsx +16 -37
- package/src/creek-table/TableViewContent.tsx +21 -12
- 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.js +0 -28
- package/dist/creek-search/CreekSearch.d.ts +0 -7
- package/dist/creek-search/CreekSearch.js +0 -51
- package/dist/creek-search/CreekSearchContext.d.ts +0 -54
- package/dist/creek-search/CreekSearchContext.js +0 -546
- package/dist/creek-search/CreekSearchFilterDisplay.d.ts +0 -5
- package/dist/creek-search/CreekSearchFilterDisplay.js +0 -97
- package/dist/creek-search/CreekSearchInput.d.ts +0 -4
- package/dist/creek-search/CreekSearchInput.js +0 -96
- package/dist/creek-search/CreekSearchValueSelector.d.ts +0 -5
- package/dist/creek-search/CreekSearchValueSelector.js +0 -422
- package/dist/creek-search/index.d.ts +0 -5
- package/dist/creek-search/index.js +0 -5
- package/dist/creek-search/type.d.ts +0 -8
- package/dist/creek-search/type.js +0 -1
- package/dist/creek-table/hooks/useAutoAddFilterToColumns.d.ts +0 -12
- package/dist/creek-table/hooks/useAutoAddFilterToColumns.js +0 -93
- package/src/bg-center/index.tsx +0 -26
- package/src/creek-search/CreekSearch.tsx +0 -59
- 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,93 +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
|
-
|
|
25
|
-
// 管理每列的下拉框状态
|
|
26
|
-
var _useSafeState = useSafeState({}),
|
|
27
|
-
_useSafeState2 = _slicedToArray(_useSafeState, 2),
|
|
28
|
-
filterOpenMap = _useSafeState2[0],
|
|
29
|
-
setFilterOpenMap = _useSafeState2[1];
|
|
30
|
-
|
|
31
|
-
// 获取列的唯一标识
|
|
32
|
-
var getColumnKey = useMemoizedFn(function (column) {
|
|
33
|
-
return column.dataIndex;
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// 控制特定列的下拉框开关
|
|
37
|
-
var setColumnFilterOpen = useMemoizedFn(function (columnKey, open) {
|
|
38
|
-
setFilterOpenMap(function (prev) {
|
|
39
|
-
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, columnKey, open));
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// 关闭特定列的下拉框
|
|
44
|
-
var closeColumnFilter = useMemoizedFn(function (columnKey) {
|
|
45
|
-
setFilterOpenMap(function (prev) {
|
|
46
|
-
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, columnKey, false));
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// 自动为列添加筛选功能
|
|
51
|
-
var autoAddFilterToColumns = useMemoizedFn(function () {
|
|
52
|
-
var columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
53
|
-
return columns.map(function (column) {
|
|
54
|
-
if (hasOptions(column)) {
|
|
55
|
-
var newColumn = _objectSpread({}, column);
|
|
56
|
-
var columnKey = getColumnKey(newColumn);
|
|
57
|
-
return _objectSpread(_objectSpread({}, newColumn), {}, {
|
|
58
|
-
filters: (newColumn === null || newColumn === void 0 ? void 0 : newColumn.filters) || true,
|
|
59
|
-
onFilter: (newColumn === null || newColumn === void 0 ? void 0 : newColumn.onFilter) || false,
|
|
60
|
-
filtered: filters.map(function (item) {
|
|
61
|
-
return item.dataIndex;
|
|
62
|
-
}).includes(columnKey),
|
|
63
|
-
filterDropdown: /*#__PURE__*/_jsx(CreekSearchValueSelector, {
|
|
64
|
-
onConfirm: function onConfirm() {
|
|
65
|
-
// 点击确认时关闭当前列的下拉框
|
|
66
|
-
closeColumnFilter(columnKey);
|
|
67
|
-
}
|
|
68
|
-
}),
|
|
69
|
-
filterDropdownProps: {
|
|
70
|
-
open: filterOpenMap[columnKey] || false,
|
|
71
|
-
onOpenChange: function onOpenChange(open) {
|
|
72
|
-
if (open) {
|
|
73
|
-
var selectedColumn = columns.find(function (item) {
|
|
74
|
-
return item.dataIndex === columnKey;
|
|
75
|
-
});
|
|
76
|
-
setSelectedColumn(selectedColumn);
|
|
77
|
-
}
|
|
78
|
-
setColumnFilterOpen(columnKey, open);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return column;
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
var columnsWithFilter = useMemo(function () {
|
|
87
|
-
return autoAddFilterForColumn ? autoAddFilterToColumns(columns) : columns;
|
|
88
|
-
}, [columns, filters, autoAddFilterToColumns, filterOpenMap]);
|
|
89
|
-
return {
|
|
90
|
-
columnsWithFilter: columnsWithFilter,
|
|
91
|
-
getColumnKey: getColumnKey
|
|
92
|
-
};
|
|
93
|
-
};
|
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,59 +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
|
-
return (
|
|
52
|
-
<CreekSearchProvider columns={columns} onSubmit={onSubmit}>
|
|
53
|
-
<div className={classnames(styles.creekSearchContainer, justify === 'end' && styles.creekSearchContainerEnd)}>
|
|
54
|
-
<CreekSearchInput />
|
|
55
|
-
<CreekFilterDisplay className={styles.creekSearchFilterDisplay} />
|
|
56
|
-
</div>
|
|
57
|
-
</CreekSearchProvider>
|
|
58
|
-
);
|
|
59
|
-
};
|