@pisell/utils 3.0.6 → 3.0.7

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 (200) hide show
  1. package/es/arrayUtils.d.ts +23 -26
  2. package/es/arrayUtils.js +157 -97
  3. package/es/common/index.d.ts +5 -0
  4. package/es/common/index.js +5 -0
  5. package/es/common/stateHelper.d.ts +2 -6
  6. package/es/common/stateHelper.js +24 -22
  7. package/es/common/types.d.ts +10 -13
  8. package/es/common/types.js +1 -0
  9. package/es/componentStorage.d.ts +25 -27
  10. package/es/componentStorage.js +130 -94
  11. package/es/constants/index.js +9 -7
  12. package/es/date.js +53 -36
  13. package/es/document.js +67 -43
  14. package/es/escPosPrinter/EscPosPrinter.js +490 -353
  15. package/es/escPosPrinter/index.d.ts +9 -9
  16. package/es/escPosPrinter/index.js +52 -37
  17. package/es/firebase/config/index.js +54 -0
  18. package/es/firebase/index.js +232 -0
  19. package/es/format.d.ts +15 -12
  20. package/es/format.js +156 -89
  21. package/es/image.js +60 -48
  22. package/es/index.d.ts +24 -39
  23. package/es/index.js +35 -40
  24. package/es/jsBridge/index.d.ts +4 -8
  25. package/es/jsBridge/index.js +55 -56
  26. package/es/jsBridge/regDeviceApi.js +126 -87
  27. package/es/jsBridge/types.d.ts +115 -95
  28. package/es/jsBridge/types.js +1 -0
  29. package/es/locales.d.ts +8 -11
  30. package/es/locales.js +96 -77
  31. package/es/log.d.ts +6 -11
  32. package/es/log.js +59 -37
  33. package/es/miniRedux.d.ts +13 -20
  34. package/es/miniRedux.js +76 -42
  35. package/es/number-input/hooks/index.d.ts +4 -0
  36. package/es/number-input/hooks/index.js +5 -0
  37. package/es/number-input/hooks/useNumberInputState.d.ts +2 -6
  38. package/es/number-input/hooks/useNumberInputState.js +128 -71
  39. package/es/number-input/index.d.ts +14 -0
  40. package/es/number-input/index.js +21 -0
  41. package/es/number-input/types.d.ts +88 -88
  42. package/es/number-input/types.js +1 -0
  43. package/es/number-input/utils/formatter.d.ts +10 -13
  44. package/es/number-input/utils/formatter.js +77 -51
  45. package/es/number-input/utils/index.d.ts +7 -0
  46. package/es/number-input/utils/index.js +8 -0
  47. package/es/number-input/utils/validation.d.ts +2 -7
  48. package/es/number-input/utils/validation.js +66 -51
  49. package/es/otherUtils.d.ts +9 -12
  50. package/es/otherUtils.js +129 -71
  51. package/es/platform.d.ts +9 -12
  52. package/es/platform.js +85 -61
  53. package/es/select/hooks/index.d.ts +5 -0
  54. package/es/select/hooks/index.js +6 -0
  55. package/es/select/hooks/useDebouncedSearch.d.ts +1 -4
  56. package/es/select/hooks/useDebouncedSearch.js +53 -39
  57. package/es/select/hooks/useSelectState.d.ts +7 -7
  58. package/es/select/hooks/useSelectState.js +113 -56
  59. package/es/select/index.d.ts +8 -7
  60. package/es/select/index.js +13 -0
  61. package/es/select/types.d.ts +211 -211
  62. package/es/select/types.js +1 -0
  63. package/es/select/utils/filterOptions.d.ts +6 -7
  64. package/es/select/utils/filterOptions.js +31 -26
  65. package/es/select/utils/helpers.d.ts +9 -10
  66. package/es/select/utils/helpers.js +52 -42
  67. package/es/select/utils/index.d.ts +7 -4
  68. package/es/select/utils/index.js +8 -0
  69. package/es/select/utils/sortOptions.d.ts +5 -6
  70. package/es/select/utils/sortOptions.js +31 -19
  71. package/es/select/utils/tagAggregation.d.ts +6 -6
  72. package/es/select/utils/tagAggregation.js +47 -34
  73. package/es/text-input/hooks/index.d.ts +4 -0
  74. package/es/text-input/hooks/index.js +5 -0
  75. package/es/text-input/hooks/useTextInputState.d.ts +2 -6
  76. package/es/text-input/hooks/useTextInputState.js +126 -69
  77. package/es/text-input/index.d.ts +14 -0
  78. package/es/text-input/index.js +20 -0
  79. package/es/text-input/types.d.ts +48 -48
  80. package/es/text-input/types.js +1 -0
  81. package/es/text-input/utils/index.d.ts +5 -0
  82. package/es/text-input/utils/index.js +7 -0
  83. package/es/text-input/utils/validation.d.ts +2 -7
  84. package/es/text-input/utils/validation.js +70 -50
  85. package/es/typeUtils.js +84 -61
  86. package/es/walletValidity.d.ts +42 -44
  87. package/es/walletValidity.js +557 -396
  88. package/es/weighing.d.ts +45 -48
  89. package/es/weighing.js +106 -83
  90. package/lib/arrayUtils.d.ts +23 -26
  91. package/lib/arrayUtils.js +111 -101
  92. package/lib/common/index.d.ts +5 -0
  93. package/lib/common/index.js +29 -0
  94. package/lib/common/stateHelper.d.ts +2 -6
  95. package/lib/common/stateHelper.js +32 -21
  96. package/lib/common/types.d.ts +10 -13
  97. package/lib/common/types.js +17 -0
  98. package/lib/componentStorage.d.ts +25 -27
  99. package/lib/componentStorage.js +126 -96
  100. package/lib/constants/index.js +36 -7
  101. package/lib/date.js +65 -43
  102. package/lib/document.js +62 -46
  103. package/lib/escPosPrinter/EscPosPrinter.js +403 -327
  104. package/lib/escPosPrinter/index.d.ts +9 -9
  105. package/lib/escPosPrinter/index.js +84 -38
  106. package/lib/firebase/config/index.js +79 -0
  107. package/lib/firebase/index.js +180 -0
  108. package/lib/format.d.ts +15 -12
  109. package/lib/format.js +133 -91
  110. package/lib/image.js +74 -48
  111. package/lib/index.d.ts +24 -39
  112. package/lib/index.js +80 -137
  113. package/lib/jsBridge/index.d.ts +4 -8
  114. package/lib/jsBridge/index.js +76 -57
  115. package/lib/jsBridge/regDeviceApi.js +133 -86
  116. package/lib/jsBridge/types.d.ts +115 -95
  117. package/lib/jsBridge/types.js +17 -0
  118. package/lib/locales.d.ts +8 -11
  119. package/lib/locales.js +90 -79
  120. package/lib/log.d.ts +6 -11
  121. package/lib/log.js +61 -37
  122. package/lib/miniRedux.d.ts +13 -20
  123. package/lib/miniRedux.js +89 -43
  124. package/lib/number-input/hooks/index.d.ts +4 -0
  125. package/lib/number-input/hooks/index.js +29 -0
  126. package/lib/number-input/hooks/useNumberInputState.d.ts +2 -6
  127. package/lib/number-input/hooks/useNumberInputState.js +81 -71
  128. package/lib/number-input/index.d.ts +14 -0
  129. package/lib/number-input/index.js +41 -0
  130. package/lib/number-input/types.d.ts +88 -88
  131. package/lib/number-input/types.js +17 -0
  132. package/lib/number-input/utils/formatter.d.ts +10 -13
  133. package/lib/number-input/utils/formatter.js +49 -52
  134. package/lib/number-input/utils/index.d.ts +7 -0
  135. package/lib/number-input/utils/index.js +39 -0
  136. package/lib/number-input/utils/validation.d.ts +2 -7
  137. package/lib/number-input/utils/validation.js +52 -50
  138. package/lib/otherUtils.d.ts +9 -12
  139. package/lib/otherUtils.js +98 -86
  140. package/lib/platform.d.ts +9 -12
  141. package/lib/platform.js +123 -68
  142. package/lib/select/hooks/index.d.ts +5 -0
  143. package/lib/select/hooks/index.js +34 -0
  144. package/lib/select/hooks/useDebouncedSearch.d.ts +1 -4
  145. package/lib/select/hooks/useDebouncedSearch.js +41 -40
  146. package/lib/select/hooks/useSelectState.d.ts +7 -7
  147. package/lib/select/hooks/useSelectState.js +93 -58
  148. package/lib/select/index.d.ts +8 -7
  149. package/lib/select/index.js +53 -0
  150. package/lib/select/types.d.ts +211 -211
  151. package/lib/select/types.js +17 -0
  152. package/lib/select/utils/filterOptions.d.ts +6 -7
  153. package/lib/select/utils/filterOptions.js +37 -26
  154. package/lib/select/utils/helpers.d.ts +9 -10
  155. package/lib/select/utils/helpers.js +41 -45
  156. package/lib/select/utils/index.d.ts +7 -4
  157. package/lib/select/utils/index.js +48 -0
  158. package/lib/select/utils/sortOptions.d.ts +5 -6
  159. package/lib/select/utils/sortOptions.js +39 -18
  160. package/lib/select/utils/tagAggregation.d.ts +6 -6
  161. package/lib/select/utils/tagAggregation.js +41 -33
  162. package/lib/text-input/hooks/index.d.ts +4 -0
  163. package/lib/text-input/hooks/index.js +29 -0
  164. package/lib/text-input/hooks/useTextInputState.d.ts +2 -6
  165. package/lib/text-input/hooks/useTextInputState.js +79 -69
  166. package/lib/text-input/index.d.ts +14 -0
  167. package/lib/text-input/index.js +35 -0
  168. package/lib/text-input/types.d.ts +48 -48
  169. package/lib/text-input/types.js +17 -0
  170. package/lib/text-input/utils/index.d.ts +5 -0
  171. package/lib/text-input/utils/index.js +32 -0
  172. package/lib/text-input/utils/validation.d.ts +2 -7
  173. package/lib/text-input/utils/validation.js +58 -49
  174. package/lib/typeUtils.js +73 -68
  175. package/lib/walletValidity.d.ts +42 -44
  176. package/lib/walletValidity.js +393 -410
  177. package/lib/weighing.d.ts +45 -48
  178. package/lib/weighing.js +149 -104
  179. package/package.json +1 -1
  180. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +0 -27
  181. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +0 -12
  182. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +0 -25
  183. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +0 -14
  184. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +0 -9
  185. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +0 -11
  186. package/es/date.d.ts +0 -31
  187. package/es/document.d.ts +0 -16
  188. package/es/image.d.ts +0 -14
  189. package/es/typeUtils.d.ts +0 -45
  190. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +0 -27
  191. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +0 -12
  192. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +0 -25
  193. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +0 -14
  194. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +0 -9
  195. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +0 -16
  196. package/lib/_virtual/_rolldown/runtime.js +0 -23
  197. package/lib/date.d.ts +0 -31
  198. package/lib/document.d.ts +0 -16
  199. package/lib/image.d.ts +0 -14
  200. package/lib/typeUtils.d.ts +0 -45
