@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.
- package/LICENSE +21 -0
- package/README.md +40 -0
- package/es/business-components/colorInput/index.d.ts +21 -0
- package/es/business-components/colorInput/index.js +43 -0
- package/es/business-components/colorInput/index.less +10 -0
- package/es/business-components/index.d.ts +11 -0
- package/es/business-components/index.js +7 -0
- package/es/business-components/rechargeOption/index.d.ts +36 -0
- package/es/business-components/rechargeOption/index.js +136 -0
- package/es/business-components/rechargeOption/index.less +0 -0
- package/es/business-components/selectTag/index.d.ts +25 -0
- package/es/business-components/selectTag/index.js +180 -0
- package/es/business-components/selectTag/index.less +22 -0
- package/es/business-components/sortModal/index.d.ts +30 -0
- package/es/business-components/sortModal/index.js +85 -0
- package/es/business-components/sortModal/index.less +29 -0
- package/es/business-components/statistics/index.d.ts +12 -0
- package/es/business-components/statistics/index.js +38 -0
- package/es/business-components/statistics/index.less +64 -0
- package/es/business-components/tagModal/index.d.ts +17 -0
- package/es/business-components/tagModal/index.js +59 -0
- package/es/business-hooks/index.d.ts +2 -0
- package/es/business-hooks/index.js +2 -0
- package/es/business-hooks/useModal/index.d.ts +31 -0
- package/es/business-hooks/useModal/index.js +91 -0
- package/es/business-hooks/useModal/index.less +0 -0
- package/es/business-hooks/useTagModal/index.d.ts +17 -0
- package/es/business-hooks/useTagModal/index.js +47 -0
- package/es/components/ColorPicker/index.d.ts +22 -0
- package/es/components/ColorPicker/index.js +51 -0
- package/es/components/ColorPicker/index.less +17 -0
- package/es/components/DragSort/index.d.ts +2 -0
- package/es/components/DragSort/index.js +68 -0
- package/es/components/Iconfont/index.d.ts +6 -0
- package/es/components/Iconfont/index.js +28 -0
- package/es/components/Iconfont/index.less +0 -0
- package/es/components/card/index.d.ts +5 -0
- package/es/components/card/index.js +16 -0
- package/es/components/card/index.less +9 -0
- package/es/components/index.d.ts +4 -0
- package/es/components/index.js +4 -0
- package/es/config/index.d.ts +16 -0
- package/es/config/index.js +18 -0
- package/es/config/utils.d.ts +0 -0
- package/es/config/utils.js +0 -0
- package/es/hooks/index.d.ts +8 -0
- package/es/hooks/index.js +8 -0
- package/es/hooks/useCountDown/index.d.ts +10 -0
- package/es/hooks/useCountDown/index.js +48 -0
- package/es/hooks/useDocumentScroll/index.d.ts +8 -0
- package/es/hooks/useDocumentScroll/index.js +41 -0
- package/es/hooks/useDocumentScroll/index.less +0 -0
- package/es/hooks/useMousemove/index.d.ts +8 -0
- package/es/hooks/useMousemove/index.js +61 -0
- package/es/hooks/useResponsive/index.d.ts +2 -0
- package/es/hooks/useResponsive/index.js +29 -0
- package/es/hooks/useResponsive/index.less +0 -0
- package/es/hooks/useSize/index.d.ts +2 -0
- package/es/hooks/useSize/index.js +27 -0
- package/es/hooks/useSize/index.less +0 -0
- package/es/hooks/useStateMulti/index.d.ts +2 -0
- package/es/hooks/useStateMulti/index.js +29 -0
- package/es/hooks/useStateWithCb/index.d.ts +2 -0
- package/es/hooks/useStateWithCb/index.js +42 -0
- package/es/hooks/useTable/index.d.ts +12 -0
- package/es/hooks/useTable/index.js +74 -0
- package/es/hooks/useTable/index.less +0 -0
- package/es/hooks/useTableModal/index.d.ts +12 -0
- package/es/hooks/useTableModal/index.js +25 -0
- package/es/hooks/useTableModal/index.less +0 -0
- package/es/hooks/useUrlState/index.d.ts +2 -0
- package/es/hooks/useUrlState/index.js +56 -0
- package/es/hooks/useWebSocket/index.d.ts +13 -0
- package/es/hooks/useWebSocket/index.js +121 -0
- package/es/index.d.ts +4 -0
- package/es/index.js +4 -0
- package/es/locales/en-US.d.ts +11 -0
- package/es/locales/en-US.js +10 -0
- package/es/locales/index.d.ts +1 -0
- package/es/locales/index.js +23 -0
- package/es/locales/zh-CN.d.ts +11 -0
- package/es/locales/zh-CN.js +10 -0
- package/es/locales/zh-TW.d.ts +11 -0
- package/es/locales/zh-TW.js +10 -0
- package/es/utils/index.d.ts +3 -0
- package/es/utils/index.js +3 -0
- package/es/utils/otherUtils.d.ts +8 -0
- package/es/utils/otherUtils.js +12 -0
- package/es/utils/storage.d.ts +30 -0
- package/es/utils/storage.js +70 -0
- package/es/utils/typeUtils.d.ts +42 -0
- package/es/utils/typeUtils.js +86 -0
- package/lib/business-components/colorInput/index.d.ts +21 -0
- package/lib/business-components/colorInput/index.js +70 -0
- package/lib/business-components/colorInput/index.less +10 -0
- package/lib/business-components/index.d.ts +11 -0
- package/lib/business-components/index.js +54 -0
- package/lib/business-components/rechargeOption/index.d.ts +36 -0
- package/lib/business-components/rechargeOption/index.js +133 -0
- package/lib/business-components/rechargeOption/index.less +0 -0
- package/lib/business-components/selectTag/index.d.ts +25 -0
- package/lib/business-components/selectTag/index.js +181 -0
- package/lib/business-components/selectTag/index.less +22 -0
- package/lib/business-components/sortModal/index.d.ts +30 -0
- package/lib/business-components/sortModal/index.js +100 -0
- package/lib/business-components/sortModal/index.less +29 -0
- package/lib/business-components/statistics/index.d.ts +12 -0
- package/lib/business-components/statistics/index.js +63 -0
- package/lib/business-components/statistics/index.less +64 -0
- package/lib/business-components/tagModal/index.d.ts +17 -0
- package/lib/business-components/tagModal/index.js +66 -0
- package/lib/business-hooks/index.d.ts +2 -0
- package/lib/business-hooks/index.js +42 -0
- package/lib/business-hooks/useModal/index.d.ts +31 -0
- package/lib/business-hooks/useModal/index.js +68 -0
- package/lib/business-hooks/useModal/index.less +0 -0
- package/lib/business-hooks/useTagModal/index.d.ts +17 -0
- package/lib/business-hooks/useTagModal/index.js +61 -0
- package/lib/components/ColorPicker/index.d.ts +22 -0
- package/lib/components/ColorPicker/index.js +80 -0
- package/lib/components/ColorPicker/index.less +17 -0
- package/lib/components/DragSort/index.d.ts +2 -0
- package/lib/components/DragSort/index.js +101 -0
- package/lib/components/Iconfont/index.d.ts +6 -0
- package/lib/components/Iconfont/index.js +47 -0
- package/lib/components/Iconfont/index.less +0 -0
- package/lib/components/card/index.d.ts +5 -0
- package/lib/components/card/index.js +42 -0
- package/lib/components/card/index.less +9 -0
- package/lib/components/index.d.ts +4 -0
- package/lib/components/index.js +48 -0
- package/lib/config/index.d.ts +16 -0
- package/lib/config/index.js +39 -0
- package/lib/config/utils.d.ts +0 -0
- package/lib/config/utils.js +0 -0
- package/lib/hooks/index.d.ts +8 -0
- package/lib/hooks/index.js +57 -0
- package/lib/hooks/useCountDown/index.d.ts +10 -0
- package/lib/hooks/useCountDown/index.js +57 -0
- package/lib/hooks/useDocumentScroll/index.d.ts +8 -0
- package/lib/hooks/useDocumentScroll/index.js +54 -0
- package/lib/hooks/useDocumentScroll/index.less +0 -0
- package/lib/hooks/useMousemove/index.d.ts +8 -0
- package/lib/hooks/useMousemove/index.js +70 -0
- package/lib/hooks/useResponsive/index.d.ts +2 -0
- package/lib/hooks/useResponsive/index.js +47 -0
- package/lib/hooks/useResponsive/index.less +0 -0
- package/lib/hooks/useSize/index.d.ts +2 -0
- package/lib/hooks/useSize/index.js +45 -0
- package/lib/hooks/useSize/index.less +0 -0
- package/lib/hooks/useStateMulti/index.d.ts +2 -0
- package/lib/hooks/useStateMulti/index.js +43 -0
- package/lib/hooks/useStateWithCb/index.d.ts +2 -0
- package/lib/hooks/useStateWithCb/index.js +53 -0
- package/lib/hooks/useTable/index.d.ts +12 -0
- package/lib/hooks/useTable/index.js +75 -0
- package/lib/hooks/useTable/index.less +0 -0
- package/lib/hooks/useTableModal/index.d.ts +12 -0
- package/lib/hooks/useTableModal/index.js +43 -0
- package/lib/hooks/useTableModal/index.less +0 -0
- package/lib/hooks/useUrlState/index.d.ts +2 -0
- package/lib/hooks/useUrlState/index.js +59 -0
- package/lib/hooks/useWebSocket/index.d.ts +13 -0
- package/lib/hooks/useWebSocket/index.js +91 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +22 -0
- package/lib/locales/en-US.d.ts +11 -0
- package/lib/locales/en-US.js +36 -0
- package/lib/locales/index.d.ts +1 -0
- package/lib/locales/index.js +59 -0
- package/lib/locales/zh-CN.d.ts +11 -0
- package/lib/locales/zh-CN.js +36 -0
- package/lib/locales/zh-TW.d.ts +11 -0
- package/lib/locales/zh-TW.js +36 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +21 -0
- package/lib/utils/otherUtils.d.ts +8 -0
- package/lib/utils/otherUtils.js +31 -0
- package/lib/utils/storage.d.ts +30 -0
- package/lib/utils/storage.js +63 -0
- package/lib/utils/typeUtils.d.ts +42 -0
- package/lib/utils/typeUtils.js +75 -0
- package/package.json +101 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 判断是否是函数
|
|
3
|
+
* @param obj
|
|
4
|
+
*/
|
|
5
|
+
export var isFunction = function isFunction(obj) {
|
|
6
|
+
return typeof obj === 'function';
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 判断是否是数组
|
|
11
|
+
* @param obj
|
|
12
|
+
*/
|
|
13
|
+
export var isArr = function isArr(obj) {
|
|
14
|
+
return Array.isArray(obj);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 判断是否是字符串
|
|
19
|
+
* @param obj
|
|
20
|
+
*/
|
|
21
|
+
export var isString = function isString(obj) {
|
|
22
|
+
return typeof obj === 'string';
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 判断是否是数字
|
|
27
|
+
* @param obj
|
|
28
|
+
*/
|
|
29
|
+
export var isNumber = function isNumber(obj) {
|
|
30
|
+
return typeof obj === 'number';
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 判断是否是undefined
|
|
35
|
+
* @param obj
|
|
36
|
+
*/
|
|
37
|
+
export var isUndefined = function isUndefined(obj) {
|
|
38
|
+
return typeof obj === 'undefined';
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 判断是否是boolean
|
|
43
|
+
* @param obj
|
|
44
|
+
*/
|
|
45
|
+
export var isBoolean = function isBoolean(obj) {
|
|
46
|
+
return typeof obj === 'boolean';
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 判断是否是json字符串
|
|
51
|
+
* @param v
|
|
52
|
+
*/
|
|
53
|
+
export var isJson = function isJson(v) {
|
|
54
|
+
if (typeof v === 'string') {
|
|
55
|
+
try {
|
|
56
|
+
return JSON.parse(v);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var getProto = Object.getPrototypeOf;
|
|
65
|
+
var hasOwn = {}.hasOwnProperty;
|
|
66
|
+
var fnToString = hasOwn.toString;
|
|
67
|
+
var ObjectFunctionString = fnToString.call(Object);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @Title: 判断是否为对象
|
|
71
|
+
* @Describe:
|
|
72
|
+
* @Author: Wzw
|
|
73
|
+
* @param {any} obj
|
|
74
|
+
*/
|
|
75
|
+
export var isPlainObject = function isPlainObject(obj) {
|
|
76
|
+
var proto, Ctor;
|
|
77
|
+
if (!obj || toString.call(obj) !== '[object Object]') {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
proto = getProto(obj);
|
|
81
|
+
if (!proto) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
Ctor = hasOwn.call(proto, 'constructor') && proto.constructor;
|
|
85
|
+
return typeof Ctor === 'function' && fnToString.call(Ctor) === ObjectFunctionString;
|
|
86
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export interface ColorInputProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 颜色值
|
|
6
|
+
* @default ""
|
|
7
|
+
*/
|
|
8
|
+
value: string;
|
|
9
|
+
/**
|
|
10
|
+
* @description 当颜色值改变触发
|
|
11
|
+
* @default () => void
|
|
12
|
+
*/
|
|
13
|
+
onChange: (val: string) => void;
|
|
14
|
+
/**
|
|
15
|
+
* @description 色块大小
|
|
16
|
+
* @default 30
|
|
17
|
+
*/
|
|
18
|
+
colorBlockSize?: number;
|
|
19
|
+
}
|
|
20
|
+
declare const ColorInput: React.FC<ColorInputProps>;
|
|
21
|
+
export default ColorInput;
|
|
@@ -0,0 +1,70 @@
|
|
|
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/colorInput/index.tsx
|
|
30
|
+
var colorInput_exports = {};
|
|
31
|
+
__export(colorInput_exports, {
|
|
32
|
+
default: () => colorInput_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(colorInput_exports);
|
|
35
|
+
var import_antd = require("antd");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_components = require("../../components");
|
|
38
|
+
var import_index = require("./index.less");
|
|
39
|
+
var prefix = "pisell-";
|
|
40
|
+
var ColorInput = (props) => {
|
|
41
|
+
const { value = "", onChange, colorBlockSize = 30 } = props;
|
|
42
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}color-input-wrap` }, /* @__PURE__ */ import_react.default.createElement(import_components.ColorPicker, { onChange, value }, /* @__PURE__ */ import_react.default.createElement(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
style: {
|
|
46
|
+
backgroundColor: value,
|
|
47
|
+
width: colorBlockSize,
|
|
48
|
+
height: colorBlockSize
|
|
49
|
+
},
|
|
50
|
+
className: `${prefix}color-block`
|
|
51
|
+
}
|
|
52
|
+
)), /* @__PURE__ */ import_react.default.createElement(
|
|
53
|
+
import_antd.Input,
|
|
54
|
+
{
|
|
55
|
+
value: value.replace("#", ""),
|
|
56
|
+
prefix: "#",
|
|
57
|
+
style: { width: 120 },
|
|
58
|
+
onChange: (e) => {
|
|
59
|
+
const reg = /^([0-9a-fA-F]{0,6})$/;
|
|
60
|
+
if (!reg.test(e.target.value)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
onChange(`#${e.target.value}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
));
|
|
67
|
+
};
|
|
68
|
+
var colorInput_default = ColorInput;
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as ColorInput } from './colorInput';
|
|
2
|
+
export type { ColorInputProps } from './colorInput';
|
|
3
|
+
export { default as RechargeOption } from './rechargeOption';
|
|
4
|
+
export type { RechargeOptionProps } from './rechargeOption';
|
|
5
|
+
export { default as SelectTag } from './selectTag';
|
|
6
|
+
export type { SelectTagProps } from './selectTag';
|
|
7
|
+
export { default as SortModal } from './sortModal';
|
|
8
|
+
export type { SortModalProps } from './sortModal';
|
|
9
|
+
export { default as Statistics } from './statistics';
|
|
10
|
+
export { default as TagModal } from './tagModal';
|
|
11
|
+
export type { TagModalProps } from './tagModal';
|
|
@@ -0,0 +1,54 @@
|
|
|
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/index.ts
|
|
30
|
+
var business_components_exports = {};
|
|
31
|
+
__export(business_components_exports, {
|
|
32
|
+
ColorInput: () => import_colorInput.default,
|
|
33
|
+
RechargeOption: () => import_rechargeOption.default,
|
|
34
|
+
SelectTag: () => import_selectTag.default,
|
|
35
|
+
SortModal: () => import_sortModal.default,
|
|
36
|
+
Statistics: () => import_statistics.default,
|
|
37
|
+
TagModal: () => import_tagModal.default
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(business_components_exports);
|
|
40
|
+
var import_colorInput = __toESM(require("./colorInput"));
|
|
41
|
+
var import_rechargeOption = __toESM(require("./rechargeOption"));
|
|
42
|
+
var import_selectTag = __toESM(require("./selectTag"));
|
|
43
|
+
var import_sortModal = __toESM(require("./sortModal"));
|
|
44
|
+
var import_statistics = __toESM(require("./statistics"));
|
|
45
|
+
var import_tagModal = __toESM(require("./tagModal"));
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
ColorInput,
|
|
49
|
+
RechargeOption,
|
|
50
|
+
SelectTag,
|
|
51
|
+
SortModal,
|
|
52
|
+
Statistics,
|
|
53
|
+
TagModal
|
|
54
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ColProps } from 'antd/lib/col';
|
|
3
|
+
import type { FormListFieldData, FormListProps } from 'antd/lib/form/FormList';
|
|
4
|
+
import type { FormItemProps } from 'antd/lib/form/FormItem';
|
|
5
|
+
import type { SortModalProps } from '../sortModal';
|
|
6
|
+
import type { FormInstance } from 'antd/es/form/hooks/useForm';
|
|
7
|
+
export interface RechargeOptionProps {
|
|
8
|
+
name: FormListProps['name'];
|
|
9
|
+
/** 是否展示编辑按钮 */
|
|
10
|
+
isShowEditButton?: boolean;
|
|
11
|
+
/** 添加按钮文案 */
|
|
12
|
+
addBtnText?: string;
|
|
13
|
+
/** 编辑按钮文案 */
|
|
14
|
+
editBtnText?: string;
|
|
15
|
+
/** 列配置 */
|
|
16
|
+
columnOption: {
|
|
17
|
+
label: string;
|
|
18
|
+
span: ColProps['span'];
|
|
19
|
+
field: string;
|
|
20
|
+
rules: FormItemProps['rules'];
|
|
21
|
+
}[];
|
|
22
|
+
/** 编辑按钮事件 */
|
|
23
|
+
onEditClick?: (bundle: FormListFieldData) => void;
|
|
24
|
+
rechargeOptionRef?: React.MutableRefObject<{
|
|
25
|
+
openSortModal: () => void;
|
|
26
|
+
} | undefined>;
|
|
27
|
+
sortModalProps?: Partial<Omit<SortModalProps<Record<string, any>>, 'ref'>>;
|
|
28
|
+
form: FormInstance;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 类充值选项组件
|
|
32
|
+
* @param props
|
|
33
|
+
* @constructor
|
|
34
|
+
*/
|
|
35
|
+
declare const RechargeOption: React.FC<RechargeOptionProps>;
|
|
36
|
+
export default RechargeOption;
|
|
@@ -0,0 +1,133 @@
|
|
|
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/rechargeOption/index.tsx
|
|
30
|
+
var rechargeOption_exports = {};
|
|
31
|
+
__export(rechargeOption_exports, {
|
|
32
|
+
default: () => rechargeOption_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(rechargeOption_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_utils = require("../../utils");
|
|
38
|
+
var import_icons = require("@ant-design/icons");
|
|
39
|
+
var import_sortModal = __toESM(require("../sortModal"));
|
|
40
|
+
var import_locales = require("../../locales");
|
|
41
|
+
var RechargeOption = (props) => {
|
|
42
|
+
const {
|
|
43
|
+
name,
|
|
44
|
+
isShowEditButton = false,
|
|
45
|
+
columnOption,
|
|
46
|
+
addBtnText,
|
|
47
|
+
editBtnText,
|
|
48
|
+
onEditClick,
|
|
49
|
+
rechargeOptionRef,
|
|
50
|
+
sortModalProps,
|
|
51
|
+
form
|
|
52
|
+
} = props;
|
|
53
|
+
const sortModalRef = (0, import_react.useRef)(null);
|
|
54
|
+
const genDefaultData = (0, import_react.useCallback)(
|
|
55
|
+
(others) => {
|
|
56
|
+
return columnOption.reduce((acc, cur) => ({ ...acc, [cur.field]: "" }), {
|
|
57
|
+
key: (0, import_utils.getUniqueId)(),
|
|
58
|
+
...others
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
[columnOption]
|
|
62
|
+
);
|
|
63
|
+
const initValue = (0, import_react.useMemo)(() => genDefaultData({ id: 0 }), [columnOption]);
|
|
64
|
+
(0, import_react.useImperativeHandle)(rechargeOptionRef, () => ({
|
|
65
|
+
openSortModal: () => {
|
|
66
|
+
var _a;
|
|
67
|
+
(_a = sortModalRef.current) == null ? void 0 : _a.showModal();
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
const handleSortModalOk = (0, import_react.useCallback)(
|
|
71
|
+
(list) => {
|
|
72
|
+
var _a;
|
|
73
|
+
form.setFieldsValue({
|
|
74
|
+
[name]: list
|
|
75
|
+
});
|
|
76
|
+
(_a = sortModalRef.current) == null ? void 0 : _a.hideModal();
|
|
77
|
+
},
|
|
78
|
+
[name]
|
|
79
|
+
);
|
|
80
|
+
return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_antd.Row, { gutter: 10, style: { marginBottom: "10px" } }, columnOption.map((item) => {
|
|
81
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: item.span, key: item.label }, item.label);
|
|
82
|
+
})), /* @__PURE__ */ import_react.default.createElement(import_antd.Form.List, { name, initialValue: [initValue] }, (fields, { add, remove }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, fields.map((bundle, i) => {
|
|
83
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { key: bundle.key, noStyle: true }, /* @__PURE__ */ import_react.default.createElement(import_antd.Row, { gutter: 10 }, columnOption.map((item) => {
|
|
84
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: item.span, key: item.label }, /* @__PURE__ */ import_react.default.createElement(
|
|
85
|
+
import_antd.Form.Item,
|
|
86
|
+
{
|
|
87
|
+
name: [bundle.name, item.field],
|
|
88
|
+
rules: item.rules
|
|
89
|
+
},
|
|
90
|
+
/* @__PURE__ */ import_react.default.createElement(import_antd.Input, { style: { width: "100%" } })
|
|
91
|
+
));
|
|
92
|
+
}), isShowEditButton && /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 3 }, /* @__PURE__ */ import_react.default.createElement(
|
|
93
|
+
import_antd.Button,
|
|
94
|
+
{
|
|
95
|
+
onClick: () => {
|
|
96
|
+
(0, import_utils.isFunction)(onEditClick) && onEditClick(bundle);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
editBtnText || (0, import_locales.getText)(
|
|
100
|
+
"pisell-design.recharge.option.button.edit"
|
|
101
|
+
)
|
|
102
|
+
)), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 2 }, i !== 0 && /* @__PURE__ */ import_react.default.createElement(
|
|
103
|
+
import_antd.Button,
|
|
104
|
+
{
|
|
105
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icons.DeleteOutlined, null),
|
|
106
|
+
onClick: () => {
|
|
107
|
+
remove(bundle.name);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
))));
|
|
111
|
+
}), /* @__PURE__ */ import_react.default.createElement(
|
|
112
|
+
import_antd.Button,
|
|
113
|
+
{
|
|
114
|
+
onClick: () => {
|
|
115
|
+
add(genDefaultData({ id: fields.length + 1 }));
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
addBtnText || (0, import_locales.getText)("pisell-design.recharge.option.button.add")
|
|
119
|
+
)))), /* @__PURE__ */ import_react.default.createElement(
|
|
120
|
+
import_sortModal.default,
|
|
121
|
+
{
|
|
122
|
+
isShowIndex: false,
|
|
123
|
+
field: sortModalProps == null ? void 0 : sortModalProps.field,
|
|
124
|
+
title: sortModalProps == null ? void 0 : sortModalProps.title,
|
|
125
|
+
items: form.getFieldValue(name) || [],
|
|
126
|
+
sortModalRef,
|
|
127
|
+
onOk: handleSortModalOk
|
|
128
|
+
}
|
|
129
|
+
));
|
|
130
|
+
};
|
|
131
|
+
var rechargeOption_default = RechargeOption;
|
|
132
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
133
|
+
0 && (module.exports = {});
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SelectProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './index.less';
|
|
4
|
+
declare type BaseValue = string | number;
|
|
5
|
+
declare type ColorValue = {
|
|
6
|
+
color: string;
|
|
7
|
+
value: BaseValue;
|
|
8
|
+
label: string;
|
|
9
|
+
};
|
|
10
|
+
declare type Value = BaseValue | ColorValue;
|
|
11
|
+
export interface SelectTagProps<T> extends Omit<SelectProps, 'options'> {
|
|
12
|
+
selectTagRef?: React.MutableRefObject<{
|
|
13
|
+
showModal: () => void;
|
|
14
|
+
hideModal: () => void;
|
|
15
|
+
}>;
|
|
16
|
+
value?: T[];
|
|
17
|
+
onChange?: (value: T[]) => void;
|
|
18
|
+
isColorSelect?: boolean;
|
|
19
|
+
options: {
|
|
20
|
+
value: BaseValue;
|
|
21
|
+
label: string;
|
|
22
|
+
}[];
|
|
23
|
+
}
|
|
24
|
+
declare const SelectTag: <T extends Value>(props: SelectTagProps<T>) => JSX.Element;
|
|
25
|
+
export default SelectTag;
|
|
@@ -0,0 +1,181 @@
|
|
|
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/selectTag/index.tsx
|
|
30
|
+
var selectTag_exports = {};
|
|
31
|
+
__export(selectTag_exports, {
|
|
32
|
+
default: () => selectTag_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(selectTag_exports);
|
|
35
|
+
var import_antd = require("antd");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_business_hooks = require("../../business-hooks");
|
|
38
|
+
var import_DragSort = __toESM(require("../../components/DragSort"));
|
|
39
|
+
var import_Iconfont = __toESM(require("../../components/Iconfont"));
|
|
40
|
+
var import_locales = require("../../locales");
|
|
41
|
+
var import_utils = require("../../utils");
|
|
42
|
+
var import_colorInput = __toESM(require("../colorInput"));
|
|
43
|
+
var import_index = require("./index.less");
|
|
44
|
+
var defaultColor = "#000";
|
|
45
|
+
var prefix = "pisell-";
|
|
46
|
+
var SelectTag = (props) => {
|
|
47
|
+
const { selectTagRef, value, onChange, options, isColorSelect } = props;
|
|
48
|
+
const tagValue = (0, import_react.useMemo)(() => {
|
|
49
|
+
if (!(0, import_utils.isArr)(value)) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
if (value.every((item) => (0, import_utils.isString)(item) || (0, import_utils.isNumber)(item))) {
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
return value.map((item) => item.value);
|
|
56
|
+
}, [value]);
|
|
57
|
+
const valueColorMap = (0, import_react.useMemo)(() => {
|
|
58
|
+
if (!isColorSelect || !(0, import_utils.isArr)(value)) {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
return value.reduce(
|
|
62
|
+
(pre, cur) => ({ ...pre, [cur.value]: cur.color }),
|
|
63
|
+
{}
|
|
64
|
+
);
|
|
65
|
+
}, [value, options]);
|
|
66
|
+
const valueLabelMap = (0, import_react.useMemo)(
|
|
67
|
+
() => options.reduce((pre, cur) => ({ ...pre, [cur.value]: cur.label }), {}),
|
|
68
|
+
[options]
|
|
69
|
+
);
|
|
70
|
+
const handleTagChange = (0, import_react.useCallback)(
|
|
71
|
+
(val) => {
|
|
72
|
+
if (isColorSelect) {
|
|
73
|
+
const _value = val.map((item) => {
|
|
74
|
+
return {
|
|
75
|
+
color: valueColorMap[item] || defaultColor,
|
|
76
|
+
value: item
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
(0, import_utils.isFunction)(onChange) && onChange(_value);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
(0, import_utils.isFunction)(onChange) && onChange(val);
|
|
83
|
+
},
|
|
84
|
+
[isColorSelect, onChange, valueColorMap]
|
|
85
|
+
);
|
|
86
|
+
const { content, hideModal, visible, showModal } = (0, import_business_hooks.useTagModal)({
|
|
87
|
+
value: tagValue,
|
|
88
|
+
onChange: handleTagChange,
|
|
89
|
+
data: options,
|
|
90
|
+
onOk: () => {
|
|
91
|
+
hideModal();
|
|
92
|
+
},
|
|
93
|
+
title: (0, import_locales.getText)("pisell-design.select.tag.modal.title"),
|
|
94
|
+
onCancel: () => {
|
|
95
|
+
hideModal();
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
(0, import_react.useImperativeHandle)(selectTagRef, () => ({
|
|
99
|
+
showModal,
|
|
100
|
+
hideModal
|
|
101
|
+
}));
|
|
102
|
+
const tagRender = (props2) => {
|
|
103
|
+
const { label, value: value2, closable, onClose } = props2;
|
|
104
|
+
const onPreventMouseDown = (event) => {
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
event.stopPropagation();
|
|
107
|
+
};
|
|
108
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
109
|
+
import_antd.Tag,
|
|
110
|
+
{
|
|
111
|
+
onMouseDown: onPreventMouseDown,
|
|
112
|
+
closable,
|
|
113
|
+
onClose,
|
|
114
|
+
className: `${prefix}select-tag`,
|
|
115
|
+
style: { color: valueColorMap[value2] || defaultColor }
|
|
116
|
+
},
|
|
117
|
+
label
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
const handleSelectChange = (0, import_react.useCallback)(
|
|
121
|
+
(val) => {
|
|
122
|
+
let newVal = val;
|
|
123
|
+
if (isColorSelect) {
|
|
124
|
+
newVal = val.map((item) => ({
|
|
125
|
+
value: item,
|
|
126
|
+
color: valueColorMap[item] || defaultColor
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
(0, import_utils.isFunction)(onChange) && onChange(newVal);
|
|
130
|
+
},
|
|
131
|
+
[isColorSelect, valueColorMap]
|
|
132
|
+
);
|
|
133
|
+
const selectValue = (0, import_react.useMemo)(() => {
|
|
134
|
+
if (!(0, import_utils.isArr)(value)) {
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
if (value.every((item) => (0, import_utils.isString)(item) || (0, import_utils.isNumber)(item))) {
|
|
138
|
+
return value;
|
|
139
|
+
}
|
|
140
|
+
if (isColorSelect) {
|
|
141
|
+
return value.map((item) => item.value);
|
|
142
|
+
}
|
|
143
|
+
}, [value, isColorSelect]);
|
|
144
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
145
|
+
import_antd.Select,
|
|
146
|
+
{
|
|
147
|
+
...props,
|
|
148
|
+
value: selectValue,
|
|
149
|
+
mode: "tags",
|
|
150
|
+
options,
|
|
151
|
+
onChange: handleSelectChange,
|
|
152
|
+
tagRender
|
|
153
|
+
}
|
|
154
|
+
), isColorSelect && /* @__PURE__ */ import_react.default.createElement(
|
|
155
|
+
import_DragSort.default,
|
|
156
|
+
{
|
|
157
|
+
list: value || [],
|
|
158
|
+
droppableId: "addressSort",
|
|
159
|
+
draggableIdKey: "value",
|
|
160
|
+
onChange: (_list) => {
|
|
161
|
+
(0, import_utils.isFunction)(onChange) && onChange(_list);
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
(item, index) => {
|
|
165
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { key: item.value, className: `${prefix}sort-item` }, /* @__PURE__ */ import_react.default.createElement(import_Iconfont.default, { type: "icon-drag", className: `${prefix}icon` }), /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefix}sort-content` }, /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefix}tag-content` }, valueLabelMap[item.value])), /* @__PURE__ */ import_react.default.createElement(
|
|
166
|
+
import_colorInput.default,
|
|
167
|
+
{
|
|
168
|
+
value: item.color,
|
|
169
|
+
onChange: (val) => {
|
|
170
|
+
const _value = value ? [...value] : [];
|
|
171
|
+
_value[index].color = val;
|
|
172
|
+
(0, import_utils.isFunction)(onChange) && onChange(_value);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
));
|
|
176
|
+
}
|
|
177
|
+
), content);
|
|
178
|
+
};
|
|
179
|
+
var selectTag_default = SelectTag;
|
|
180
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
181
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.pisell-sort-item {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
height: 50px;
|
|
5
|
+
margin-top: 12px;
|
|
6
|
+
line-height: 40px;
|
|
7
|
+
background-color: #f0f0f0;
|
|
8
|
+
.pisell-sort-content {
|
|
9
|
+
margin-right: 10px;
|
|
10
|
+
}
|
|
11
|
+
.pisell-icon {
|
|
12
|
+
color: #999;
|
|
13
|
+
font-size: 20px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pisell-select-tag {
|
|
18
|
+
margin: 0 3px 3px 0;
|
|
19
|
+
padding: 2px 8px;
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
border-radius: 6px;
|
|
22
|
+
}
|