@pisell/utils 1.0.71 → 1.0.73

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 (202) hide show
  1. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +27 -0
  2. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +12 -0
  3. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +25 -0
  4. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +14 -0
  5. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +9 -0
  6. package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +11 -0
  7. package/es/arrayUtils.d.ts +4 -1
  8. package/es/arrayUtils.js +15 -24
  9. package/es/common/stateHelper.d.ts +6 -2
  10. package/es/common/stateHelper.js +22 -24
  11. package/es/common/types.d.ts +13 -10
  12. package/es/componentStorage.d.ts +27 -25
  13. package/es/componentStorage.js +94 -130
  14. package/es/constants/index.js +7 -9
  15. package/es/date.d.ts +6 -3
  16. package/es/date.js +36 -53
  17. package/es/document.d.ts +6 -3
  18. package/es/document.js +43 -67
  19. package/es/escPosPrinter/EscPosPrinter.js +353 -490
  20. package/es/escPosPrinter/index.d.ts +9 -9
  21. package/es/escPosPrinter/index.js +37 -52
  22. package/es/format.d.ts +12 -11
  23. package/es/format.js +90 -116
  24. package/es/image.d.ts +13 -10
  25. package/es/image.js +48 -60
  26. package/es/index.d.ts +38 -23
  27. package/es/index.js +39 -34
  28. package/es/jsBridge/index.d.ts +8 -4
  29. package/es/jsBridge/index.js +57 -56
  30. package/es/jsBridge/regDeviceApi.js +107 -149
  31. package/es/jsBridge/types.d.ts +95 -115
  32. package/es/locales.d.ts +11 -8
  33. package/es/locales.js +77 -96
  34. package/es/log.d.ts +11 -6
  35. package/es/log.js +37 -59
  36. package/es/miniRedux.d.ts +20 -13
  37. package/es/miniRedux.js +42 -78
  38. package/es/number-input/hooks/useNumberInputState.d.ts +6 -2
  39. package/es/number-input/hooks/useNumberInputState.js +71 -128
  40. package/es/number-input/types.d.ts +88 -88
  41. package/es/number-input/utils/formatter.d.ts +13 -10
  42. package/es/number-input/utils/formatter.js +51 -77
  43. package/es/number-input/utils/validation.d.ts +7 -2
  44. package/es/number-input/utils/validation.js +51 -66
  45. package/es/otherUtils.d.ts +12 -9
  46. package/es/otherUtils.js +71 -129
  47. package/es/platform.d.ts +17 -9
  48. package/es/platform.js +78 -85
  49. package/es/select/hooks/useDebouncedSearch.d.ts +4 -1
  50. package/es/select/hooks/useDebouncedSearch.js +39 -53
  51. package/es/select/hooks/useSelectState.d.ts +7 -7
  52. package/es/select/hooks/useSelectState.js +56 -113
  53. package/es/select/index.d.ts +7 -8
  54. package/es/select/types.d.ts +211 -211
  55. package/es/select/utils/filterOptions.d.ts +7 -6
  56. package/es/select/utils/filterOptions.js +26 -31
  57. package/es/select/utils/helpers.d.ts +10 -9
  58. package/es/select/utils/helpers.js +42 -52
  59. package/es/select/utils/index.d.ts +4 -7
  60. package/es/select/utils/sortOptions.d.ts +6 -5
  61. package/es/select/utils/sortOptions.js +19 -31
  62. package/es/select/utils/tagAggregation.d.ts +6 -6
  63. package/es/select/utils/tagAggregation.js +34 -47
  64. package/es/text-input/hooks/useTextInputState.d.ts +6 -2
  65. package/es/text-input/hooks/useTextInputState.js +69 -126
  66. package/es/text-input/types.d.ts +48 -48
  67. package/es/text-input/utils/validation.d.ts +7 -2
  68. package/es/text-input/utils/validation.js +50 -70
  69. package/es/typeUtils.d.ts +11 -8
  70. package/es/typeUtils.js +61 -84
  71. package/es/walletValidity.d.ts +36 -34
  72. package/es/walletValidity.js +332 -456
  73. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +27 -0
  74. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +12 -0
  75. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +25 -0
  76. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +14 -0
  77. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +9 -0
  78. package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +16 -0
  79. package/lib/_virtual/_rolldown/runtime.js +23 -0
  80. package/lib/arrayUtils.d.ts +4 -1
  81. package/lib/arrayUtils.js +14 -39
  82. package/lib/common/stateHelper.d.ts +6 -2
  83. package/lib/common/stateHelper.js +21 -32
  84. package/lib/common/types.d.ts +13 -10
  85. package/lib/componentStorage.d.ts +27 -25
  86. package/lib/componentStorage.js +96 -126
  87. package/lib/constants/index.js +7 -36
  88. package/lib/date.d.ts +6 -3
  89. package/lib/date.js +43 -65
  90. package/lib/document.d.ts +6 -3
  91. package/lib/document.js +46 -62
  92. package/lib/escPosPrinter/EscPosPrinter.js +327 -403
  93. package/lib/escPosPrinter/index.d.ts +9 -9
  94. package/lib/escPosPrinter/index.js +38 -84
  95. package/lib/format.d.ts +12 -11
  96. package/lib/format.js +91 -99
  97. package/lib/image.d.ts +13 -10
  98. package/lib/image.js +48 -74
  99. package/lib/index.d.ts +38 -23
  100. package/lib/index.js +115 -78
  101. package/lib/jsBridge/index.d.ts +8 -4
  102. package/lib/jsBridge/index.js +58 -77
  103. package/lib/jsBridge/regDeviceApi.js +106 -153
  104. package/lib/jsBridge/types.d.ts +95 -115
  105. package/lib/locales.d.ts +11 -8
  106. package/lib/locales.js +79 -90
  107. package/lib/log.d.ts +11 -6
  108. package/lib/log.js +37 -61
  109. package/lib/miniRedux.d.ts +20 -13
  110. package/lib/miniRedux.js +43 -92
  111. package/lib/number-input/hooks/useNumberInputState.d.ts +6 -2
  112. package/lib/number-input/hooks/useNumberInputState.js +71 -81
  113. package/lib/number-input/types.d.ts +88 -88
  114. package/lib/number-input/utils/formatter.d.ts +13 -10
  115. package/lib/number-input/utils/formatter.js +52 -49
  116. package/lib/number-input/utils/validation.d.ts +7 -2
  117. package/lib/number-input/utils/validation.js +50 -52
  118. package/lib/otherUtils.d.ts +12 -9
  119. package/lib/otherUtils.js +86 -98
  120. package/lib/platform.d.ts +17 -9
  121. package/lib/platform.js +85 -122
  122. package/lib/select/hooks/useDebouncedSearch.d.ts +4 -1
  123. package/lib/select/hooks/useDebouncedSearch.js +40 -41
  124. package/lib/select/hooks/useSelectState.d.ts +7 -7
  125. package/lib/select/hooks/useSelectState.js +58 -93
  126. package/lib/select/index.d.ts +7 -8
  127. package/lib/select/types.d.ts +211 -211
  128. package/lib/select/utils/filterOptions.d.ts +7 -6
  129. package/lib/select/utils/filterOptions.js +26 -37
  130. package/lib/select/utils/helpers.d.ts +10 -9
  131. package/lib/select/utils/helpers.js +45 -41
  132. package/lib/select/utils/index.d.ts +4 -7
  133. package/lib/select/utils/sortOptions.d.ts +6 -5
  134. package/lib/select/utils/sortOptions.js +18 -39
  135. package/lib/select/utils/tagAggregation.d.ts +6 -6
  136. package/lib/select/utils/tagAggregation.js +33 -41
  137. package/lib/text-input/hooks/useTextInputState.d.ts +6 -2
  138. package/lib/text-input/hooks/useTextInputState.js +69 -79
  139. package/lib/text-input/types.d.ts +48 -48
  140. package/lib/text-input/utils/validation.d.ts +7 -2
  141. package/lib/text-input/utils/validation.js +49 -58
  142. package/lib/typeUtils.d.ts +11 -8
  143. package/lib/typeUtils.js +68 -73
  144. package/lib/walletValidity.d.ts +36 -34
  145. package/lib/walletValidity.js +345 -317
  146. package/package.json +1 -2
  147. package/es/common/index.d.ts +0 -5
  148. package/es/common/index.js +0 -5
  149. package/es/common/types.js +0 -1
  150. package/es/constants/index.d.ts +0 -7
  151. package/es/firebase/config/index.d.ts +0 -13
  152. package/es/firebase/config/index.js +0 -54
  153. package/es/firebase/index.d.ts +0 -28
  154. package/es/firebase/index.js +0 -232
  155. package/es/jsBridge/types.js +0 -1
  156. package/es/number-input/hooks/index.d.ts +0 -4
  157. package/es/number-input/hooks/index.js +0 -5
  158. package/es/number-input/index.d.ts +0 -14
  159. package/es/number-input/index.js +0 -21
  160. package/es/number-input/types.js +0 -1
  161. package/es/number-input/utils/index.d.ts +0 -7
  162. package/es/number-input/utils/index.js +0 -8
  163. package/es/select/hooks/index.d.ts +0 -5
  164. package/es/select/hooks/index.js +0 -6
  165. package/es/select/index.js +0 -13
  166. package/es/select/types.js +0 -1
  167. package/es/select/utils/index.js +0 -8
  168. package/es/text-input/hooks/index.d.ts +0 -4
  169. package/es/text-input/hooks/index.js +0 -5
  170. package/es/text-input/index.d.ts +0 -14
  171. package/es/text-input/index.js +0 -20
  172. package/es/text-input/types.js +0 -1
  173. package/es/text-input/utils/index.d.ts +0 -5
  174. package/es/text-input/utils/index.js +0 -7
  175. package/lib/common/index.d.ts +0 -5
  176. package/lib/common/index.js +0 -29
  177. package/lib/common/types.js +0 -17
  178. package/lib/constants/index.d.ts +0 -7
  179. package/lib/firebase/config/index.d.ts +0 -13
  180. package/lib/firebase/config/index.js +0 -79
  181. package/lib/firebase/index.d.ts +0 -28
  182. package/lib/firebase/index.js +0 -180
  183. package/lib/jsBridge/types.js +0 -17
  184. package/lib/number-input/hooks/index.d.ts +0 -4
  185. package/lib/number-input/hooks/index.js +0 -29
  186. package/lib/number-input/index.d.ts +0 -14
  187. package/lib/number-input/index.js +0 -41
  188. package/lib/number-input/types.js +0 -17
  189. package/lib/number-input/utils/index.d.ts +0 -7
  190. package/lib/number-input/utils/index.js +0 -39
  191. package/lib/select/hooks/index.d.ts +0 -5
  192. package/lib/select/hooks/index.js +0 -34
  193. package/lib/select/index.js +0 -53
  194. package/lib/select/types.js +0 -17
  195. package/lib/select/utils/index.js +0 -48
  196. package/lib/text-input/hooks/index.d.ts +0 -4
  197. package/lib/text-input/hooks/index.js +0 -29
  198. package/lib/text-input/index.d.ts +0 -14
  199. package/lib/text-input/index.js +0 -35
  200. package/lib/text-input/types.js +0 -17
  201. package/lib/text-input/utils/index.d.ts +0 -5
  202. package/lib/text-input/utils/index.js +0 -32
