@creekjs/web-components 1.0.2 → 1.0.4

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 (154) hide show
  1. package/.fatherrc.ts +1 -5
  2. package/.turbo/turbo-father$colon$build.log +39 -0
  3. package/.turbo/turbo-father$colon$dev.log +33 -0
  4. package/dist/creek-config-provider/CreekConfigContext.js +31 -2
  5. package/dist/creek-config-provider/CreekConfigContext.js.map +7 -0
  6. package/dist/creek-config-provider/index.js +35 -13
  7. package/dist/creek-config-provider/index.js.map +7 -0
  8. package/dist/creek-hooks/index.d.ts +1 -0
  9. package/dist/creek-hooks/index.js +26 -1
  10. package/dist/creek-hooks/index.js.map +7 -0
  11. package/dist/creek-hooks/useApp/DrawerHelper.d.ts +9 -0
  12. package/dist/creek-hooks/useApp/DrawerHelper.js +62 -0
  13. package/dist/creek-hooks/useApp/DrawerHelper.js.map +7 -0
  14. package/dist/creek-hooks/useApp/ModalHelper.d.ts +9 -0
  15. package/dist/creek-hooks/useApp/ModalHelper.js +62 -0
  16. package/dist/creek-hooks/useApp/ModalHelper.js.map +7 -0
  17. package/dist/creek-hooks/useApp/index.d.ts +25 -0
  18. package/dist/creek-hooks/useApp/index.js +118 -0
  19. package/dist/creek-hooks/useApp/index.js.map +7 -0
  20. package/dist/creek-hooks/useApp/types.d.ts +26 -0
  21. package/dist/creek-hooks/useApp/types.js +18 -0
  22. package/dist/creek-hooks/useApp/types.js.map +7 -0
  23. package/dist/creek-hooks/useViewportHeight.js +99 -97
  24. package/dist/creek-hooks/useViewportHeight.js.map +7 -0
  25. package/dist/creek-icon/index.js +53 -31
  26. package/dist/creek-icon/index.js.map +7 -0
  27. package/dist/creek-keep-alive/index.js +36 -18
  28. package/dist/creek-keep-alive/index.js.map +7 -0
  29. package/dist/creek-layout/CollapseButton.js +69 -47
  30. package/dist/creek-layout/CollapseButton.js.map +7 -0
  31. package/dist/creek-layout/Exception/NotFound.js +42 -13
  32. package/dist/creek-layout/Exception/NotFound.js.map +7 -0
  33. package/dist/creek-layout/Exception/NotFoundPage.js +30 -5
  34. package/dist/creek-layout/Exception/NotFoundPage.js.map +7 -0
  35. package/dist/creek-layout/Exception/index.js +37 -8
  36. package/dist/creek-layout/Exception/index.js.map +7 -0
  37. package/dist/creek-layout/HeaderContent/FullScreen.js +45 -39
  38. package/dist/creek-layout/HeaderContent/FullScreen.js.map +7 -0
  39. package/dist/creek-layout/HeaderContent/UserInfo.js +75 -53
  40. package/dist/creek-layout/HeaderContent/UserInfo.js.map +7 -0
  41. package/dist/creek-layout/HeaderContent/index.js +48 -28
  42. package/dist/creek-layout/HeaderContent/index.js.map +7 -0
  43. package/dist/creek-layout/index.js +117 -81
  44. package/dist/creek-layout/index.js.map +7 -0
  45. package/dist/creek-loading/index.js +55 -48
  46. package/dist/creek-loading/index.js.map +7 -0
  47. package/dist/creek-table/SearchTable.js +118 -114
  48. package/dist/creek-table/SearchTable.js.map +7 -0
  49. package/dist/creek-table/TableOptionRender.js +69 -60
  50. package/dist/creek-table/TableOptionRender.js.map +7 -0
  51. package/dist/creek-table/hooks/index.d.ts +2 -1
  52. package/dist/creek-table/hooks/index.js +30 -3
  53. package/dist/creek-table/hooks/index.js.map +7 -0
  54. package/dist/creek-table/hooks/useAdaptiveToolBar.js +48 -36
  55. package/dist/creek-table/hooks/useAdaptiveToolBar.js.map +7 -0
  56. package/dist/creek-table/hooks/useAutoWidthColumns.d.ts +6 -0
  57. package/dist/creek-table/hooks/useAutoWidthColumns.js +187 -0
  58. package/dist/creek-table/hooks/useAutoWidthColumns.js.map +7 -0
  59. package/dist/creek-table/hooks/useElementDistance.js +51 -39
  60. package/dist/creek-table/hooks/useElementDistance.js.map +7 -0
  61. package/dist/creek-table/hooks/useTableScrollHeight.d.ts +1 -0
  62. package/dist/creek-table/hooks/useTableScrollHeight.js +72 -0
  63. package/dist/creek-table/hooks/useTableScrollHeight.js.map +7 -0
  64. package/dist/creek-table/index.js +35 -25
  65. package/dist/creek-table/index.js.map +7 -0
  66. package/dist/creek-table/toolBarRender.d.ts +1 -0
  67. package/dist/creek-table/toolBarRender.js +55 -33
  68. package/dist/creek-table/toolBarRender.js.map +7 -0
  69. package/dist/creek-table/type.d.ts +1 -1
  70. package/dist/creek-table/type.js +18 -1
  71. package/dist/creek-table/type.js.map +7 -0
  72. package/dist/index.d.ts +1 -2
  73. package/dist/index.js +34 -7
  74. package/dist/index.js.map +7 -0
  75. package/package.json +2 -2
  76. package/src/creek-hooks/index.ts +2 -0
  77. package/src/creek-hooks/useApp/DrawerHelper.tsx +43 -0
  78. package/src/creek-hooks/useApp/ModalHelper.tsx +43 -0
  79. package/src/creek-hooks/useApp/index.tsx +119 -0
  80. package/src/creek-hooks/useApp/types.ts +25 -0
  81. package/src/creek-hooks/useViewportHeight.tsx +34 -5
  82. package/src/creek-layout/index.tsx +2 -2
  83. package/src/creek-table/SearchTable.tsx +69 -77
  84. package/src/creek-table/hooks/index.ts +3 -1
  85. package/src/creek-table/hooks/useAutoWidthColumns.tsx +212 -0
  86. package/src/creek-table/hooks/useTableScrollHeight.tsx +63 -0
  87. package/src/creek-table/index.tsx +2 -6
  88. package/src/creek-table/toolBarRender.tsx +3 -3
  89. package/src/creek-table/type.ts +1 -1
  90. package/src/index.tsx +2 -2
  91. package/dist/bg-center/index.d.ts +0 -5
  92. package/dist/bg-center/index.d.ts.map +0 -1
  93. package/dist/bg-center/index.js +0 -28
  94. package/dist/creek-config-provider/CreekConfigContext.d.ts.map +0 -1
  95. package/dist/creek-config-provider/index.d.ts.map +0 -1
  96. package/dist/creek-hooks/index.d.ts.map +0 -1
  97. package/dist/creek-hooks/useViewportHeight.d.ts.map +0 -1
  98. package/dist/creek-icon/index.d.ts.map +0 -1
  99. package/dist/creek-keep-alive/index.d.ts.map +0 -1
  100. package/dist/creek-layout/CollapseButton.d.ts.map +0 -1
  101. package/dist/creek-layout/Exception/NotFound.d.ts.map +0 -1
  102. package/dist/creek-layout/Exception/NotFoundPage.d.ts.map +0 -1
  103. package/dist/creek-layout/Exception/index.d.ts.map +0 -1
  104. package/dist/creek-layout/HeaderContent/FullScreen.d.ts.map +0 -1
  105. package/dist/creek-layout/HeaderContent/UserInfo.d.ts.map +0 -1
  106. package/dist/creek-layout/HeaderContent/index.d.ts.map +0 -1
  107. package/dist/creek-layout/index.d.ts.map +0 -1
  108. package/dist/creek-loading/index.d.ts.map +0 -1
  109. package/dist/creek-search/CreekSearch.d.ts +0 -7
  110. package/dist/creek-search/CreekSearch.d.ts.map +0 -1
  111. package/dist/creek-search/CreekSearch.js +0 -51
  112. package/dist/creek-search/CreekSearchContext.d.ts +0 -54
  113. package/dist/creek-search/CreekSearchContext.d.ts.map +0 -1
  114. package/dist/creek-search/CreekSearchContext.js +0 -546
  115. package/dist/creek-search/CreekSearchFilterDisplay.d.ts +0 -5
  116. package/dist/creek-search/CreekSearchFilterDisplay.d.ts.map +0 -1
  117. package/dist/creek-search/CreekSearchFilterDisplay.js +0 -97
  118. package/dist/creek-search/CreekSearchInput.d.ts +0 -4
  119. package/dist/creek-search/CreekSearchInput.d.ts.map +0 -1
  120. package/dist/creek-search/CreekSearchInput.js +0 -96
  121. package/dist/creek-search/CreekSearchValueSelector.d.ts +0 -5
  122. package/dist/creek-search/CreekSearchValueSelector.d.ts.map +0 -1
  123. package/dist/creek-search/CreekSearchValueSelector.js +0 -422
  124. package/dist/creek-search/index.d.ts +0 -5
  125. package/dist/creek-search/index.d.ts.map +0 -1
  126. package/dist/creek-search/index.js +0 -5
  127. package/dist/creek-search/type.d.ts +0 -8
  128. package/dist/creek-search/type.d.ts.map +0 -1
  129. package/dist/creek-search/type.js +0 -1
  130. package/dist/creek-table/SearchTable.d.ts.map +0 -1
  131. package/dist/creek-table/TableOptionRender.d.ts.map +0 -1
  132. package/dist/creek-table/TableViewContent.d.ts +0 -4
  133. package/dist/creek-table/TableViewContent.d.ts.map +0 -1
  134. package/dist/creek-table/TableViewContent.js +0 -47
  135. package/dist/creek-table/hooks/index.d.ts.map +0 -1
  136. package/dist/creek-table/hooks/useAdaptiveToolBar.d.ts.map +0 -1
  137. package/dist/creek-table/hooks/useAutoAddFilterToColumns.d.ts +0 -12
  138. package/dist/creek-table/hooks/useAutoAddFilterToColumns.d.ts.map +0 -1
  139. package/dist/creek-table/hooks/useAutoAddFilterToColumns.js +0 -96
  140. package/dist/creek-table/hooks/useElementDistance.d.ts.map +0 -1
  141. package/dist/creek-table/index.d.ts.map +0 -1
  142. package/dist/creek-table/toolBarRender.d.ts.map +0 -1
  143. package/dist/creek-table/type.d.ts.map +0 -1
  144. package/dist/index.d.ts.map +0 -1
  145. package/src/bg-center/index.tsx +0 -26
  146. package/src/creek-search/CreekSearch.tsx +0 -60
  147. package/src/creek-search/CreekSearchContext.tsx +0 -593
  148. package/src/creek-search/CreekSearchFilterDisplay.tsx +0 -84
  149. package/src/creek-search/CreekSearchInput.tsx +0 -75
  150. package/src/creek-search/CreekSearchValueSelector.tsx +0 -324
  151. package/src/creek-search/index.tsx +0 -5
  152. package/src/creek-search/type.ts +0 -9
  153. package/src/creek-table/TableViewContent.tsx +0 -46
  154. package/src/creek-table/hooks/useAutoAddFilterToColumns.tsx +0 -90
