@allahjs/utils 1.8.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/browser/domUtils/index.cjs +102 -0
  3. package/dist/browser/domUtils/index.cjs.map +1 -1
  4. package/dist/browser/domUtils/index.d.ts +24 -0
  5. package/dist/core/constants/asyncTaskScheduleVo.d.ts +98 -0
  6. package/dist/core/constants/comm.cjs +25 -0
  7. package/dist/core/constants/comm.cjs.map +1 -0
  8. package/dist/core/constants/comm.d.ts +309 -0
  9. package/dist/core/constants/defaultData.cjs +16 -0
  10. package/dist/core/constants/defaultData.cjs.map +1 -0
  11. package/dist/core/constants/defaultData.d.ts +8 -0
  12. package/dist/core/constants/index.cjs +22 -0
  13. package/dist/core/constants/index.cjs.map +1 -0
  14. package/dist/core/constants/index.d.ts +4 -0
  15. package/dist/core/constants/systemEnum.cjs +25 -0
  16. package/dist/core/constants/systemEnum.cjs.map +1 -0
  17. package/dist/core/constants/systemEnum.d.ts +22 -0
  18. package/dist/core/dateUtils/index.cjs +46 -1
  19. package/dist/core/dateUtils/index.cjs.map +1 -1
  20. package/dist/core/dateUtils/index.d.ts +21 -1
  21. package/dist/core/index.cjs +19 -17
  22. package/dist/core/index.cjs.map +1 -1
  23. package/dist/core/index.d.ts +10 -0
  24. package/dist/core/storageUtils/index.cjs +135 -0
  25. package/dist/core/storageUtils/index.cjs.map +1 -0
  26. package/dist/core/storageUtils/index.d.ts +54 -0
  27. package/dist/esm/browser/domUtils/index.d.ts +24 -0
  28. package/dist/esm/browser/domUtils/index.js +102 -0
  29. package/dist/esm/browser/domUtils/index.js.map +1 -1
  30. package/dist/esm/core/constants/asyncTaskScheduleVo.d.ts +98 -0
  31. package/dist/esm/core/constants/comm.d.ts +309 -0
  32. package/dist/esm/core/constants/comm.js +25 -0
  33. package/dist/esm/core/constants/comm.js.map +1 -0
  34. package/dist/esm/core/constants/defaultData.d.ts +8 -0
  35. package/dist/esm/core/constants/defaultData.js +14 -0
  36. package/dist/esm/core/constants/defaultData.js.map +1 -0
  37. package/dist/esm/core/constants/index.d.ts +4 -0
  38. package/dist/esm/core/constants/index.js +4 -0
  39. package/dist/esm/core/constants/index.js.map +1 -0
  40. package/dist/esm/core/constants/systemEnum.d.ts +22 -0
  41. package/dist/esm/core/constants/systemEnum.js +25 -0
  42. package/dist/esm/core/constants/systemEnum.js.map +1 -0
  43. package/dist/esm/core/dateUtils/index.d.ts +21 -1
  44. package/dist/esm/core/dateUtils/index.js +46 -2
  45. package/dist/esm/core/dateUtils/index.js.map +1 -1
  46. package/dist/esm/core/index.d.ts +10 -0
  47. package/dist/esm/core/index.js +3 -1
  48. package/dist/esm/core/index.js.map +1 -1
  49. package/dist/esm/core/storageUtils/index.d.ts +54 -0
  50. package/dist/esm/core/storageUtils/index.js +131 -0
  51. package/dist/esm/core/storageUtils/index.js.map +1 -0
  52. package/dist/esm/form/index.d.ts +1 -0
  53. package/dist/esm/form/index.js +2 -0
  54. package/dist/esm/form/index.js.map +1 -0
  55. package/dist/esm/form/types.d.ts +878 -0
  56. package/dist/esm/index.d.ts +7 -2
  57. package/dist/esm/index.js +5 -1
  58. package/dist/esm/index.js.map +1 -1
  59. package/dist/esm/types/data/index.d.ts +22 -1
  60. package/dist/esm/types/index.d.ts +1 -1
  61. package/dist/esm/umijs/index.d.ts +1 -0
  62. package/dist/esm/umijs/index.js +2 -0
  63. package/dist/esm/umijs/index.js.map +1 -0
  64. package/dist/esm/umijs/initialUmiState.d.ts +148 -0
  65. package/dist/esm/umijs/initialUmiState.js +107 -0
  66. package/dist/esm/umijs/initialUmiState.js.map +1 -0
  67. package/dist/form/index.cjs +3 -0
  68. package/dist/form/index.cjs.map +1 -0
  69. package/dist/form/index.d.ts +1 -0
  70. package/dist/form/types.d.ts +878 -0
  71. package/dist/index.cjs +49 -37
  72. package/dist/index.cjs.map +1 -1
  73. package/dist/index.d.ts +7 -2
  74. package/dist/types/data/index.d.ts +22 -1
  75. package/dist/types/index.d.ts +1 -1
  76. package/dist/umijs/index.cjs +13 -0
  77. package/dist/umijs/index.cjs.map +1 -0
  78. package/dist/umijs/index.d.ts +1 -0
  79. package/dist/umijs/initialUmiState.cjs +114 -0
  80. package/dist/umijs/initialUmiState.cjs.map +1 -0
  81. package/dist/umijs/initialUmiState.d.ts +148 -0
  82. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/core/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAAA;;;AAGG;AAWH;;AAEG;AACH,YAAe;IACb,UAAU;IACV,WAAW;IACX,WAAW;IACX,WAAW;IACX,SAAS;IACT,UAAU;IACV,UAAU;IACV,eAAe;IACf;CACD;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/core/index.ts"],"sourcesContent":[null],"names":["constants"],"mappings":";;;;;;;;;;AAAA;;;AAGG;AAYH;;AAEG;AACH,YAAe;IACb,UAAU;IACV,WAAW;IACX,WAAW;IACX,WAAW;IACX,SAAS;IACT,UAAU;IACV,UAAU;IACV,eAAe;IACf,UAAU;eACVA;CACD;;;;"}
