@pisell/common 0.0.1

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 (183) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +40 -0
  3. package/es/business-components/colorInput/index.d.ts +21 -0
  4. package/es/business-components/colorInput/index.js +43 -0
  5. package/es/business-components/colorInput/index.less +10 -0
  6. package/es/business-components/index.d.ts +11 -0
  7. package/es/business-components/index.js +7 -0
  8. package/es/business-components/rechargeOption/index.d.ts +36 -0
  9. package/es/business-components/rechargeOption/index.js +136 -0
  10. package/es/business-components/rechargeOption/index.less +0 -0
  11. package/es/business-components/selectTag/index.d.ts +25 -0
  12. package/es/business-components/selectTag/index.js +180 -0
  13. package/es/business-components/selectTag/index.less +22 -0
  14. package/es/business-components/sortModal/index.d.ts +30 -0
  15. package/es/business-components/sortModal/index.js +85 -0
  16. package/es/business-components/sortModal/index.less +29 -0
  17. package/es/business-components/statistics/index.d.ts +12 -0
  18. package/es/business-components/statistics/index.js +38 -0
  19. package/es/business-components/statistics/index.less +64 -0
  20. package/es/business-components/tagModal/index.d.ts +17 -0
  21. package/es/business-components/tagModal/index.js +59 -0
  22. package/es/business-hooks/index.d.ts +2 -0
  23. package/es/business-hooks/index.js +2 -0
  24. package/es/business-hooks/useModal/index.d.ts +31 -0
  25. package/es/business-hooks/useModal/index.js +91 -0
  26. package/es/business-hooks/useModal/index.less +0 -0
  27. package/es/business-hooks/useTagModal/index.d.ts +17 -0
  28. package/es/business-hooks/useTagModal/index.js +47 -0
  29. package/es/components/ColorPicker/index.d.ts +22 -0
  30. package/es/components/ColorPicker/index.js +51 -0
  31. package/es/components/ColorPicker/index.less +17 -0
  32. package/es/components/DragSort/index.d.ts +2 -0
  33. package/es/components/DragSort/index.js +68 -0
  34. package/es/components/Iconfont/index.d.ts +6 -0
  35. package/es/components/Iconfont/index.js +28 -0
  36. package/es/components/Iconfont/index.less +0 -0
  37. package/es/components/card/index.d.ts +5 -0
  38. package/es/components/card/index.js +16 -0
  39. package/es/components/card/index.less +9 -0
  40. package/es/components/index.d.ts +4 -0
  41. package/es/components/index.js +4 -0
  42. package/es/config/index.d.ts +16 -0
  43. package/es/config/index.js +18 -0
  44. package/es/config/utils.d.ts +0 -0
  45. package/es/config/utils.js +0 -0
  46. package/es/hooks/index.d.ts +8 -0
  47. package/es/hooks/index.js +8 -0
  48. package/es/hooks/useCountDown/index.d.ts +10 -0
  49. package/es/hooks/useCountDown/index.js +48 -0
  50. package/es/hooks/useDocumentScroll/index.d.ts +8 -0
  51. package/es/hooks/useDocumentScroll/index.js +41 -0
  52. package/es/hooks/useDocumentScroll/index.less +0 -0
  53. package/es/hooks/useMousemove/index.d.ts +8 -0
  54. package/es/hooks/useMousemove/index.js +61 -0
  55. package/es/hooks/useResponsive/index.d.ts +2 -0
  56. package/es/hooks/useResponsive/index.js +29 -0
  57. package/es/hooks/useResponsive/index.less +0 -0
  58. package/es/hooks/useSize/index.d.ts +2 -0
  59. package/es/hooks/useSize/index.js +27 -0
  60. package/es/hooks/useSize/index.less +0 -0
  61. package/es/hooks/useStateMulti/index.d.ts +2 -0
  62. package/es/hooks/useStateMulti/index.js +29 -0
  63. package/es/hooks/useStateWithCb/index.d.ts +2 -0
  64. package/es/hooks/useStateWithCb/index.js +42 -0
  65. package/es/hooks/useTable/index.d.ts +12 -0
  66. package/es/hooks/useTable/index.js +74 -0
  67. package/es/hooks/useTable/index.less +0 -0
  68. package/es/hooks/useTableModal/index.d.ts +12 -0
  69. package/es/hooks/useTableModal/index.js +25 -0
  70. package/es/hooks/useTableModal/index.less +0 -0
  71. package/es/hooks/useUrlState/index.d.ts +2 -0
  72. package/es/hooks/useUrlState/index.js +56 -0
  73. package/es/hooks/useWebSocket/index.d.ts +13 -0
  74. package/es/hooks/useWebSocket/index.js +121 -0
  75. package/es/index.d.ts +4 -0
  76. package/es/index.js +4 -0
  77. package/es/locales/en-US.d.ts +11 -0
  78. package/es/locales/en-US.js +10 -0
  79. package/es/locales/index.d.ts +1 -0
  80. package/es/locales/index.js +23 -0
  81. package/es/locales/zh-CN.d.ts +11 -0
  82. package/es/locales/zh-CN.js +10 -0
  83. package/es/locales/zh-TW.d.ts +11 -0
  84. package/es/locales/zh-TW.js +10 -0
  85. package/es/utils/index.d.ts +3 -0
  86. package/es/utils/index.js +3 -0
  87. package/es/utils/otherUtils.d.ts +8 -0
  88. package/es/utils/otherUtils.js +12 -0
  89. package/es/utils/storage.d.ts +30 -0
  90. package/es/utils/storage.js +70 -0
  91. package/es/utils/typeUtils.d.ts +42 -0
  92. package/es/utils/typeUtils.js +86 -0
  93. package/lib/business-components/colorInput/index.d.ts +21 -0
  94. package/lib/business-components/colorInput/index.js +70 -0
  95. package/lib/business-components/colorInput/index.less +10 -0
  96. package/lib/business-components/index.d.ts +11 -0
  97. package/lib/business-components/index.js +54 -0
  98. package/lib/business-components/rechargeOption/index.d.ts +36 -0
  99. package/lib/business-components/rechargeOption/index.js +133 -0
  100. package/lib/business-components/rechargeOption/index.less +0 -0
  101. package/lib/business-components/selectTag/index.d.ts +25 -0
  102. package/lib/business-components/selectTag/index.js +181 -0
  103. package/lib/business-components/selectTag/index.less +22 -0
  104. package/lib/business-components/sortModal/index.d.ts +30 -0
  105. package/lib/business-components/sortModal/index.js +100 -0
  106. package/lib/business-components/sortModal/index.less +29 -0
  107. package/lib/business-components/statistics/index.d.ts +12 -0
  108. package/lib/business-components/statistics/index.js +63 -0
  109. package/lib/business-components/statistics/index.less +64 -0
  110. package/lib/business-components/tagModal/index.d.ts +17 -0
  111. package/lib/business-components/tagModal/index.js +66 -0
  112. package/lib/business-hooks/index.d.ts +2 -0
  113. package/lib/business-hooks/index.js +42 -0
  114. package/lib/business-hooks/useModal/index.d.ts +31 -0
  115. package/lib/business-hooks/useModal/index.js +68 -0
  116. package/lib/business-hooks/useModal/index.less +0 -0
  117. package/lib/business-hooks/useTagModal/index.d.ts +17 -0
  118. package/lib/business-hooks/useTagModal/index.js +61 -0
  119. package/lib/components/ColorPicker/index.d.ts +22 -0
  120. package/lib/components/ColorPicker/index.js +80 -0
  121. package/lib/components/ColorPicker/index.less +17 -0
  122. package/lib/components/DragSort/index.d.ts +2 -0
  123. package/lib/components/DragSort/index.js +101 -0
  124. package/lib/components/Iconfont/index.d.ts +6 -0
  125. package/lib/components/Iconfont/index.js +47 -0
  126. package/lib/components/Iconfont/index.less +0 -0
  127. package/lib/components/card/index.d.ts +5 -0
  128. package/lib/components/card/index.js +42 -0
  129. package/lib/components/card/index.less +9 -0
  130. package/lib/components/index.d.ts +4 -0
  131. package/lib/components/index.js +48 -0
  132. package/lib/config/index.d.ts +16 -0
  133. package/lib/config/index.js +39 -0
  134. package/lib/config/utils.d.ts +0 -0
  135. package/lib/config/utils.js +0 -0
  136. package/lib/hooks/index.d.ts +8 -0
  137. package/lib/hooks/index.js +57 -0
  138. package/lib/hooks/useCountDown/index.d.ts +10 -0
  139. package/lib/hooks/useCountDown/index.js +57 -0
  140. package/lib/hooks/useDocumentScroll/index.d.ts +8 -0
  141. package/lib/hooks/useDocumentScroll/index.js +54 -0
  142. package/lib/hooks/useDocumentScroll/index.less +0 -0
  143. package/lib/hooks/useMousemove/index.d.ts +8 -0
  144. package/lib/hooks/useMousemove/index.js +70 -0
  145. package/lib/hooks/useResponsive/index.d.ts +2 -0
  146. package/lib/hooks/useResponsive/index.js +47 -0
  147. package/lib/hooks/useResponsive/index.less +0 -0
  148. package/lib/hooks/useSize/index.d.ts +2 -0
  149. package/lib/hooks/useSize/index.js +45 -0
  150. package/lib/hooks/useSize/index.less +0 -0
  151. package/lib/hooks/useStateMulti/index.d.ts +2 -0
  152. package/lib/hooks/useStateMulti/index.js +43 -0
  153. package/lib/hooks/useStateWithCb/index.d.ts +2 -0
  154. package/lib/hooks/useStateWithCb/index.js +53 -0
  155. package/lib/hooks/useTable/index.d.ts +12 -0
  156. package/lib/hooks/useTable/index.js +75 -0
  157. package/lib/hooks/useTable/index.less +0 -0
  158. package/lib/hooks/useTableModal/index.d.ts +12 -0
  159. package/lib/hooks/useTableModal/index.js +43 -0
  160. package/lib/hooks/useTableModal/index.less +0 -0
  161. package/lib/hooks/useUrlState/index.d.ts +2 -0
  162. package/lib/hooks/useUrlState/index.js +59 -0
  163. package/lib/hooks/useWebSocket/index.d.ts +13 -0
  164. package/lib/hooks/useWebSocket/index.js +91 -0
  165. package/lib/index.d.ts +4 -0
  166. package/lib/index.js +22 -0
  167. package/lib/locales/en-US.d.ts +11 -0
  168. package/lib/locales/en-US.js +36 -0
  169. package/lib/locales/index.d.ts +1 -0
  170. package/lib/locales/index.js +59 -0
  171. package/lib/locales/zh-CN.d.ts +11 -0
  172. package/lib/locales/zh-CN.js +36 -0
  173. package/lib/locales/zh-TW.d.ts +11 -0
  174. package/lib/locales/zh-TW.js +36 -0
  175. package/lib/utils/index.d.ts +3 -0
  176. package/lib/utils/index.js +21 -0
  177. package/lib/utils/otherUtils.d.ts +8 -0
  178. package/lib/utils/otherUtils.js +31 -0
  179. package/lib/utils/storage.d.ts +30 -0
  180. package/lib/utils/storage.js +63 -0
  181. package/lib/utils/typeUtils.d.ts +42 -0
  182. package/lib/utils/typeUtils.js +75 -0
  183. package/package.json +101 -0