@@ -1,58 +1,70 @@
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 { useDebounceFn, useEventListener, useLatest } from 'ahooks';
8
- import { useEffect, useState } from 'react';
9
- var getElementCenter = function getElementCenter(element) {
10
- var rect = element.getBoundingClientRect();
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/creek-table/hooks/useElementDistance.tsx
20
+ var useElementDistance_exports = {};
21
+ __export(useElementDistance_exports, {
22
+ useElementDistance: () => useElementDistance
23
+ });
24
+ module.exports = __toCommonJS(useElementDistance_exports);
25
+ var import_ahooks = require("ahooks");
26
+ var import_react = require("react");
27
+ var getElementCenter = (element) => {
28
+ const rect = element.getBoundingClientRect();
11
29
  return {
12
30
  left: rect.left,
13
31
  width: rect.width
14
32
  };
15
33
  };
16
- var calculateDistance = function calculateDistance(pos1, pos2) {
17
- var x = Math.abs(pos2.left - pos1.left - pos1.width);
18
- return {
19
- x: x
20
- };
34
+ var calculateDistance = (pos1, pos2) => {
35
+ const x = Math.abs(pos2.left - pos1.left - pos1.width);
36
+ return { x };
21
37
  };
22
- export var useElementDistance = function useElementDistance(element1Ref, element2Ref) {
23
- var _useState = useState(null),
24
- _useState2 = _slicedToArray(_useState, 2),
25
- distance = _useState2[0],
26
- setDistance = _useState2[1];
27
- var distanceRef = useLatest(distance);
28
- var _useDebounceFn = useDebounceFn(function () {
38
+ var useElementDistance = (element1Ref, element2Ref) => {
39
+ const [distance, setDistance] = (0, import_react.useState)(null);
40
+ const distanceRef = (0, import_ahooks.useLatest)(distance);
41
+ const { run: calculateAndUpdateDistance } = (0, import_ahooks.useDebounceFn)(
42
+ () => {
29
43
  if (!element1Ref.current || !element2Ref.current) {
30
44
  if (distanceRef.current !== null) {
31
45
  setDistance(null);
32
46
  }
33
47
  return;
34
48
  }
35
- var pos1 = getElementCenter(element1Ref.current);
36
- var pos2 = getElementCenter(element2Ref.current);
37
- var newDistance = calculateDistance(pos1, pos2);
38
-
39
- // 只有当距离发生变化时才更新,避免不必要的重渲染
49
+ const pos1 = getElementCenter(element1Ref.current);
50
+ const pos2 = getElementCenter(element2Ref.current);
51
+ const newDistance = calculateDistance(pos1, pos2);
40
52
  if (!distanceRef.current || distanceRef.current.x !== newDistance.x) {
41
53
  setDistance(newDistance);
42
54
  }
43
- }, {
55
+ },
56
+ {
44
57
  wait: 100
45
- }),
46
- calculateAndUpdateDistance = _useDebounceFn.run;
47
-
48
- // 初始计算
49
- useEffect(function () {
58
+ }
59
+ );
60
+ (0, import_react.useEffect)(() => {
50
61
  calculateAndUpdateDistance();
51
62
  }, [element1Ref, element2Ref]);
52
-
53
- // 监听 window 的 resize 和 scroll 事件
54
- useEventListener('resize', calculateAndUpdateDistance, {
55
- target: window
56
- });
63
+ (0, import_ahooks.useEventListener)("resize", calculateAndUpdateDistance, { target: window });
57
64
  return distance;
58
- };
65
+ };
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
68
+ useElementDistance
69
+ });
70
+ //# sourceMappingURL=useElementDistance.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/creek-table/hooks/useElementDistance.tsx"],
4
+ "sourcesContent": ["import { useDebounceFn, useEventListener, useLatest } from 'ahooks';\nimport { useEffect, useState } from 'react';\n\ntype ElementRef = React.RefObject<HTMLElement>;\n\ninterface Position {\n left: number;\n width: number;\n}\n\ninterface Distance {\n x: number;\n}\n\nconst getElementCenter = (element: HTMLElement): Position => {\n const rect = element.getBoundingClientRect();\n return {\n left: rect.left,\n width: rect.width,\n };\n};\n\nconst calculateDistance = (pos1: Position, pos2: Position): Distance => {\n const x = Math.abs(pos2.left - pos1.left - pos1.width);\n return { x };\n};\n\nexport const useElementDistance = (element1Ref: ElementRef, element2Ref: ElementRef): Distance | null => {\n const [distance, setDistance] = useState<Distance | null>(null);\n const distanceRef = useLatest(distance);\n\n const { run: calculateAndUpdateDistance } = useDebounceFn(\n () => {\n if (!element1Ref.current || !element2Ref.current) {\n if (distanceRef.current !== null) {\n setDistance(null);\n }\n return;\n }\n\n const pos1 = getElementCenter(element1Ref.current);\n const pos2 = getElementCenter(element2Ref.current);\n const newDistance = calculateDistance(pos1, pos2);\n\n // 只有当距离发生变化时才更新,避免不必要的重渲染\n if (!distanceRef.current || distanceRef.current.x !== newDistance.x) {\n setDistance(newDistance);\n }\n },\n {\n wait: 100,\n },\n );\n\n // 初始计算\n useEffect(() => {\n calculateAndUpdateDistance();\n }, [element1Ref, element2Ref]);\n\n // 监听 window 的 resize 和 scroll 事件\n useEventListener('resize', calculateAndUpdateDistance, { target: window });\n\n return distance;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA2D;AAC3D,mBAAoC;AAapC,IAAM,mBAAmB,CAAC,YAAmC;AAC3D,QAAM,OAAO,QAAQ,sBAAsB;AAC3C,SAAO;AAAA,IACL,MAAM,KAAK;AAAA,IACX,OAAO,KAAK;AAAA,EACd;AACF;AAEA,IAAM,oBAAoB,CAAC,MAAgB,SAA6B;AACtE,QAAM,IAAI,KAAK,IAAI,KAAK,OAAO,KAAK,OAAO,KAAK,KAAK;AACrD,SAAO,EAAE,EAAE;AACb;AAEO,IAAM,qBAAqB,CAAC,aAAyB,gBAA6C;AACvG,QAAM,CAAC,UAAU,WAAW,QAAI,uBAA0B,IAAI;AAC9D,QAAM,kBAAc,yBAAU,QAAQ;AAEtC,QAAM,EAAE,KAAK,2BAA2B,QAAI;AAAA,IAC1C,MAAM;AACJ,UAAI,CAAC,YAAY,WAAW,CAAC,YAAY,SAAS;AAChD,YAAI,YAAY,YAAY,MAAM;AAChC,sBAAY,IAAI;AAAA,QAClB;AACA;AAAA,MACF;AAEA,YAAM,OAAO,iBAAiB,YAAY,OAAO;AACjD,YAAM,OAAO,iBAAiB,YAAY,OAAO;AACjD,YAAM,cAAc,kBAAkB,MAAM,IAAI;AAGhD,UAAI,CAAC,YAAY,WAAW,YAAY,QAAQ,MAAM,YAAY,GAAG;AACnE,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,IACA;AAAA,MACE,MAAM;AAAA,IACR;AAAA,EACF;AAGA,8BAAU,MAAM;AACd,+BAA2B;AAAA,EAC7B,GAAG,CAAC,aAAa,WAAW,CAAC;AAG7B,sCAAiB,UAAU,4BAA4B,EAAE,QAAQ,OAAO,CAAC;AAEzE,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export declare const useTableScrollHeight: (prefixCls: string, tableRef: React.RefObject<HTMLDivElement>, pageFixedBottom?: boolean, contentPadding?: number, offsetBottom?: number) => number | undefined;
@@ -0,0 +1,72 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/creek-table/hooks/useTableScrollHeight.tsx
20
+ var useTableScrollHeight_exports = {};
21
+ __export(useTableScrollHeight_exports, {
22
+ useTableScrollHeight: () => useTableScrollHeight
23
+ });
24
+ module.exports = __toCommonJS(useTableScrollHeight_exports);
25
+ var import_ahooks = require("ahooks");
26
+ var import_react = require("react");
27
+ var useTableScrollHeight = (prefixCls, tableRef, pageFixedBottom = true, contentPadding = 16, offsetBottom = 16) => {
28
+ const [scrollY, setScrollY] = (0, import_react.useState)(void 0);
29
+ const { run: calcHeight } = (0, import_ahooks.useDebounceFn)(
30
+ () => {
31
+ if (!pageFixedBottom || !tableRef.current)
32
+ return;
33
+ const tableEl = tableRef.current;
34
+ const tableHeader = tableEl.querySelector(`.${prefixCls}-table-thead`);
35
+ const tableBody = tableEl.querySelector(`.${prefixCls}-table-body`);
36
+ let top = 0;
37
+ if (tableHeader) {
38
+ top = tableHeader.getBoundingClientRect().bottom;
39
+ } else if (tableBody) {
40
+ top = tableBody.getBoundingClientRect().top;
41
+ }
42
+ const windowHeight = window.innerHeight;
43
+ let height = windowHeight - top - contentPadding - offsetBottom;
44
+ const pagination = tableEl.querySelector(`.${prefixCls}-pagination`);
45
+ if (pagination) {
46
+ const paginationHeight = pagination.clientHeight;
47
+ const styles = window.getComputedStyle(pagination);
48
+ const totalPaginationMargin = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
49
+ height = height - paginationHeight - totalPaginationMargin;
50
+ } else {
51
+ height = height - 40;
52
+ }
53
+ setScrollY(height);
54
+ },
55
+ { wait: 100 }
56
+ );
57
+ (0, import_react.useEffect)(() => {
58
+ calcHeight();
59
+ const observer = new MutationObserver(calcHeight);
60
+ if (tableRef.current) {
61
+ observer.observe(tableRef.current, { childList: true, subtree: true });
62
+ }
63
+ return () => observer.disconnect();
64
+ }, [tableRef, pageFixedBottom, prefixCls]);
65
+ (0, import_ahooks.useEventListener)("resize", calcHeight);
66
+ return scrollY;
67
+ };
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ useTableScrollHeight
71
+ });
72
+ //# sourceMappingURL=useTableScrollHeight.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/creek-table/hooks/useTableScrollHeight.tsx"],
4
+ "sourcesContent": ["import { useDebounceFn, useEventListener } from 'ahooks';\nimport { useEffect, useState } from 'react';\n\nexport const useTableScrollHeight = (prefixCls: string, tableRef: React.RefObject<HTMLDivElement>, pageFixedBottom: boolean = true, contentPadding: number = 16, offsetBottom: number = 16) => {\n const [scrollY, setScrollY] = useState<number | undefined>(undefined);\n\n const { run: calcHeight } = useDebounceFn(\n () => {\n if (!pageFixedBottom || !tableRef.current) return;\n\n const tableEl = tableRef.current;\n\n const tableHeader = tableEl.querySelector(`.${prefixCls}-table-thead`);\n const tableBody = tableEl.querySelector(`.${prefixCls}-table-body`);\n\n let top = 0;\n if (tableHeader) {\n top = tableHeader.getBoundingClientRect().bottom;\n } else if (tableBody) {\n top = tableBody.getBoundingClientRect().top;\n }\n\n const windowHeight = window.innerHeight;\n \n let height = windowHeight - top - contentPadding - offsetBottom;\n\n const pagination = tableEl.querySelector(`.${prefixCls}-pagination`);\n\n if (pagination) {\n const paginationHeight = pagination.clientHeight;\n\n const styles = window.getComputedStyle(pagination);\n const totalPaginationMargin = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);\n\n height = height - paginationHeight - totalPaginationMargin;\n } else {\n // 如果没有找到分页,预留一个高度(假设分页高度为 24px + margin 16px = 40px)\n // 这样可以避免初始加载时高度过大,导致出现滚动条,然后分页出现后高度又变小\n height = height - 40;\n }\n\n // Minimum height to avoid crashes or ugly rendering\n setScrollY(height);\n },\n { wait: 100 },\n );\n\n useEffect(() => {\n // Initial calculation\n calcHeight();\n\n // Observer for DOM changes that might affect position\n const observer = new MutationObserver(calcHeight);\n if (tableRef.current) {\n observer.observe(tableRef.current, { childList: true, subtree: true });\n }\n return () => observer.disconnect();\n }, [tableRef, pageFixedBottom, prefixCls]);\n\n useEventListener('resize', calcHeight);\n\n return scrollY;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgD;AAChD,mBAAoC;AAE7B,IAAM,uBAAuB,CAAC,WAAmB,UAA2C,kBAA2B,MAAM,iBAAyB,IAAI,eAAuB,OAAO;AAC7L,QAAM,CAAC,SAAS,UAAU,QAAI,uBAA6B,MAAS;AAEpE,QAAM,EAAE,KAAK,WAAW,QAAI;AAAA,IAC1B,MAAM;AACJ,UAAI,CAAC,mBAAmB,CAAC,SAAS;AAAS;AAE3C,YAAM,UAAU,SAAS;AAEzB,YAAM,cAAc,QAAQ,cAAc,IAAI,uBAAuB;AACrE,YAAM,YAAY,QAAQ,cAAc,IAAI,sBAAsB;AAElE,UAAI,MAAM;AACV,UAAI,aAAa;AACf,cAAM,YAAY,sBAAsB,EAAE;AAAA,MAC5C,WAAW,WAAW;AACpB,cAAM,UAAU,sBAAsB,EAAE;AAAA,MAC1C;AAEA,YAAM,eAAe,OAAO;AAE5B,UAAI,SAAS,eAAe,MAAO,iBAAiB;AAEpD,YAAM,aAAa,QAAQ,cAAc,IAAI,sBAAsB;AAEnE,UAAI,YAAY;AACd,cAAM,mBAAmB,WAAW;AAEpC,cAAM,SAAS,OAAO,iBAAiB,UAAU;AACjD,cAAM,wBAAwB,WAAW,OAAO,SAAS,IAAI,WAAW,OAAO,YAAY;AAE3F,iBAAS,SAAS,mBAAmB;AAAA,MACvC,OAAO;AAGL,iBAAS,SAAS;AAAA,MACpB;AAGA,iBAAW,MAAM;AAAA,IACnB;AAAA,IACA,EAAE,MAAM,IAAI;AAAA,EACd;AAEA,8BAAU,MAAM;AAEd,eAAW;AAGX,UAAM,WAAW,IAAI,iBAAiB,UAAU;AAChD,QAAI,SAAS,SAAS;AACpB,eAAS,QAAQ,SAAS,SAAS,EAAE,WAAW,MAAM,SAAS,KAAK,CAAC;AAAA,IACvE;AACA,WAAO,MAAM,SAAS,WAAW;AAAA,EACnC,GAAG,CAAC,UAAU,iBAAiB,SAAS,CAAC;AAEzC,sCAAiB,UAAU,UAAU;AAErC,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -1,25 +1,35 @@
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 = ["columns", "onSubmit"];
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 { CreekSearchProvider } from "../creek-search";
11
- import { SearchProTable } from "./SearchTable";
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- export var CreekTable = function CreekTable(props) {
14
- var _props$columns = props.columns,
15
- columns = _props$columns === void 0 ? [] : _props$columns,
16
- onSubmit = props.onSubmit,
17
- restProps = _objectWithoutProperties(props, _excluded);
18
- return /*#__PURE__*/_jsx(CreekSearchProvider, {
19
- columns: columns,
20
- onSubmit: onSubmit,
21
- children: /*#__PURE__*/_jsx(SearchProTable, _objectSpread({
22
- columns: columns
23
- }, restProps))
24
- });
25
- };
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/creek-table/index.tsx
20
+ var creek_table_exports = {};
21
+ __export(creek_table_exports, {
22
+ CreekTable: () => CreekTable
23
+ });
24
+ module.exports = __toCommonJS(creek_table_exports);
25
+ var import_SearchTable = require("./SearchTable");
26
+ var import_jsx_runtime = require("react/jsx-runtime");
27
+ var CreekTable = (props) => {
28
+ const { columns = [], ...restProps } = props;
29
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SearchTable.SearchProTable, { columns, ...restProps });
30
+ };
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ CreekTable
34
+ });
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/creek-table/index.tsx"],
4
+ "sourcesContent": ["import { ParamsType } from '@ant-design/pro-components';\n\nimport { SearchProTable } from './SearchTable';\nimport { CreekTableProps } from './type';\n\nexport const CreekTable = <T extends ParamsType, U extends ParamsType, ValueType = 'text'>(props: CreekTableProps<T, U, ValueType>) => {\n const { columns = [], ...restProps } = props;\n\n return (\n <SearchProTable columns={columns} {...restProps} />\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA+B;AAO1B;AAJE,IAAM,aAAa,CAAiE,UAA4C;AACrI,QAAM,EAAE,UAAU,CAAC,GAAI,GAAG,UAAU,IAAI;AAExC,SACG,4CAAC,qCAAe,SAAmB,GAAG,WAAW;AAEtD;",
6
+ "names": []
7
+ }
@@ -1,4 +1,5 @@
1
1
  export declare const toolBarRender: (options: {
2
2
  shouldCollapse: boolean;
3
3
  restProps: any;
4
+ args?: any[];
4
5
  }) => any;
