@hanwenbo/x-web-pro-components 0.0.1

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 (150) hide show
  1. package/LICENSE +21 -0
  2. package/es/blocks/index.d.ts +1 -0
  3. package/es/blocks/index.js +2 -0
  4. package/es/blocks/shared.d.ts +24 -0
  5. package/es/blocks/shared.js +77 -0
  6. package/es/components/card/index.d.ts +82 -0
  7. package/es/components/card/index.js +361 -0
  8. package/es/components/descriptions/index.d.ts +31 -0
  9. package/es/components/descriptions/index.js +434 -0
  10. package/es/components/field/index.d.ts +75 -0
  11. package/es/components/field/index.js +761 -0
  12. package/es/components/form/captcha.d.ts +19 -0
  13. package/es/components/form/captcha.js +165 -0
  14. package/es/components/form/colorPicker.d.ts +7 -0
  15. package/es/components/form/colorPicker.js +73 -0
  16. package/es/components/form/fieldControls.d.ts +43 -0
  17. package/es/components/form/fieldControls.js +282 -0
  18. package/es/components/form/index.d.ts +285 -0
  19. package/es/components/form/index.js +2268 -0
  20. package/es/components/form/loginForm.d.ts +22 -0
  21. package/es/components/form/loginForm.js +159 -0
  22. package/es/components/form/schemaForm.d.ts +30 -0
  23. package/es/components/form/schemaForm.js +644 -0
  24. package/es/components/form/stepsForm.d.ts +26 -0
  25. package/es/components/form/stepsForm.js +183 -0
  26. package/es/components/form/uploadButton.d.ts +20 -0
  27. package/es/components/form/uploadButton.js +134 -0
  28. package/es/components/form/uploadDragger.d.ts +13 -0
  29. package/es/components/form/uploadDragger.js +144 -0
  30. package/es/components/index.d.ts +9 -0
  31. package/es/components/index.js +9 -0
  32. package/es/components/layout/components/Help/index.d.ts +72 -0
  33. package/es/components/layout/components/Help/index.js +350 -0
  34. package/es/components/layout/index.d.ts +182 -0
  35. package/es/components/layout/index.js +892 -0
  36. package/es/components/list/index.d.ts +80 -0
  37. package/es/components/list/index.js +431 -0
  38. package/es/components/provider/context.d.ts +7 -0
  39. package/es/components/provider/context.js +21 -0
  40. package/es/components/provider/index.d.ts +28 -0
  41. package/es/components/provider/index.js +117 -0
  42. package/es/components/provider/intl.d.ts +38 -0
  43. package/es/components/provider/intl.js +112 -0
  44. package/es/components/provider/types.d.ts +37 -0
  45. package/es/components/provider/types.js +1 -0
  46. package/es/components/provider/useStyle/index.d.ts +28 -0
  47. package/es/components/provider/useStyle/index.js +208 -0
  48. package/es/components/skeleton/index.d.ts +61 -0
  49. package/es/components/skeleton/index.js +388 -0
  50. package/es/components/table/dragSortTable.d.ts +8 -0
  51. package/es/components/table/dragSortTable.js +229 -0
  52. package/es/components/table/editableTable.d.ts +31 -0
  53. package/es/components/table/editableTable.js +507 -0
  54. package/es/components/table/index.d.ts +52 -0
  55. package/es/components/table/index.js +1554 -0
  56. package/es/components/table/listToolBar.d.ts +48 -0
  57. package/es/components/table/listToolBar.js +194 -0
  58. package/es/components/table/search.d.ts +5 -0
  59. package/es/components/table/search.js +13 -0
  60. package/es/index.d.ts +4 -0
  61. package/es/index.js +4 -0
  62. package/es/types.d.ts +219 -0
  63. package/es/types.js +1 -0
  64. package/es/utils/attachPropertiesToComponent.d.ts +1 -0
  65. package/es/utils/attachPropertiesToComponent.js +6 -0
  66. package/es/utils/getRequestParams.d.ts +19 -0
  67. package/es/utils/getRequestParams.js +57 -0
  68. package/es/utils/getTableListColumns.d.ts +20 -0
  69. package/es/utils/getTableListColumns.js +36 -0
  70. package/es/utils/index.d.ts +4 -0
  71. package/es/utils/index.js +4 -0
  72. package/es/utils/loading.d.ts +3 -0
  73. package/es/utils/loading.js +25 -0
  74. package/es/version.d.ts +2 -0
  75. package/es/version.js +2 -0
  76. package/lib/blocks/index.d.ts +1 -0
  77. package/lib/blocks/index.js +5 -0
  78. package/lib/blocks/shared.d.ts +24 -0
  79. package/lib/blocks/shared.js +83 -0
  80. package/lib/components/card/index.d.ts +82 -0
  81. package/lib/components/card/index.js +368 -0
  82. package/lib/components/descriptions/index.d.ts +31 -0
  83. package/lib/components/descriptions/index.js +440 -0
  84. package/lib/components/field/index.d.ts +75 -0
  85. package/lib/components/field/index.js +767 -0
  86. package/lib/components/form/captcha.d.ts +19 -0
  87. package/lib/components/form/captcha.js +172 -0
  88. package/lib/components/form/colorPicker.d.ts +7 -0
  89. package/lib/components/form/colorPicker.js +79 -0
  90. package/lib/components/form/fieldControls.d.ts +43 -0
  91. package/lib/components/form/fieldControls.js +288 -0
  92. package/lib/components/form/index.d.ts +285 -0
  93. package/lib/components/form/index.js +2332 -0
  94. package/lib/components/form/loginForm.d.ts +22 -0
  95. package/lib/components/form/loginForm.js +165 -0
  96. package/lib/components/form/schemaForm.d.ts +30 -0
  97. package/lib/components/form/schemaForm.js +651 -0
  98. package/lib/components/form/stepsForm.d.ts +26 -0
  99. package/lib/components/form/stepsForm.js +189 -0
  100. package/lib/components/form/uploadButton.d.ts +20 -0
  101. package/lib/components/form/uploadButton.js +141 -0
  102. package/lib/components/form/uploadDragger.d.ts +13 -0
  103. package/lib/components/form/uploadDragger.js +151 -0
  104. package/lib/components/index.d.ts +9 -0
  105. package/lib/components/index.js +104 -0
  106. package/lib/components/layout/components/Help/index.d.ts +72 -0
  107. package/lib/components/layout/components/Help/index.js +356 -0
  108. package/lib/components/layout/index.d.ts +182 -0
  109. package/lib/components/layout/index.js +930 -0
  110. package/lib/components/list/index.d.ts +80 -0
  111. package/lib/components/list/index.js +438 -0
  112. package/lib/components/provider/context.d.ts +7 -0
  113. package/lib/components/provider/context.js +27 -0
  114. package/lib/components/provider/index.d.ts +28 -0
  115. package/lib/components/provider/index.js +174 -0
  116. package/lib/components/provider/intl.d.ts +38 -0
  117. package/lib/components/provider/intl.js +118 -0
  118. package/lib/components/provider/types.d.ts +37 -0
  119. package/lib/components/provider/types.js +5 -0
  120. package/lib/components/provider/useStyle/index.d.ts +28 -0
  121. package/lib/components/provider/useStyle/index.js +217 -0
  122. package/lib/components/skeleton/index.d.ts +61 -0
  123. package/lib/components/skeleton/index.js +394 -0
  124. package/lib/components/table/dragSortTable.d.ts +8 -0
  125. package/lib/components/table/dragSortTable.js +236 -0
  126. package/lib/components/table/editableTable.d.ts +31 -0
  127. package/lib/components/table/editableTable.js +514 -0
  128. package/lib/components/table/index.d.ts +52 -0
  129. package/lib/components/table/index.js +1699 -0
  130. package/lib/components/table/listToolBar.d.ts +48 -0
  131. package/lib/components/table/listToolBar.js +200 -0
  132. package/lib/components/table/search.d.ts +5 -0
  133. package/lib/components/table/search.js +20 -0
  134. package/lib/index.d.ts +4 -0
  135. package/lib/index.js +49 -0
  136. package/lib/types.d.ts +219 -0
  137. package/lib/types.js +5 -0
  138. package/lib/utils/attachPropertiesToComponent.d.ts +1 -0
  139. package/lib/utils/attachPropertiesToComponent.js +12 -0
  140. package/lib/utils/getRequestParams.d.ts +19 -0
  141. package/lib/utils/getRequestParams.js +63 -0
  142. package/lib/utils/getTableListColumns.d.ts +20 -0
  143. package/lib/utils/getTableListColumns.js +42 -0
  144. package/lib/utils/index.d.ts +4 -0
  145. package/lib/utils/index.js +49 -0
  146. package/lib/utils/loading.d.ts +3 -0
  147. package/lib/utils/loading.js +31 -0
  148. package/lib/version.d.ts +2 -0
  149. package/lib/version.js +8 -0
  150. package/package.json +68 -0
