@beppla/tapas-ui 1.0.67 → 1.0.68

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 (255) hide show
  1. package/commonjs/AnimatedNavItem/index.js +15 -9
  2. package/commonjs/BarChart/BarChart.js +90 -112
  3. package/commonjs/BarChart/BarChart.js.map +1 -1
  4. package/commonjs/Button/Button.js +78 -96
  5. package/commonjs/Calendar/Calendar.base.js +190 -162
  6. package/commonjs/Calendar/Calendar.base.js.map +2 -1
  7. package/commonjs/Calendar/Calendar.js +102 -86
  8. package/commonjs/Calendar/Calendar.js.map +1 -2
  9. package/commonjs/Calendar/ConcreteTimeSelector.js +271 -220
  10. package/commonjs/Calendar/CustomRange.js +324 -271
  11. package/commonjs/Calendar/CustomRange.js.map +2 -1
  12. package/commonjs/Calendar/MonthSelector.js.map +2 -1
  13. package/commonjs/Calendar/TimeSelector.js +274 -223
  14. package/commonjs/Calendar/TimeSelector.js.map +2 -1
  15. package/commonjs/Calendar/WeekDaySelector.js.map +2 -1
  16. package/commonjs/Calendar/helper.js +68 -68
  17. package/commonjs/Calendar/local.js +2 -2
  18. package/commonjs/Calendar/local.js.map +1 -2
  19. package/commonjs/Calendar/types.js +11 -11
  20. package/commonjs/Card/Card.js +150 -159
  21. package/commonjs/Card/Card.js.map +1 -2
  22. package/commonjs/CheckBox/GroupCheckBox.js +80 -67
  23. package/commonjs/CheckBox/GroupCheckBox.js.map +1 -2
  24. package/commonjs/CircularProgress/CircularProgress.js +0 -11
  25. package/commonjs/Collapsible/Collapsible.js +102 -55
  26. package/commonjs/Collapsible/Collapsible.js.map +1 -2
  27. package/commonjs/DashboardCard/DashboardCard.js +94 -74
  28. package/commonjs/DashboardCard/DashboardCard.js.map +1 -2
  29. package/commonjs/DataCell/DataCell.js +205 -259
  30. package/commonjs/DataCell/DataCell.js.map +1 -1
  31. package/commonjs/DataCell/index.js.map +1 -2
  32. package/commonjs/DataTable/DataTable.js +136 -141
  33. package/commonjs/DataTable/DataTable.js.map +2 -1
  34. package/commonjs/DeviceSelectionModal/DeviceSelectionModal.js +244 -242
  35. package/commonjs/DeviceSelectionModal/DeviceSelectionModal.js.map +2 -1
  36. package/commonjs/DraggableFlatList/DraggableFlatList.js +10 -12
  37. package/commonjs/DraggableFlatList/DraggableFlatList.js.map +1 -1
  38. package/commonjs/Drawer/Drawer.js +140 -159
  39. package/commonjs/Drawer/Drawer.js.map +1 -2
  40. package/commonjs/Dropdown/InputDropdown.js +123 -114
  41. package/commonjs/Dropdown/InputDropdown.js.map +1 -2
  42. package/commonjs/ExternalLink/ExternalLink.js +50 -58
  43. package/commonjs/ExternalLink/ExternalLink.js.map +2 -1
  44. package/commonjs/Gantt/Accessories.js +168 -135
  45. package/commonjs/Gantt/Accessories.js.map +2 -1
  46. package/commonjs/Gantt/GanttInnerElementType.js +102 -93
  47. package/commonjs/Gantt/GanttInnerElementType.js.map +1 -2
  48. package/commonjs/Gantt/types.js.map +2 -1
  49. package/commonjs/Grid/FixedSizeGrid.js +76 -82
  50. package/commonjs/Grid/Grid.base.js +374 -357
  51. package/commonjs/Grid/Grid.base.js.map +1 -1
  52. package/commonjs/Grid/StaticFixedSizeGrid.js.map +1 -2
  53. package/commonjs/Grid/VariableSizeGrid.js +113 -120
  54. package/commonjs/Grid/VariableSizeGrid.js.map +1 -2
  55. package/commonjs/Grid/helper.js.map +1 -2
  56. package/commonjs/Grid/timer.js +5 -9
  57. package/commonjs/Grid/timer.js.map +2 -1
  58. package/commonjs/Icons/TapasIconExpo.js +94 -101
  59. package/commonjs/Icons/TapasIconExpo.js.map +2 -1
  60. package/commonjs/Icons/fontLoader.js.map +1 -2
  61. package/commonjs/Icons/smartFontLoader.js +222 -266
  62. package/commonjs/Image/Image.js +96 -106
  63. package/commonjs/Image/Image.js.map +2 -1
  64. package/commonjs/Image/PreviewImg.js +63 -85
  65. package/commonjs/Layout/DrawerContext.js +35 -0
  66. package/commonjs/Layout/DrawerContext.js.map +1 -0
  67. package/commonjs/Layout/index.js +34 -38
  68. package/commonjs/Layout/index.js.map +2 -1
  69. package/commonjs/LineChart/LineChart.js +144 -126
  70. package/commonjs/Loading/Loading.js.map +0 -1
  71. package/commonjs/MessageBox/MessageBox.js +126 -127
  72. package/commonjs/MessageBox/MessageBox.js.map +1 -2
  73. package/commonjs/MultiSelector/MultiSelector.js.map +2 -1
  74. package/commonjs/MultiSelector/index.js +8 -3
  75. package/commonjs/MultiSelector/index.js.map +1 -1
  76. package/commonjs/Navigation/Navigation.js.map +0 -1
  77. package/commonjs/Notification/Notification.js.map +1 -2
  78. package/commonjs/Notification/index.js +8 -6
  79. package/commonjs/Notification/index.js.map +1 -2
  80. package/commonjs/NumericInput/NumericInput.js +0 -23
  81. package/commonjs/NumericInput/NumericInput.js.map +0 -1
  82. package/commonjs/Overlay/Overlay.js +30 -29
  83. package/commonjs/Overlay/Overlay.js.map +1 -2
  84. package/commonjs/Pagination/Pagination.js +139 -120
  85. package/commonjs/Pagination/Pagination.js.map +1 -2
  86. package/commonjs/PieChart/PieChart.js +97 -74
  87. package/commonjs/PieChart/PieChart.js.map +1 -2
  88. package/commonjs/PieChart/index.js +4 -3
  89. package/commonjs/PieChart/index.js.map +1 -2
  90. package/commonjs/Popover/Popover.js +137 -112
  91. package/commonjs/Popover/Popover.js.map +2 -1
  92. package/commonjs/Progress/Progress.js.map +1 -0
  93. package/commonjs/Quantity/Quantity.js +122 -117
  94. package/commonjs/Quantity/index.js +3 -0
  95. package/commonjs/Quantity/index.js.map +1 -0
  96. package/commonjs/RadioButton/RadioButton.js +46 -94
  97. package/commonjs/RadioButton/RadioButton.js.map +1 -1
  98. package/commonjs/ReasonModal/ReasonModal.js +122 -125
  99. package/commonjs/ReasonModal/ReasonModal.js.map +1 -2
  100. package/commonjs/ReasonModal/index.js +15 -9
  101. package/commonjs/ReasonModal/index.js.map +2 -1
  102. package/commonjs/ScanButton/ScanButton.js +64 -50
  103. package/commonjs/ScanButton/ScanButton.js.map +2 -1
  104. package/commonjs/SearchInput/index.js +8 -6
  105. package/commonjs/SearchInput/index.js.map +1 -2
  106. package/commonjs/Shell/Shell.js +92 -84
  107. package/commonjs/Shell/Shell.js.map +1 -2
  108. package/commonjs/StatisticCard/StatisticCard.js +47 -41
  109. package/commonjs/StatisticCard/StatisticCard.js.map +2 -1
  110. package/commonjs/Steps/Steps.js +43 -39
  111. package/commonjs/Steps/Steps.js.map +1 -1
  112. package/commonjs/TabTitle/TabTitle.js.map +2 -1
  113. package/commonjs/TableColumnHeader/TableColumnHeader.js +140 -134
  114. package/commonjs/TableColumnHeader/index.js +15 -9
  115. package/commonjs/TableColumnHeader/index.js.map +2 -1
  116. package/commonjs/Task/type.js.map +1 -2
  117. package/commonjs/TextArea/TextArea.js +82 -0
  118. package/commonjs/TextArea/TextArea.js.map +1 -0
  119. package/commonjs/Theme/ThemeProvider.js.map +2 -1
  120. package/commonjs/Theme/defaultTheme.js +18 -10
  121. package/commonjs/Theme/defaultTheme.js.map +1 -1
  122. package/commonjs/Toast/Toast.js +41 -94
  123. package/commonjs/Toast/Toast.js.map +1 -1
  124. package/commonjs/UserSwitcher/index.js +14 -8
  125. package/commonjs/UserSwitcher/index.js.map +2 -1
  126. package/commonjs/common.js +4 -5
  127. package/commonjs/common.js.map +1 -2
  128. package/commonjs/index.js +426 -336
  129. package/commonjs/index.js.map +2 -1
  130. package/module/Alert/Alert.js +51 -71
  131. package/module/Alert/Alert.js.map +1 -2
  132. package/module/AnimatedNavItem/index.js +3 -7
  133. package/module/AnimatedNavItem/index.js.map +2 -1
  134. package/module/BarChart/index.js.map +2 -1
  135. package/module/Button/Button.js +80 -71
  136. package/module/Button/Button.js.map +1 -2
  137. package/module/Button/ButtonGroup.js +129 -120
  138. package/module/Button/ButtonGroup.js.map +2 -1
  139. package/module/Calendar/Calendar.js +80 -76
  140. package/module/Calendar/ConcreteTimeSelector.js.map +1 -2
  141. package/module/Calendar/CustomRange.js +258 -357
  142. package/module/Calendar/DaySelector.js +95 -118
  143. package/module/Calendar/DaySelector.js.map +1 -2
  144. package/module/Calendar/TimeSelector.js +215 -307
  145. package/module/Calendar/WeekDaySelector.js +98 -122
  146. package/module/Calendar/helper.js +74 -74
  147. package/module/Calendar/helper.js.map +1 -2
  148. package/module/Calendar/types.js.map +2 -1
  149. package/module/Card/Card.js +0 -133
  150. package/module/Card/Card.js.map +0 -1
  151. package/module/CheckBox/CheckBox.js +93 -89
  152. package/module/CheckBox/CheckBox.js.map +1 -2
  153. package/module/CheckBox/CheckBoxItem.js +69 -84
  154. package/module/CheckBox/CheckBoxItem.js.map +1 -2
  155. package/module/Collapsible/Collapsible.js +66 -0
  156. package/module/Collapsible/Collapsible.js.map +1 -0
  157. package/module/DashboardCard/DashboardCard.js +80 -88
  158. package/module/DashboardCard/DashboardCard.js.map +2 -1
  159. package/module/DataCell/DataCell.js +311 -224
  160. package/module/DataTable/DataTable.js +0 -100
  161. package/module/DataTable/index.js +4 -2
  162. package/module/DeviceSelectionModal/DeviceSelectionModal.js +0 -124
  163. package/module/DeviceSelectionModal/DeviceSelectionModal.js.map +0 -1
  164. package/module/Dropdown/CustomDropdown.js +212 -160
  165. package/module/Dropdown/CustomDropdown.js.map +1 -1
  166. package/module/Dropdown/Dropdown.js +484 -408
  167. package/module/Dropdown/Dropdown.js.map +2 -1
  168. package/module/Dropdown/InputDropdown.js +116 -134
  169. package/module/Dropdown/InputDropdown.js.map +1 -2
  170. package/module/Gantt/Accessories.js +176 -149
  171. package/module/Gantt/Accessories.js.map +1 -1
  172. package/module/Gantt/Gantt.js.map +1 -2
  173. package/module/Gantt/types.js.map +2 -1
  174. package/module/Grid/FixedSizeGrid.js +80 -86
  175. package/module/Grid/FixedSizeGrid.js.map +1 -2
  176. package/module/Grid/Grid.base.js +339 -401
  177. package/module/Grid/Grid.base.js.map +1 -2
  178. package/module/Grid/VariableSizeGrid.js +121 -118
  179. package/module/Grid/VariableSizeGrid.js.map +2 -1
  180. package/module/Grid/helper.js.map +1 -2
  181. package/module/Grid/timer.js.map +2 -1
  182. package/module/HelloWave/HelloWave.js +43 -53
  183. package/module/HelloWave/HelloWave.js.map +1 -2
  184. package/module/Icons/TapasIcon.js +120 -96
  185. package/module/Icons/TapasIconExpo.js.map +1 -2
  186. package/module/Icons/index.js +9 -10
  187. package/module/Icons/index.js.map +2 -1
  188. package/module/Icons/smartFontLoader.js.map +1 -2
  189. package/module/Image/PreviewImg.js +76 -79
  190. package/module/Input/Input.js +34 -112
  191. package/module/Input/Input.js.map +1 -1
  192. package/module/Layout/DrawerContext.js +18 -29
  193. package/module/Layout/DrawerContext.js.map +1 -2
  194. package/module/Layout/Layout.js.map +1 -2
  195. package/module/Layout/ToastContext.js.map +1 -2
  196. package/module/Layout/index.js +14 -15
  197. package/module/LineChart/LineChart.js.map +1 -2
  198. package/module/ListItem/ListItem.js +98 -105
  199. package/module/ListItem/ListItem.js.map +2 -1
  200. package/module/Loading/Loading.js +67 -65
  201. package/module/Loading/Loading.js.map +1 -1
  202. package/module/MessageBox/MessageBox.js +137 -98
  203. package/module/MessageBox/MessageBox.js.map +2 -1
  204. package/module/MultiSelector/MultiSelector.js +229 -320
  205. package/module/MultiSelector/MultiSelector.js.map +1 -2
  206. package/module/MultiSelector/index.js +3 -2
  207. package/module/MultiSelector/index.js.map +1 -2
  208. package/module/Navigation/Navigation.js.map +1 -0
  209. package/module/Notification/index.js +0 -16
  210. package/module/Notification/index.js.map +0 -1
  211. package/module/NumericInput/NumericInput.js.map +0 -1
  212. package/module/Overlay/Overlay.js +0 -29
  213. package/module/Pagination/Pagination.js +139 -134
  214. package/module/Pagination/Pagination.js.map +2 -1
  215. package/module/PieChart/PieChart.js.map +2 -1
  216. package/module/Popover/Popover.js +117 -147
  217. package/module/Popover/Popover.js.map +1 -2
  218. package/module/Quantity/Quantity.js +112 -129
  219. package/module/Quantity/index.js +16 -0
  220. package/module/Quantity/index.js.map +1 -0
  221. package/module/ReasonModal/index.js +0 -27
  222. package/module/ScanButton/ScanButton.js +0 -45
  223. package/module/SearchInput/index.js +3 -2
  224. package/module/SearchInput/index.js.map +1 -2
  225. package/module/SheetTitle/SheetTitle.js +35 -40
  226. package/module/SheetTitle/SheetTitle.js.map +1 -2
  227. package/module/Shell/Shell.js +79 -92
  228. package/module/Shell/Shell.js.map +1 -2
  229. package/module/Shell/styles.js +8 -8
  230. package/module/Shell/styles.js.map +1 -2
  231. package/module/StatisticCard/StatisticCard.js +79 -48
  232. package/module/StatisticCard/StatisticCard.js.map +2 -1
  233. package/module/TabTitle/TabTitle.js.map +1 -2
  234. package/module/TableColumnHeader/TableColumnHeader.js.map +2 -1
  235. package/module/TableColumnHeader/index.js +3 -8
  236. package/module/Tag/Tag.js +87 -72
  237. package/module/Tag/Tag.js.map +2 -1
  238. package/module/Task/Task.js +108 -0
  239. package/module/Task/type.js.map +2 -1
  240. package/module/Text/Text.js +70 -80
  241. package/module/Text/Text.js.map +2 -1
  242. package/module/TextArea/TextArea.js +0 -119
  243. package/module/TextArea/TextArea.js.map +0 -1
  244. package/module/Theme/ThemeProvider.js.map +2 -1
  245. package/module/Theme/defaultTheme.js +0 -20
  246. package/module/Theme/defaultTheme.js.map +0 -1
  247. package/module/Timeline/Timeline.js +0 -54
  248. package/module/Timeline/Timeline.js.map +0 -1
  249. package/module/UserSwitcher/UserSwitcher.js +171 -130
  250. package/module/UserSwitcher/index.js +3 -5
  251. package/module/UserSwitcher/index.js.map +2 -1
  252. package/module/common.js +8 -7
  253. package/module/common.js.map +1 -2
  254. package/module/index.js +131 -120
  255. package/package.json +2 -2