@@ -1,36 +1,58 @@
1
- function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import { DownOutlined } from '@ant-design/icons';
8
- import { Button, Dropdown } from 'antd';
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- import { jsxs as _jsxs } from "react/jsx-runtime";
11
- export var toolBarRender = function toolBarRender(options) {
12
- var _restProps$toolBarRen;
13
- var shouldCollapse = options.shouldCollapse,
14
- restProps = options.restProps;
15
- var baseActions = ((_restProps$toolBarRen = restProps.toolBarRender) === null || _restProps$toolBarRen === void 0 ? void 0 : _restProps$toolBarRen.call(restProps)) || [];
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/creek-table/toolBarRender.tsx
20
+ var toolBarRender_exports = {};
21
+ __export(toolBarRender_exports, {
22
+ toolBarRender: () => toolBarRender
23
+ });
24
+ module.exports = __toCommonJS(toolBarRender_exports);
25
+ var import_icons = require("@ant-design/icons");
26
+ var import_antd = require("antd");
27
+ var import_jsx_runtime = require("react/jsx-runtime");
28
+ var toolBarRender = (options) => {
29
+ var _a;
30
+ const { shouldCollapse, restProps, args = [] } = options;
31
+ const baseActions = ((_a = restProps.toolBarRender) == null ? void 0 : _a.call(restProps, ...args)) || [];
16
32
  if (!shouldCollapse || baseActions.length <= 1) {
17
33
  return baseActions;
18
34
  }
19
- var _baseActions = _toArray(baseActions),
20
- first = _baseActions[0],
21
- rest = _baseActions.slice(1);
22
- return [first, /*#__PURE__*/_jsx(Dropdown, {
23
- menu: {
24
- items: rest.map(function (item, index) {
25
- return {
26
- key: index,
27
- label: item
28
- };
29
- })
30
- },
31
- trigger: ['click'],
32
- children: /*#__PURE__*/_jsxs(Button, {
33
- children: ["\u66F4\u591A ", /*#__PURE__*/_jsx(DownOutlined, {})]
34
- })
35
- }, "more")];
36
- };
35
+ const [first, ...rest] = baseActions;
36
+ return [
37
+ first,
38
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
39
+ import_antd.Dropdown,
40
+ {
41
+ menu: {
42
+ items: rest.map((item, index) => ({ key: index, label: item }))
43
+ },
44
+ trigger: ["click"],
45
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Button, { children: [
46
+ "更多 ",
47
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.DownOutlined, {})
48
+ ] })
49
+ },
50
+ "more"
51
+ )
52
+ ];
53
+ };
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {
56
+ toolBarRender
57
+ });
58
+ //# sourceMappingURL=toolBarRender.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/creek-table/toolBarRender.tsx"],
4
+ "sourcesContent": ["import { DownOutlined } from '@ant-design/icons';\nimport { Button, Dropdown } from 'antd';\n\nexport const toolBarRender = (options: { shouldCollapse: boolean; restProps: any; args?: any[] }) => {\n const { shouldCollapse, restProps, args = [] } = options;\n\n const baseActions = restProps.toolBarRender?.(...args) || [];\n if (!shouldCollapse || baseActions.length <= 1) {\n return baseActions;\n }\n\n const [first, ...rest] = baseActions;\n\n return [\n first,\n <Dropdown\n key=\"more\"\n menu={{\n items: rest.map((item: React.ReactDOM, index: number) => ({ key: index, label: item })),\n }}\n trigger={['click']}\n >\n <Button>\n 更多 <DownOutlined />\n </Button>\n </Dropdown>,\n ];\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6B;AAC7B,kBAAiC;AAqB3B;AAnBC,IAAM,gBAAgB,CAAC,YAAuE;AAHrG;AAIE,QAAM,EAAE,gBAAgB,WAAW,OAAO,CAAC,EAAE,IAAI;AAEjD,QAAM,gBAAc,eAAU,kBAAV,mCAA0B,GAAG,UAAS,CAAC;AAC3D,MAAI,CAAC,kBAAkB,YAAY,UAAU,GAAG;AAC9C,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,OAAO,GAAG,IAAI,IAAI;AAEzB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QAEC,MAAM;AAAA,UACJ,OAAO,KAAK,IAAI,CAAC,MAAsB,WAAmB,EAAE,KAAK,OAAO,OAAO,KAAK,EAAE;AAAA,QACxF;AAAA,QACA,SAAS,CAAC,OAAO;AAAA,QAEjB,uDAAC,sBAAO;AAAA;AAAA,UACH,4CAAC,6BAAa;AAAA,WACnB;AAAA;AAAA,MARI;AAAA,IASN;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -5,7 +5,7 @@ export type OptionRenderCustom = {
5
5
  icon?: React.ReactNode;
6
6
  onClick?: () => void;
7
7
  };
