@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,30 @@
1
+ import React from 'react';
2
+ import type { useModalProps } from '../../business-hooks/useModal';
3
+ import './index.less';
4
+ export interface SortModalProps<T> {
5
+ /** 排序数据 */
6
+ items: T[];
7
+ /** 弹窗标题 */
8
+ title: useModalProps['title'];
9
+ /** 自定义渲染内容 */
10
+ renderContent?: (items: T[], content: React.ReactNode) => React.ReactNode;
11
+ /** 自定义渲染排序项 */
12
+ renderSortItem?: (item: T, index: number) => React.ReactNode;
13
+ /** 是否展示序号 */
14
+ isShowIndex?: boolean;
15
+ /** 字段展示配置 */
16
+ field: {
17
+ id: keyof T;
18
+ name: keyof T;
19
+ key: keyof T;
20
+ };
21
+ /** 确认事件 返回调整后的顺序 */
22
+ onOk?: (list: T[]) => void;
23
+ /** 弹窗ref 可外部唤起弹窗 */
24
+ sortModalRef?: React.Ref<{
25
+ showModal: () => void;
26
+ hideModal: () => void;
27
+ }>;
28
+ }
29
+ declare const SortModal: <T extends Record<string, any>>(props: SortModalProps<T>) => JSX.Element;
30
+ export default SortModal;
@@ -0,0 +1,100 @@
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/business-components/sortModal/index.tsx
30
+ var sortModal_exports = {};
31
+ __export(sortModal_exports, {
32
+ default: () => sortModal_default
33
+ });
34
+ module.exports = __toCommonJS(sortModal_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_utils = require("../../utils");
37
+ var import_useModal = __toESM(require("../../business-hooks/useModal"));
38
+ var import_components = require("../../components");
39
+ var import_index = require("./index.less");
40
+ var prefix = "pisell-";
41
+ var SortModal = (props) => {
42
+ const {
43
+ title,
44
+ items,
45
+ renderSortItem,
46
+ field,
47
+ isShowIndex,
48
+ onOk,
49
+ sortModalRef,
50
+ renderContent
51
+ } = props;
52
+ const [sortItems, setSortItems] = (0, import_react.useState)(items);
53
+ (0, import_react.useEffect)(() => {
54
+ setSortItems(items);
55
+ }, [items]);
56
+ const RenderSortItem = (0, import_react.useCallback)(
57
+ (item, index) => {
58
+ return /* @__PURE__ */ import_react.default.createElement("div", { key: item[field.key], className: `${prefix}sort-item` }, /* @__PURE__ */ import_react.default.createElement(import_components.IconFont, { type: "icon-drag", className: `${prefix}item` }), /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefix}sort-content` }, isShowIndex && index + 1, /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefix}tag-content` }, item[field.name])));
59
+ },
60
+ [props]
61
+ );
62
+ const ModalContent = (0, import_react.useMemo)(() => {
63
+ const content2 = /* @__PURE__ */ import_react.default.createElement(
64
+ import_components.DragSort,
65
+ {
66
+ list: sortItems,
67
+ droppableId: "addressSort",
68
+ draggableIdKey: field.id,
69
+ className: `${prefix}sort-list`,
70
+ onChange: (_list) => {
71
+ setSortItems(_list);
72
+ }
73
+ },
74
+ (0, import_utils.isFunction)(renderSortItem) ? renderSortItem : RenderSortItem
75
+ );
76
+ if ((0, import_utils.isFunction)(renderContent)) {
77
+ return renderContent(sortItems, content2);
78
+ }
79
+ if (renderContent) {
80
+ return renderContent;
81
+ }
82
+ return content2;
83
+ }, [sortItems, renderSortItem, RenderSortItem, renderContent]);
84
+ const handleOk = (0, import_react.useCallback)(() => {
85
+ (0, import_utils.isFunction)(onOk) && onOk(sortItems);
86
+ }, [onOk, sortItems]);
87
+ const { content, hideModal, visible, showModal } = (0, import_useModal.default)({
88
+ children: ModalContent,
89
+ title,
90
+ onOk: handleOk
91
+ });
92
+ (0, import_react.useImperativeHandle)(sortModalRef, () => ({
93
+ showModal,
94
+ hideModal
95
+ }));
96
+ return content;
97
+ };
98
+ var sortModal_default = SortModal;
99
+ // Annotate the CommonJS export names for ESM import in node:
100
+ 0 && (module.exports = {});
@@ -0,0 +1,29 @@
1
+ .pisell-sort-list {
2
+ .pisell-sort-item {
3
+ display: flex;
4
+ align-items: center;
5
+ width: 100%;
6
+ min-width: 40px;
7
+ margin-bottom: 10px;
8
+ font-size: 16px;
9
+ text-align: center;
10
+ background: none;
11
+ border: none;
12
+ .pisell-sort-content {
13
+ display: flex;
14
+ width: 100%;
15
+ }
16
+
17
+ .pisell-icon {
18
+ margin-right: 6px;
19
+ font-size: 20px;
20
+ }
21
+
22
+ .pisell-tag-content {
23
+ flex: 1;
24
+ width: 100%;
25
+ text-align: left;
26
+ word-break: break-word;
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface StatisticsOption {
4
+ label: string;
5
+ value: string;
6
+ }
7
+ export interface StatisticsProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
8
+ loading: boolean;
9
+ options: StatisticsOption[];
10
+ }
11
+ declare const Statistics: React.FC<Partial<StatisticsProps>>;
12
+ export default Statistics;
@@ -0,0 +1,63 @@
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/business-components/statistics/index.tsx
30
+ var statistics_exports = {};
31
+ __export(statistics_exports, {
32
+ default: () => statistics_default
33
+ });
34
+ module.exports = __toCommonJS(statistics_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_classnames = __toESM(require("classnames"));
38
+ var import_hooks = require("../../hooks");
39
+ var import_index = require("./index.less");
40
+ var Statistics = (props) => {
41
+ const { loading, options = [] } = props;
42
+ const responsive = (0, import_hooks.useResponsive)();
43
+ return /* @__PURE__ */ import_react.default.createElement(
44
+ "div",
45
+ {
46
+ className: (0, import_classnames.default)(
47
+ "pisell-statistics",
48
+ "pisell-scrollbar",
49
+ props.className,
50
+ {
51
+ "phone-wrap": responsive === "phone"
52
+ }
53
+ ),
54
+ style: props.style
55
+ },
56
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-statistics-options" }, options.map((d, i) => {
57
+ return /* @__PURE__ */ import_react.default.createElement("div", { key: i, className: "pisell-statistics-item" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-statistics-label" }, d.label), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-statistics-value" }, loading ? /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton.Input, { active: true, size: "default" }) : d.value));
58
+ }))
59
+ );
60
+ };
61
+ var statistics_default = Statistics;
62
+ // Annotate the CommonJS export names for ESM import in node:
63
+ 0 && (module.exports = {});
@@ -0,0 +1,64 @@
1
+ .pisell-statistics {
2
+ width: 100%;
3
+ overflow-y: auto;
4
+
5
+ &.phone-wrap {
6
+ overflow-y: hidden;
7
+
8
+ .pisell-statistics-options {
9
+ min-width: 100%;
10
+ display: block;
11
+
12
+ .pisell-statistics-item {
13
+ padding: 12px;
14
+ width: 100%;
15
+ margin-bottom: 20px;
16
+ border-bottom: 1px solid #ccc;
17
+
18
+ &::after {
19
+ display: none;
20
+ }
21
+ }
22
+ }
23
+ }
24
+
25
+ .pisell-statistics-options {
26
+ width: 100%;
27
+ min-width: 1000px;
28
+ display: flex;
29
+ align-items: flex-start;
30
+ justify-content: center;
31
+
32
+ .pisell-statistics-item {
33
+ flex: 1;
34
+ position: relative;
35
+ text-align: center;
36
+
37
+ &::after {
38
+ content: '';
39
+ position: absolute;
40
+ right: 0;
41
+ top: 50%;
42
+ transform: translate(-50%, -50%);
43
+ height: 40px;
44
+ width: 1px;
45
+ background-color: #ccc;
46
+ }
47
+
48
+ .pisell-statistics-label {
49
+ }
50
+
51
+ .pisell-statistics-value {
52
+ margin-top: 10px;
53
+ font-size: 26px;
54
+ // font-weight: 500;
55
+ }
56
+
57
+ &:last-child {
58
+ &::after {
59
+ display: none;
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { useModalProps } from '../../business-hooks/useModal';
3
+ export interface TagDataType<T> {
4
+ value: T;
5
+ label: string;
6
+ }
7
+ export interface TagModalProps<T> extends useModalProps {
8
+ data: TagDataType<T>[];
9
+ value: T[];
10
+ onChange: (value: T[]) => void;
11
+ tagModalRef: React.Ref<{
12
+ showModal: () => void;
13
+ hideModal: () => void;
14
+ }>;
15
+ }
16
+ declare const TagModal: <T extends string | number>(props: TagModalProps<T>) => JSX.Element;
17
+ export default TagModal;
@@ -0,0 +1,66 @@
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/business-components/tagModal/index.tsx
30
+ var tagModal_exports = {};
31
+ __export(tagModal_exports, {
32
+ default: () => tagModal_default
33
+ });
34
+ module.exports = __toCommonJS(tagModal_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_useModal = __toESM(require("../../business-hooks/useModal"));
38
+ var TagModal = (props) => {
39
+ const { data, onChange, value, tagModalRef, ...others } = props;
40
+ const Content = (0, import_react.useMemo)(() => {
41
+ return /* @__PURE__ */ import_react.default.createElement(
42
+ import_antd.Checkbox.Group,
43
+ {
44
+ style: { width: "100%" },
45
+ onChange: (val) => onChange(val),
46
+ value
47
+ },
48
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Row, { gutter: 10 }, data.map((d, i) => {
49
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 8, key: i }, /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox, { value: d.value }, d.label));
50
+ }))
51
+ );
52
+ }, [data]);
53
+ const { showModal, visible, hideModal, content } = (0, import_useModal.default)({
54
+ ...others,
55
+ children: Content,
56
+ destroyOnClose: true
57
+ });
58
+ (0, import_react.useImperativeHandle)(tagModalRef, () => ({
59
+ showModal,
60
+ hideModal
61
+ }));
62
+ return content;
63
+ };
64
+ var tagModal_default = TagModal;
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {});
@@ -0,0 +1,2 @@
1
+ export { default as useModal } from './useModal';
2
+ export { default as useTagModal } from './useTagModal';
@@ -0,0 +1,42 @@
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/business-hooks/index.ts
30
+ var business_hooks_exports = {};
31
+ __export(business_hooks_exports, {
32
+ useModal: () => import_useModal.default,
33
+ useTagModal: () => import_useTagModal.default
34
+ });
35
+ module.exports = __toCommonJS(business_hooks_exports);
36
+ var import_useModal = __toESM(require("./useModal"));
37
+ var import_useTagModal = __toESM(require("./useTagModal"));
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ useModal,
41
+ useTagModal
42
+ });
@@ -0,0 +1,31 @@
1
+ import { ModalProps } from 'node_modules/antd/lib/modal/Modal.d';
2
+ import React from 'react';
3
+ /**
4
+ * @Title: 传入参数
5
+ * @Describe: 其余参数与Modal一致
6
+ * @Author: Wzw
7
+ */
8
+ export interface useModalProps extends ModalProps {
9
+ /**
10
+ * @description 属性描述
11
+ * @default "默认值"
12
+ */
13
+ children: React.ReactNode;
14
+ /**
15
+ * @description 取消事件,不传则执行关闭事件
16
+ * @default "默认值"
17
+ */
18
+ onCancel: () => void;
19
+ /**
20
+ * @description 确认事件,不传则执行关闭事件
21
+ * @default "默认值"
22
+ */
23
+ onOk: () => void;
24
+ }
25
+ declare const useModal: (props: Partial<useModalProps>) => {
26
+ showModal: () => void;
27
+ hideModal: () => void;
28
+ visible: boolean;
29
+ content: JSX.Element;
30
+ };
31
+ export default useModal;
@@ -0,0 +1,68 @@
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/business-hooks/useModal/index.tsx
30
+ var useModal_exports = {};
31
+ __export(useModal_exports, {
32
+ default: () => useModal_default
33
+ });
34
+ module.exports = __toCommonJS(useModal_exports);
35
+ var import_antd = require("antd");
36
+ var import_react = __toESM(require("react"));
37
+ var useModal = (props) => {
38
+ const [visible, setVisible] = (0, import_react.useState)(false);
39
+ const showModal = () => {
40
+ setVisible(true);
41
+ };
42
+ const hideModal = () => {
43
+ setVisible(false);
44
+ };
45
+ const _onOk = () => {
46
+ if (props.onOk) {
47
+ props.onOk();
48
+ } else {
49
+ hideModal();
50
+ }
51
+ };
52
+ const _onCancel = () => {
53
+ if (props.onCancel) {
54
+ props.onCancel();
55
+ } else {
56
+ hideModal();
57
+ }
58
+ };
59
+ return {
60
+ showModal,
61
+ hideModal,
62
+ visible,
63
+ content: /* @__PURE__ */ import_react.default.createElement(import_antd.Modal, { open: visible, onOk: _onOk, onCancel: _onCancel, ...props }, props.children)
64
+ };
65
+ };
66
+ var useModal_default = useModal;
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {});
File without changes
@@ -0,0 +1,17 @@
1
+ import { useModalProps } from '../useModal';
2
+ export interface TagDataType<T> {
3
+ value: T;
4
+ label: string;
5
+ }
6
+ export interface UseTagModalProps<T> extends Omit<useModalProps, 'children'> {
7
+ data: TagDataType<T>[];
8
+ value: T[];
9
+ onChange?: (value: T[]) => void;
10
+ }
11
+ declare const useTagModal: <T extends string | number>(props: UseTagModalProps<T>) => {
12
+ showModal: () => void;
13
+ hideModal: () => void;
14
+ visible: boolean;
15
+ content: JSX.Element;
16
+ };
17
+ export default useTagModal;
@@ -0,0 +1,61 @@
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/business-hooks/useTagModal/index.tsx
30
+ var useTagModal_exports = {};
31
+ __export(useTagModal_exports, {
32
+ default: () => useTagModal_default
33
+ });
34
+ module.exports = __toCommonJS(useTagModal_exports);
35
+ var import_useModal = __toESM(require("../useModal"));
36
+ var import_react = __toESM(require("react"));
37
+ var import_antd = require("antd");
38
+ var useTagModal = (props) => {
39
+ const { data, onChange, value, ...others } = props;
40
+ const Content = (0, import_react.useMemo)(() => {
41
+ return /* @__PURE__ */ import_react.default.createElement(
42
+ import_antd.Checkbox.Group,
43
+ {
44
+ style: { width: "100%" },
45
+ onChange: (val) => onChange == null ? void 0 : onChange(val),
46
+ value
47
+ },
48
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Row, { gutter: 10 }, data.map((d, i) => {
49
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 8, key: i }, /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox, { value: d.value }, d.label));
50
+ }))
51
+ );
52
+ }, [data, value]);
53
+ const modalResult = (0, import_useModal.default)({
54
+ ...others,
55
+ children: Content
56
+ });
57
+ return modalResult;
58
+ };
59
+ var useTagModal_default = useTagModal;
60
+ // Annotate the CommonJS export names for ESM import in node:
61
+ 0 && (module.exports = {});
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface ColorPickerProps {
4
+ keyName?: string;
5
+ /**
6
+ * @description 属性描述
7
+ * @default "默认值"
8
+ */
9
+ value: string;
10
+ /**
11
+ * @description 属性描述
12
+ * @default "默认值"
13
+ */
14
+ onChange: (val: any) => void;
15
+ /**
16
+ * @description 属性描述
17
+ * @default "默认值"
18
+ */
19
+ children?: React.ReactNode;
20
+ }
21
+ declare const ColorPicker: React.FC<ColorPickerProps>;
22
+ export default ColorPicker;