@@ -1,204 +1,121 @@
1
- "use strict";
2
-
3
- var __assign = this && this.__assign || function () {
4
- __assign = Object.assign || function (t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = {
18
- enumerable: true,
19
- get: function () {
20
- return m[k];
21
- }
22
- };
23
- }
24
- Object.defineProperty(o, k2, desc);
25
- } : function (o, m, k, k2) {
26
- if (k2 === undefined) k2 = k;
27
- o[k2] = m[k];
28
- });
29
- var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
30
- Object.defineProperty(o, "default", {
31
- enumerable: true,
32
- value: v
33
- });
34
- } : function (o, v) {
35
- o["default"] = v;
36
- });
37
- var __importStar = this && this.__importStar || function () {
38
- var ownKeys = function (o) {
39
- ownKeys = Object.getOwnPropertyNames || function (o) {
40
- var ar = [];
41
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
42
- return ar;
43
- };
44
- return ownKeys(o);
45
- };
46
- return function (mod) {
47
- if (mod && mod.__esModule) return mod;
48
- var result = {};
49
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
50
- __setModuleDefault(result, mod);
51
- return result;
52
- };
53
- }();
54
- var __rest = this && this.__rest || function (s, e) {
55
- var t = {};
56
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
57
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
58
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
59
- }
60
- return t;
61
- };
62
- var __importDefault = this && this.__importDefault || function (mod) {
63
- return mod && mod.__esModule ? mod : {
64
- "default": mod
65
- };
66
- };
67
- Object.defineProperty(exports, "__esModule", {
68
- value: true
69
- });
70
- exports.setDropdownStateChangeListener = exports.TapasDataCell = exports.DataCell = void 0;
71
- var react_1 = __importStar(require("react"));
72
- var react_native_1 = require("react-native");
73
- var themed_1 = require("@rneui/themed");
74
- var TapasIcon_1 = __importDefault(require("../Icons/TapasIcon"));
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { useCallback, useMemo, useState, useEffect } from "react";
3
+ import { View, Text, Pressable } from "react-native";
4
+ import { withTheme, makeStyles } from "@rneui/themed";
5
+ import TapasIcon from "../Icons/TapasIcon";
75
6
  // import { TapasDropdown } from "../Dropdown/Dropdown";