8
- export type CreekTableProps<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = Omit<ProTableProps<T, U, ValueType>, 'search' | 'options'> & {
8
+ export type CreekTableProps<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = Omit<ProTableProps<T, U, ValueType>, 'options'> & {
9
9
  pageFixedBottom?: boolean;
10
10
  pageFixedBottomConfig?: {
11
11
  /** 底部保留空间(如固定在底部的元素高度),默认 0 */
@@ -1 +1,18 @@
1
- export {};
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/creek-table/type.ts
16
+ var type_exports = {};
17
+ module.exports = __toCommonJS(type_exports);
18
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/creek-table/type.ts"],
4
+ "sourcesContent": ["import { ParamsType, ProTableProps } from '@ant-design/pro-components';\n\nexport type OptionRenderCustom = {\n text?: string;\n icon?: React.ReactNode;\n onClick?: () => void;\n};\n\nexport type CreekTableProps<T extends ParamsType, U extends ParamsType, ValueType = 'text'> = Omit<ProTableProps<T, U, ValueType>, 'options'> & {\n pageFixedBottom?: boolean; // 是否固定分页在底部\n pageFixedBottomConfig?: {\n /** 底部保留空间(如固定在底部的元素高度),默认 0 */\n bottomFix?: number;\n };\n options?: ProTableProps<T, U, ValueType>['options'] & {\n importConfig?: OptionRenderCustom;\n exportConfig?: OptionRenderCustom;\n };\n // 是否自动为列添加筛选功能,默认 true\n autoAddFilterForColumn?: boolean;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- export * from './bg-center';
2
1
  export * from './creek-config-provider';
2
+ export * from './creek-hooks';
3
3
  export * from './creek-icon';
4
4
  export * from './creek-layout';
5
5
  export * from './creek-loading';
6
- export * from './creek-search';
7
6
  export * from './creek-table';
package/dist/index.js CHANGED
@@ -1,7 +1,34 @@
1
- export * from "./bg-center";
2
- export * from "./creek-config-provider";
3
- export * from "./creek-icon";
4
- export * from "./creek-layout";
5
- export * from "./creek-loading";
6
- export * from "./creek-search";
7
- export * from "./creek-table";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/index.tsx
17
+ var src_exports = {};
18
+ module.exports = __toCommonJS(src_exports);
19
+ __reExport(src_exports, require("./creek-config-provider"), module.exports);
20
+ __reExport(src_exports, require("./creek-hooks"), module.exports);
21
+ __reExport(src_exports, require("./creek-icon"), module.exports);
22
+ __reExport(src_exports, require("./creek-layout"), module.exports);
23
+ __reExport(src_exports, require("./creek-loading"), module.exports);
24
+ __reExport(src_exports, require("./creek-table"), module.exports);
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ ...require("./creek-config-provider"),
28
+ ...require("./creek-hooks"),
29
+ ...require("./creek-icon"),
30
+ ...require("./creek-layout"),
31
+ ...require("./creek-loading"),
32
+ ...require("./creek-table")
33
+ });
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.tsx"],
4
+ "sourcesContent": ["\nexport * from './creek-config-provider';\nexport * from './creek-hooks';\nexport * from './creek-icon';\nexport * from './creek-layout';\nexport * from './creek-loading';\nexport * from './creek-table';\n\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AACA,wBAAc,oCADd;AAEA,wBAAc,0BAFd;AAGA,wBAAc,yBAHd;AAIA,wBAAc,2BAJd;AAKA,wBAAc,4BALd;AAMA,wBAAc,0BANd;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@creekjs/web-components",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "father:build": "father build",
8
- "father:dev": "father dev"
8
+ "father:dev": "father dev --no-clean"
9
9
  },
10
10
  "keywords": [],
11
11
  "author": "",
@@ -1 +1,3 @@
1
+ export * from './useApp';
1
2
  export * from './useViewportHeight';
3
+
@@ -0,0 +1,43 @@
1
+ import { DrawerForm } from '@ant-design/pro-components';
2
+ import { Drawer } from 'antd';
3
+ import { omit } from 'lodash';
4
+ import React from 'react';
5
+ import { DrawerConfig, FormDrawerConfig, NormalDrawerConfig } from './types';
6
+
7
+ interface DrawerHelperProps {
8
+ open: boolean;
9
+ config: DrawerConfig;
10
+ onClose: () => void;
11
+ }
12
+
13
+ export const DrawerHelper: React.FC<DrawerHelperProps> = ({ open, config, onClose }) => {
14
+ const { content, type, ...restConfig } = config;
15
+
16
+ if (type === 'form') {
17
+ return (
18
+ <DrawerForm
19
+ open={open}
20
+ onOpenChange={(visible) => !visible && onClose()}
21
+ drawerProps={{
22
+ destroyOnHidden: true,
23
+ onClose,
24
+ ...((config as FormDrawerConfig).drawerProps || {}),
25
+ }}
26
+ {...(omit(restConfig, 'drawerProps') as any)}
27
+ >
28
+ {content}
29
+ </DrawerForm>
30
+ );
31
+ }
32
+
33
+ return (
34
+ <Drawer
35
+ open={open}
36
+ onClose={onClose}
37
+ destroyOnHidden
38
+ {...(restConfig as NormalDrawerConfig)}
39
+ >
40
+ {content}
41
+ </Drawer>
42
+ );
43
+ };
@@ -0,0 +1,43 @@
1
+ import { ModalForm } from '@ant-design/pro-components';
2
+ import { Modal } from 'antd';
3
+ import { omit } from 'lodash';
4
+ import React from 'react';
5
+ import { FormModalConfig, ModalConfig, NormalModalConfig } from './types';
6
+
7
+ interface ModalHelperProps {
8
+ open: boolean;
9
+ config: ModalConfig;
10
+ onClose: () => void;
11
+ }
12
+
13
+ export const ModalHelper: React.FC<ModalHelperProps> = ({ open, config, onClose }) => {
14
+ const { content, type, ...restConfig } = config;
15
+
16
+ if (type === 'form') {
17
+ return (
18
+ <ModalForm
19
+ open={open}
20
+ onOpenChange={(visible) => !visible && onClose()}
21
+ modalProps={{
22
+ destroyOnHidden: true,
23
+ onCancel: onClose,
24
+ ...((config as FormModalConfig).modalProps || {}),
25
+ }}
26
+ {...(omit(restConfig, 'modalProps') as any)}
27
+ >
28
+ {content}
29
+ </ModalForm>
30
+ );
31
+ }
32
+
33
+ return (
34
+ <Modal
35
+ open={open}
36
+ onCancel={onClose}
37
+ destroyOnHidden
38
+ {...(restConfig as NormalModalConfig)}
39
+ >
40
+ {content}
41
+ </Modal>
42
+ );
43
+ };