@sheinx/base 3.1.0-rc.2 → 3.1.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 (288) hide show
  1. package/LICENSE +21 -0
  2. package/cjs/button/button-group.d.ts.map +1 -1
  3. package/cjs/button/button-group.js +3 -0
  4. package/cjs/button/button.d.ts.map +1 -1
  5. package/cjs/button/button.js +5 -1
  6. package/cjs/card/card-header.d.ts.map +1 -1
  7. package/cjs/card/card-header.js +3 -0
  8. package/cjs/carousel/carousel.d.ts.map +1 -1
  9. package/cjs/carousel/carousel.js +6 -4
  10. package/cjs/cascader/cascader.d.ts.map +1 -1
  11. package/cjs/cascader/cascader.js +9 -7
  12. package/cjs/cascader/list.d.ts.map +1 -1
  13. package/cjs/cascader/list.js +3 -1
  14. package/cjs/cascader/list.type.d.ts +1 -1
  15. package/cjs/cascader/list.type.d.ts.map +1 -1
  16. package/cjs/cascader/node.d.ts.map +1 -1
  17. package/cjs/cascader/node.js +9 -10
  18. package/cjs/collapse/collapse-item.d.ts.map +1 -1
  19. package/cjs/collapse/collapse-item.js +5 -1
  20. package/cjs/common/use-tip.d.ts.map +1 -1
  21. package/cjs/common/use-tip.js +4 -1
  22. package/cjs/date-picker/date-picker.d.ts.map +1 -1
  23. package/cjs/date-picker/date-picker.js +7 -3
  24. package/cjs/date-picker/date-picker.type.d.ts +1 -0
  25. package/cjs/date-picker/date-picker.type.d.ts.map +1 -1
  26. package/cjs/date-picker/day.d.ts.map +1 -1
  27. package/cjs/date-picker/day.js +10 -1
  28. package/cjs/date-picker/month.d.ts.map +1 -1
  29. package/cjs/date-picker/month.js +8 -1
  30. package/cjs/date-picker/picker.js +4 -3
  31. package/cjs/date-picker/picker.type.d.ts +1 -0
  32. package/cjs/date-picker/picker.type.d.ts.map +1 -1
  33. package/cjs/date-picker/quarter.d.ts.map +1 -1
  34. package/cjs/date-picker/quarter.js +7 -1
  35. package/cjs/date-picker/result.d.ts +1 -1
  36. package/cjs/date-picker/result.d.ts.map +1 -1
  37. package/cjs/date-picker/result.js +19 -17
  38. package/cjs/date-picker/time.d.ts.map +1 -1
  39. package/cjs/date-picker/time.js +7 -4
  40. package/cjs/date-picker/year.d.ts.map +1 -1
  41. package/cjs/date-picker/year.js +7 -1
  42. package/cjs/dropdown/Item.d.ts.map +1 -1
  43. package/cjs/dropdown/Item.js +5 -3
  44. package/cjs/dropdown/dropdown.type.d.ts +1 -0
  45. package/cjs/dropdown/dropdown.type.d.ts.map +1 -1
  46. package/cjs/dropdown/dropdownIn.d.ts.map +1 -1
  47. package/cjs/dropdown/dropdownIn.js +30 -18
  48. package/cjs/form/form-item.d.ts.map +1 -1
  49. package/cjs/image/image-gallery.d.ts.map +1 -1
  50. package/cjs/image/image-gallery.js +6 -1
  51. package/cjs/input/input-group.d.ts.map +1 -1
  52. package/cjs/input/input-group.js +3 -0
  53. package/cjs/input/simple-input.d.ts.map +1 -1
  54. package/cjs/input/simple-input.js +3 -0
  55. package/cjs/input/use-input-common.d.ts.map +1 -1
  56. package/cjs/input/use-input-common.js +2 -1
  57. package/cjs/list/list.d.ts.map +1 -1
  58. package/cjs/list/list.js +4 -4
  59. package/cjs/menu/item.d.ts.map +1 -1
  60. package/cjs/menu/item.js +6 -0
  61. package/cjs/menu/scrollbar.d.ts.map +1 -1
  62. package/cjs/menu/scrollbar.js +1 -0
  63. package/cjs/pagination/pagination-buttons.d.ts.map +1 -1
  64. package/cjs/pagination/pagination-buttons.js +5 -4
  65. package/cjs/pagination/pagination-next.d.ts.map +1 -1
  66. package/cjs/pagination/pagination-next.js +6 -6
  67. package/cjs/pagination/pagination-prev.d.ts.map +1 -1
  68. package/cjs/pagination/pagination-prev.js +6 -6
  69. package/cjs/pagination/pagination.type.d.ts +0 -1
  70. package/cjs/pagination/pagination.type.d.ts.map +1 -1
  71. package/cjs/popover/popover.d.ts.map +1 -1
  72. package/cjs/popover/popover.js +3 -0
  73. package/cjs/rate/rate.d.ts.map +1 -1
  74. package/cjs/rate/rate.js +3 -0
  75. package/cjs/select/list-option.d.ts.map +1 -1
  76. package/cjs/select/list-option.js +4 -0
  77. package/cjs/select/result-input.d.ts.map +1 -1
  78. package/cjs/select/result-input.js +1 -4
  79. package/cjs/select/result.d.ts.map +1 -1
  80. package/cjs/select/result.js +44 -47
  81. package/cjs/select/result.type.d.ts +1 -0
  82. package/cjs/select/result.type.d.ts.map +1 -1
  83. package/cjs/select/select.d.ts.map +1 -1
  84. package/cjs/select/select.js +16 -23
  85. package/cjs/slider/slider.d.ts.map +1 -1
  86. package/cjs/slider/slider.js +9 -2
  87. package/cjs/steps/step.arrow.d.ts.map +1 -1
  88. package/cjs/steps/step.arrow.js +4 -0
  89. package/cjs/steps/step.d.ts.map +1 -1
  90. package/cjs/steps/step.default.d.ts.map +1 -1
  91. package/cjs/steps/step.default.js +6 -1
  92. package/cjs/steps/step.dot.d.ts.map +1 -1
  93. package/cjs/steps/step.dot.js +6 -1
  94. package/cjs/steps/step.js +3 -0
  95. package/cjs/switch/switch.d.ts.map +1 -1
  96. package/cjs/switch/switch.js +3 -0
  97. package/cjs/table/table.d.ts.map +1 -1
  98. package/cjs/table/table.js +71 -124
  99. package/cjs/table/table.type.d.ts +1 -0
  100. package/cjs/table/table.type.d.ts.map +1 -1
  101. package/cjs/table/thead.d.ts.map +1 -1
  102. package/cjs/table/thead.js +10 -3
  103. package/cjs/table/tr.d.ts.map +1 -1
  104. package/cjs/table/tr.js +13 -10
  105. package/cjs/tabs/tab.d.ts.map +1 -1
  106. package/cjs/tabs/tab.js +4 -0
  107. package/cjs/tabs/tabs-header.d.ts.map +1 -1
  108. package/cjs/tabs/tabs-header.js +47 -23
  109. package/cjs/tabs/tabs.d.ts.map +1 -1
  110. package/cjs/textarea/textarea.d.ts.map +1 -1
  111. package/cjs/textarea/textarea.js +1 -0
  112. package/cjs/textarea/use-auto-size.d.ts.map +1 -1
  113. package/cjs/textarea/use-auto-size.js +1 -0
  114. package/cjs/tooltip/tooltip.d.ts.map +1 -1
  115. package/cjs/tooltip/tooltip.js +3 -0
  116. package/cjs/transfer/transfer.d.ts.map +1 -1
  117. package/cjs/transfer/transfer.js +5 -2
  118. package/cjs/tree/tree-checkbox.d.ts.map +1 -1
  119. package/cjs/tree/tree-checkbox.js +8 -1
  120. package/cjs/tree/tree-content.d.ts.map +1 -1
  121. package/cjs/tree/tree-content.js +24 -4
  122. package/cjs/tree/tree-content.type.d.ts +1 -1
  123. package/cjs/tree/tree-content.type.d.ts.map +1 -1
  124. package/cjs/tree/tree-context.d.ts +3 -3
  125. package/cjs/tree/tree-context.d.ts.map +1 -1
  126. package/cjs/tree/tree-node.d.ts.map +1 -1
  127. package/cjs/tree/tree-node.js +3 -0
  128. package/cjs/tree/tree.d.ts.map +1 -1
  129. package/cjs/tree/tree.js +4 -13
  130. package/cjs/tree-select/tree-select.d.ts.map +1 -1
  131. package/cjs/tree-select/tree-select.js +109 -72
  132. package/cjs/tree-select/tree-select.type.d.ts +6 -0
  133. package/cjs/tree-select/tree-select.type.d.ts.map +1 -1
  134. package/cjs/upload/button.d.ts.map +1 -1
  135. package/cjs/upload/button.js +4 -3
  136. package/cjs/upload/result.d.ts.map +1 -1
  137. package/cjs/upload/result.js +3 -0
  138. package/cjs/virtual-scroll/scroll.d.ts.map +1 -1
  139. package/cjs/virtual-scroll/scroll.js +28 -14
  140. package/cjs/virtual-scroll/virtual-scroll-list.d.ts.map +1 -1
  141. package/cjs/virtual-scroll/virtual-scroll-list.js +2 -0
  142. package/esm/button/button-group.d.ts.map +1 -1
  143. package/esm/button/button-group.js +3 -0
  144. package/esm/button/button.d.ts.map +1 -1
  145. package/esm/button/button.js +5 -1
  146. package/esm/card/card-header.d.ts.map +1 -1
  147. package/esm/card/card-header.js +3 -0
  148. package/esm/carousel/carousel.d.ts.map +1 -1
  149. package/esm/carousel/carousel.js +6 -4
  150. package/esm/cascader/cascader.d.ts.map +1 -1
  151. package/esm/cascader/cascader.js +9 -7
  152. package/esm/cascader/list.d.ts.map +1 -1
  153. package/esm/cascader/list.js +3 -1
  154. package/esm/cascader/list.type.d.ts +1 -1
  155. package/esm/cascader/list.type.d.ts.map +1 -1
  156. package/esm/cascader/node.d.ts.map +1 -1
  157. package/esm/cascader/node.js +9 -10
  158. package/esm/collapse/collapse-item.d.ts.map +1 -1
  159. package/esm/collapse/collapse-item.js +5 -1
  160. package/esm/common/use-tip.d.ts.map +1 -1
  161. package/esm/common/use-tip.js +4 -1
  162. package/esm/date-picker/date-picker.d.ts.map +1 -1
  163. package/esm/date-picker/date-picker.js +9 -4
  164. package/esm/date-picker/date-picker.type.d.ts +1 -0
  165. package/esm/date-picker/date-picker.type.d.ts.map +1 -1
  166. package/esm/date-picker/day.d.ts.map +1 -1
  167. package/esm/date-picker/day.js +10 -1
  168. package/esm/date-picker/month.d.ts.map +1 -1
  169. package/esm/date-picker/month.js +8 -1
  170. package/esm/date-picker/picker.js +4 -3
  171. package/esm/date-picker/picker.type.d.ts +1 -0
  172. package/esm/date-picker/picker.type.d.ts.map +1 -1
  173. package/esm/date-picker/quarter.d.ts.map +1 -1
  174. package/esm/date-picker/quarter.js +7 -1
  175. package/esm/date-picker/result.d.ts +1 -1
  176. package/esm/date-picker/result.d.ts.map +1 -1
  177. package/esm/date-picker/result.js +6 -4
  178. package/esm/date-picker/time.d.ts.map +1 -1
  179. package/esm/date-picker/time.js +5 -2
  180. package/esm/date-picker/year.d.ts.map +1 -1
  181. package/esm/date-picker/year.js +7 -1
  182. package/esm/dropdown/Item.d.ts.map +1 -1
  183. package/esm/dropdown/Item.js +5 -3
  184. package/esm/dropdown/dropdown.type.d.ts +1 -0
  185. package/esm/dropdown/dropdown.type.d.ts.map +1 -1
  186. package/esm/dropdown/dropdownIn.d.ts.map +1 -1
  187. package/esm/dropdown/dropdownIn.js +30 -18
  188. package/esm/form/form-item.d.ts.map +1 -1
  189. package/esm/image/image-gallery.d.ts.map +1 -1
  190. package/esm/image/image-gallery.js +6 -1
  191. package/esm/input/input-group.d.ts.map +1 -1
  192. package/esm/input/input-group.js +3 -0
  193. package/esm/input/simple-input.d.ts.map +1 -1
  194. package/esm/input/simple-input.js +3 -0
  195. package/esm/input/use-input-common.d.ts.map +1 -1
  196. package/esm/input/use-input-common.js +3 -2
  197. package/esm/list/list.d.ts.map +1 -1
  198. package/esm/list/list.js +4 -4
  199. package/esm/menu/item.d.ts.map +1 -1
  200. package/esm/menu/item.js +6 -0
  201. package/esm/menu/scrollbar.d.ts.map +1 -1
  202. package/esm/menu/scrollbar.js +1 -0
  203. package/esm/pagination/pagination-buttons.d.ts.map +1 -1
  204. package/esm/pagination/pagination-buttons.js +5 -4
  205. package/esm/pagination/pagination-next.d.ts.map +1 -1
  206. package/esm/pagination/pagination-next.js +6 -6
  207. package/esm/pagination/pagination-prev.d.ts.map +1 -1
  208. package/esm/pagination/pagination-prev.js +6 -6
  209. package/esm/pagination/pagination.type.d.ts +0 -1
  210. package/esm/pagination/pagination.type.d.ts.map +1 -1
  211. package/esm/popover/popover.d.ts.map +1 -1
  212. package/esm/popover/popover.js +3 -0
  213. package/esm/rate/rate.d.ts.map +1 -1
  214. package/esm/rate/rate.js +3 -0
  215. package/esm/select/list-option.d.ts.map +1 -1
  216. package/esm/select/list-option.js +4 -0
  217. package/esm/select/result-input.d.ts.map +1 -1
  218. package/esm/select/result-input.js +1 -4
  219. package/esm/select/result.d.ts.map +1 -1
  220. package/esm/select/result.js +45 -48
  221. package/esm/select/result.type.d.ts +1 -0
  222. package/esm/select/result.type.d.ts.map +1 -1
  223. package/esm/select/select.d.ts.map +1 -1
  224. package/esm/select/select.js +16 -23
  225. package/esm/slider/slider.d.ts.map +1 -1
  226. package/esm/slider/slider.js +9 -2
  227. package/esm/steps/step.arrow.d.ts.map +1 -1
  228. package/esm/steps/step.arrow.js +4 -0
  229. package/esm/steps/step.d.ts.map +1 -1
  230. package/esm/steps/step.default.d.ts.map +1 -1
  231. package/esm/steps/step.default.js +6 -1
  232. package/esm/steps/step.dot.d.ts.map +1 -1
  233. package/esm/steps/step.dot.js +6 -1
  234. package/esm/steps/step.js +3 -0
  235. package/esm/switch/switch.d.ts.map +1 -1
  236. package/esm/switch/switch.js +3 -0
  237. package/esm/table/table.d.ts.map +1 -1
  238. package/esm/table/table.js +72 -125
  239. package/esm/table/table.type.d.ts +1 -0
  240. package/esm/table/table.type.d.ts.map +1 -1
  241. package/esm/table/thead.d.ts.map +1 -1
  242. package/esm/table/thead.js +10 -3
  243. package/esm/table/tr.d.ts.map +1 -1
  244. package/esm/table/tr.js +13 -10
  245. package/esm/tabs/tab.d.ts.map +1 -1
  246. package/esm/tabs/tab.js +4 -0
  247. package/esm/tabs/tabs-header.d.ts.map +1 -1
  248. package/esm/tabs/tabs-header.js +47 -23
  249. package/esm/tabs/tabs.d.ts.map +1 -1
  250. package/esm/textarea/textarea.d.ts.map +1 -1
  251. package/esm/textarea/textarea.js +1 -0
  252. package/esm/textarea/use-auto-size.d.ts.map +1 -1
  253. package/esm/textarea/use-auto-size.js +1 -0
  254. package/esm/tooltip/tooltip.d.ts.map +1 -1
  255. package/esm/tooltip/tooltip.js +3 -0
  256. package/esm/transfer/transfer.d.ts.map +1 -1
  257. package/esm/transfer/transfer.js +5 -2
  258. package/esm/tree/tree-checkbox.d.ts.map +1 -1
  259. package/esm/tree/tree-checkbox.js +8 -1
  260. package/esm/tree/tree-content.d.ts.map +1 -1
  261. package/esm/tree/tree-content.js +25 -5
  262. package/esm/tree/tree-content.type.d.ts +1 -1
  263. package/esm/tree/tree-content.type.d.ts.map +1 -1
  264. package/esm/tree/tree-context.d.ts +3 -3
  265. package/esm/tree/tree-context.d.ts.map +1 -1
  266. package/esm/tree/tree-node.d.ts.map +1 -1
  267. package/esm/tree/tree-node.js +3 -0
  268. package/esm/tree/tree.d.ts.map +1 -1
  269. package/esm/tree/tree.js +5 -14
  270. package/esm/tree-select/tree-select.d.ts.map +1 -1
  271. package/esm/tree-select/tree-select.js +110 -73
  272. package/esm/tree-select/tree-select.type.d.ts +6 -0
  273. package/esm/tree-select/tree-select.type.d.ts.map +1 -1
  274. package/esm/upload/button.d.ts.map +1 -1
  275. package/esm/upload/button.js +4 -3
  276. package/esm/upload/result.d.ts.map +1 -1
  277. package/esm/upload/result.js +3 -0
  278. package/esm/virtual-scroll/scroll.d.ts.map +1 -1
  279. package/esm/virtual-scroll/scroll.js +28 -14
  280. package/esm/virtual-scroll/virtual-scroll-list.d.ts.map +1 -1
  281. package/esm/virtual-scroll/virtual-scroll-list.js +2 -0
  282. package/package.json +9 -4
  283. package/cjs/table/temp/01-base.d.ts +0 -4
  284. package/cjs/table/temp/01-base.d.ts.map +0 -1
  285. package/cjs/table/temp/01-base.js +0 -199
  286. package/esm/table/temp/01-base.d.ts +0 -4
  287. package/esm/table/temp/01-base.d.ts.map +0 -1
  288. package/esm/table/temp/01-base.js +0 -194