@@ -0,0 +1,80 @@
1
+ import React from 'react';
2
+ import { Card } from '@hanwenbo/x-web-ui/card';
3
+ import type { ActionType, ProColumnType, RequestData } from '../../types';
4
+ export declare type Key = React.Key;
5
+ export declare type TriggerEventHandler = (...args: any[]) => void;
6
+ export declare type GetComponentProps<RecordType = any> = (item: RecordType) => React.HTMLAttributes<HTMLDivElement>;
7
+ export declare type AntdListProps = React.HTMLAttributes<HTMLDivElement>;
8
+ export declare type ProListMeta<T = any> = Pick<ProColumnType<T>, 'dataIndex' | 'valueType' | 'render' | 'title' | 'valueEnum' | 'fieldProps' | 'formItemProps' | 'formItemRender' | 'search' | 'editable' | 'listSlot'> & {
9
+ key?: React.Key;
10
+ };
11
+ export declare type ProListMetas<T = any> = {
12
+ title?: ProListMeta<T>;
13
+ subTitle?: ProListMeta<T>;
14
+ description?: ProListMeta<T>;
15
+ avatar?: ProListMeta<T>;
16
+ content?: ProListMeta<T>;
17
+ actions?: ProListMeta<T>;
18
+ [key: string]: ProListMeta<T> | undefined;
19
+ };
20
+ export declare type BaseProListMetas<T = any> = ProListMetas<T>;
21
+ export interface ProListProps<RecordType = any> {
22
+ title?: React.ReactNode;
23
+ headerTitle?: React.ReactNode;
24
+ tooltip?: React.ReactNode;
25
+ header?: React.ReactNode;
26
+ footer?: React.ReactNode;
27
+ columns?: ProColumnType<RecordType>[];
28
+ metas?: ProListMetas<RecordType>;
29
+ dataSource?: RecordType[];
30
+ params?: Record<string, any>;
31
+ request?: (params?: Record<string, any>) => Promise<RequestData<RecordType>>;
32
+ rowKey?: string | ((record: RecordType) => React.Key);
33
+ loading?: boolean;
34
+ split?: boolean;
35
+ itemLayout?: 'horizontal' | 'vertical';
36
+ emptyText?: React.ReactNode;
37
+ grid?: boolean | {
38
+ gutter?: number | [number, number];
39
+ column?: number;
40
+ xs?: number;
41
+ sm?: number;
42
+ md?: number;
43
+ lg?: number;
44
+ xl?: number;
45
+ xxl?: number;
46
+ };
47
+ itemRender?: (record: RecordType, index: number, dom: React.ReactNode) => React.ReactNode;
48
+ itemCardProps?: React.ComponentProps<typeof Card>;
49
+ onItem?: (record: RecordType, index: number) => React.HTMLAttributes<HTMLDivElement>;
50
+ onRow?: (record: RecordType, index: number) => React.HTMLAttributes<HTMLDivElement>;
51
+ rowClassName?: string | ((record: RecordType, index: number) => string);
52
+ itemHeaderRender?: (record: RecordType, defaultDom: React.ReactNode) => React.ReactNode;
53
+ itemTitleRender?: (record: RecordType, defaultDom: React.ReactNode) => React.ReactNode;
54
+ actionRef?: React.MutableRefObject<ActionType | undefined>;
55
+ toolBarRender?: (action: ActionType | undefined, rows?: RecordType[]) => React.ReactNode[];
56
+ onDataSourceChange?: (dataSource: RecordType[]) => void;
57
+ rowSelection?: false | {
58
+ selectedRowKeys?: React.Key[];
59
+ defaultSelectedRowKeys?: React.Key[];
60
+ onChange?: (selectedRowKeys: React.Key[], selectedRows: RecordType[]) => void;
61
+ getCheckboxProps?: (record: RecordType) => {
62
+ disabled?: boolean;
63
+ };
64
+ };
65
+ pagination?: false | {
66
+ current?: number;
67
+ defaultCurrent?: number;
68
+ pageSize?: number;
69
+ defaultPageSize?: number;
70
+ total?: number;
71
+ position?: 'top' | 'bottom' | 'both';
72
+ showQuickJumper?: boolean;
73
+ showTotal?: boolean;
74
+ onChange?: (page: number, pageSize: number) => void;
75
+ };
76
+ }
77
+ export declare type ProListItemRender<RecordType = any> = (record: RecordType, index: number, dom: React.ReactNode) => React.ReactNode;
78
+ export declare const ProList: <RecordType extends Record<string, any> = Record<string, any>>({ title, headerTitle, tooltip, header, footer, columns, metas, dataSource: controlledDataSource, params, request, rowKey, loading: controlledLoading, split, itemLayout, emptyText, grid, itemRender, itemCardProps, onItem, onRow, rowClassName, itemHeaderRender, itemTitleRender, actionRef, toolBarRender, onDataSourceChange, rowSelection, pagination }: ProListProps<RecordType>) => React.JSX.Element;
79
+ export declare const BaseProList: <RecordType extends Record<string, any> = Record<string, any>>({ title, headerTitle, tooltip, header, footer, columns, metas, dataSource: controlledDataSource, params, request, rowKey, loading: controlledLoading, split, itemLayout, emptyText, grid, itemRender, itemCardProps, onItem, onRow, rowClassName, itemHeaderRender, itemTitleRender, actionRef, toolBarRender, onDataSourceChange, rowSelection, pagination }: ProListProps<RecordType>) => React.JSX.Element;
80
+ export default ProList;
@@ -0,0 +1,431 @@
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
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
+ 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; }
12
+ 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; }
13
+ 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; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
15
+ 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); }
16
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
17
+ import { Card } from '@hanwenbo/x-web-ui/card';
18
+ import { Checkbox } from '@hanwenbo/x-web-ui/checkbox';
19
+ import { List, ListItem } from '@hanwenbo/x-web-ui/list';
20
+ import { Pagination } from '@hanwenbo/x-web-ui/pagination';
21
+ import { cn } from '@hanwenbo/x-web-ui/utils/cn';
22
+ import { mergeBooleanLoading } from "../../utils";
23
+ import { ProField } from "../field";
24
+ import { ListToolBar } from "../table/listToolBar";
25
+ import { jsx as _jsx } from "react/jsx-runtime";
26
+ import { jsxs as _jsxs } from "react/jsx-runtime";
27
+ var DEFAULT_VALUE_TYPE_MAP = {
28
+ avatar: 'avatar',
29
+ actions: 'option',
30
+ description: 'textarea'
31
+ };
32
+ var getValueByDataIndex = function getValueByDataIndex(record, dataIndex) {
33
+ if (!dataIndex) {
34
+ return undefined;
35
+ }
36
+ var path = Array.isArray(dataIndex) ? dataIndex : [dataIndex];
37
+ return path.reduce(function (current, key) {
38
+ return current == null ? current : current[key];
39
+ }, record);
40
+ };
41
+ var normalizeSlotNode = function normalizeSlotNode(node) {
42
+ var children = React.Children.toArray(node);
43
+ if (children.length <= 1) {
44
+ var _children$;
45
+ return (_children$ = children[0]) !== null && _children$ !== void 0 ? _children$ : null;
46
+ }
47
+ return children;
48
+ };
49
+ var resolveGridColumnCount = function resolveGridColumnCount(grid) {
50
+ if (!grid || grid === true) {
51
+ return 1;
52
+ }
53
+ return grid.column || grid.xxl || grid.xl || grid.lg || grid.md || grid.sm || grid.xs || 1;
54
+ };
55
+ var resolveGridGap = function resolveGridGap(grid) {
56
+ if (!grid || grid === true) {
57
+ return undefined;
58
+ }
59
+ if (Array.isArray(grid.gutter)) {
60
+ return "".concat(grid.gutter[1] || 0, "px ").concat(grid.gutter[0] || 0, "px");
61
+ }
62
+ if (typeof grid.gutter === 'number') {
63
+ return "".concat(grid.gutter, "px");
64
+ }
65
+ return undefined;
66
+ };
67
+ var getRecordKey = function getRecordKey(record, index, rowKey) {
68
+ var _rowKey;
69
+ return typeof rowKey === 'function' ? rowKey(record) : (_rowKey = record[rowKey]) !== null && _rowKey !== void 0 ? _rowKey : index;
70
+ };
71
+ var metasToColumns = function metasToColumns(metas) {
72
+ return Object.keys(metas).map(function (key) {
73
+ var meta = metas[key] || {};
74
+ return _objectSpread(_objectSpread({
75
+ listSlot: key,
76
+ dataIndex: meta.dataIndex || key
77
+ }, meta), {}, {
78
+ valueType: meta.valueType || DEFAULT_VALUE_TYPE_MAP[key]
79
+ });
80
+ });
81
+ };
82
+ export var ProList = function ProList(_ref) {
83
+ var _rowSelection$selecte2;
84
+ var title = _ref.title,
85
+ headerTitle = _ref.headerTitle,
86
+ tooltip = _ref.tooltip,
87
+ header = _ref.header,
88
+ footer = _ref.footer,
89
+ _ref$columns = _ref.columns,
90
+ columns = _ref$columns === void 0 ? [] : _ref$columns,
91
+ metas = _ref.metas,
92
+ controlledDataSource = _ref.dataSource,
93
+ params = _ref.params,
94
+ request = _ref.request,
95
+ _ref$rowKey = _ref.rowKey,
96
+ rowKey = _ref$rowKey === void 0 ? 'id' : _ref$rowKey,
97
+ _ref$loading = _ref.loading,
98
+ controlledLoading = _ref$loading === void 0 ? false : _ref$loading,
99
+ _ref$split = _ref.split,
100
+ split = _ref$split === void 0 ? true : _ref$split,
101
+ _ref$itemLayout = _ref.itemLayout,
102
+ itemLayout = _ref$itemLayout === void 0 ? 'horizontal' : _ref$itemLayout,
103
+ _ref$emptyText = _ref.emptyText,
104
+ emptyText = _ref$emptyText === void 0 ? '暂无数据' : _ref$emptyText,
105
+ _ref$grid = _ref.grid,
106
+ grid = _ref$grid === void 0 ? false : _ref$grid,
107
+ itemRender = _ref.itemRender,
108
+ itemCardProps = _ref.itemCardProps,
109
+ onItem = _ref.onItem,
110
+ onRow = _ref.onRow,
111
+ rowClassName = _ref.rowClassName,
112
+ itemHeaderRender = _ref.itemHeaderRender,
113
+ itemTitleRender = _ref.itemTitleRender,
114
+ actionRef = _ref.actionRef,
115
+ toolBarRender = _ref.toolBarRender,
116
+ onDataSourceChange = _ref.onDataSourceChange,
117
+ _ref$rowSelection = _ref.rowSelection,
118
+ rowSelection = _ref$rowSelection === void 0 ? false : _ref$rowSelection,
119
+ _ref$pagination = _ref.pagination,
120
+ pagination = _ref$pagination === void 0 ? false : _ref$pagination;
121
+ var _useState = useState(false),
122
+ _useState2 = _slicedToArray(_useState, 2),
123
+ requestLoading = _useState2[0],
124
+ setRequestLoading = _useState2[1];
125
+ var _useState3 = useState(controlledDataSource || []),
126
+ _useState4 = _slicedToArray(_useState3, 2),
127
+ dataSource = _useState4[0],
128
+ setDataSource = _useState4[1];
129
+ var _useState5 = useState(rowSelection && rowSelection !== false ? rowSelection.defaultSelectedRowKeys || [] : []),
130
+ _useState6 = _slicedToArray(_useState5, 2),
131
+ innerSelectedRowKeys = _useState6[0],
132
+ setInnerSelectedRowKeys = _useState6[1];
133
+ var _useState7 = useState({
134
+ current: pagination && pagination !== false ? pagination.current || pagination.defaultCurrent || 1 : 1,
135
+ pageSize: pagination && pagination !== false ? pagination.pageSize || pagination.defaultPageSize || 10 : 10
136
+ }),
137
+ _useState8 = _slicedToArray(_useState7, 2),
138
+ pageInfo = _useState8[0],
139
+ setPageInfo = _useState8[1];
140
+ var _useState9 = useState([]),
141
+ _useState10 = _slicedToArray(_useState9, 2),
142
+ selectedRows = _useState10[0],
143
+ setSelectedRows = _useState10[1];
144
+ var getDefaultPageInfo = useCallback(function () {
145
+ return {
146
+ current: pagination && pagination !== false ? pagination.current || pagination.defaultCurrent || 1 : 1,
147
+ pageSize: pagination && pagination !== false ? pagination.pageSize || pagination.defaultPageSize || 10 : 10
148
+ };
149
+ }, [pagination]);
150
+ var proColumns = useMemo(function () {
151
+ if (columns.length) {
152
+ return columns;
153
+ }
154
+ if (metas) {
155
+ return metasToColumns(metas);
156
+ }
157
+ return [];
158
+ }, [columns, metas]);
159
+ var fetchData = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
160
+ var result, nextDataSource;
161
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
162
+ while (1) switch (_context.prev = _context.next) {
163
+ case 0:
164
+ if (request) {
165
+ _context.next = 3;
166
+ break;
167
+ }
168
+ setDataSource(controlledDataSource || []);
169
+ return _context.abrupt("return");
170
+ case 3:
171
+ setRequestLoading(true);
172
+ _context.prev = 4;
173
+ _context.next = 7;
174
+ return request(params);
175
+ case 7:
176
+ result = _context.sent;
177
+ if (!(result.success === false)) {
178
+ _context.next = 10;
179
+ break;
180
+ }
181
+ return _context.abrupt("return");
182
+ case 10:
183
+ nextDataSource = result.data || [];
184
+ setDataSource(nextDataSource);
185
+ onDataSourceChange === null || onDataSourceChange === void 0 || onDataSourceChange(nextDataSource);
186
+ _context.next = 18;
187
+ break;
188
+ case 15:
189
+ _context.prev = 15;
190
+ _context.t0 = _context["catch"](4);
191
+ console.error('ProList request error:', _context.t0);
192
+ case 18:
193
+ _context.prev = 18;
194
+ setRequestLoading(false);
195
+ return _context.finish(18);
196
+ case 21:
197
+ case "end":
198
+ return _context.stop();
199
+ }
200
+ }, _callee, null, [[4, 15, 18, 21]]);
201
+ })), [controlledDataSource, onDataSourceChange, params, request]);
202
+ useEffect(function () {
203
+ fetchData();
204
+ }, [fetchData]);
205
+ useEffect(function () {
206
+ if (!request) {
207
+ setDataSource(controlledDataSource || []);
208
+ }
209
+ }, [controlledDataSource, request]);
210
+ useEffect(function () {
211
+ if (rowSelection && rowSelection !== false && rowSelection.selectedRowKeys !== undefined) {
212
+ setInnerSelectedRowKeys(rowSelection.selectedRowKeys);
213
+ setSelectedRows(dataSource.filter(function (record, index) {
214
+ var _rowSelection$selecte;
215
+ return (_rowSelection$selecte = rowSelection.selectedRowKeys) === null || _rowSelection$selecte === void 0 ? void 0 : _rowSelection$selecte.includes(getRecordKey(record, index, rowKey));
216
+ }));
217
+ }
218
+ }, [dataSource, rowKey, rowSelection]);
219
+ var mergedLoading = mergeBooleanLoading(controlledLoading, requestLoading);
220
+ var mergedSelectedRowKeys = rowSelection && rowSelection !== false ? (_rowSelection$selecte2 = rowSelection.selectedRowKeys) !== null && _rowSelection$selecte2 !== void 0 ? _rowSelection$selecte2 : innerSelectedRowKeys : [];
221
+ var mergedTotal = pagination && pagination !== false ? pagination.total || (controlledDataSource === null || controlledDataSource === void 0 ? void 0 : controlledDataSource.length) || dataSource.length : dataSource.length;
222
+ var pagedDataSource = useMemo(function () {
223
+ if (!pagination || pagination === false || request) {
224
+ return dataSource;
225
+ }
226
+ var start = (pageInfo.current - 1) * pageInfo.pageSize;
227
+ return dataSource.slice(start, start + pageInfo.pageSize);
228
+ }, [dataSource, pageInfo.current, pageInfo.pageSize, pagination, request]);
229
+ var emitSelectionChange = useCallback(function (nextKeys) {
230
+ var _rowSelection$onChang2;
231
+ var nextRows = dataSource.filter(function (record, index) {
232
+ return nextKeys.includes(getRecordKey(record, index, rowKey));
233
+ });
234
+ if (!rowSelection || rowSelection === false || rowSelection.selectedRowKeys !== undefined) {
235
+ var _rowSelection$onChang;
236
+ setSelectedRows(nextRows);
237
+ rowSelection && rowSelection !== false && ((_rowSelection$onChang = rowSelection.onChange) === null || _rowSelection$onChang === void 0 ? void 0 : _rowSelection$onChang.call(rowSelection, nextKeys, nextRows));
238
+ return;
239
+ }
240
+ setInnerSelectedRowKeys(nextKeys);
241
+ setSelectedRows(nextRows);
242
+ (_rowSelection$onChang2 = rowSelection.onChange) === null || _rowSelection$onChang2 === void 0 || _rowSelection$onChang2.call(rowSelection, nextKeys, nextRows);
243
+ }, [dataSource, rowKey, rowSelection]);
244
+ var action = useMemo(function () {
245
+ return {
246
+ reload: fetchData,
247
+ reloadAndRest: function () {
248
+ var _reloadAndRest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
249
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
250
+ while (1) switch (_context2.prev = _context2.next) {
251
+ case 0:
252
+ setPageInfo(getDefaultPageInfo());
253
+ emitSelectionChange([]);
254
+ _context2.next = 4;
255
+ return fetchData();
256
+ case 4:
257
+ case "end":
258
+ return _context2.stop();
259
+ }
260
+ }, _callee2);
261
+ }));
262
+ function reloadAndRest() {
263
+ return _reloadAndRest.apply(this, arguments);
264
+ }
265
+ return reloadAndRest;
266
+ }(),
267
+ reset: function reset() {
268
+ setPageInfo(getDefaultPageInfo());
269
+ emitSelectionChange([]);
270
+ fetchData();
271
+ },
272
+ clearSelected: function clearSelected() {
273
+ emitSelectionChange([]);
274
+ }
275
+ };
276
+ }, [emitSelectionChange, fetchData, getDefaultPageInfo]);
277
+ useEffect(function () {
278
+ if (actionRef) {
279
+ actionRef.current = action;
280
+ }
281
+ }, [action, actionRef]);
282
+ var toolbarActions = toolBarRender === null || toolBarRender === void 0 ? void 0 : toolBarRender(action, selectedRows);
283
+ var selectionEnabled = Boolean(rowSelection && rowSelection !== false);
284
+ var gridStyle = useMemo(function () {
285
+ if (!grid) {
286
+ return undefined;
287
+ }
288
+ return {
289
+ display: 'grid',
290
+ gridTemplateColumns: "repeat(".concat(resolveGridColumnCount(grid), ", minmax(0, 1fr))"),
291
+ gap: resolveGridGap(grid)
292
+ };
293
+ }, [grid]);
294
+ var renderPaginationNode = function renderPaginationNode() {
295
+ return pagination && pagination !== false ? /*#__PURE__*/_jsx(Pagination, {
296
+ current: pageInfo.current,
297
+ pageSize: pageInfo.pageSize,
298
+ total: mergedTotal,
299
+ showQuickJumper: pagination.showQuickJumper,
300
+ showTotal: pagination.showTotal,
301
+ onChange: function onChange(page, pageSize) {
302
+ var _pagination$onChange;
303
+ setPageInfo({
304
+ current: page,
305
+ pageSize: pageSize
306
+ });
307
+ (_pagination$onChange = pagination.onChange) === null || _pagination$onChange === void 0 || _pagination$onChange.call(pagination, page, pageSize);
308
+ }
309
+ }) : null;
310
+ };
311
+ var showPaginationTop = pagination && pagination !== false && pagination.position === 'top';
312
+ var showPaginationBoth = pagination && pagination !== false && pagination.position === 'both';
313
+ return /*#__PURE__*/_jsxs(Card, {
314
+ loading: mergedLoading,
315
+ children: [headerTitle || title || toolbarActions !== null && toolbarActions !== void 0 && toolbarActions.length ? /*#__PURE__*/_jsx(ListToolBar, {
316
+ className: "mb-4",
317
+ title: headerTitle || title,
318
+ tooltip: tooltip,
319
+ actions: toolbarActions || []
320
+ }) : null, (showPaginationTop || showPaginationBoth) && pagination ? /*#__PURE__*/_jsx("div", {
321
+ className: "mb-4 flex justify-end",
322
+ children: renderPaginationNode()
323
+ }) : null, header ? /*#__PURE__*/_jsx("div", {
324
+ className: "mb-4",
325
+ children: header
326
+ }) : null, pagedDataSource.length === 0 ? /*#__PURE__*/_jsx("div", {
327
+ className: "bg-muted/10 rounded-2xl border border-dashed border-border px-4 py-8 text-center text-sm text-muted-foreground",
328
+ children: emptyText
329
+ }) : /*#__PURE__*/_jsx(List, {
330
+ mode: "card",
331
+ children: /*#__PURE__*/_jsx("div", {
332
+ style: gridStyle,
333
+ children: pagedDataSource.map(function (record, index) {
334
+ var _rowSelection$getChec;
335
+ var recordKey = getRecordKey(record, index, rowKey);
336
+ var slotMap = proColumns.reduce(function (acc, columnItem) {
337
+ var slot = columnItem.listSlot || 'content';
338
+ var value = getValueByDataIndex(record, columnItem.dataIndex);
339
+ var nextValue = columnItem.renderText ? columnItem.renderText(value, record, index) : value;
340
+ acc[slot] = normalizeSlotNode(columnItem.render ? columnItem.render(value, record, index) : /*#__PURE__*/_jsx(ProField, {
341
+ text: nextValue,
342
+ valueType: columnItem.valueType,
343
+ valueEnum: columnItem.valueEnum
344
+ }));
345
+ return acc;
346
+ }, {});
347
+ var checkboxProps = rowSelection && rowSelection !== false ? (_rowSelection$getChec = rowSelection.getCheckboxProps) === null || _rowSelection$getChec === void 0 ? void 0 : _rowSelection$getChec.call(rowSelection, record) : {};
348
+ var selected = mergedSelectedRowKeys.includes(recordKey);
349
+ var selectionNode = selectionEnabled ? /*#__PURE__*/_jsx(Checkbox, {
350
+ checked: selected,
351
+ disabled: checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.disabled,
352
+ onChange: function onChange() {
353
+ var nextKeys = selected ? mergedSelectedRowKeys.filter(function (key) {
354
+ return key !== recordKey;
355
+ }) : mergedSelectedRowKeys.concat(recordKey);
356
+ emitSelectionChange(nextKeys);
357
+ }
358
+ }) : null;
359
+ var mergedPrefix = selectionEnabled ? /*#__PURE__*/_jsxs("div", {
360
+ className: "flex items-center gap-3",
361
+ children: [selectionNode, slotMap.avatar]
362
+ }) : slotMap.avatar;
363
+ var actionsNode = React.Children.toArray(slotMap.actions || slotMap.aside);
364
+ var defaultTitleDom = itemTitleRender ? itemTitleRender(record, slotMap.title) : slotMap.title;
365
+ var defaultHeaderDom = itemLayout === 'vertical' ? /*#__PURE__*/_jsxs("div", {
366
+ className: "flex items-start justify-between gap-3",
367
+ children: [/*#__PURE__*/_jsxs("div", {
368
+ className: "min-w-0 flex-1",
369
+ children: [/*#__PURE__*/_jsx("div", {
370
+ children: defaultTitleDom
371
+ }), slotMap.description || slotMap.subTitle ? /*#__PURE__*/_jsx("div", {
372
+ className: "mt-1 text-sm text-muted-foreground",
373
+ children: slotMap.description || slotMap.subTitle
374
+ }) : null]
375
+ }), actionsNode.length ? /*#__PURE__*/_jsx("div", {
376
+ className: "shrink-0",
377
+ children: actionsNode
378
+ }) : null]
379
+ }) : defaultTitleDom;
380
+ var contentNode = itemLayout === 'vertical' ? /*#__PURE__*/_jsxs("div", {
381
+ className: "space-y-3",
382
+ children: [itemHeaderRender ? itemHeaderRender(record, defaultHeaderDom) : defaultHeaderDom, slotMap.content ? /*#__PURE__*/_jsx("div", {
383
+ children: slotMap.content
384
+ }) : null]
385
+ }) : slotMap.content;
386
+ var itemProps = _objectSpread(_objectSpread({}, (onRow === null || onRow === void 0 ? void 0 : onRow(record, index)) || {}), (onItem === null || onItem === void 0 ? void 0 : onItem(record, index)) || {});
387
+ var itemClassName = cn(typeof rowClassName === 'function' ? rowClassName(record, index) : rowClassName, selected && 'ring-primary/20 ring-1');
388
+ var dom = /*#__PURE__*/_jsx(ListItem, _objectSpread(_objectSpread({
389
+ prefix: mergedPrefix,
390
+ title: itemLayout === 'vertical' ? undefined : defaultHeaderDom,
391
+ description: itemLayout === 'vertical' ? undefined : slotMap.description || slotMap.subTitle,
392
+ extra: itemLayout === 'vertical' ? undefined : actionsNode,
393
+ bordered: split,
394
+ className: itemClassName
395
+ }, itemProps), {}, {
396
+ children: contentNode
397
+ }), recordKey);
398
+ var maybeWrappedDom = itemCardProps ? /*#__PURE__*/_jsx(Card, _objectSpread(_objectSpread({}, itemCardProps), {}, {
399
+ className: cn('h-full', itemCardProps.className),
400
+ bodyClassName: cn(itemCardProps.bodyClassName),
401
+ children: dom
402
+ }), recordKey) : dom;
403
+ var finalDom = Object.keys(itemProps).length > 0 ? /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, itemProps), {}, {
404
+ children: maybeWrappedDom
405
+ }), recordKey) : maybeWrappedDom;
406
+ if (!itemRender) {
407
+ return finalDom;
408
+ }
409
+ var renderedItem = itemRender(record, index, finalDom);
410
+ if ( /*#__PURE__*/React.isValidElement(renderedItem) && renderedItem.key == null) {
411
+ return /*#__PURE__*/React.cloneElement(renderedItem, {
412
+ key: recordKey
413
+ });
414
+ }
415
+ return renderedItem;
416
+ })
417
+ })
418
+ }), footer ? /*#__PURE__*/_jsx("div", {
419
+ className: "mt-4",
420
+ children: footer
421
+ }) : null, pagination && !(showPaginationTop || showPaginationBoth) ? /*#__PURE__*/_jsx("div", {
422
+ className: "mt-4 flex justify-end",
423
+ children: renderPaginationNode()
424
+ }) : null, showPaginationBoth && pagination ? /*#__PURE__*/_jsx("div", {
425
+ className: "mt-4 flex justify-end",
426
+ children: renderPaginationNode()
427
+ }) : null]
428
+ });
429
+ };
430
+ export var BaseProList = ProList;
431
+ export default ProList;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { ConfigContextPropsType } from './types';
3
+ export declare const ProProvider: React.Context<ConfigContextPropsType>;
4
+ export declare const useProConfig: () => ConfigContextPropsType;
5
+ export declare const useIntl: () => IntlType;
6
+ export declare const ConfigConsumer: React.Consumer<ConfigContextPropsType>;
7
+ export declare const IntlConsumer: React.Consumer<ConfigContextPropsType>;
@@ -0,0 +1,21 @@
1
+ import { createContext, useContext } from 'react';
2
+ import { zhCNIntl } from "./intl";
3
+ export var ProProvider = /*#__PURE__*/createContext({
4
+ cache: new Map(),
5
+ dark: false,
6
+ hashId: '',
7
+ hashed: false,
8
+ intl: zhCNIntl,
9
+ prefixCls: 'x-web-pro',
10
+ token: {},
11
+ valueTypeMap: {}
12
+ });
13
+ ProProvider.displayName = 'ProProvider';
14
+ export var useProConfig = function useProConfig() {
15
+ return useContext(ProProvider);
16
+ };
17
+ export var useIntl = function useIntl() {
18
+ return useProConfig().intl;
19
+ };
20
+ export var ConfigConsumer = ProProvider.Consumer;
21
+ export var IntlConsumer = ProProvider.Consumer;
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { type ConfigProviderProps } from '@hanwenbo/x-web-ui/configProvider';
3
+ import { ProProvider } from './context';
4
+ import type { IntlType } from './intl';
5
+ import type { ConfigContextPropsType, DeepPartial, ProRenderFieldPropsType, ProTokenType } from './types';
6
+ export * from './context';
7
+ export * from './intl';
8
+ export * from './types';
9
+ export * from './useStyle';
10
+ export declare const isNeedOpenHash: () => boolean;
11
+ export interface ProConfigProviderProps extends ConfigProviderProps {
12
+ prefixCls?: string;
13
+ valueTypeMap?: Record<string, ProRenderFieldPropsType>;
14
+ token?: DeepPartial<ProTokenType>;
15
+ hashed?: boolean;
16
+ dark?: boolean;
17
+ intl?: IntlType;
18
+ autoClearCache?: boolean;
19
+ needDeps?: boolean;
20
+ children?: React.ReactNode;
21
+ }
22
+ export declare type ProProviderProps = ProConfigProviderProps;
23
+ export declare const useProConfig: () => ConfigContextPropsType;
24
+ export declare const useIntl: () => IntlType;
25
+ export declare const ConfigConsumer: React.Consumer<ConfigContextPropsType>;
26
+ export declare const IntlConsumer: React.Consumer<ConfigContextPropsType>;
27
+ export declare const ProConfigProvider: React.FC<ProConfigProviderProps>;
28
+ export default ProProvider;