@@ -1,106 +1,142 @@
1
- import { _objectSpread2 } from "./_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
- import { isJson } from "./typeUtils.js";
3
- //#region src/componentStorage.ts
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _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; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ 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); }
4
7
  /**
5
- * 组件级 localStorage 存储:列设置、列显隐等。
6
- * 供 pisellDataSourceContainer、pisellRecordBoard 等复用,key 含 pathname 与 memory_key 以区分页面。
7
- */
8
+ * 组件级 localStorage 存储:列设置、列显隐等。
9
+ * 供 pisellDataSourceContainer、pisellRecordBoard 等复用,key 含 pathname 与 memory_key 以区分页面。
10
+ */
11
+ import { isJson } from "./typeUtils";
12
+
8
13
  /** 生成存储 key 的路径后缀:pathname 或 pathname#memory_key(来自 URL memory_key 参数) */
9
- function getStorageKeySuffix() {
10
- if (typeof window === "undefined" || typeof window.location === "undefined") return "/";
11
- const { pathname, search } = window.location;
12
- const appendPath = pathname || "/";
13
- let memoryKey = "";
14
- try {
15
- const mk = new URLSearchParams(search || "").get("memory_key");
16
- if (mk && mk.trim() !== "") memoryKey = mk.trim();
17
- } catch (_unused) {}
18
- return memoryKey ? `${appendPath}#${memoryKey}` : appendPath;
14
+ export function getStorageKeySuffix() {
15
+ if (typeof window === 'undefined' || typeof window.location === 'undefined') {
16
+ return '/';
17
+ }
18
+ var _window$location = window.location,
19
+ pathname = _window$location.pathname,
20
+ search = _window$location.search;
21
+ var appendPath = pathname || '/';
22
+ var memoryKey = '';
23
+ try {
24
+ var params = new URLSearchParams(search || '');
25
+ var mk = params.get('memory_key');
26
+ if (mk && mk.trim() !== '') memoryKey = mk.trim();
27
+ } catch (_unused) {
28
+ // ignore
29
+ }
30
+ return memoryKey ? "".concat(appendPath, "#").concat(memoryKey) : appendPath;
19
31
  }
32
+
20
33
  /**
21
- * 生成组件实例的存储 key。
22
- * @param componentId 组件实例 id(如 __id)
23
- * @param prefix 前缀,如 'table-setting'、'record-board-column-visibility'
24
- */
25
- function getComponentStorageKey(componentId, prefix) {
26
- if (typeof window === "undefined" || typeof window.location === "undefined") return `${prefix}-${componentId}`;
27
- return `${prefix}-${componentId}-${getStorageKeySuffix()}`;
34
+ * 生成组件实例的存储 key。
35
+ * @param componentId 组件实例 id(如 __id)
36
+ * @param prefix 前缀,如 'table-setting'、'record-board-column-visibility'
37
+ */
38
+ export function getComponentStorageKey(componentId, prefix) {
39
+ if (typeof window === 'undefined' || typeof window.location === 'undefined') {
40
+ return "".concat(prefix, "-").concat(componentId);
41
+ }
42
+ var suffix = getStorageKeySuffix();
43
+ return "".concat(prefix, "-").concat(componentId, "-").concat(suffix);
28
44
  }
29
- function saveColumnSettingToLocal(params) {
30
- const { componentId, columnSetting } = params;
31
- if (!componentId) return;
32
- if (typeof window === "undefined" || !window.localStorage) return;
33
- const storageKey = getComponentStorageKey(componentId, "table-setting");
34
- const data = {
35
- column_setting: columnSetting,
36
- updatedAt: Date.now()
37
- };
38
- try {
39
- window.localStorage.setItem(storageKey, JSON.stringify(data));
40
- } catch (_unused2) {}
45
+
46
+ // ---------- 列设置(DataSourceContainer Table 列显隐+排序等,数组格式) ----------
47
+
48
+ export function saveColumnSettingToLocal(params) {
49
+ var componentId = params.componentId,
50
+ columnSetting = params.columnSetting;
51
+ if (!componentId) return;
52
+ if (typeof window === 'undefined' || !window.localStorage) return;
53
+ var storageKey = getComponentStorageKey(componentId, 'table-setting');
54
+ var data = {
55
+ column_setting: columnSetting,
56
+ updatedAt: Date.now()
57
+ };
58
+ try {
59
+ window.localStorage.setItem(storageKey, JSON.stringify(data));
60
+ } catch (_unused2) {
61
+ // ignore
62
+ }
41
63
  }
42
- function getColumnSettingFromLocal(componentId) {
43
- if (!componentId) return null;
44
- if (typeof window === "undefined" || !window.localStorage) return null;
45
- const storageKey = getComponentStorageKey(componentId, "table-setting");
46
- const raw = window.localStorage.getItem(storageKey);
47
- if (raw && isJson(raw)) {
48
- const data = JSON.parse(raw);
49
- const arr = data === null || data === void 0 ? void 0 : data.column_setting;
50
- return Array.isArray(arr) ? arr : null;
51
- }
52
- return null;
64
+ export function getColumnSettingFromLocal(componentId) {
65
+ if (!componentId) return null;
66
+ if (typeof window === 'undefined' || !window.localStorage) return null;
67
+ var storageKey = getComponentStorageKey(componentId, 'table-setting');
68
+ var raw = window.localStorage.getItem(storageKey);
69
+ if (raw && isJson(raw)) {
70
+ var data = JSON.parse(raw);
71
+ var arr = data === null || data === void 0 ? void 0 : data.column_setting;
72
+ return Array.isArray(arr) ? arr : null;
73
+ }
74
+ return null;
53
75
  }
54
- function clearColumnSettingFromLocal(componentId) {
55
- if (!componentId) return;
56
- if (typeof window === "undefined" || !window.localStorage) return;
57
- const storageKey = getComponentStorageKey(componentId, "table-setting");
58
- window.localStorage.removeItem(storageKey);
76
+ export function clearColumnSettingFromLocal(componentId) {
77
+ if (!componentId) return;
78
+ if (typeof window === 'undefined' || !window.localStorage) return;
79
+ var storageKey = getComponentStorageKey(componentId, 'table-setting');
80
+ window.localStorage.removeItem(storageKey);
59
81
  }
60
- const RECORD_BOARD_VISIBILITY_PREFIX = "record-board-column-visibility";
61
- function saveColumnVisibilityToLocal(params) {
62
- const { componentId, columnVisibility, columnOrder } = params;
63
- if (!componentId) return;
64
- if (typeof window === "undefined" || !window.localStorage) return;
65
- const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
66
- const data = _objectSpread2(_objectSpread2({ column_visibility: columnVisibility }, columnOrder != null && { column_order: columnOrder }), {}, { updatedAt: Date.now() });
67
- try {
68
- window.localStorage.setItem(storageKey, JSON.stringify(data));
69
- } catch (_unused3) {}
82
+
83
+ // ---------- 列显隐(RecordBoard,Record<列 key, boolean> 格式) ----------
84
+
85
+ var RECORD_BOARD_VISIBILITY_PREFIX = 'record-board-column-visibility';
86
+ export function saveColumnVisibilityToLocal(params) {
87
+ var componentId = params.componentId,
88
+ columnVisibility = params.columnVisibility,
89
+ columnOrder = params.columnOrder;
90
+ if (!componentId) return;
91
+ if (typeof window === 'undefined' || !window.localStorage) return;
92
+ var storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
93
+ var data = _objectSpread(_objectSpread({
94
+ column_visibility: columnVisibility
95
+ }, columnOrder != null && {
96
+ column_order: columnOrder
97
+ }), {}, {
98
+ updatedAt: Date.now()
99
+ });
100
+ try {
101
+ window.localStorage.setItem(storageKey, JSON.stringify(data));
102
+ } catch (_unused3) {
103
+ // ignore
104
+ }
70
105
  }
71
- function getColumnVisibilityFromLocal(componentId) {
72
- if (!componentId) return null;
73
- if (typeof window === "undefined" || !window.localStorage) return null;
74
- const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
75
- const raw = window.localStorage.getItem(storageKey);
76
- if (raw && isJson(raw)) {
77
- const data = JSON.parse(raw);
78
- const vis = data === null || data === void 0 ? void 0 : data.column_visibility;
79
- return vis && typeof vis === "object" && vis !== null ? vis : null;
80
- }
81
- return null;
106
+ export function getColumnVisibilityFromLocal(componentId) {
107
+ if (!componentId) return null;
108
+ if (typeof window === 'undefined' || !window.localStorage) return null;
109
+ var storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
110
+ var raw = window.localStorage.getItem(storageKey);
111
+ if (raw && isJson(raw)) {
112
+ var data = JSON.parse(raw);
113
+ var vis = data === null || data === void 0 ? void 0 : data.column_visibility;
114
+ return vis && _typeof(vis) === 'object' && vis !== null ? vis : null;
115
+ }
116
+ return null;
82
117
  }
118
+
83
119
  /** RecordBoard 列设置(显隐 + 顺序)从 localStorage 读取,用于列设置弹层拖拽排序与显隐持久化 */
84
- function getRecordBoardColumnSettingFromLocal(componentId) {
85
- if (!componentId) return null;
86
- if (typeof window === "undefined" || !window.localStorage) return null;
87
- const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
88
- const raw = window.localStorage.getItem(storageKey);
89
- if (raw && isJson(raw)) {
90
- const data = JSON.parse(raw);
91
- const vis = data === null || data === void 0 ? void 0 : data.column_visibility;
92
- return {
93
- columnVisibility: vis && typeof vis === "object" && vis !== null ? vis : {},
94
- columnOrder: Array.isArray(data === null || data === void 0 ? void 0 : data.column_order) ? data.column_order : null
95
- };
96
- }
97
- return null;
120
+ export function getRecordBoardColumnSettingFromLocal(componentId) {
121
+ if (!componentId) return null;
122
+ if (typeof window === 'undefined' || !window.localStorage) return null;
123
+ var storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
124
+ var raw = window.localStorage.getItem(storageKey);
125
+ if (raw && isJson(raw)) {
126
+ var data = JSON.parse(raw);
127
+ var vis = data === null || data === void 0 ? void 0 : data.column_visibility;
128
+ var columnVisibility = vis && _typeof(vis) === 'object' && vis !== null ? vis : {};
129
+ var columnOrder = Array.isArray(data === null || data === void 0 ? void 0 : data.column_order) ? data.column_order : null;
130
+ return {
131
+ columnVisibility: columnVisibility,
132
+ columnOrder: columnOrder
133
+ };
134
+ }
135
+ return null;
98
136
  }
99
- function clearColumnVisibilityFromLocal(componentId) {
100
- if (!componentId) return;
101
- if (typeof window === "undefined" || !window.localStorage) return;
102
- const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
103
- window.localStorage.removeItem(storageKey);
104
- }
105
- //#endregion
106
- export { clearColumnSettingFromLocal, clearColumnVisibilityFromLocal, getColumnSettingFromLocal, getColumnVisibilityFromLocal, getComponentStorageKey, getRecordBoardColumnSettingFromLocal, getStorageKeySuffix, saveColumnSettingToLocal, saveColumnVisibilityToLocal };
137
+ export function clearColumnVisibilityFromLocal(componentId) {
138
+ if (!componentId) return;
139
+ if (typeof window === 'undefined' || !window.localStorage) return;
140
+ var storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
141
+ window.localStorage.removeItem(storageKey);
142
+ }
@@ -1,7 +1,9 @@
1
- //#region src/constants/index.ts
2
- const webHookApi = { warning_log: {
3
- test: "https://open.feishu.cn/open-apis/bot/v2/hook/985186a7-d939-4daf-9f30-3a3cc9c47d97",
4
- prod: "https://open.feishu.cn/open-apis/bot/v2/hook/887dfff9-2ccc-4513-87ff-a05d8cef953e"
5
- } };
6
- //#endregion
7
- export { webHookApi };
1
+ var webHookApi = {
2
+ warning_log: {
3
+ // 非生产环境共用一个url
4
+ test: 'https://open.feishu.cn/open-apis/bot/v2/hook/985186a7-d939-4daf-9f30-3a3cc9c47d97',
5
+ // 生产环境
6
+ prod: 'https://open.feishu.cn/open-apis/bot/v2/hook/887dfff9-2ccc-4513-87ff-a05d8cef953e'
7
+ }
8
+ };
9
+ export { webHookApi };
package/es/date.js CHANGED
@@ -1,42 +1,59 @@
1
1
  import dayjs from "dayjs";
2
- //#region src/date.ts
3
- const formatMaps = ["D MMM YYYY, hh:mma", "YYYY-MM-DD"];
2
+ var formatMaps = [
3
+ // 19 Jul 2023, 09:00am
4
+ 'D MMM YYYY, hh:mma',
5
+ // 2023-07-19
6
+ 'YYYY-MM-DD'];
7
+
4
8
  /**
5
- * @title: 格式化日期
6
- * @description:
7
- * @param {string} date
8
- * @param {string} format
9
- * @return {*}
10
- * @Author: zhiwei.Wang
11
- * @Date: 2023-07-21 10:49
12
- */
13
- const formatDate = (date, format) => {
14
- let _format = format || formatMaps[0];
15
- if (!date) return date;
16
- return dayjs(date).format(_format);
9
+ * @title: 格式化日期
10
+ * @description:
11
+ * @param {string} date
12
+ * @param {string} format
13
+ * @return {*}
14
+ * @Author: zhiwei.Wang
15
+ * @Date: 2023-07-21 10:49
16
+ */
17
+ export var formatDate = function formatDate(date, format) {
18
+ // 19 Jul 2023, 09:00am
19
+ var _format = format || formatMaps[0];
20
+ if (!date) {
21
+ return date;
22
+ }
23
+ return dayjs(date).format(_format);
17
24
  };
25
+
18
26
  /**
19
- * @title: excel日期 转 js日期
20
- * @description:
21
- * @param {number} excelDate
22
- * @return {*}
23
- * @Author: zhiwei.Wang
24
- * @Date: 2023-07-21 10:49
25
- */
26
- const excelDateToJSDate = (excelDate) => {
27
- const dateOffset = (excelDate - 25569) * 864e5;
28
- return formatDate(new Date(dateOffset), formatMaps[1]);
27
+ * @title: excel日期 转 js日期
28
+ * @description:
29
+ * @param {number} excelDate
30
+ * @return {*}
31
+ * @Author: zhiwei.Wang
32
+ * @Date: 2023-07-21 10:49
33
+ */
34
+ export var excelDateToJSDate = function excelDateToJSDate(excelDate) {
35
+ // Excel日期的起始日期为1900年1月1日,JavaScript的起始日期为1970年1月1日
36
+ var dateOffset = (excelDate - 25569) * 86400000; // 将天数转换成毫秒数
37
+
38
+ var jsDate = formatDate(new Date(dateOffset), formatMaps[1]);
39
+ return jsDate;
29
40
  };
41
+
30
42
  /**
31
- * @title: js日期 转 excel日期
32
- * @description:
33
- * @param {string} jsDate
34
- * @return {*}
35
- * @Author: zhiwei.Wang
36
- * @Date: 2023-07-21 10:49
37
- */
38
- const jsDateToExcelDate = (jsDate) => {
39
- return (new Date(jsDate) - new Date(Date.UTC(1900, 0, 1))) / 864e5 + 25569;
40
- };
41
- //#endregion
42
- export { excelDateToJSDate, formatDate, jsDateToExcelDate };
43
+ * @title: js日期 转 excel日期
44
+ * @description:
45
+ * @param {string} jsDate
46
+ * @return {*}
47
+ * @Author: zhiwei.Wang
48
+ * @Date: 2023-07-21 10:49
49
+ */
50
+ export var jsDateToExcelDate = function jsDateToExcelDate(jsDate) {
51
+ var _jsDate = new Date(jsDate);
52
+ // Excel日期的起始日期为1900年1月1日,JavaScript的起始日期为1970年1月1日
53
+ var excelStartDate = new Date(Date.UTC(1900, 0, 1)); // Excel的起始日期为UTC的1900年1月1日
54
+ var dateOffset = _jsDate - excelStartDate; // 计算日期之间的偏移量(毫秒数)
55
+
56
+ var excelDate = dateOffset / 86400000 + 25569; // 将毫秒数转换回天数,并加上Excel的起始日期偏移量
57
+
58
+ return excelDate;
59
+ };
package/es/document.js CHANGED
@@ -1,47 +1,71 @@
1
- import { _asyncToGenerator } from "./_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
2
- //#region src/document.ts
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); }); }; }
3
5
  /**
4
- * @Title: 设置主题
5
- * @Describe: 传入字符串键值对
6
- * @Author: Wzw
7
- */
8
- const setTheme = (themes) => {
9
- try {
10
- let _themes = Object.entries(themes);
11
- for (let item of _themes) document.documentElement.style.setProperty(item[0], item[1]);
12
- } catch (err) {
13
- console.error(err);
14
- }
6
+ * @Title: 设置主题
7
+ * @Describe: 传入字符串键值对
8
+ * @Author: Wzw
9
+ */
10
+ export var setTheme = function setTheme(themes) {
11
+ try {
12
+ var _themes = Object.entries(themes);
13
+ for (var _i = 0, _themes2 = _themes; _i < _themes2.length; _i++) {
14
+ var item = _themes2[_i];
15
+ document.documentElement.style.setProperty(item[0], item[1]);
16
+ }
17
+ } catch (err) {
18
+ console.error(err);
19
+ }
15
20
  };
16
- const httpCopyToClipboard = (text) => {
17
- const textArea = document.createElement("textarea");
18
- textArea.value = text;
19
- textArea.style.position = "fixed";
20
- textArea.style.top = "-10000px";
21
- textArea.style.left = "-10000px";
22
- document.body.appendChild(textArea);
23
- textArea.focus();
24
- textArea.select();
25
- document.execCommand("copy");
26
- document.body.removeChild(textArea);
21
+ var httpCopyToClipboard = function httpCopyToClipboard(text) {
22
+ var textArea = document.createElement('textarea');
23
+ textArea.value = text;
24
+ textArea.style.position = 'fixed';
25
+ textArea.style.top = '-10000px';
26
+ textArea.style.left = '-10000px';
27
+ document.body.appendChild(textArea);
28
+ textArea.focus();
29
+ textArea.select();
30
+ document.execCommand('copy');
31
+ document.body.removeChild(textArea);
27
32
  };
33
+
28
34
  /**
29
- * 复制到剪切板
30
- * @param text
31
- */
32
- const copyToClipboard = function() {
33
- var _ref = _asyncToGenerator(function* (text) {
34
- if (navigator.clipboard) try {
35
- return yield navigator.clipboard.writeText(text);
36
- } catch (error) {
37
- console.error(error);
38
- return httpCopyToClipboard(text);
39
- }
40
- else return httpCopyToClipboard(text);
41
- });
42
- return function copyToClipboard(_x) {
43
- return _ref.apply(this, arguments);
44
- };
45
- }();
46
- //#endregion
47
- export { copyToClipboard, setTheme };
35
+ * 复制到剪切板
36
+ * @param text
37
+ */
38
+ export var copyToClipboard = /*#__PURE__*/function () {
39
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(text) {
40
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
41
+ while (1) switch (_context.prev = _context.next) {
42
+ case 0:
43
+ if (!navigator.clipboard) {
44
+ _context.next = 13;
45
+ break;
46
+ }
47
+ _context.prev = 1;
48
+ _context.next = 4;
49
+ return navigator.clipboard.writeText(text);
50
+ case 4:
51
+ return _context.abrupt("return", _context.sent);
52
+ case 7:
53
+ _context.prev = 7;
54
+ _context.t0 = _context["catch"](1);
55
+ console.error(_context.t0);
56
+ return _context.abrupt("return", httpCopyToClipboard(text));
57
+ case 11:
58
+ _context.next = 14;
59
+ break;
60
+ case 13:
61
+ return _context.abrupt("return", httpCopyToClipboard(text));
62
+ case 14:
63
+ case "end":
64
+ return _context.stop();
65
+ }
66
+ }, _callee, null, [[1, 7]]);
67
+ }));
68
+ return function copyToClipboard(_x) {
69
+ return _ref.apply(this, arguments);
70
+ };
71
+ }();