@creekjs/web-components 1.0.0

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.
Files changed (73) hide show
  1. package/.fatherrc.ts +13 -0
  2. package/.turbo/daemon/deec863de02760ed-turbo.log.2024-11-20 +0 -0
  3. package/README.md +1026 -0
  4. package/dist/bg-center/index.js +28 -0
  5. package/dist/creek-config-provider/CreekConfigContext.js +2 -0
  6. package/dist/creek-config-provider/index.js +14 -0
  7. package/dist/creek-hooks/index.js +1 -0
  8. package/dist/creek-hooks/useViewportHeight.js +147 -0
  9. package/dist/creek-icon/index.js +37 -0
  10. package/dist/creek-keep-alive/index.js +20 -0
  11. package/dist/creek-layout/CollapseButton.js +59 -0
  12. package/dist/creek-layout/Exception/NotFound.js +13 -0
  13. package/dist/creek-layout/Exception/NotFoundPage.js +5 -0
  14. package/dist/creek-layout/Exception/index.js +8 -0
  15. package/dist/creek-layout/HeaderContent/FullScreen.js +50 -0
  16. package/dist/creek-layout/HeaderContent/UserInfo.js +58 -0
  17. package/dist/creek-layout/HeaderContent/index.js +33 -0
  18. package/dist/creek-layout/index.js +86 -0
  19. package/dist/creek-loading/index.js +52 -0
  20. package/dist/creek-search/CreekSearch.js +51 -0
  21. package/dist/creek-search/CreekSearchContext.js +546 -0
  22. package/dist/creek-search/CreekSearchFilterDisplay.js +97 -0
  23. package/dist/creek-search/CreekSearchInput.js +96 -0
  24. package/dist/creek-search/CreekSearchValueSelector.js +422 -0
  25. package/dist/creek-search/index.js +5 -0
  26. package/dist/creek-search/type.js +1 -0
  27. package/dist/creek-table/SearchTable.js +121 -0
  28. package/dist/creek-table/TableOptionRender.js +65 -0
  29. package/dist/creek-table/TableViewContent.js +45 -0
  30. package/dist/creek-table/hooks/index.js +3 -0
  31. package/dist/creek-table/hooks/useAdaptiveToolBar.js +48 -0
  32. package/dist/creek-table/hooks/useAutoAddFilterToColumns.js +93 -0
  33. package/dist/creek-table/hooks/useElementDistance.js +58 -0
  34. package/dist/creek-table/index.js +25 -0
  35. package/dist/creek-table/toolBarRender.js +36 -0
  36. package/dist/creek-table/type.js +1 -0
  37. package/dist/index.js +7 -0
  38. package/package.json +19 -0
  39. package/src/bg-center/index.tsx +26 -0
  40. package/src/creek-config-provider/CreekConfigContext.tsx +7 -0
  41. package/src/creek-config-provider/index.tsx +12 -0
  42. package/src/creek-hooks/index.ts +1 -0
  43. package/src/creek-hooks/useViewportHeight.tsx +154 -0
  44. package/src/creek-icon/index.tsx +34 -0
  45. package/src/creek-keep-alive/index.tsx +11 -0
  46. package/src/creek-layout/CollapseButton.tsx +66 -0
  47. package/src/creek-layout/Exception/NotFound.tsx +12 -0
  48. package/src/creek-layout/Exception/NotFoundPage.tsx +4 -0
  49. package/src/creek-layout/Exception/index.tsx +10 -0
  50. package/src/creek-layout/HeaderContent/FullScreen.tsx +46 -0
  51. package/src/creek-layout/HeaderContent/UserInfo.tsx +54 -0
  52. package/src/creek-layout/HeaderContent/index.tsx +27 -0
  53. package/src/creek-layout/index.tsx +98 -0
  54. package/src/creek-loading/index.tsx +35 -0
  55. package/src/creek-search/CreekSearch.tsx +59 -0
  56. package/src/creek-search/CreekSearchContext.tsx +593 -0
  57. package/src/creek-search/CreekSearchFilterDisplay.tsx +84 -0
  58. package/src/creek-search/CreekSearchInput.tsx +75 -0
  59. package/src/creek-search/CreekSearchValueSelector.tsx +324 -0
  60. package/src/creek-search/index.tsx +5 -0
  61. package/src/creek-search/type.ts +9 -0
  62. package/src/creek-table/SearchTable.tsx +115 -0
  63. package/src/creek-table/TableOptionRender.tsx +57 -0
  64. package/src/creek-table/TableViewContent.tsx +44 -0
  65. package/src/creek-table/hooks/index.ts +4 -0
  66. package/src/creek-table/hooks/useAdaptiveToolBar.tsx +45 -0
  67. package/src/creek-table/hooks/useAutoAddFilterToColumns.tsx +90 -0
  68. package/src/creek-table/hooks/useElementDistance.tsx +64 -0
  69. package/src/creek-table/index.tsx +16 -0
  70. package/src/creek-table/toolBarRender.tsx +28 -0
  71. package/src/creek-table/type.ts +21 -0
  72. package/src/index.tsx +8 -0
  73. package/tsconfig.json +12 -0