7
+
76
8
  // 全局下拉菜单状态管理
77
- var globalDropdownState = {
9
+ const globalDropdownState = {
78
10
  activeColumn: null,
79
11
  activeRow: null,
80
- closeAll: function () {},
12
+ closeAll: () => {},
81
13
  onDropdownStateChange: undefined
82
14
  };
15
+
83
16
  // 注册和注销下拉菜单的函数
84
- var registerDropdown = function (columnIndex, rowIndex, closeCallback) {
85
- var _a;
17
+ const registerDropdown = (columnIndex, rowIndex, closeCallback) => {
86
18
  globalDropdownState.activeColumn = columnIndex;
87
19
  globalDropdownState.activeRow = rowIndex;
88
20
  globalDropdownState.closeAll = closeCallback;
89
21
  // 通知状态变化
90
- (_a = globalDropdownState.onDropdownStateChange) === null || _a === void 0 ? void 0 : _a.call(globalDropdownState, columnIndex, rowIndex);
22
+ globalDropdownState.onDropdownStateChange?.(columnIndex, rowIndex);
91
23
  };
92
- var unregisterDropdown = function () {
93
- var _a;
24
+ const unregisterDropdown = () => {
94
25
  globalDropdownState.activeColumn = null;
95
26
  globalDropdownState.activeRow = null;
96
- globalDropdownState.closeAll = function () {};
27
+ globalDropdownState.closeAll = () => {};
97
28
  // 通知状态变化
98
- (_a = globalDropdownState.onDropdownStateChange) === null || _a === void 0 ? void 0 : _a.call(globalDropdownState, null, null);
29
+ globalDropdownState.onDropdownStateChange?.(null, null);
99
30
  };
100
- var closeAllDropdowns = function () {
31
+ const closeAllDropdowns = () => {
101
32
  if (globalDropdownState.closeAll) {
102
33
  globalDropdownState.closeAll();
103
34
  }
104
35
  };
36
+
105
37
  // 设置下拉菜单状态变化监听器
106
- var setDropdownStateChangeListener = function (callback) {
38
+ const setDropdownStateChangeListener = callback => {
107
39
  globalDropdownState.onDropdownStateChange = callback;
108
40
  };
109
- exports.setDropdownStateChangeListener = setDropdownStateChangeListener;
110
- var TapasDataCell = function (_a) {
111
- var value = _a.value,
112
- _b = _a.dataType,
113
- dataType = _b === void 0 ? "text" : _b,
114
- _c = _a.alignment,
115
- alignment = _c === void 0 ? "left" : _c,
116
- columnIndex = _a.columnIndex,
117
- rowIndex = _a.rowIndex,
118
- fieldName = _a.fieldName,
119
- _d = _a.clickable,
120
- clickable = _d === void 0 ? false : _d,
121
- _e = _a.ellipsizeMode,
122
- ellipsizeMode = _e === void 0 ? "tail" : _e,
123
- _f = _a.numberOfLines,
124
- numberOfLines = _f === void 0 ? 1 : _f,
125
- textStyle = _a.textStyle,
126
- _g = _a.padding,
127
- padding = _g === void 0 ? {
128
- horizontal: 16,
129
- vertical: 8
130
- } : _g,
131
- _h = _a.statusConfig,
132
- statusConfig = _h === void 0 ? {} : _h,
133
- _j = _a.actions,
134
- actions = _j === void 0 ? [] : _j,
135
- _k = _a.showActions,
136
- showActions = _k === void 0 ? false : _k,
137
- _l = _a.actionIcon,
138
- actionIcon = _l === void 0 ? "more_vert" : _l,
139
- formatter = _a.formatter,
140
- _m = _a.currencySymbol,
141
- currencySymbol = _m === void 0 ? "$" : _m,
142
- _o = _a.currencyPrecision,
143
- currencyPrecision = _o === void 0 ? 2 : _o,
144
- _p = _a.dateFormat,
145
- dateFormat = _p === void 0 ? "YYYY-MM-DD" : _p,
146
- _q = _a.booleanTrueText,
147
- booleanTrueText = _q === void 0 ? "Yes" : _q,
148
- _r = _a.booleanFalseText,
149
- booleanFalseText = _r === void 0 ? "No" : _r,
150
- _s = _a.emptyText,
151
- emptyText = _s === void 0 ? "-" : _s,
152
- onCellPress = _a.onCellPress,
153
- onActionPress = _a.onActionPress,
154
- attachMoreAction = _a.attachMoreAction,
155
- onLongPress = _a.onLongPress,
156
- _t = _a.disabled,
157
- disabled = _t === void 0 ? false : _t,
158
- _u = _a.minHeight,
159
- minHeight = _u === void 0 ? 40 : _u,
160
- _v = _a.isBlank,
161
- isBlank = _v === void 0 ? false : _v,
162
- onDropdownStateChange = _a.onDropdownStateChange,
163
- gridInfo = _a.gridInfo,
164
- style = _a.style,
165
- otherProps = __rest(_a, ["value", "dataType", "alignment", "columnIndex", "rowIndex", "fieldName", "clickable", "ellipsizeMode", "numberOfLines", "textStyle", "padding", "statusConfig", "actions", "showActions", "actionIcon", "formatter", "currencySymbol", "currencyPrecision", "dateFormat", "booleanTrueText", "booleanFalseText", "emptyText", "onCellPress", "onActionPress", "attachMoreAction", "onLongPress", "disabled", "minHeight", "isBlank", "onDropdownStateChange", "gridInfo", "style"]);
166
- var styles = useStyles({
167
- alignment: alignment,
168
- padding: padding,
169
- minHeight: minHeight,
170
- disabled: disabled,
41
+ const TapasDataCell = ({
42
+ value,
43
+ dataType = "text",
44
+ alignment = "left",
45
+ columnIndex,
46
+ rowIndex,
47
+ fieldName,
48
+ clickable = false,
49
+ ellipsizeMode = "tail",
50
+ numberOfLines = 1,
51
+ textStyle,
52
+ padding = {
53
+ horizontal: 16,
54
+ vertical: 8
55
+ },
56
+ statusConfig = {},
57
+ actions = [],
58
+ showActions = false,
59
+ actionIcon = "more_vert",
60
+ formatter,
61
+ currencySymbol = "$",
62
+ currencyPrecision = 2,
63
+ dateFormat = "YYYY-MM-DD",
64
+ booleanTrueText = "Yes",
65
+ booleanFalseText = "No",
66
+ emptyText = "-",
67
+ onCellPress,
68
+ onActionPress,
69
+ attachMoreAction,
70
+ onLongPress,
71
+ disabled = false,
72
+ minHeight = 40,
73
+ isBlank = false,
74
+ onDropdownStateChange,
75
+ gridInfo,
76
+ style,
77
+ ...otherProps
78
+ }) => {
79
+ const styles = useStyles({
80
+ alignment,
81
+ padding,
82
+ minHeight,
83
+ disabled,
171
84
  clickable: clickable || !!onCellPress
172
85
  });
86
+
173
87
  // 格式化显示值
174
- var formattedValue = (0, react_1.useMemo)(function () {
88
+ const formattedValue = useMemo(() => {
175
89
  if (isBlank || value === null || value === undefined) {
176
90
  return emptyText;
177
91
  }
92
+
178
93
  // 使用自定义格式化函数
179
94
  if (formatter) {
180
95
  return formatter(value, dataType);
181
96
  }
97
+
182
98
  // 内置格式化逻辑
183
99
  switch (dataType) {
184
100
  case "number":
185
101
  return typeof value === "number" ? value.toLocaleString() : String(value);
186
102
  case "currency":
187
103
  {
188
- var numValue = typeof value === "number" ? value : parseFloat(value);
104
+ const numValue = typeof value === "number" ? value : parseFloat(value);
189
105
  if (isNaN(numValue)) return emptyText;
190
- return "".concat(currencySymbol).concat(numValue.toFixed(currencyPrecision));
106
+ return `${currencySymbol}${numValue.toFixed(currencyPrecision)}`;
191
107
  }
192
108
  case "date":
193
109
  {
194
110
  if (!value) return emptyText;
195
- var date = new Date(value);
111
+ const date = new Date(value);
196
112
  if (isNaN(date.getTime())) return emptyText;
113
+
197
114
  // 简单的日期格式化
198
115
  if (dateFormat === "YYYY-MM-DD") {
199
116
  return date.toISOString().split('T')[0];
200
117
  } else if (dateFormat === "MM/DD/YYYY") {
201
- return "".concat((date.getMonth() + 1).toString().padStart(2, '0'), "/").concat(date.getDate().toString().padStart(2, '0'), "/").concat(date.getFullYear());
118
+ return `${(date.getMonth() + 1).toString().padStart(2, '0')}/${date.getDate().toString().padStart(2, '0')}/${date.getFullYear()}`;
202
119
  } else {
203
120
  return date.toLocaleDateString();
204
121
  }
@@ -213,12 +130,13 @@ var TapasDataCell = function (_a) {
213
130
  return String(value || emptyText);
214
131
  }
215
132
  }, [value, dataType, formatter, currencySymbol, currencyPrecision, dateFormat, booleanTrueText, booleanFalseText, emptyText, isBlank]);
133
+
216
134
  // 获取状态样式
217
- var getStatusStyle = (0, react_1.useCallback)(function () {
135
+ const getStatusStyle = useCallback(() => {
218
136
  if (dataType !== "status" || !value || !statusConfig[value]) {
219
137
  return {};
220
138
  }
221
- var config = statusConfig[value];
139
+ const config = statusConfig[value];
222
140
  return {
223
141
  color: config.color,
224
142
  backgroundColor: config.backgroundColor,
@@ -230,62 +148,69 @@ var TapasDataCell = function (_a) {
230
148
  overflow: "hidden"
231
149
  };
232
150
  }, [dataType, value, statusConfig]);
151
+
233
152
  // 处理单元格点击
234
- var handleCellPress = (0, react_1.useCallback)(function () {
153
+ const handleCellPress = useCallback(() => {
235
154
  if (disabled || isBlank) return;
236
- onCellPress === null || onCellPress === void 0 ? void 0 : onCellPress(value, rowIndex, columnIndex, fieldName);
155
+ onCellPress?.(value, rowIndex, columnIndex, fieldName);
237
156
  }, [disabled, isBlank, onCellPress, value, rowIndex, columnIndex, fieldName]);
157
+
238
158
  // 处理长按
239
- var handleLongPress = (0, react_1.useCallback)(function () {
159
+ const handleLongPress = useCallback(() => {
240
160
  if (disabled || isBlank) return;
241
- onLongPress === null || onLongPress === void 0 ? void 0 : onLongPress(value, rowIndex, columnIndex, fieldName);
161
+ onLongPress?.(value, rowIndex, columnIndex, fieldName);
242
162
  }, [disabled, isBlank, onLongPress, value, rowIndex, columnIndex, fieldName]);
163
+
243
164
  // 处理操作按钮点击
244
- var handleActionPress = (0, react_1.useCallback)(function (action) {
165
+ const handleActionPress = useCallback(action => {
245
166
  if (disabled || action.disabled) return;
246
- onActionPress === null || onActionPress === void 0 ? void 0 : onActionPress(action, value, rowIndex, columnIndex);
167
+ onActionPress?.(action, value, rowIndex, columnIndex);
247
168
  }, [disabled, onActionPress, value, rowIndex, columnIndex]);
169
+
248
170
  // 下拉菜单状态
249
- var _w = (0, react_1.useState)(false),
250
- dropdownVisible = _w[0],
251
- setDropdownVisible = _w[1];
252
- var _x = (0, react_1.useState)({
253
- top: 32,
254
- right: 0
255
- }),
256
- dropdownPosition = _x[0],
257
- setDropdownPosition = _x[1];
171
+ const [dropdownVisible, setDropdownVisible] = useState(false);
172
+ const [dropdownPosition, setDropdownPosition] = useState({
173
+ top: 32,
174
+ right: 0
175
+ });
176
+
258
177
  // 计算下拉菜单的最佳位置
259
- var calculateDropdownPosition = (0, react_1.useCallback)(function () {
178
+ const calculateDropdownPosition = useCallback(() => {
260
179
  // 更准确地计算下拉菜单的实际高度
261
- var itemHeight = 32; // 每个选项的高度
262
- var borderWidth = 2; // 边框宽度
263
- var padding = 8; // 内边距
264
- var shadowHeight = 4; // 阴影高度
180
+ const itemHeight = 32; // 每个选项的高度
181
+ const borderWidth = 2; // 边框宽度
182
+ const padding = 8; // 内边距
183
+ const shadowHeight = 4; // 阴影高度
184
+
265
185
  // 考虑文本长度对高度的影响
266
- var maxTextLength = Math.max.apply(Math, actions.map(function (action) {
267
- return action.label.length;
268
- }));
269
- var textHeightAdjustment = maxTextLength > 10 ? 4 : 0; // 长文本可能需要更多高度
186
+ const maxTextLength = Math.max(...actions.map(action => action.label.length));
187
+ const textHeightAdjustment = maxTextLength > 10 ? 4 : 0; // 长文本可能需要更多高度
188
+
270
189
  // 计算下拉菜单的宽度(考虑文本长度)
271
190
  // const minWidth = 120; // 最小宽度
272
191
  // const textWidth = maxTextLength * 8; // 估算文本宽度
273
192
  // const _actualWidth = Math.max(minWidth, textWidth + 24); // 24px 为内边距和图标空间
274
- var actualHeight = actions.length * itemHeight + borderWidth + padding + shadowHeight + textHeightAdjustment;
275
- var buttonHeight = 32; // 按钮高度
276
- var cellHeight = (gridInfo === null || gridInfo === void 0 ? void 0 : gridInfo.rowHeight) || 56; // 使用传入的 rowHeight 或默认值
277
- var gridHeight = (gridInfo === null || gridInfo === void 0 ? void 0 : gridInfo.gridHeight) || 400; // 使用传入的 gridHeight 或默认值
193
+
194
+ const actualHeight = actions.length * itemHeight + borderWidth + padding + shadowHeight + textHeightAdjustment;
195
+ const buttonHeight = 32; // 按钮高度
196
+ const cellHeight = gridInfo?.rowHeight || 56; // 使用传入的 rowHeight 或默认值
197
+ const gridHeight = gridInfo?.gridHeight || 400; // 使用传入的 gridHeight 或默认值
198
+
278
199
  // 根据行索引估算当前单元格在 Grid 中的位置
279
- var currentRowIndex = rowIndex || 0;
200
+ const currentRowIndex = rowIndex || 0;
201
+
280
202
  // 计算当前单元格距离 Grid 底部的距离
281
- var currentCellBottom = (currentRowIndex + 1) * cellHeight;
282
- var spaceBelow = gridHeight - currentCellBottom;
203
+ const currentCellBottom = (currentRowIndex + 1) * cellHeight;
204
+ const spaceBelow = gridHeight - currentCellBottom;
205
+
283
206
  // 计算上方可用空间
284
- var currentCellTop = currentRowIndex * cellHeight;
285
- var spaceAbove = currentCellTop;
207
+ const currentCellTop = currentRowIndex * cellHeight;
208
+ const spaceAbove = currentCellTop;
209
+
286
210
  // 添加安全边距,确保下拉菜单不会紧贴边界
287
- var safetyMargin = 8;
288
- var requiredSpace = actualHeight + safetyMargin;
211
+ const safetyMargin = 8;
212
+ const requiredSpace = actualHeight + safetyMargin;
213
+
289
214
  // 智能选择显示位置
290
215
  if (requiredSpace > spaceBelow && requiredSpace <= spaceAbove) {
291
216
  // 下方空间不够,但上方空间足够,显示在上方
@@ -318,79 +243,89 @@ var TapasDataCell = function (_a) {
318
243
  };
319
244
  }
320
245
  }, [actions.length, rowIndex, gridInfo]);
246
+
321
247
  // 全局下拉菜单管理
322
- (0, react_1.useEffect)(function () {
323
- var closeDropdown = function () {
248
+ useEffect(() => {
249
+ const closeDropdown = () => {
324
250
  setDropdownVisible(false);
325
251
  unregisterDropdown();
326
252
  };
253
+
327
254
  // 注册当前下拉菜单
328
255
  if (dropdownVisible) {
329
256
  registerDropdown(columnIndex || 0, rowIndex || 0, closeDropdown);
330
257
  } else {
331
258
  unregisterDropdown();
332
259
  }
260
+
333
261
  // 清理函数
334
- return function () {
262
+ return () => {
335
263
  unregisterDropdown();
336
264
  };
337
265
  }, [dropdownVisible, columnIndex, rowIndex]);
266
+
338
267
  // 通知父组件下拉菜单状态变化
339
- (0, react_1.useEffect)(function () {
340
- onDropdownStateChange === null || onDropdownStateChange === void 0 ? void 0 : onDropdownStateChange(dropdownVisible);
268
+ useEffect(() => {
269
+ onDropdownStateChange?.(dropdownVisible);
341
270
  }, [dropdownVisible, onDropdownStateChange]);
271
+
342
272
  // 监听全局关闭事件
343
- (0, react_1.useEffect)(function () {
273
+ useEffect(() => {
344
274
  // const _handleGlobalClose = () => {
345
275
  // if (globalDropdownState.activeColumn !== columnIndex ||
346
276
  // globalDropdownState.activeRow !== rowIndex) {
347
277
  // setDropdownVisible(false);
348
278
  // }
349
279
  // };
280
+
350
281
  // 这里可以添加全局事件监听器
351
282
  // 为了简化,我们在点击其他单元格时关闭当前下拉菜单
352
283
  }, [columnIndex, rowIndex]);
284
+
353
285
  // 渲染操作按钮
354
- var renderActions = function () {
286
+ const renderActions = () => {
355
287
  if (!showActions || actions.length === 0 || isBlank) {
356
288
  return null;
357
289
  }
290
+
358
291
  // 如果只有一个操作,直接显示图标按钮
359
292
  if (actions.length === 1) {
360
- var action_1 = actions[0];
361
- if (!action_1) return null;
293
+ const action = actions[0];
294
+ if (!action) return null;
295
+
362
296
  // 检查是否有文本内容,如果没有文本内容,按钮应该居中
363
- var hasTextContent = formattedValue && formattedValue.trim() !== '';
364
- var buttonStyle = hasTextContent ? [styles.actionButton, {
297
+ const hasTextContent = formattedValue && formattedValue.trim() !== '';
298
+ const buttonStyle = hasTextContent ? [styles.actionButton, {
365
299
  marginLeft: 8
366
300
  }] : styles.actionButton;
367
- return react_1.default.createElement(react_native_1.Pressable, {
301
+ return /*#__PURE__*/React.createElement(Pressable, {
368
302
  style: buttonStyle,
369
- onPress: function (event) {
303
+ onPress: event => {
370
304
  // 阻止事件冒泡,避免触发外层的 attachCellPress
371
305
  event.stopPropagation();
372
306
  if (attachMoreAction) {
373
- attachMoreAction(action_1);
307
+ attachMoreAction(action);
374
308
  } else {
375
- handleActionPress(action_1);
309
+ handleActionPress(action);
376
310
  }
377
311
  },
378
- disabled: disabled || action_1.disabled
379
- }, react_1.default.createElement(TapasIcon_1.default, {
380
- name: action_1.icon || actionIcon,
312
+ disabled: disabled || action.disabled
313
+ }, /*#__PURE__*/React.createElement(TapasIcon, {
314
+ name: action.icon || actionIcon,
381
315
  size: 16,
382
316
  color: styles.actionIcon.color
383
317
  }));
384
318
  }
319
+
385
320
  // 多个操作显示下拉菜单
386
- return react_1.default.createElement(react_native_1.View, {
321
+ return /*#__PURE__*/React.createElement(View, {
387
322
  style: [styles.dropdownContainer, {
388
323
  // 只有当前激活的下拉菜单容器才有高 z-index
389
324
  zIndex: globalDropdownState.activeColumn === columnIndex && globalDropdownState.activeRow === rowIndex ? 2147483646 : 1
390
325
  }]
391
- }, react_1.default.createElement(react_native_1.Pressable, {
326
+ }, /*#__PURE__*/React.createElement(Pressable, {
392
327
  style: styles.actionButton,
393
- onPress: function (event) {
328
+ onPress: event => {
394
329
  // 阻止事件冒泡,避免触发外层的 attachCellPress
395
330
  event.stopPropagation();
396
331
  if (dropdownVisible) {
@@ -399,35 +334,187 @@ var TapasDataCell = function (_a) {
399
334
  } else {
400
335
  // 如果当前下拉菜单关闭,先关闭其他所有下拉菜单,然后打开当前菜单
401
336
  closeAllDropdowns();
337
+
402
338
  // 计算并设置下拉菜单位置
403
339
  setDropdownPosition(calculateDropdownPosition());
340
+
404
341
  // 延迟打开当前下拉菜单,确保其他菜单已关闭
405
- setTimeout(function () {
342
+ setTimeout(() => {
406
343
  setDropdownVisible(true);
407
344
  }, 0);
408
345
  }
409
346
  },
410
347
  disabled: disabled
411
- }, react_1.default.createElement(TapasIcon_1.default, {
348
+ }, /*#__PURE__*/React.createElement(TapasIcon, {
412
349
  name: actionIcon,
413
350
  size: 16,
414
351
  color: styles.actionIcon.color
415
- })), dropdownVisible && react_1.default.createElement(react_native_1.View, {
352
+ })), dropdownVisible && /*#__PURE__*/React.createElement(View, {
416
353
  style: [styles.dropdownMenu, {
417
354
  top: dropdownPosition.top,
418
355
  right: dropdownPosition.right
419
356
  }]
420
- }, actions.map(function (action, index) {
421
- return react_1.default.createElement(react_native_1.Pressable, {
422
- key: action.id,
423
- style: [styles.dropdownItem, index === actions.length - 1 && styles.dropdownItemLast],
424
- onPress: function (event) {
425
- // 阻止事件冒泡,避免触发外层的 attachCellPress
426
- event.stopPropagation();
427
- if (attachMoreAction) {
428
- attachMoreAction(action);
429
- } else {
430
- handleActionPress(action);
357
+ }, actions.map((action, index) => /*#__PURE__*/React.createElement(Pressable, {
358
+ key: action.id,
359
+ style: [styles.dropdownItem, index === actions.length - 1 && styles.dropdownItemLast],
360
+ onPress: event => {
361
+ // 阻止事件冒泡,避免触发外层的 attachCellPress
362
+ event.stopPropagation();
363
+ if (attachMoreAction) {
364
+ attachMoreAction(action);
365
+ } else {
366
+ handleActionPress(action);
367
+ }
368
+ setDropdownVisible(false);
369
+ },
370
+ disabled: disabled || action.disabled
371
+ }, /*#__PURE__*/React.createElement(Text, {
372
+ style: [styles.dropdownItemText, action.disabled && styles.dropdownItemDisabled]
373
+ }, action.label)))));
374
+ };
375
+
376
+ // 渲染内容
377
+ const renderContent = () => {
378
+ if (isBlank) {
379
+ return null;
380
+ }
381
+ const statusStyle = getStatusStyle();
382
+ const hasStatusStyle = Object.keys(statusStyle).length > 0;
383
+ return /*#__PURE__*/React.createElement(View, {
384
+ style: styles.content
385
+ }, /*#__PURE__*/React.createElement(Text, {
386
+ style: [styles.text, hasStatusStyle && statusStyle, textStyle],
387
+ numberOfLines: numberOfLines,
388
+ ellipsizeMode: ellipsizeMode
389
+ }, formattedValue), renderActions());
390
+ };
391
+
392
+ // 如果可点击,使用 Pressable
393
+ if (clickable || onCellPress || onLongPress) {
394
+ return /*#__PURE__*/React.createElement(Pressable, _extends({}, otherProps, {
395
+ style: [styles.container, style],
396
+ onPress: handleCellPress,
397
+ onLongPress: handleLongPress,
398
+ disabled: disabled
399
+ }), renderContent());
400
+ }
401
+
402
+ // 否则使用普通 View
403
+ return /*#__PURE__*/React.createElement(View, _extends({}, otherProps, {
404
+ style: [styles.container, style]
405
+ }), renderContent());
406
+ };
407
+ const useStyles = makeStyles((theme, props) => {
408
+ const alignment = props?.alignment || "left";
409
+ const paddingHorizontal = props?.padding?.horizontal || 16;
410
+ const paddingVertical = props?.padding?.vertical || 8;
411
+ const minHeight = props?.minHeight || 40;
412
+ const disabled = props?.disabled || false;
413
+ const clickable = props?.clickable || false;
414
+ const justifyContent = alignment === "left" ? "flex-start" : alignment === "right" ? "flex-end" : "center";
415
+ return {
416
+ container: {
417
+ minHeight,
418
+ paddingHorizontal,
419
+ paddingVertical,
420
+ backgroundColor: disabled ? theme?.colors?.grey5 || "#f8f9fa" : "transparent",
421
+ opacity: disabled ? 0.6 : 1,
422
+ borderBottomWidth: 0,
423
+ // 移除边框,让 Grid 处理边框
424
+ borderBottomColor: "transparent",
425
+ display: "flex",
426
+ flexDirection: "row",
427
+ alignItems: "center",
428
+ justifyContent: "space-between",
429
+ width: "100%",
430
+ height: "100%",
431
+ // 确保下拉菜单不被截断
432
+ overflow: "visible"
433
+ },
434
+ content: {
435
+ flex: 1,
436
+ flexDirection: "row",
437
+ alignItems: "center",
438
+ justifyContent: "space-between",
439
+ height: "100%",
440
+ minHeight
441
+ },
442
+ text: {
443
+ flex: 1,
444
+ fontSize: theme?.fonts?.sizeM || 14,
445
+ fontWeight: "400",
446
+ color: theme?.colors?.colorTextPrimary || theme?.colors?.grey1 || "#333",
447
+ textAlign: alignment,
448
+ alignSelf: justifyContent === "flex-start" ? "flex-start" : justifyContent === "flex-end" ? "flex-end" : "center"
449
+ },
450
+ actionButton: {
451
+ padding: 4,
452
+ borderRadius: 4,
453
+ backgroundColor: clickable ? "transparent" : theme?.colors?.grey5 || "#f8f9fa",
454
+ display: "flex",
455
+ alignItems: "center",
456
+ justifyContent: "center",
457
+ minWidth: 24,
458
+ minHeight: 24
459
+ },
460
+ actionIcon: {
461
+ color: theme?.colors?.grey2 || "#999"
462
+ },
463
+ dropdownContainer: {
464
+ position: "relative",
465
+ // 默认使用较低的 z-index,只有激活的下拉菜单容器才有高 z-index
466
+ zIndex: 1,
467
+ // 确保容器本身不会创建新的 stacking context
468
+ isolation: "auto"
469
+ },
470
+ dropdownMenu: {
471
+ position: "absolute",
472
+ // 使用绝对定位
473
+ backgroundColor: theme?.colors?.background || "#fff",
474
+ borderRadius: 4,
475
+ borderWidth: 1,
476
+ borderColor: theme?.colors?.grey4 || "#e0e0e0",
477
+ shadowColor: "#000",
478
+ shadowOffset: {
479
+ width: 0,
480
+ height: 2
481
+ },
482
+ shadowOpacity: 0.25,
483
+ shadowRadius: 3.84,
484
+ elevation: 5,
485
+ minWidth: 120,
486
+ zIndex: 2147483647,
487
+ // 更高的 z-index,确保显示在所有元素之上
488
+ // 确保下拉菜单不被父容器的 overflow 隐藏
489
+ overflow: "visible",
490
+ // 确保下拉菜单在正确的层级上
491
+ isolation: "isolate"
492
+ },
493
+ dropdownItem: {
494
+ paddingHorizontal: 12,
495
+ paddingVertical: 8,
496
+ borderBottomWidth: 1,
497
+ borderBottomColor: theme?.colors?.grey4 || "#e0e0e0"
498
+ },
499
+ dropdownItemLast: {
500
+ borderBottomWidth: 0
501
+ },
502
+ dropdownItemText: {
503
+ fontSize: 14,
504
+ color: theme?.colors?.colorTextPrimary || theme?.colors?.grey1 || "#333"
505
+ },
506
+ dropdownItemDisabled: {
507
+ color: theme?.colors?.grey3 || "#999",
508
+ opacity: 0.6
509
+ }
510
+ };
511
+ });
512
+ export default withTheme(TapasDataCell);
513
+
514
+ // Export aliases for compatibility
515
+ export const DataCell = withTheme(TapasDataCell);
516
+ export { TapasDataCell, setDropdownStateChangeListener };
517
+ //# sourceMappingURL=DataCell.js.mapPress(action);
431
518
  }
432
519
  setDropdownVisible(false);
433
520
  },