@@ -0,0 +1,36 @@
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/locales/en-US.ts
20
+ var en_US_exports = {};
21
+ __export(en_US_exports, {
22
+ default: () => en_US_default
23
+ });
24
+ module.exports = __toCommonJS(en_US_exports);
25
+ var en_US_default = {
26
+ "pisell-design.multi-select.apply": "Apply",
27
+ "pisell-design.multi-select.apply.no-data": "Sorry, no products matched your selection",
28
+ "pisell-design.paginator.previous": "Previous",
29
+ "pisell-design.paginator.next": "Next",
30
+ "pisell-design.search.search": "Search",
31
+ "pisell-design.recharge.option.button.edit": "Edit",
32
+ "pisell-design.recharge.option.button.add": "Add recharge item",
33
+ "pisell-design.select.tag.modal.title": "Select tag"
34
+ };
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {});
@@ -0,0 +1 @@
1
+ export declare const getText: (id: string) => any;
@@ -0,0 +1,59 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/locales/index.ts
30
+ var locales_exports = {};
31
+ __export(locales_exports, {
32
+ getText: () => getText
33
+ });
34
+ module.exports = __toCommonJS(locales_exports);
35
+ var import_zh_CN = __toESM(require("../locales/zh-CN"));
36
+ var import_zh_TW = __toESM(require("../locales/zh-TW"));
37
+ var import_en_US = __toESM(require("../locales/en-US"));
38
+ var import_storage = require("../utils/storage");
39
+ var langMap = {
40
+ "zh-CN": import_zh_CN.default,
41
+ "en-US": import_en_US.default,
42
+ "zh-TW": import_zh_TW.default
43
+ };
44
+ var getText = (id) => {
45
+ if (!id) {
46
+ return "";
47
+ }
48
+ let locale = "en-US";
49
+ let oldLocale = (0, import_storage.getStorage)("umi_locale");
50
+ if (oldLocale) {
51
+ locale = oldLocale;
52
+ }
53
+ console.log("locale", (0, import_storage.getStorage)("umi_locale"));
54
+ return langMap[locale] ? langMap[locale][id] || id : id;
55
+ };
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ getText
59
+ });
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ 'pisell-design.multi-select.apply': string;
3
+ 'pisell-design.multi-select.apply.no-data': string;
4
+ 'pisell-design.paginator.previous': string;
5
+ 'pisell-design.paginator.next': string;
6
+ 'pisell-design.search.search': string;
7
+ 'pisell-design.recharge.option.button.edit': string;
8
+ 'pisell-design.recharge.option.button.add': string;
9
+ 'pisell-design.select.tag.modal.title': string;
10
+ };
11
+ export default _default;
@@ -0,0 +1,36 @@
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/locales/zh-CN.ts
20
+ var zh_CN_exports = {};
21
+ __export(zh_CN_exports, {
22
+ default: () => zh_CN_default
23
+ });
24
+ module.exports = __toCommonJS(zh_CN_exports);
25
+ var zh_CN_default = {
26
+ "pisell-design.multi-select.apply": "应用",
27
+ "pisell-design.multi-select.apply.no-data": "对不起,没有符合您选择的产品",
28
+ "pisell-design.paginator.previous": "上一页",
29
+ "pisell-design.paginator.next": "下一页",
30
+ "pisell-design.search.search": "搜索",
31
+ "pisell-design.recharge.option.button.edit": "编辑",
32
+ "pisell-design.recharge.option.button.add": "添加充值项",
33
+ "pisell-design.select.tag.modal.title": "选择标签"
34
+ };
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {});
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ 'pisell-design.multi-select.apply': string;
3
+ 'pisell-design.multi-select.apply.no-data': string;
4
+ 'pisell-design.paginator.previous': string;
5
+ 'pisell-design.paginator.next': string;
6
+ 'pisell-design.search.search': string;
7
+ 'pisell-design.recharge.option.button.edit': string;
8
+ 'pisell-design.recharge.option.button.add': string;
9
+ 'pisell-design.select.tag.modal.title': string;
10
+ };
11
+ export default _default;
@@ -0,0 +1,36 @@
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/locales/zh-TW.ts
20
+ var zh_TW_exports = {};
21
+ __export(zh_TW_exports, {
22
+ default: () => zh_TW_default
23
+ });
24
+ module.exports = __toCommonJS(zh_TW_exports);
25
+ var zh_TW_default = {
26
+ "pisell-design.multi-select.apply": "應用",
27
+ "pisell-design.multi-select.apply.no-data": "對不起,沒有符合您選擇的產品",
28
+ "pisell-design.paginator.previous": "上一頁",
29
+ "pisell-design.paginator.next": "下一頁",
30
+ "pisell-design.search.search": "搜索",
31
+ "pisell-design.recharge.option.button.edit": "編輯",
32
+ "pisell-design.recharge.option.button.add": "添加充值項",
33
+ "pisell-design.select.tag.modal.title": "選擇標籤"
34
+ };
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {});
@@ -0,0 +1,3 @@
1
+ export * from './otherUtils';
2
+ export * from './storage';
3
+ export * from './typeUtils';
@@ -0,0 +1,21 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/utils/index.ts
17
+ var utils_exports = {};
18
+ module.exports = __toCommonJS(utils_exports);
19
+ __reExport(utils_exports, require("./otherUtils"), module.exports);
20
+ __reExport(utils_exports, require("./storage"), module.exports);
21
+ __reExport(utils_exports, require("./typeUtils"), module.exports);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @Description: 生成唯一id
3
+ * @Author: wzw
4
+ * @Date: 2020-12-01 14:20:29
5
+ * @param {*}
6
+ * @return {*}
7
+ */
8
+ export declare const getUniqueId: (prefix?: string, maxLength?: number) => string;
@@ -0,0 +1,31 @@
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/utils/otherUtils.ts
20
+ var otherUtils_exports = {};
21
+ __export(otherUtils_exports, {
22
+ getUniqueId: () => getUniqueId
23
+ });
24
+ module.exports = __toCommonJS(otherUtils_exports);
25
+ var getUniqueId = (prefix = "", maxLength = 11) => {
26
+ return prefix + (Math.random() + "").replace(/\D/g, "").substring(0, maxLength);
27
+ };
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ getUniqueId
31
+ });
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @title: 设置storage
3
+ * @description:
4
+ * @param {*} T
5
+ * @param {*} param2
6
+ * @return {*}
7
+ * @Author: Wzw
8
+ * @Date: 2022-02-21 10:30
9
+ */
10
+ export declare const setStorage: (key: string, value: any, type?: 'local' | 'session', prefix?: string) => any;
11
+ /**
12
+ * @title: 获取storage
13
+ * @description:
14
+ * @param {string} key
15
+ * @param {string} prefix
16
+ * @return {*}
17
+ * @Author: Wzw
18
+ * @Date: 2022-02-21 10:30
19
+ */
20
+ export declare const getStorage: (key: string, prefix?: string, type?: 'local' | 'session') => any;
21
+ /**
22
+ * @title: 删除storage
23
+ * @description:
24
+ * @param {string} key
25
+ * @param {string} prefix
26
+ * @return {*}
27
+ * @Author: Wzw
28
+ * @Date: 2022-02-21 10:30
29
+ */
30
+ export declare const removeStorage: (key: string, prefix?: string, type?: 'local' | 'session') => void;
@@ -0,0 +1,63 @@
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/utils/storage.ts
20
+ var storage_exports = {};
21
+ __export(storage_exports, {
22
+ getStorage: () => getStorage,
23
+ removeStorage: () => removeStorage,
24
+ setStorage: () => setStorage
25
+ });
26
+ module.exports = __toCommonJS(storage_exports);
27
+ var default_prefix = "shop_";
28
+ var setStorage = (key, value, type, prefix) => {
29
+ const _value = value;
30
+ let _key = (prefix || default_prefix) + key;
31
+ if (type === void 0 || type === "local") {
32
+ localStorage.setItem(_key, _value);
33
+ } else {
34
+ sessionStorage.setItem(_key, _value);
35
+ }
36
+ };
37
+ var getStorage = (key, prefix, type) => {
38
+ let _key = (prefix || default_prefix) + key;
39
+ if (key === "umi_locale") {
40
+ _key = key;
41
+ }
42
+ if (type === void 0 || type === "local") {
43
+ let _localValue = localStorage.getItem(_key) || "";
44
+ return _localValue;
45
+ } else {
46
+ let _sessionValue = sessionStorage.getItem(_key) || "";
47
+ return _sessionValue;
48
+ }
49
+ };
50
+ var removeStorage = (key, prefix, type) => {
51
+ let _key = (prefix || default_prefix) + key;
52
+ if (type === void 0 || type === "local") {
53
+ localStorage.removeItem(_key);
54
+ } else {
55
+ sessionStorage.removeItem(_key);
56
+ }
57
+ };
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {
60
+ getStorage,
61
+ removeStorage,
62
+ setStorage
63
+ });
@@ -0,0 +1,42 @@
1
+ /**
2
+ * 判断是否是函数
3
+ * @param obj
4
+ */
5
+ export declare const isFunction: (obj: any) => obj is Function;
6
+ /**
7
+ * 判断是否是数组
8
+ * @param obj
9
+ */
10
+ export declare const isArr: (obj: any) => obj is any[];
11
+ /**
12
+ * 判断是否是字符串
13
+ * @param obj
14
+ */
15
+ export declare const isString: (obj: any) => obj is string;
16
+ /**
17
+ * 判断是否是数字
18
+ * @param obj
19
+ */
20
+ export declare const isNumber: (obj: any) => obj is number;
21
+ /**
22
+ * 判断是否是undefined
23
+ * @param obj
24
+ */
25
+ export declare const isUndefined: (obj: any) => obj is undefined;
26
+ /**
27
+ * 判断是否是boolean
28
+ * @param obj
29
+ */
30
+ export declare const isBoolean: (obj: any) => obj is boolean;
31
+ /**
32
+ * 判断是否是json字符串
33
+ * @param v
34
+ */
35
+ export declare const isJson: (v: any) => boolean;
36
+ /**
37
+ * @Title: 判断是否为对象
38
+ * @Describe:
39
+ * @Author: Wzw
40
+ * @param {any} obj
41
+ */
42
+ export declare const isPlainObject: (obj: any) => boolean;
@@ -0,0 +1,75 @@
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/utils/typeUtils.ts
20
+ var typeUtils_exports = {};
21
+ __export(typeUtils_exports, {
22
+ isArr: () => isArr,
23
+ isBoolean: () => isBoolean,
24
+ isFunction: () => isFunction,
25
+ isJson: () => isJson,
26
+ isNumber: () => isNumber,
27
+ isPlainObject: () => isPlainObject,
28
+ isString: () => isString,
29
+ isUndefined: () => isUndefined
30
+ });
31
+ module.exports = __toCommonJS(typeUtils_exports);
32
+ var isFunction = (obj) => typeof obj === "function";
33
+ var isArr = (obj) => Array.isArray(obj);
34
+ var isString = (obj) => typeof obj === "string";
35
+ var isNumber = (obj) => typeof obj === "number";
36
+ var isUndefined = (obj) => typeof obj === "undefined";
37
+ var isBoolean = (obj) => typeof obj === "boolean";
38
+ var isJson = (v) => {
39
+ if (typeof v === "string") {
40
+ try {
41
+ return JSON.parse(v);
42
+ } catch (e) {
43
+ return false;
44
+ }
45
+ } else {
46
+ return false;
47
+ }
48
+ };
49
+ var getProto = Object.getPrototypeOf;
50
+ var hasOwn = {}.hasOwnProperty;
51
+ var fnToString = hasOwn.toString;
52
+ var ObjectFunctionString = fnToString.call(Object);
53
+ var isPlainObject = (obj) => {
54
+ var proto, Ctor;
55
+ if (!obj || toString.call(obj) !== "[object Object]") {
56
+ return false;
57
+ }
58
+ proto = getProto(obj);
59
+ if (!proto) {
60
+ return true;
61
+ }
62
+ Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
63
+ return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
64
+ };
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ isArr,
68
+ isBoolean,
69
+ isFunction,
70
+ isJson,
71
+ isNumber,
72
+ isPlainObject,
73
+ isString,
74
+ isUndefined
75
+ });
package/package.json ADDED
@@ -0,0 +1,101 @@
1
+ {
2
+ "name": "@pisell/common",
3
+ "version": "0.0.1",
4
+ "description": "A collection of reusable UI components for web development",
5
+ "license": "MIT",
6
+ "sideEffects": [
7
+ "*.less"
8
+ ],
9
+ "main": "./lib/index.js",
10
+ "module": "./es/index.js",
11
+ "types": "./lib/index.d.ts",
12
+ "typings": "./lib/index.d.ts",
13
+ "files": [
14
+ "es",
15
+ "lib",
16
+ "package.json",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "father build",
21
+ "build:watch": "father dev",
22
+ "dev": "dumi dev",
23
+ "docs:build": "dumi build",
24
+ "doctor": "father doctor",
25
+ "lint": "npm run lint:es && npm run lint:css",
26
+ "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
27
+ "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
28
+ "prepare": "husky install && dumi setup",
29
+ "prepublishOnly": "father doctor && npm run build",
30
+ "release": "npm run build && np --no-cleanup --any-branch --yolo --tag",
31
+ "release:beta": "npm run build && np --no-cleanup --any-branch --yolo --tag=beta",
32
+ "release:next": "npm run build && np --no-cleanup --any-branch --yolo --tag=next",
33
+ "start": "npm run dev"
34
+ },
35
+ "commitlint": {
36
+ "extends": [
37
+ "@commitlint/config-conventional"
38
+ ]
39
+ },
40
+ "lint-staged": {
41
+ "*.{md,json}": [
42
+ "prettier --write --no-error-on-unmatched-pattern"
43
+ ],
44
+ "*.{css,less}": [
45
+ "stylelint --fix",
46
+ "prettier --write"
47
+ ],
48
+ "*.{js,jsx}": [
49
+ "eslint --fix",
50
+ "prettier --write"
51
+ ],
52
+ "*.{ts,tsx}": [
53
+ "eslint --fix",
54
+ "prettier --parser=typescript --write"
55
+ ]
56
+ },
57
+ "dependencies": {
58
+ "array-move": "^3.0.1",
59
+ "react-beautiful-dnd": "^13.1.0",
60
+ "react-color": "^2.19.3"
61
+ },
62
+ "devDependencies": {
63
+ "@ant-design/icons": "^4.8.0",
64
+ "@commitlint/cli": "^17.1.2",
65
+ "@commitlint/config-conventional": "^17.1.0",
66
+ "@types/react": "^18.0.0",
67
+ "@types/react-dom": "^18.0.0",
68
+ "@umijs/fabric": "^2.0.0",
69
+ "@umijs/lint": "^4.0.0",
70
+ "ahooks": "^2.10.0",
71
+ "antd": "4.23.2",
72
+ "classnames": "^2.3.1",
73
+ "dumi": "^2.0.2",
74
+ "eslint": "^8.23.0",
75
+ "father": "^4.1.0",
76
+ "husky": "^8.0.1",
77
+ "lint-staged": "^13.0.3",
78
+ "np": "^7.7.0",
79
+ "prettier": "^2.7.1",
80
+ "prettier-plugin-organize-imports": "^3.0.0",
81
+ "prettier-plugin-packagejson": "^2.2.18",
82
+ "react": "^17.0.0",
83
+ "react-dom": "^17.0.0",
84
+ "stylelint": "^14.9.1",
85
+ "typescript": "^4.9.5",
86
+ "umi": "^3.3.9"
87
+ },
88
+ "peerDependencies": {
89
+ "@ant-design/icons": "^4.8.0",
90
+ "ahooks": "^2.10.0",
91
+ "antd": "4.23.2",
92
+ "classnames": "^2.3.1",
93
+ "react": ">=17.0",
94
+ "react-dom": ">=17.0",
95
+ "umi": "^3.3.9"
96
+ },
97
+ "publishConfig": {
98
+ "access": "public"
99
+ },
100
+ "authors": []
101
+ }