@@ -0,0 +1,28 @@
1
+ import { createStyles } from 'antd-style';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export var BgCenter = function BgCenter(_ref) {
4
+ var children = _ref.children;
5
+ var useStyles = createStyles(function (_ref2) {
6
+ var token = _ref2.token;
7
+ return {
8
+ bgCenterContianer: {
9
+ display: 'flex',
10
+ alignItems: 'center',
11
+ justifyContent: 'center',
12
+ position: 'fixed',
13
+ top: 0,
14
+ left: 0,
15
+ right: 0,
16
+ bottom: 0,
17
+ backgroundColor: 'rgba(255, 255, 255, 0.7)',
18
+ zIndex: token.zIndexBase
19
+ }
20
+ };
21
+ });
22
+ var _useStyles = useStyles(),
23
+ styles = _useStyles.styles;
24
+ return /*#__PURE__*/_jsx("div", {
25
+ className: styles.bgCenterContianer,
26
+ children: children
27
+ });
28
+ };
@@ -0,0 +1,2 @@
1
+ import { createContext } from 'react';
2
+ export var CreekConfigContext = /*#__PURE__*/createContext({});
@@ -0,0 +1,14 @@
1
+ var _excluded = ["children"];
2
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
+ import { CreekConfigContext } from "./CreekConfigContext";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ export var CreekConfigProvider = function CreekConfigProvider(props) {
7
+ var children = props.children,
8
+ more = _objectWithoutProperties(props, _excluded);
9
+ return /*#__PURE__*/_jsx(CreekConfigContext.Provider, {
10
+ value: more,
11
+ children: children
12
+ });
13
+ };
14
+ CreekConfigProvider.CreekConfigContext = CreekConfigContext;
@@ -0,0 +1 @@
1
+ export * from "./useViewportHeight";
@@ -0,0 +1,147 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ 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."); }
7
+ 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); }
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
+ 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
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import { useDebounceEffect, useDeepCompareEffect, useEventListener, useMemoizedFn, useMount, useUnmount } from 'ahooks';
12
+ import { useRef, useState } from 'react';
13
+ export var useViewportHeight = function useViewportHeight() {
14
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15
+ var _options$bottomOffset = options.bottomOffset,
16
+ bottomOffset = _options$bottomOffset === void 0 ? 0 : _options$bottomOffset,
17
+ topOffset = options.topOffset,
18
+ _options$margin = options.margin,
19
+ margin = _options$margin === void 0 ? 0 : _options$margin,
20
+ _options$minHeight = options.minHeight,
21
+ minHeight = _options$minHeight === void 0 ? 0 : _options$minHeight,
22
+ maxHeight = options.maxHeight,
23
+ _options$debug = options.debug,
24
+ debug = _options$debug === void 0 ? false : _options$debug,
25
+ _options$debounceDela = options.debounceDelay,
26
+ debounceDelay = _options$debounceDela === void 0 ? 16 : _options$debounceDela,
27
+ _options$deps = options.deps,
28
+ deps = _options$deps === void 0 ? [] : _options$deps,
29
+ isObserverParent = options.isObserverParent;
30
+ var _useState = useState(undefined),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ viewPortHeight = _useState2[0],
33
+ setHeight = _useState2[1];
34
+ var containerRef = useRef(null);
35
+ var resizeObserverRef = useRef(null);
36
+ var mutationObserverRef = useRef(null);
37
+
38
+ // 使用 useMemoizedFn 缓存计算函数,避免不必要的重新创建
39
+ var calculateHeight = useMemoizedFn(function () {
40
+ if (!containerRef.current) return;
41
+ var container = containerRef.current;
42
+ var rect = container.getBoundingClientRect();
43
+
44
+ // 计算顶部偏移量
45
+ var calculatedTopOffset = topOffset !== null && topOffset !== void 0 ? topOffset : rect.top;
46
+
47
+ // 计算可用高度
48
+ var viewportHeight = window.innerHeight;
49
+ var availableHeight = viewportHeight - calculatedTopOffset - bottomOffset - margin;
50
+
51
+ // 应用最小/最大高度限制
52
+ if (minHeight > 0) {
53
+ availableHeight = Math.max(availableHeight, minHeight);
54
+ }
55
+ if (maxHeight && maxHeight > 0) {
56
+ availableHeight = Math.min(availableHeight, maxHeight);
57
+ }
58
+ if (debug) {
59
+ console.log('计算可视区域高度:', {
60
+ viewportHeight: viewportHeight,
61
+ calculatedTopOffset: calculatedTopOffset,
62
+ bottomOffset: bottomOffset,
63
+ margin: margin,
64
+ minHeight: minHeight,
65
+ maxHeight: maxHeight,
66
+ availableHeight: availableHeight,
67
+ containerRect: rect
68
+ });
69
+ }
70
+ setHeight(availableHeight);
71
+ });
72
+
73
+ // 使用 ahooks 的 useEventListener 监听窗口 resize 事件
74
+ useEventListener('resize', calculateHeight, {
75
+ target: function target() {
76
+ return window;
77
+ }
78
+ });
79
+
80
+ // 使用 useDebounceEffect 处理依赖项变化时的防抖计算
81
+ useDebounceEffect(function () {
82
+ if (containerRef.current) {
83
+ calculateHeight();
84
+ }
85
+ }, [].concat(_toConsumableArray(deps), [topOffset, bottomOffset, margin, minHeight, maxHeight]), {
86
+ wait: debounceDelay
87
+ });
88
+
89
+ // 初始化计算
90
+ useMount(function () {
91
+ calculateHeight();
92
+ });
93
+
94
+ // 设置观察器
95
+ var setupObservers = useMemoizedFn(function () {
96
+ if (!containerRef.current) return;
97
+ var container = containerRef.current;
98
+ var observerParent = isObserverParent ? container.parentElement : container;
99
+ if (!observerParent) return;
100
+ cleanupObservers();
101
+ resizeObserverRef.current = new ResizeObserver(function () {
102
+ calculateHeight();
103
+ });
104
+ resizeObserverRef.current.observe(container);
105
+ mutationObserverRef.current = new MutationObserver(function () {
106
+ setTimeout(calculateHeight, 0);
107
+ });
108
+ mutationObserverRef.current.observe(observerParent, {
109
+ childList: true,
110
+ subtree: false,
111
+ // 只监听直接子节点变化
112
+ attributes: false
113
+ });
114
+ });
115
+
116
+ // 清理观察器
117
+ var cleanupObservers = useMemoizedFn(function () {
118
+ if (resizeObserverRef.current) {
119
+ resizeObserverRef.current.disconnect();
120
+ resizeObserverRef.current = null;
121
+ }
122
+ if (mutationObserverRef.current) {
123
+ mutationObserverRef.current.disconnect();
124
+ mutationObserverRef.current = null;
125
+ }
126
+ });
127
+
128
+ // 组件卸载时清理
129
+ useUnmount(function () {
130
+ cleanupObservers();
131
+ });
132
+ useDeepCompareEffect(function () {
133
+ if (containerRef.current) {
134
+ setupObservers();
135
+ }
136
+ }, [containerRef.current]);
137
+ return {
138
+ /** 容器引用,需要绑定到目标元素的容器 */
139
+ containerRef: containerRef,
140
+ /** 计算得出的可视区域高度 */
141
+ viewPortHeight: viewPortHeight,
142
+ /** 手动重新计算高度的方法 */
143
+ recalculate: calculateHeight,
144
+ /** 是否已完成高度计算 */
145
+ isCalculated: viewPortHeight !== undefined
146
+ };
147
+ };
@@ -0,0 +1,37 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["component", "type", "iconFontCNs"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
+ import Icon, { createFromIconfontCN } from '@ant-design/icons';
11
+ import { isEmpty } from 'lodash';
12
+ import { useContext } from 'react';
13
+ import { CreekConfigProvider } from "../creek-config-provider";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ export var CreekIcon = function CreekIcon(props) {
16
+ var _useContext = useContext(CreekConfigProvider.CreekConfigContext),
17
+ iconFontCNsContext = _useContext.iconFontCNs;
18
+ var component = props.component,
19
+ type = props.type,
20
+ iconFontCNs = props.iconFontCNs,
21
+ more = _objectWithoutProperties(props, _excluded);
22
+ var _iconFontCNs = iconFontCNs || iconFontCNsContext;
23
+ if (component) {
24
+ return /*#__PURE__*/_jsx(Icon, _objectSpread({
25
+ component: component
26
+ }, more));
27
+ }
28
+ if (type && !isEmpty(_iconFontCNs)) {
29
+ var IconFont = createFromIconfontCN({
30
+ scriptUrl: _iconFontCNs
31
+ });
32
+ return /*#__PURE__*/_jsx(IconFont, _objectSpread({
33
+ type: type
34
+ }, more));
35
+ }
36
+ return null;
37
+ };
@@ -0,0 +1,20 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useEffect, useState } from 'react';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ export var CreekKeepAlive = function CreekKeepAlive() {
10
+ var _useState = useState(false),
11
+ _useState2 = _slicedToArray(_useState, 2),
12
+ isMounted = _useState2[0],
13
+ setIsMounted = _useState2[1];
14
+ useEffect(function () {
15
+ setIsMounted(true);
16
+ }, []);
17
+ return /*#__PURE__*/_jsx("div", {
18
+ children: "KeepAlive"
19
+ });
20
+ };
@@ -0,0 +1,59 @@
1
+ import { ArrowLeftOutlined, ArrowRightOutlined } from "@ant-design/icons";
2
+ import { createStyles } from "antd-style";
3
+ import { useEffect } from "react";
4
+ import { create } from "zustand";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ var useStyles = createStyles(function (_ref) {
7
+ var token = _ref.token;
8
+ return {
9
+ buttonContainer: {
10
+ padding: token.padding
11
+ },
12
+ iconContainer: {
13
+ width: "24px",
14
+ height: "24px",
15
+ background: "#f3f3f3",
16
+ display: "flex",
17
+ alignItems: "center",
18
+ justifyContent: "center",
19
+ cursor: "pointer"
20
+ }
21
+ };
22
+ });
23
+ export var useCollapsedStore = create(function (set, get) {
24
+ return {
25
+ collapsed: false,
26
+ changeCollapsed: function changeCollapsed() {
27
+ var _collapsed = get().collapsed;
28
+ set({
29
+ collapsed: !_collapsed
30
+ });
31
+ }
32
+ };
33
+ });
34
+ export var CollapsedButton = function CollapsedButton(props) {
35
+ var _props$collapsed = props.collapsed,
36
+ defaultCollapsed = _props$collapsed === void 0 ? false : _props$collapsed;
37
+ var _useStyles = useStyles(),
38
+ styles = _useStyles.styles;
39
+ var _useCollapsedStore$ge = useCollapsedStore.getState(),
40
+ collapsed = _useCollapsedStore$ge.collapsed,
41
+ changeCollapsed = _useCollapsedStore$ge.changeCollapsed;
42
+ useEffect(function () {
43
+ if (defaultCollapsed !== collapsed) {
44
+ useCollapsedStore.setState({
45
+ collapsed: defaultCollapsed
46
+ });
47
+ }
48
+ }, [defaultCollapsed]);
49
+ return /*#__PURE__*/_jsx("div", {
50
+ className: styles.buttonContainer,
51
+ onClick: function onClick() {
52
+ changeCollapsed();
53
+ },
54
+ children: /*#__PURE__*/_jsx("div", {
55
+ className: styles.iconContainer,
56
+ children: collapsed ? /*#__PURE__*/_jsx(ArrowRightOutlined, {}) : /*#__PURE__*/_jsx(ArrowLeftOutlined, {})
57
+ })
58
+ });
59
+ };
@@ -0,0 +1,13 @@
1
+ import { Button, Result } from "antd";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export var NotFound = function NotFound() {
4
+ return /*#__PURE__*/_jsx(Result, {
5
+ status: "404",
6
+ title: "404",
7
+ subTitle: "Sorry, the page you visited does not exist.",
8
+ extra: /*#__PURE__*/_jsx(Button, {
9
+ type: "primary",
10
+ children: "Back Home"
11
+ })
12
+ });
13
+ };
@@ -0,0 +1,5 @@
1
+ import { NotFound } from "./NotFound";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export default (function () {
4
+ return /*#__PURE__*/_jsx(NotFound, {});
5
+ });
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export * from "./NotFound";
3
+ export var Exception = function Exception(props) {
4
+ var children = props.children;
5
+ return /*#__PURE__*/_jsx("div", {
6
+ children: children
7
+ });
8
+ };
@@ -0,0 +1,50 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { FullscreenExitOutlined, FullscreenOutlined } from "@ant-design/icons";
8
+ import { useFullscreen, useMemoizedFn } from "ahooks";
9
+ import { Tooltip } from "antd";
10
+ import { create } from "zustand";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { Fragment as _Fragment } from "react/jsx-runtime";
13
+ export var useFullScreenStore = create(function (set, get) {
14
+ return {
15
+ isFullScreen: false,
16
+ changeFullScreen: function changeFullScreen() {
17
+ var _isFullScreen = get().isFullScreen;
18
+ set({
19
+ isFullScreen: !_isFullScreen
20
+ });
21
+ }
22
+ };
23
+ });
24
+ export var FullScreen = function FullScreen() {
25
+ var _useFullscreen = useFullscreen(document.body),
26
+ _useFullscreen2 = _slicedToArray(_useFullscreen, 2),
27
+ toggleFullscreen = _useFullscreen2[1].toggleFullscreen;
28
+ var _useFullScreenStore$g = useFullScreenStore.getState(),
29
+ isFullScreen = _useFullScreenStore$g.isFullScreen,
30
+ changeFullScreen = _useFullScreenStore$g.changeFullScreen;
31
+ var handleFullScreen = useMemoizedFn(function () {
32
+ toggleFullscreen();
33
+ changeFullScreen();
34
+ });
35
+ return /*#__PURE__*/_jsx(_Fragment, {
36
+ children: isFullScreen ? /*#__PURE__*/_jsx(Tooltip, {
37
+ title: "\u9000\u51FA\u5168\u5C4F",
38
+ placement: "top",
39
+ children: /*#__PURE__*/_jsx(FullscreenExitOutlined, {
40
+ onClick: handleFullScreen
41
+ })
42
+ }) : /*#__PURE__*/_jsx(Tooltip, {
43
+ title: "\u5168\u5C4F",
44
+ placement: "top",
45
+ children: /*#__PURE__*/_jsx(FullscreenOutlined, {
46
+ onClick: handleFullScreen
47
+ })
48
+ })
49
+ });
50
+ };
@@ -0,0 +1,58 @@
1
+ import { LogoutOutlined } from "@ant-design/icons";
2
+ import { Avatar, Dropdown, Space } from "antd";
3
+ import { createStyles } from "antd-style";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ var useStyles = createStyles(function (_ref) {
7
+ var token = _ref.token;
8
+ return {
9
+ avatarContainer: {
10
+ backgroundColor: token.colorPrimary,
11
+ width: 24,
12
+ height: 24
13
+ },
14
+ userInfoDropdownOverlay: {
15
+ ".ant-dropdown-menu": {
16
+ padding: "8px 0"
17
+ },
18
+ ".ant-dropdown-menu-item": {
19
+ ".ant-dropdown-menu-item-icon": {
20
+ fontSize: "18px",
21
+ marginRight: "8px"
22
+ }
23
+ }
24
+ }
25
+ };
26
+ });
27
+ export var UserInfo = function UserInfo() {
28
+ var _useStyles = useStyles(),
29
+ styles = _useStyles.styles;
30
+ var userInfoMenu = {
31
+ items: [{
32
+ key: "logout",
33
+ label: /*#__PURE__*/_jsxs(Space, {
34
+ size: 8,
35
+ children: [/*#__PURE__*/_jsx(LogoutOutlined, {}), /*#__PURE__*/_jsx("span", {
36
+ children: "\u9000\u51FA\u767B\u5F55"
37
+ })]
38
+ }),
39
+ onClick: function onClick() {}
40
+ }]
41
+ };
42
+ return /*#__PURE__*/_jsx(Dropdown, {
43
+ arrow: true,
44
+ placement: "bottom",
45
+ overlayClassName: styles.userInfoDropdownOverlay,
46
+ menu: userInfoMenu,
47
+ children: /*#__PURE__*/_jsxs(Space, {
48
+ size: 4,
49
+ align: "center",
50
+ children: [/*#__PURE__*/_jsx(Avatar, {
51
+ className: styles.avatarContainer,
52
+ children: "C"
53
+ }), /*#__PURE__*/_jsx("span", {
54
+ children: "Creek"
55
+ })]
56
+ })
57
+ });
58
+ };
@@ -0,0 +1,33 @@
1
+ function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
2
+ import { Divider, Flex, Space } from 'antd';
3
+ import { createStyles } from 'antd-style';
4
+ import { FullScreen } from "./FullScreen";
5
+ import { UserInfo } from "./UserInfo";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ var useStyles = createStyles(function (_ref) {
9
+ _objectDestructuringEmpty(_ref);
10
+ return {
11
+ headerContentContainer: {
12
+ color: '#fff'
13
+ },
14
+ dividerContainer: {
15
+ backgroundColor: '#9b9999'
16
+ }
17
+ };
18
+ });
19
+ export var HeaderContent = function HeaderContent() {
20
+ var _useStyles = useStyles(),
21
+ styles = _useStyles.styles;
22
+ return /*#__PURE__*/_jsxs(Flex, {
23
+ justify: "space-between",
24
+ className: styles.headerContentContainer,
25
+ children: [/*#__PURE__*/_jsx("span", {}), /*#__PURE__*/_jsxs(Space, {
26
+ split: /*#__PURE__*/_jsx(Divider, {
27
+ type: "vertical",
28
+ className: styles.dividerContainer
29
+ }),
30
+ children: [/*#__PURE__*/_jsx(FullScreen, {}), /*#__PURE__*/_jsx(UserInfo, {})]
31
+ })]
32
+ });
33
+ };
@@ -0,0 +1,86 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["route", "userConfig", "runtimeConfig", "children", "location", "navigate"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
+ import { ProLayout } from "@ant-design/pro-components";
11
+ import { useMemoizedFn } from "ahooks";
12
+ import { theme } from "antd";
13
+ import classnames from "classnames";
14
+ import { CollapsedButton, useCollapsedStore } from "./CollapseButton";
15
+ import { Exception } from "./Exception";
16
+ import { HeaderContent } from "./HeaderContent";
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ export var CreekLayout = function CreekLayout(props) {
19
+ var route = props.route,
20
+ userConfig = props.userConfig,
21
+ runtimeConfig = props.runtimeConfig,
22
+ children = props.children,
23
+ location = props.location,
24
+ navigate = props.navigate,
25
+ more = _objectWithoutProperties(props, _excluded);
26
+ var useToken = theme.useToken;
27
+ var _useToken = useToken(),
28
+ token = _useToken.token;
29
+ var _useCollapsedStore = useCollapsedStore(),
30
+ collapsed = _useCollapsedStore.collapsed;
31
+ var menuItemRender = useMemoizedFn(function (itemProps, defaultDom) {
32
+ return /*#__PURE__*/_jsx("span", {
33
+ onClick: function onClick() {
34
+ if (navigate) {
35
+ navigate(itemProps.path);
36
+ }
37
+ },
38
+ children: defaultDom
39
+ });
40
+ });
41
+ return /*#__PURE__*/_jsx(ProLayout, _objectSpread(_objectSpread({
42
+ className: classnames("creek-layout-container", userConfig === null || userConfig === void 0 ? void 0 : userConfig.className),
43
+ layout: "mix",
44
+ route: route,
45
+ title: userConfig === null || userConfig === void 0 ? void 0 : userConfig.title,
46
+ siderWidth: 212,
47
+ location: location,
48
+ menuItemRender: menuItemRender,
49
+ headerContentRender: function headerContentRender() {
50
+ return /*#__PURE__*/_jsx(HeaderContent, {});
51
+ },
52
+ token: {
53
+ header: {
54
+ colorBgHeader: "#2c2c2c",
55
+ colorHeaderTitle: "#fff",
56
+ colorTextMenuSelected: "#fff",
57
+ heightLayoutHeader: 48
58
+ },
59
+ sider: {
60
+ colorMenuBackground: "#fff",
61
+ colorBgMenuItemSelected: "transparent",
62
+ colorTextMenuActive: token.colorPrimary,
63
+ colorTextMenuSelected: token.colorPrimary,
64
+ colorTextMenuItemHover: token.colorPrimary,
65
+ colorTextMenu: "#333"
66
+ },
67
+ pageContainer: {
68
+ paddingBlockPageContainerContent: 0,
69
+ paddingInlinePageContainerContent: 0
70
+ }
71
+ },
72
+ fixSiderbar: true,
73
+ fixedHeader: true,
74
+ collapsed: collapsed,
75
+ collapsedButtonRender: function collapsedButtonRender(collapsed) {
76
+ return /*#__PURE__*/_jsx(CollapsedButton, {
77
+ collapsed: collapsed
78
+ });
79
+ }
80
+ }, more), {}, {
81
+ children: /*#__PURE__*/_jsx(Exception, {
82
+ children: children
83
+ })
84
+ }));
85
+ };
86
+ export * from "./Exception";
@@ -0,0 +1,52 @@
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
+ 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; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ 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); }
10
+ import { Spin } from 'antd';
11
+ import React from 'react';
12
+ import { createRoot } from 'react-dom/client';
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ export var Loading = /*#__PURE__*/function () {
15
+ function Loading() {
16
+ _classCallCheck(this, Loading);
17
+ }
18
+ _createClass(Loading, null, [{
19
+ key: "createContainer",
20
+ value: function createContainer() {
21
+ if (this.container) return this.container;
22
+ this.container = document.createElement('div');
23
+ document.body.appendChild(this.container);
24
+ this.root = createRoot(this.container);
25
+ return this.container;
26
+ }
27
+ }, {
28
+ key: "open",
29
+ value: function open(config) {
30
+ var _this$root;
31
+ this.createContainer();
32
+ (_this$root = this.root) === null || _this$root === void 0 || _this$root.render( /*#__PURE__*/_jsx(Spin, _objectSpread(_objectSpread({}, config), {}, {
33
+ fullscreen: true
34
+ })));
35
+ }
36
+ }, {
37
+ key: "close",
38
+ value: function close() {
39
+ if (this.root) {
40
+ this.root.unmount();
41
+ if (this.container) {
42
+ document.body.removeChild(this.container);
43
+ this.container = null;
44
+ this.root = null;
45
+ }
46
+ }
47
+ }
48
+ }]);
49
+ return Loading;
50
+ }();
51
+ _defineProperty(Loading, "container", null);
52
+ _defineProperty(Loading, "root", null);