@@ -1,199 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _2 = require("../..");
9
- var _shineoutStyle = require("@sheinx/shineout-style");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- 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); }
13
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
- 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."); }
15
- 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); }
16
- 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; }
17
- 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; } }
18
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
- 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; }
20
- 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; }
21
- 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; }
22
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
23
- 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); } /**
24
- * cn - 基本用法
25
- * --
26
- * en - Basic
27
- * --
28
- */
29
- var jssStyle = {
30
- table: _shineoutStyle.useTableStyle,
31
- radio: _shineoutStyle.useRadioStyle,
32
- checkbox: _shineoutStyle.useCheckboxStyle
33
- };
34
- var id = 0;
35
- var mockData = function mockData(i) {
36
- var item = {
37
- id: id++,
38
- name: "Edward King Edward King Edward King Edward King ".concat(i),
39
- age: Math.floor(Math.random() * 100),
40
- address: "London, Park Lane no. ".concat(i),
41
- sex: i % 2 === 0 ? 'man' : 'femail',
42
- children: []
43
- };
44
- return item;
45
- };
46
- // mock 1000 rows 学生数据
47
- var data = Array(10).fill(0).map(function (_, i) {
48
- return _objectSpread({}, mockData(i));
49
- });
50
- var columns = [{
51
- type: 'checkbox',
52
- width: 20
53
- }, {
54
- type: 'expand',
55
- width: 20,
56
- render: function render() {
57
- return function () {
58
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
59
- style: {
60
- padding: '12px'
61
- },
62
- children: "123213"
63
- });
64
- };
65
- }
66
- }, {
67
- title: 'ID2',
68
- render: 'id',
69
- width: 40,
70
- treeColumnsName: 'children',
71
- sorter: function sorter(order) {
72
- return function (a, b) {
73
- return order === 'asc' ? a.id - b.id : b.id - a.id;
74
- };
75
- },
76
- defaultOrder: 'asc'
77
- }, {
78
- title: 'age2',
79
- render: 'age',
80
- width: 40,
81
- sorter: function sorter(order) {
82
- return function (a, b) {
83
- return order === 'asc' ? a.age - b.age : b.age - a.age;
84
- };
85
- }
86
- }, {
87
- title: 'age',
88
- render: 'age',
89
- width: 40,
90
- sorter: 'age',
91
- rowSpan: function rowSpan(data, nextData) {
92
- return data.age === nextData.age;
93
- },
94
- colSpan: function colSpan(data) {
95
- return data.age % 2 === 0 ? 2 : 1;
96
- }
97
- }, {
98
- title: 'Name',
99
- render: 'name',
100
- width: 80,
101
- sorter: 'name'
102
- }, {
103
- title: 'Age',
104
- render: 'age',
105
- width: 100,
106
- group: ['group1', 'group2']
107
- }, {
108
- title: 'Address',
109
- render: 'address',
110
- group: ['group1', 'group2'],
111
- width: 100
112
- }, {
113
- title: 'Sex',
114
- render: 'sex',
115
- width: 50,
116
- fixed: 'right'
117
- }];
118
- var sorters = {
119
- id: function id(order) {
120
- return function (a, b) {
121
- return order === 'asc' ? a.id - b.id : b.id - a.id;
122
- };
123
- },
124
- name: function name(order) {
125
- return function (a, b) {
126
- return order === 'asc' ? a.name.localeCompare(b.name) : b.name.localeCompare(a.name);
127
- };
128
- },
129
- age: function age(order) {
130
- return function (a, b) {
131
- return order === 'asc' ? a.age - b.age : b.age - a.age;
132
- };
133
- }
134
- };
135
- var _default = exports.default = function _default() {
136
- var _React$useState = _react.default.useState(1),
137
- _React$useState2 = _slicedToArray(_React$useState, 2),
138
- bordered = _React$useState2[0],
139
- setBordered = _React$useState2[1];
140
- var _React$useState3 = _react.default.useState('top'),
141
- _React$useState4 = _slicedToArray(_React$useState3, 2),
142
- va = _React$useState4[0],
143
- setVa = _React$useState4[1];
144
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
145
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
146
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
147
- children: "bordered:"
148
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_2.RadioGroup, {
149
- jssStyle: jssStyle,
150
- data: [0, 1],
151
- value: bordered,
152
- onChange: function onChange(d) {
153
- return setBordered(d);
154
- },
155
- keygen: true,
156
- renderItem: function renderItem(d) {
157
- return !!d ? 'true' : 'false';
158
- }
159
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
160
- children: "vertical:"
161
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_2.RadioGroup, {
162
- jssStyle: jssStyle,
163
- data: ['middle', 'top'],
164
- value: va,
165
- onChange: function onChange(d) {
166
- return setVa(d);
167
- },
168
- keygen: true,
169
- renderItem: function renderItem(d) {
170
- return d;
171
- }
172
- })]
173
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_2.Table, {
174
- sticky: {
175
- top: 180
176
- },
177
- columnResizable: true,
178
- bordered: !!bordered,
179
- sorter: function sorter(key, order, list) {
180
- console.log(key, order, list);
181
- var orderFunc = sorters[key];
182
- return orderFunc(order);
183
- },
184
- width: 1000,
185
- style: {
186
- height: ''
187
- },
188
- keygen: "id",
189
- verticalAlign: va,
190
- jssStyle: jssStyle,
191
- data: data,
192
- format: 'id',
193
- columns: columns,
194
- onRowSelect: function onRowSelect(value) {
195
- console.log(value);
196
- }
197
- })]
198
- });
199
- };
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- declare const _default: () => JSX.Element;
3
- export default _default;
4
- //# sourceMappingURL=01-base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"01-base.d.ts","sourceRoot":"","sources":["01-base.tsx"],"names":[],"mappings":";;AA+GA,wBAgDE"}
@@ -1,194 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
- 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."); }
4
- 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); }
5
- 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; }
6
- 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; } }
7
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
- 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; }
9
- 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; }
10
- 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; }
11
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
- 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); }
13
- /**
14
- * cn - 基本用法
15
- * --
16
- * en - Basic
17
- * --
18
- */
19
- import React from 'react';
20
- import { Table, RadioGroup } from "../..";
21
- import { useTableStyle, useRadioStyle, useCheckboxStyle } from '@sheinx/shineout-style';
22
- import { jsx as _jsx } from "react/jsx-runtime";
23
- import { jsxs as _jsxs } from "react/jsx-runtime";
24
- var jssStyle = {
25
- table: useTableStyle,
26
- radio: useRadioStyle,
27
- checkbox: useCheckboxStyle
28
- };
29
- var id = 0;
30
- var mockData = function mockData(i) {
31
- var item = {
32
- id: id++,
33
- name: "Edward King Edward King Edward King Edward King ".concat(i),
34
- age: Math.floor(Math.random() * 100),
35
- address: "London, Park Lane no. ".concat(i),
36
- sex: i % 2 === 0 ? 'man' : 'femail',
37
- children: []
38
- };
39
- return item;
40
- };
41
- // mock 1000 rows 学生数据
42
- var data = Array(10).fill(0).map(function (_, i) {
43
- return _objectSpread({}, mockData(i));
44
- });
45
- var columns = [{
46
- type: 'checkbox',
47
- width: 20
48
- }, {
49
- type: 'expand',
50
- width: 20,
51
- render: function render() {
52
- return function () {
53
- return /*#__PURE__*/_jsx("div", {
54
- style: {
55
- padding: '12px'
56
- },
57
- children: "123213"
58
- });
59
- };
60
- }
61
- }, {
62
- title: 'ID2',
63
- render: 'id',
64
- width: 40,
65
- treeColumnsName: 'children',
66
- sorter: function sorter(order) {
67
- return function (a, b) {
68
- return order === 'asc' ? a.id - b.id : b.id - a.id;
69
- };
70
- },
71
- defaultOrder: 'asc'
72
- }, {
73
- title: 'age2',
74
- render: 'age',
75
- width: 40,
76
- sorter: function sorter(order) {
77
- return function (a, b) {
78
- return order === 'asc' ? a.age - b.age : b.age - a.age;
79
- };
80
- }
81
- }, {
82
- title: 'age',
83
- render: 'age',
84
- width: 40,
85
- sorter: 'age',
86
- rowSpan: function rowSpan(data, nextData) {
87
- return data.age === nextData.age;
88
- },
89
- colSpan: function colSpan(data) {
90
- return data.age % 2 === 0 ? 2 : 1;
91
- }
92
- }, {
93
- title: 'Name',
94
- render: 'name',
95
- width: 80,
96
- sorter: 'name'
97
- }, {
98
- title: 'Age',
99
- render: 'age',
100
- width: 100,
101
- group: ['group1', 'group2']
102
- }, {
103
- title: 'Address',
104
- render: 'address',
105
- group: ['group1', 'group2'],
106
- width: 100
107
- }, {
108
- title: 'Sex',
109
- render: 'sex',
110
- width: 50,
111
- fixed: 'right'
112
- }];
113
- var sorters = {
114
- id: function id(order) {
115
- return function (a, b) {
116
- return order === 'asc' ? a.id - b.id : b.id - a.id;
117
- };
118
- },
119
- name: function name(order) {
120
- return function (a, b) {
121
- return order === 'asc' ? a.name.localeCompare(b.name) : b.name.localeCompare(a.name);
122
- };
123
- },
124
- age: function age(order) {
125
- return function (a, b) {
126
- return order === 'asc' ? a.age - b.age : b.age - a.age;
127
- };
128
- }
129
- };
130
- export default (function () {
131
- var _React$useState = React.useState(1),
132
- _React$useState2 = _slicedToArray(_React$useState, 2),
133
- bordered = _React$useState2[0],
134
- setBordered = _React$useState2[1];
135
- var _React$useState3 = React.useState('top'),
136
- _React$useState4 = _slicedToArray(_React$useState3, 2),
137
- va = _React$useState4[0],
138
- setVa = _React$useState4[1];
139
- return /*#__PURE__*/_jsxs("div", {
140
- children: [/*#__PURE__*/_jsxs("div", {
141
- children: [/*#__PURE__*/_jsx("span", {
142
- children: "bordered:"
143
- }), /*#__PURE__*/_jsx(RadioGroup, {
144
- jssStyle: jssStyle,
145
- data: [0, 1],
146
- value: bordered,
147
- onChange: function onChange(d) {
148
- return setBordered(d);
149
- },
150
- keygen: true,
151
- renderItem: function renderItem(d) {
152
- return !!d ? 'true' : 'false';
153
- }
154
- }), /*#__PURE__*/_jsx("span", {
155
- children: "vertical:"
156
- }), /*#__PURE__*/_jsx(RadioGroup, {
157
- jssStyle: jssStyle,
158
- data: ['middle', 'top'],
159
- value: va,
160
- onChange: function onChange(d) {
161
- return setVa(d);
162
- },
163
- keygen: true,
164
- renderItem: function renderItem(d) {
165
- return d;
166
- }
167
- })]
168
- }), /*#__PURE__*/_jsx(Table, {
169
- sticky: {
170
- top: 180
171
- },
172
- columnResizable: true,
173
- bordered: !!bordered,
174
- sorter: function sorter(key, order, list) {
175
- console.log(key, order, list);
176
- var orderFunc = sorters[key];
177
- return orderFunc(order);
178
- },
179
- width: 1000,
180
- style: {
181
- height: ''
182
- },
183
- keygen: "id",
184
- verticalAlign: va,
185
- jssStyle: jssStyle,
186
- data: data,
187
- format: 'id',
188
- columns: columns,
189
- onRowSelect: function onRowSelect(value) {
190
- console.log(value);
191
- }
192
- })]
193
- });
194
- });