@@ -0,0 +1,54 @@
1
+ type ICache = 'local' | 'session';
2
+ declare const storageUtils: {
3
+ /**
4
+ * 获取存储的项目并解析为相应的数据类型
5
+ * @param key 存储项的键
6
+ * @param cacheType
7
+ * @returns 存储项的值,解析后的数据
8
+ */
9
+ getItem: <T = any>(key: string, cacheType?: ICache) => T;
10
+ /**
11
+ * 从sessionStorage中获取数据
12
+ * @param key
13
+ */
14
+ getSItem: <T = any>(key: string) => T;
15
+ /**
16
+ * 存储项目,并自动识别数据类型
17
+ * @param key 存储项的键
18
+ * @param value 要存储的值
19
+ * @param cacheType
20
+ */
21
+ setItem: (key: string, value: any, cacheType?: ICache) => void;
22
+ /**
23
+ * 将数据存储到 sessionStorage
24
+ * @param key 存储项的键
25
+ * @param value 存储项的值
26
+ */
27
+ setSItem: (key: string, value: any) => void;
28
+ /**
29
+ * 删除存储项
30
+ * @param key 存储项的键
31
+ * @param cacheType
32
+ */
33
+ removeItem: (key: string, cacheType?: ICache) => void;
34
+ /**
35
+ * 从 sessionStorage 中移除数据
36
+ * @param key 存储项的键
37
+ */
38
+ removeSItem: (key: string) => void;
39
+ /**
40
+ * 检查存储项是否存在
41
+ * @param key 存储项的键
42
+ * @param cacheType
43
+ * @returns 如果存储项存在则返回 true,否则返回 false
44
+ */
45
+ existsItem: (key: string, cacheType?: ICache) => boolean;
46
+ /**
47
+ * 检查数据是否存在于 sessionStorage 中
48
+ * @param key 存储项的键
49
+ * @returns 如果存在则返回 true,否则返回 false
50
+ */
51
+ existsSItem: (key: string) => boolean;
52
+ };
53
+
54
+ export { storageUtils as default };
@@ -0,0 +1,131 @@
1
+ // 获取适当的存储对象(localStorage 或 uni)
2
+ const getStorage = (type = 'local') => {
3
+ if (typeof window !== 'undefined') {
4
+ if (type === 'local') {
5
+ return {
6
+ getItem: (key) => localStorage.getItem(key),
7
+ setItem: (key, value) => localStorage.setItem(key, value),
8
+ removeItem: (key) => localStorage.removeItem(key)
9
+ };
10
+ }
11
+ return {
12
+ getItem: (key) => sessionStorage.getItem(key),
13
+ setItem: (key, value) => sessionStorage.setItem(key, value),
14
+ removeItem: (key) => sessionStorage.removeItem(key)
15
+ };
16
+ }
17
+ else if (typeof uni !== 'undefined') {
18
+ return {
19
+ getItem: (key) => uni.getStorageSync(key),
20
+ setItem: (key, value) => uni.setStorageSync(key, value),
21
+ removeItem: (key) => uni.removeStorageSync(key)
22
+ };
23
+ }
24
+ throw new Error('No storage mechanism available');
25
+ };
26
+ const storageUtils = {
27
+ /**
28
+ * 获取存储的项目并解析为相应的数据类型
29
+ * @param key 存储项的键
30
+ * @param cacheType
31
+ * @returns 存储项的值,解析后的数据
32
+ */
33
+ getItem: (key, cacheType) => {
34
+ const storage = getStorage(cacheType);
35
+ const str = storage.getItem(key) || '';
36
+ if (str) {
37
+ try {
38
+ const parsed = JSON.parse(str);
39
+ switch (parsed.type) {
40
+ case 'object':
41
+ return parsed.data;
42
+ case 'array':
43
+ return parsed.data;
44
+ case 'string':
45
+ return parsed.data;
46
+ default:
47
+ return parsed.data;
48
+ }
49
+ }
50
+ catch (e) {
51
+ return str;
52
+ }
53
+ }
54
+ return null;
55
+ },
56
+ /**
57
+ * 从sessionStorage中获取数据
58
+ * @param key
59
+ */
60
+ getSItem: (key) => {
61
+ return storageUtils.getItem(key, 'session');
62
+ },
63
+ /**
64
+ * 存储项目,并自动识别数据类型
65
+ * @param key 存储项的键
66
+ * @param value 要存储的值
67
+ * @param cacheType
68
+ */
69
+ setItem: (key, value, cacheType) => {
70
+ let type;
71
+ if (Array.isArray(value)) {
72
+ type = 'array';
73
+ }
74
+ else if (typeof value === 'object') {
75
+ type = 'object';
76
+ }
77
+ else {
78
+ type = 'string';
79
+ }
80
+ const serializedValue = JSON.stringify({ type, data: value });
81
+ const storage = getStorage(cacheType);
82
+ storage.setItem(key, serializedValue);
83
+ },
84
+ /**
85
+ * 将数据存储到 sessionStorage
86
+ * @param key 存储项的键
87
+ * @param value 存储项的值
88
+ */
89
+ setSItem: (key, value) => {
90
+ storageUtils.setItem(key, value, 'session');
91
+ },
92
+ /**
93
+ * 删除存储项
94
+ * @param key 存储项的键
95
+ * @param cacheType
96
+ */
97
+ removeItem: (key, cacheType) => {
98
+ const storage = getStorage(cacheType);
99
+ storage.removeItem(key);
100
+ },
101
+ /**
102
+ * 从 sessionStorage 中移除数据
103
+ * @param key 存储项的键
104
+ */
105
+ removeSItem: (key) => {
106
+ storageUtils.removeItem(key, 'session');
107
+ },
108
+ /**
109
+ * 检查存储项是否存在
110
+ * @param key 存储项的键
111
+ * @param cacheType
112
+ * @returns 如果存储项存在则返回 true,否则返回 false
113
+ */
114
+ existsItem: (key, cacheType) => {
115
+ const storage = getStorage(cacheType);
116
+ const value = storage.getItem(key);
117
+ return value !== null;
118
+ },
119
+ /**
120
+ * 检查数据是否存在于 sessionStorage 中
121
+ * @param key 存储项的键
122
+ * @returns 如果存在则返回 true,否则返回 false
123
+ */
124
+ existsSItem: (key) => {
125
+ const item = storageUtils.getItem(key, 'session');
126
+ return item !== null;
127
+ }
128
+ };
129
+
130
+ export { storageUtils as default };
131
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/core/storageUtils/index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAIA;AACA,MAAM,UAAU,GAAG,CAAC,IAAA,GAAe,OAAO,KAAI;AAC5C,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,QAAA,IAAI,IAAI,KAAK,OAAO,EAAE;YACpB,OAAO;gBACL,OAAO,EAAE,CAAC,GAAW,KAAK,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC;AACnD,gBAAA,OAAO,EAAE,CAAC,GAAW,EAAE,KAAa,KAAK,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC;gBACzE,UAAU,EAAE,CAAC,GAAW,KAAK,YAAY,CAAC,UAAU,CAAC,GAAG;aACzD;QACH;QACA,OAAO;YACL,OAAO,EAAE,CAAC,GAAW,KAAK,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC;AACrD,YAAA,OAAO,EAAE,CAAC,GAAW,EAAE,KAAa,KAAK,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC;YAC3E,UAAU,EAAE,CAAC,GAAW,KAAK,cAAc,CAAC,UAAU,CAAC,GAAG;SAC3D;IACH;AAAO,SAAA,IAAI,OAAO,GAAG,KAAK,WAAW,EAAE;QACrC,OAAO;YACL,OAAO,EAAE,CAAC,GAAW,KAAK,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC;AACjD,YAAA,OAAO,EAAE,CAAC,GAAW,EAAE,KAAa,KAAK,GAAG,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC;YACvE,UAAU,EAAE,CAAC,GAAW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,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC7D,QAAA,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC;AACrC,QAAA,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC;IACvC,CAAC;AAED;;;;AAIG;AACH,IAAA,QAAQ,EAAE,CAAC,GAAW,EAAE,KAAU,KAAU;QAC1C,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC;IAC7C,CAAC;AAED;;;;AAIG;AACH,IAAA,UAAU,EAAE,CAAC,GAAW,EAAE,SAAkB,KAAU;AACpD,QAAA,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC;AACrC,QAAA,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;IACzB,CAAC;AAED;;;AAGG;AACH,IAAA,WAAW,EAAE,CAAC,GAAW,KAAU;AACjC,QAAA,YAAY,CAAC,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC;IACzC,CAAC;AAED;;;;;AAKG;AACH,IAAA,UAAU,EAAE,CAAC,GAAW,EAAE,SAAkB,KAAa;AACvD,QAAA,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC;QACrC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;QAClC,OAAO,KAAK,KAAK,IAAI;IACvB,CAAC;AAED;;;;AAIG;AACH,IAAA,WAAW,EAAE,CAAC,GAAW,KAAa;QACpC,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC;QACjD,OAAO,IAAI,KAAK,IAAI;IACtB;;;;;"}
@@ -0,0 +1 @@
1
+ export { FieldData, FieldError, FilterFunc, FormFieldType, FormInstance, FormItemLabelProps, FormItemProps, GetFieldsValueConfig, IDependent, IEnumObj, IEnumObjAll, IFormColumns, IJsonRuleItem, IJsonRuleListItem, ISizeType, IUploadProps, IValueType, IZlCascaderProps, IZlFormColumns, IZlFormItemProps, InternalFieldData, InternalNamePath, Meta, NamePath, ProFieldValueType, ProFieldValueTypeWithFieldProps, ProFormInstance, ProFormInstanceType, ProSchemaValueEnumMap, ProSchemaValueEnumObj, ProSchemaValueEnumType, RcFormInstance, RequiredMark, RuleType, TooltipProps, ValidateFields, ValidateOptions, ValidateStatus, WrapperTooltipProps } from './types.js';
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}