@@ -0,0 +1,27 @@
1
+ //#region \0@oxc-project+runtime@0.122.0/helpers/asyncToGenerator.js
2
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
3
+ try {
4
+ var i = n[a](c), u = i.value;
5
+ } catch (n) {
6
+ e(n);
7
+ return;
8
+ }
9
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
10
+ }
11
+ function _asyncToGenerator(n) {
12
+ return function() {
13
+ var t = this, e = arguments;
14
+ return new Promise(function(r, o) {
15
+ var a = n.apply(t, e);
16
+ function _next(n) {
17
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
18
+ }
19
+ function _throw(n) {
20
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
21
+ }
22
+ _next(void 0);
23
+ });
24
+ };
25
+ }
26
+ //#endregion
27
+ exports._asyncToGenerator = _asyncToGenerator;
@@ -0,0 +1,12 @@
1
+ const require_toPropertyKey = require("./toPropertyKey.js");
2
+ //#region \0@oxc-project+runtime@0.122.0/helpers/defineProperty.js
3
+ function _defineProperty(e, r, t) {
4
+ return (r = require_toPropertyKey.toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
5
+ value: t,
6
+ enumerable: !0,
7
+ configurable: !0,
8
+ writable: !0
9
+ }) : e[r] = t, e;
10
+ }
11
+ //#endregion
12
+ exports._defineProperty = _defineProperty;
@@ -0,0 +1,25 @@
1
+ const require_defineProperty = require("./defineProperty.js");
2
+ //#region \0@oxc-project+runtime@0.122.0/helpers/objectSpread2.js
3
+ function ownKeys(e, r) {
4
+ var t = Object.keys(e);
5
+ if (Object.getOwnPropertySymbols) {
6
+ var o = Object.getOwnPropertySymbols(e);
7
+ r && (o = o.filter(function(r) {
8
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
9
+ })), t.push.apply(t, o);
10
+ }
11
+ return t;
12
+ }
13
+ function _objectSpread2(e) {
14
+ for (var r = 1; r < arguments.length; r++) {
15
+ var t = null != arguments[r] ? arguments[r] : {};
16
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
17
+ require_defineProperty._defineProperty(e, r, t[r]);
18
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
19
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
20
+ });
21
+ }
22
+ return e;
23
+ }
24
+ //#endregion
25
+ exports._objectSpread2 = _objectSpread2;
@@ -0,0 +1,14 @@
1
+ const require_typeof = require("./typeof.js");
2
+ //#region \0@oxc-project+runtime@0.122.0/helpers/toPrimitive.js
3
+ function toPrimitive(t, r) {
4
+ if ("object" != require_typeof._typeof(t) || !t) return t;
5
+ var e = t[Symbol.toPrimitive];
6
+ if (void 0 !== e) {
7
+ var i = e.call(t, r || "default");
8
+ if ("object" != require_typeof._typeof(i)) return i;
9
+ throw new TypeError("@@toPrimitive must return a primitive value.");
10
+ }
11
+ return ("string" === r ? String : Number)(t);
12
+ }
13
+ //#endregion
14
+ exports.toPrimitive = toPrimitive;
@@ -0,0 +1,9 @@
1
+ const require_typeof = require("./typeof.js");
2
+ const require_toPrimitive = require("./toPrimitive.js");
3
+ //#region \0@oxc-project+runtime@0.122.0/helpers/toPropertyKey.js
4
+ function toPropertyKey(t) {
5
+ var i = require_toPrimitive.toPrimitive(t, "string");
6
+ return "symbol" == require_typeof._typeof(i) ? i : i + "";
7
+ }
8
+ //#endregion
9
+ exports.toPropertyKey = toPropertyKey;
@@ -0,0 +1,16 @@
1
+ //#region \0@oxc-project+runtime@0.122.0/helpers/typeof.js
2
+ function _typeof(o) {
3
+ "@babel/helpers - typeof";
4
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
5
+ return typeof o;
6
+ } : function(o) {
7
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
8
+ }, _typeof(o);
9
+ }
10
+ //#endregion
11
+ Object.defineProperty(exports, "_typeof", {
12
+ enumerable: true,
13
+ get: function() {
14
+ return _typeof;
15
+ }
16
+ });
@@ -0,0 +1,23 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ exports.__toESM = __toESM;
@@ -1 +1,4 @@
1
- export declare const uniqueByKey: <T>(arr: T[], key: keyof T) => T[];
1
+ //#region src/arrayUtils.d.ts
2
+ declare const uniqueByKey: <T>(arr: T[], key: keyof T) => T[];
3
+ //#endregion
4
+ export { uniqueByKey };
package/lib/arrayUtils.js CHANGED
@@ -1,40 +1,15 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
1
+ //#region src/arrayUtils.ts
2
+ const uniqueByKey = (arr, key) => {
3
+ const seen = /* @__PURE__ */ new Set();
4
+ const result = [];
5
+ for (const item of arr) {
6
+ const keyValue = item[key];
7
+ if (!seen.has(keyValue)) {
8
+ seen.add(keyValue);
9
+ result.push(item);
10
+ }
11
+ }
12
+ return result;
8
13
  };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/arrayUtils.ts
20
- var arrayUtils_exports = {};
21
- __export(arrayUtils_exports, {
22
- uniqueByKey: () => uniqueByKey
23
- });
24
- module.exports = __toCommonJS(arrayUtils_exports);
25
- var uniqueByKey = (arr, key) => {
26
- const seen = /* @__PURE__ */ new Set();
27
- const result = [];
28
- for (const item of arr) {
29
- const keyValue = item[key];
30
- if (!seen.has(keyValue)) {
31
- seen.add(keyValue);
32
- result.push(item);
33
- }
34
- }
35
- return result;
36
- };
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- uniqueByKey
40
- });
14
+ //#endregion
15
+ exports.uniqueByKey = uniqueByKey;
@@ -1,4 +1,6 @@
1
- import type { DisplayState } from './types';
1
+ import { DisplayState } from "./types.js";
2
+
3
+ //#region src/common/stateHelper.d.ts
2
4
  /**
3
5
  * 根据 mode 和 disabled 计算组件的显示状态
4
6
  *
@@ -15,4 +17,6 @@ import type { DisplayState } from './types';
15
17
  * getDisplayState('edit', true) // 'disabled'
16
18
  * getDisplayState('read', true) // 'disabled'
17
19
  */
18
- export declare function getDisplayState(mode?: 'read' | 'edit', disabled?: boolean): DisplayState;
20
+ declare function getDisplayState(mode?: 'read' | 'edit', disabled?: boolean): DisplayState;
21
+ //#endregion
22
+ export { getDisplayState };
@@ -1,34 +1,23 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/common/stateHelper.ts
20
- var stateHelper_exports = {};
21
- __export(stateHelper_exports, {
22
- getDisplayState: () => getDisplayState
23
- });
24
- module.exports = __toCommonJS(stateHelper_exports);
1
+ //#region src/common/stateHelper.ts
2
+ /**
3
+ * 根据 mode 和 disabled 计算组件的显示状态
4
+ *
5
+ * 状态优先级:disabled > mode
6
+ * 当 disabled=true 时,无论 mode 是什么,都显示为禁用态
7
+ *
8
+ * @param mode 状态模式('read' | 'edit')
9
+ * @param disabled 是否禁用
10
+ * @returns 显示状态('read' | 'edit' | 'disabled')
11
+ *
12
+ * @example
13
+ * getDisplayState('edit', false) // 'edit'
14
+ * getDisplayState('read', false) // 'read'
15
+ * getDisplayState('edit', true) // 'disabled'
16
+ * getDisplayState('read', true) // 'disabled'
17
+ */
25
18
  function getDisplayState(mode, disabled) {
26
- if (disabled) {
27
- return "disabled";
28
- }
29
- return mode || "edit";
19
+ if (disabled) return "disabled";
20
+ return mode || "edit";
30
21
  }
31
- // Annotate the CommonJS export names for ESM import in node:
32
- 0 && (module.exports = {
33
- getDisplayState
34
- });
22
+ //#endregion
23
+ exports.getDisplayState = getDisplayState;
@@ -1,3 +1,4 @@
1
+ //#region src/common/types.d.ts
1
2
  /**
2
3
  * 公共类型定义
3
4
  * 供所有输入组件使用
@@ -10,19 +11,21 @@
10
11
  * - edit: 编辑态,显示输入控件
11
12
  * - disabled: 禁用态,禁用的输入控件
12
13
  */
13
- export declare type DisplayState = 'read' | 'edit' | 'disabled';
14
+ type DisplayState = 'read' | 'edit' | 'disabled';
14
15
  /**
15
16
  * 校验结果类型
16
17
  *
17
18
  * 所有输入组件的校验结果统一格式
18
19
  */
19
- export interface ValidationResult {
20
- /**
21
- * 是否校验通过
22
- */
23
- isValid: boolean;
24
- /**
25
- * 错误信息数组
26
- */
27
- errors: string[];
20
+ interface ValidationResult {
21
+ /**
22
+ * 是否校验通过
23
+ */
24
+ isValid: boolean;
25
+ /**
26
+ * 错误信息数组
27
+ */
28
+ errors: string[];
28
29
  }
30
+ //#endregion
31
+ export { DisplayState, ValidationResult };
@@ -1,36 +1,38 @@
1
+ //#region src/componentStorage.d.ts
1
2
  /** 生成存储 key 的路径后缀:pathname 或 pathname#memory_key(来自 URL memory_key 参数) */
2
- export declare function getStorageKeySuffix(): string;
3
+ declare function getStorageKeySuffix(): string;
3
4
  /**
4
5
  * 生成组件实例的存储 key。
5
6
  * @param componentId 组件实例 id(如 __id)
6
7
  * @param prefix 前缀,如 'table-setting'、'record-board-column-visibility'
7
8
  */
8
- export declare function getComponentStorageKey(componentId: string, prefix: string): string;
9
- export interface ColumnSettingStorageItem {
10
- key: string;
11
- dataIndex: string;
12
- title?: unknown;
13
- titleString?: string;
14
- isShow: boolean;
15
- sortIndex?: number;
16
- fixed?: 'left' | 'right' | boolean;
9
+ declare function getComponentStorageKey(componentId: string, prefix: string): string;
10
+ interface ColumnSettingStorageItem {
11
+ key: string;
12
+ dataIndex: string;
13
+ title?: unknown;
14
+ titleString?: string;
15
+ isShow: boolean;
16
+ sortIndex?: number;
17
+ fixed?: 'left' | 'right' | boolean;
17
18
  }
18
- export declare function saveColumnSettingToLocal(params: {
19
- componentId: string;
20
- columnSetting: ColumnSettingStorageItem[];
19
+ declare function saveColumnSettingToLocal(params: {
20
+ componentId: string;
21
+ columnSetting: ColumnSettingStorageItem[];
21
22
  }): void;
22
- export declare function getColumnSettingFromLocal(componentId?: string): ColumnSettingStorageItem[] | null;
23
- export declare function clearColumnSettingFromLocal(componentId?: string): void;
24
- export declare function saveColumnVisibilityToLocal(params: {
25
- componentId: string;
26
- columnVisibility: Record<string, boolean>;
27
- /** 列 key 顺序,用于列设置弹层拖拽排序后持久化 */
28
- columnOrder?: string[];
23
+ declare function getColumnSettingFromLocal(componentId?: string): ColumnSettingStorageItem[] | null;
24
+ declare function clearColumnSettingFromLocal(componentId?: string): void;
25
+ declare function saveColumnVisibilityToLocal(params: {
26
+ componentId: string;
27
+ columnVisibility: Record<string, boolean>; /** 列 key 顺序,用于列设置弹层拖拽排序后持久化 */
28
+ columnOrder?: string[];
29
29
  }): void;
30
- export declare function getColumnVisibilityFromLocal(componentId?: string): Record<string, boolean> | null;
30
+ declare function getColumnVisibilityFromLocal(componentId?: string): Record<string, boolean> | null;
31
31
  /** RecordBoard 列设置(显隐 + 顺序)从 localStorage 读取,用于列设置弹层拖拽排序与显隐持久化 */
32
- export declare function getRecordBoardColumnSettingFromLocal(componentId?: string): {
33
- columnVisibility: Record<string, boolean>;
34
- columnOrder: string[] | null;
32
+ declare function getRecordBoardColumnSettingFromLocal(componentId?: string): {
33
+ columnVisibility: Record<string, boolean>;
34
+ columnOrder: string[] | null;
35
35
  } | null;
36
- export declare function clearColumnVisibilityFromLocal(componentId?: string): void;
36
+ declare function clearColumnVisibilityFromLocal(componentId?: string): void;
37
+ //#endregion
38
+ export { ColumnSettingStorageItem, clearColumnSettingFromLocal, clearColumnVisibilityFromLocal, getColumnSettingFromLocal, getColumnVisibilityFromLocal, getComponentStorageKey, getRecordBoardColumnSettingFromLocal, getStorageKeySuffix, saveColumnSettingToLocal, saveColumnVisibilityToLocal };
@@ -1,144 +1,114 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/componentStorage.ts
20
- var componentStorage_exports = {};
21
- __export(componentStorage_exports, {
22
- clearColumnSettingFromLocal: () => clearColumnSettingFromLocal,
23
- clearColumnVisibilityFromLocal: () => clearColumnVisibilityFromLocal,
24
- getColumnSettingFromLocal: () => getColumnSettingFromLocal,
25
- getColumnVisibilityFromLocal: () => getColumnVisibilityFromLocal,
26
- getComponentStorageKey: () => getComponentStorageKey,
27
- getRecordBoardColumnSettingFromLocal: () => getRecordBoardColumnSettingFromLocal,
28
- getStorageKeySuffix: () => getStorageKeySuffix,
29
- saveColumnSettingToLocal: () => saveColumnSettingToLocal,
30
- saveColumnVisibilityToLocal: () => saveColumnVisibilityToLocal
31
- });
32
- module.exports = __toCommonJS(componentStorage_exports);
33
- var import_typeUtils = require("./typeUtils");
1
+ const require_objectSpread2 = require("./_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
2
+ const require_typeUtils = require("./typeUtils.js");
3
+ //#region src/componentStorage.ts
4
+ /**
5
+ * 组件级 localStorage 存储:列设置、列显隐等。
6
+ * 供 pisellDataSourceContainer、pisellRecordBoard 等复用,key 含 pathname 与 memory_key 以区分页面。
7
+ */
8
+ /** 生成存储 key 的路径后缀:pathname 或 pathname#memory_key(来自 URL memory_key 参数) */
34
9
  function getStorageKeySuffix() {
35
- if (typeof window === "undefined" || typeof window.location === "undefined") {
36
- return "/";
37
- }
38
- const { pathname, search } = window.location;
39
- const appendPath = pathname || "/";
40
- let memoryKey = "";
41
- try {
42
- const params = new URLSearchParams(search || "");
43
- const mk = params.get("memory_key");
44
- if (mk && mk.trim() !== "") memoryKey = mk.trim();
45
- } catch {
46
- }
47
- return memoryKey ? `${appendPath}#${memoryKey}` : appendPath;
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;
48
19
  }
20
+ /**
21
+ * 生成组件实例的存储 key。
22
+ * @param componentId 组件实例 id(如 __id)
23
+ * @param prefix 前缀,如 'table-setting'、'record-board-column-visibility'
24
+ */
49
25
  function getComponentStorageKey(componentId, prefix) {
50
- if (typeof window === "undefined" || typeof window.location === "undefined") {
51
- return `${prefix}-${componentId}`;
52
- }
53
- const suffix = getStorageKeySuffix();
54
- return `${prefix}-${componentId}-${suffix}`;
26
+ if (typeof window === "undefined" || typeof window.location === "undefined") return `${prefix}-${componentId}`;
27
+ return `${prefix}-${componentId}-${getStorageKeySuffix()}`;
55
28
  }
56
29
  function saveColumnSettingToLocal(params) {
57
- const { componentId, columnSetting } = params;
58
- if (!componentId) return;
59
- if (typeof window === "undefined" || !window.localStorage) return;
60
- const storageKey = getComponentStorageKey(componentId, "table-setting");
61
- const data = { column_setting: columnSetting, updatedAt: Date.now() };
62
- try {
63
- window.localStorage.setItem(storageKey, JSON.stringify(data));
64
- } catch {
65
- }
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) {}
66
41
  }
67
42
  function getColumnSettingFromLocal(componentId) {
68
- if (!componentId) return null;
69
- if (typeof window === "undefined" || !window.localStorage) return null;
70
- const storageKey = getComponentStorageKey(componentId, "table-setting");
71
- const raw = window.localStorage.getItem(storageKey);
72
- if (raw && (0, import_typeUtils.isJson)(raw)) {
73
- const data = JSON.parse(raw);
74
- const arr = data == null ? void 0 : data.column_setting;
75
- return Array.isArray(arr) ? arr : null;
76
- }
77
- return null;
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 && require_typeUtils.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;
78
53
  }
79
54
  function clearColumnSettingFromLocal(componentId) {
80
- if (!componentId) return;
81
- if (typeof window === "undefined" || !window.localStorage) return;
82
- const storageKey = getComponentStorageKey(componentId, "table-setting");
83
- window.localStorage.removeItem(storageKey);
55
+ if (!componentId) return;
56
+ if (typeof window === "undefined" || !window.localStorage) return;
57
+ const storageKey = getComponentStorageKey(componentId, "table-setting");
58
+ window.localStorage.removeItem(storageKey);
84
59
  }
85
- var RECORD_BOARD_VISIBILITY_PREFIX = "record-board-column-visibility";
60
+ const RECORD_BOARD_VISIBILITY_PREFIX = "record-board-column-visibility";
86
61
  function saveColumnVisibilityToLocal(params) {
87
- const { componentId, columnVisibility, columnOrder } = params;
88
- if (!componentId) return;
89
- if (typeof window === "undefined" || !window.localStorage) return;
90
- const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
91
- const data = {
92
- column_visibility: columnVisibility,
93
- ...columnOrder != null && { column_order: columnOrder },
94
- updatedAt: Date.now()
95
- };
96
- try {
97
- window.localStorage.setItem(storageKey, JSON.stringify(data));
98
- } catch {
99
- }
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 = require_objectSpread2._objectSpread2(require_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) {}
100
70
  }
101
71
  function getColumnVisibilityFromLocal(componentId) {
102
- if (!componentId) return null;
103
- if (typeof window === "undefined" || !window.localStorage) return null;
104
- const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
105
- const raw = window.localStorage.getItem(storageKey);
106
- if (raw && (0, import_typeUtils.isJson)(raw)) {
107
- const data = JSON.parse(raw);
108
- const vis = data == null ? void 0 : data.column_visibility;
109
- return vis && typeof vis === "object" && vis !== null ? vis : null;
110
- }
111
- return null;
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 && require_typeUtils.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;
112
82
  }
83
+ /** RecordBoard 列设置(显隐 + 顺序)从 localStorage 读取,用于列设置弹层拖拽排序与显隐持久化 */
113
84
  function getRecordBoardColumnSettingFromLocal(componentId) {
114
- if (!componentId) return null;
115
- if (typeof window === "undefined" || !window.localStorage) return null;
116
- const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
117
- const raw = window.localStorage.getItem(storageKey);
118
- if (raw && (0, import_typeUtils.isJson)(raw)) {
119
- const data = JSON.parse(raw);
120
- const vis = data == null ? void 0 : data.column_visibility;
121
- const columnVisibility = vis && typeof vis === "object" && vis !== null ? vis : {};
122
- const columnOrder = Array.isArray(data == null ? void 0 : data.column_order) ? data.column_order : null;
123
- return { columnVisibility, columnOrder };
124
- }
125
- return null;
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 && require_typeUtils.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;
126
98
  }
127
99
  function clearColumnVisibilityFromLocal(componentId) {
128
- if (!componentId) return;
129
- if (typeof window === "undefined" || !window.localStorage) return;
130
- const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
131
- window.localStorage.removeItem(storageKey);
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);
132
104
  }
133
- // Annotate the CommonJS export names for ESM import in node:
134
- 0 && (module.exports = {
135
- clearColumnSettingFromLocal,
136
- clearColumnVisibilityFromLocal,
137
- getColumnSettingFromLocal,
138
- getColumnVisibilityFromLocal,
139
- getComponentStorageKey,
140
- getRecordBoardColumnSettingFromLocal,
141
- getStorageKeySuffix,
142
- saveColumnSettingToLocal,
143
- saveColumnVisibilityToLocal
144
- });
105
+ //#endregion
106
+ exports.clearColumnSettingFromLocal = clearColumnSettingFromLocal;
107
+ exports.clearColumnVisibilityFromLocal = clearColumnVisibilityFromLocal;
108
+ exports.getColumnSettingFromLocal = getColumnSettingFromLocal;
109
+ exports.getColumnVisibilityFromLocal = getColumnVisibilityFromLocal;
110
+ exports.getComponentStorageKey = getComponentStorageKey;
111
+ exports.getRecordBoardColumnSettingFromLocal = getRecordBoardColumnSettingFromLocal;
112
+ exports.getStorageKeySuffix = getStorageKeySuffix;
113
+ exports.saveColumnSettingToLocal = saveColumnSettingToLocal;
114
+ exports.saveColumnVisibilityToLocal = saveColumnVisibilityToLocal;