@pisell/common 0.0.18 → 1.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 (279) hide show
  1. package/.fatherrc.ts +7 -0
  2. package/CHANGELOG.md +7 -0
  3. package/README.md +1 -38
  4. package/{lib/components → es}/button/index.d.ts +5 -4
  5. package/es/button/index.d.ts.map +1 -0
  6. package/es/button/index.js +33 -0
  7. package/{es/components → lib}/button/index.d.ts +5 -4
  8. package/lib/button/index.d.ts.map +1 -0
  9. package/lib/{components/avatar → button}/index.js +14 -11
  10. package/package.json +20 -77
  11. package/src/button/index.md +17 -0
  12. package/src/button/index.tsx +38 -0
  13. package/tsconfig.json +14 -0
  14. package/LICENSE +0 -21
  15. package/es/bin/pisell.js +0 -2
  16. package/es/business-components/colorInput/index.d.ts +0 -21
  17. package/es/business-components/colorInput/index.js +0 -43
  18. package/es/business-components/colorInput/index.less +0 -10
  19. package/es/business-components/index.d.ts +0 -11
  20. package/es/business-components/index.js +0 -7
  21. package/es/business-components/rechargeOption/index.d.ts +0 -36
  22. package/es/business-components/rechargeOption/index.js +0 -132
  23. package/es/business-components/rechargeOption/index.less +0 -0
  24. package/es/business-components/selectTag/index.d.ts +0 -25
  25. package/es/business-components/selectTag/index.js +0 -179
  26. package/es/business-components/selectTag/index.less +0 -22
  27. package/es/business-components/sortModal/index.d.ts +0 -30
  28. package/es/business-components/sortModal/index.js +0 -85
  29. package/es/business-components/sortModal/index.less +0 -29
  30. package/es/business-components/statistics/index.d.ts +0 -12
  31. package/es/business-components/statistics/index.js +0 -38
  32. package/es/business-components/statistics/index.less +0 -64
  33. package/es/business-components/tagModal/index.d.ts +0 -17
  34. package/es/business-components/tagModal/index.js +0 -58
  35. package/es/business-hooks/index.d.ts +0 -2
  36. package/es/business-hooks/index.js +0 -2
  37. package/es/business-hooks/useModal/index.d.ts +0 -31
  38. package/es/business-hooks/useModal/index.js +0 -91
  39. package/es/business-hooks/useModal/index.less +0 -0
  40. package/es/business-hooks/useTagModal/index.d.ts +0 -17
  41. package/es/business-hooks/useTagModal/index.js +0 -47
  42. package/es/components/ColorPicker/index.d.ts +0 -22
  43. package/es/components/ColorPicker/index.js +0 -51
  44. package/es/components/ColorPicker/index.less +0 -17
  45. package/es/components/DragSort/index.d.ts +0 -2
  46. package/es/components/DragSort/index.js +0 -68
  47. package/es/components/EditorPreview/index.d.ts +0 -5
  48. package/es/components/EditorPreview/index.js +0 -14
  49. package/es/components/EditorPreview/index.less +0 -81
  50. package/es/components/Iconfont/index.d.ts +0 -6
  51. package/es/components/Iconfont/index.js +0 -29
  52. package/es/components/Iconfont/index.less +0 -0
  53. package/es/components/agreement/Detail/index.d.ts +0 -3
  54. package/es/components/agreement/Detail/index.js +0 -77
  55. package/es/components/agreement/Detail/serve.d.ts +0 -1
  56. package/es/components/agreement/Detail/serve.js +0 -6
  57. package/es/components/agreement/index.d.ts +0 -11
  58. package/es/components/agreement/index.js +0 -45
  59. package/es/components/agreement/index.less +0 -20
  60. package/es/components/avatar/index.d.ts +0 -13
  61. package/es/components/avatar/index.js +0 -25
  62. package/es/components/button/index.js +0 -36
  63. package/es/components/card/index.d.ts +0 -5
  64. package/es/components/card/index.js +0 -16
  65. package/es/components/card/index.less +0 -9
  66. package/es/components/checkbox/index.d.ts +0 -20
  67. package/es/components/checkbox/index.js +0 -43
  68. package/es/components/configProvider/index.d.ts +0 -113
  69. package/es/components/configProvider/index.js +0 -114
  70. package/es/components/datePicker/index.d.ts +0 -9
  71. package/es/components/datePicker/index.js +0 -17
  72. package/es/components/index.d.ts +0 -30
  73. package/es/components/index.js +0 -16
  74. package/es/components/input/index.d.ts +0 -35
  75. package/es/components/input/index.js +0 -97
  76. package/es/components/inputNumber/index.d.ts +0 -9
  77. package/es/components/inputNumber/index.js +0 -17
  78. package/es/components/pagination/index.d.ts +0 -10
  79. package/es/components/pagination/index.js +0 -18
  80. package/es/components/radio/index.d.ts +0 -13
  81. package/es/components/radio/index.js +0 -28
  82. package/es/components/select/index.d.ts +0 -9
  83. package/es/components/select/index.js +0 -17
  84. package/es/components/switch/index.d.ts +0 -10
  85. package/es/components/switch/index.js +0 -18
  86. package/es/config/index.d.ts +0 -30
  87. package/es/config/index.js +0 -18
  88. package/es/config/request.d.ts +0 -7
  89. package/es/config/request.js +0 -67
  90. package/es/config/utils.d.ts +0 -0
  91. package/es/config/utils.js +0 -0
  92. package/es/hooks/index.d.ts +0 -8
  93. package/es/hooks/index.js +0 -8
  94. package/es/hooks/useCountDown/index.d.ts +0 -10
  95. package/es/hooks/useCountDown/index.js +0 -48
  96. package/es/hooks/useDocumentScroll/index.d.ts +0 -8
  97. package/es/hooks/useDocumentScroll/index.js +0 -41
  98. package/es/hooks/useDocumentScroll/index.less +0 -0
  99. package/es/hooks/useMousemove/index.d.ts +0 -8
  100. package/es/hooks/useMousemove/index.js +0 -61
  101. package/es/hooks/useResponsive/index.d.ts +0 -2
  102. package/es/hooks/useResponsive/index.js +0 -29
  103. package/es/hooks/useResponsive/index.less +0 -0
  104. package/es/hooks/useSize/index.d.ts +0 -2
  105. package/es/hooks/useSize/index.js +0 -27
  106. package/es/hooks/useSize/index.less +0 -0
  107. package/es/hooks/useStateMulti/index.d.ts +0 -2
  108. package/es/hooks/useStateMulti/index.js +0 -29
  109. package/es/hooks/useStateWithCb/index.d.ts +0 -2
  110. package/es/hooks/useStateWithCb/index.js +0 -42
  111. package/es/hooks/useTable/index.d.ts +0 -12
  112. package/es/hooks/useTable/index.js +0 -74
  113. package/es/hooks/useTable/index.less +0 -0
  114. package/es/hooks/useTableModal/index.d.ts +0 -12
  115. package/es/hooks/useTableModal/index.js +0 -25
  116. package/es/hooks/useTableModal/index.less +0 -0
  117. package/es/hooks/useUrlState/index.d.ts +0 -2
  118. package/es/hooks/useUrlState/index.js +0 -56
  119. package/es/hooks/useWebSocket/index.d.ts +0 -13
  120. package/es/hooks/useWebSocket/index.js +0 -121
  121. package/es/index.d.ts +0 -4
  122. package/es/index.js +0 -4
  123. package/es/locales/en-US.d.ts +0 -11
  124. package/es/locales/en-US.js +0 -10
  125. package/es/locales/index.d.ts +0 -1
  126. package/es/locales/index.js +0 -23
  127. package/es/locales/zh-CN.d.ts +0 -11
  128. package/es/locales/zh-CN.js +0 -10
  129. package/es/locales/zh-TW.d.ts +0 -11
  130. package/es/locales/zh-TW.js +0 -10
  131. package/es/script/constants/index.js +0 -8
  132. package/es/script/deploy.js +0 -47
  133. package/es/script/index.js +0 -40
  134. package/es/script/package.json +0 -4
  135. package/es/script/release/index.js +0 -161
  136. package/es/script/release/release.js +0 -163
  137. package/es/script/uploadCode/index.js +0 -278
  138. package/es/script/uploadCode/uploadCode.js +0 -401
  139. package/es/script/utils/index.js +0 -321
  140. package/es/utils/index.d.ts +0 -3
  141. package/es/utils/index.js +0 -3
  142. package/es/utils/otherUtils.d.ts +0 -8
  143. package/es/utils/otherUtils.js +0 -12
  144. package/es/utils/storage.d.ts +0 -30
  145. package/es/utils/storage.js +0 -70
  146. package/es/utils/typeUtils.d.ts +0 -42
  147. package/es/utils/typeUtils.js +0 -86
  148. package/lib/bin/pisell.js +0 -26
  149. package/lib/business-components/colorInput/index.d.ts +0 -21
  150. package/lib/business-components/colorInput/index.js +0 -70
  151. package/lib/business-components/colorInput/index.less +0 -10
  152. package/lib/business-components/index.d.ts +0 -11
  153. package/lib/business-components/index.js +0 -54
  154. package/lib/business-components/rechargeOption/index.d.ts +0 -36
  155. package/lib/business-components/rechargeOption/index.js +0 -112
  156. package/lib/business-components/rechargeOption/index.less +0 -0
  157. package/lib/business-components/selectTag/index.d.ts +0 -25
  158. package/lib/business-components/selectTag/index.js +0 -181
  159. package/lib/business-components/selectTag/index.less +0 -22
  160. package/lib/business-components/sortModal/index.d.ts +0 -30
  161. package/lib/business-components/sortModal/index.js +0 -100
  162. package/lib/business-components/sortModal/index.less +0 -29
  163. package/lib/business-components/statistics/index.d.ts +0 -12
  164. package/lib/business-components/statistics/index.js +0 -63
  165. package/lib/business-components/statistics/index.less +0 -64
  166. package/lib/business-components/tagModal/index.d.ts +0 -17
  167. package/lib/business-components/tagModal/index.js +0 -66
  168. package/lib/business-hooks/index.d.ts +0 -2
  169. package/lib/business-hooks/index.js +0 -42
  170. package/lib/business-hooks/useModal/index.d.ts +0 -31
  171. package/lib/business-hooks/useModal/index.js +0 -68
  172. package/lib/business-hooks/useModal/index.less +0 -0
  173. package/lib/business-hooks/useTagModal/index.d.ts +0 -17
  174. package/lib/business-hooks/useTagModal/index.js +0 -61
  175. package/lib/components/ColorPicker/index.d.ts +0 -22
  176. package/lib/components/ColorPicker/index.js +0 -80
  177. package/lib/components/ColorPicker/index.less +0 -17
  178. package/lib/components/DragSort/index.d.ts +0 -2
  179. package/lib/components/DragSort/index.js +0 -101
  180. package/lib/components/EditorPreview/index.d.ts +0 -5
  181. package/lib/components/EditorPreview/index.js +0 -37
  182. package/lib/components/EditorPreview/index.less +0 -81
  183. package/lib/components/Iconfont/index.d.ts +0 -6
  184. package/lib/components/Iconfont/index.js +0 -48
  185. package/lib/components/Iconfont/index.less +0 -0
  186. package/lib/components/agreement/Detail/index.d.ts +0 -3
  187. package/lib/components/agreement/Detail/index.js +0 -86
  188. package/lib/components/agreement/Detail/serve.d.ts +0 -1
  189. package/lib/components/agreement/Detail/serve.js +0 -30
  190. package/lib/components/agreement/index.d.ts +0 -11
  191. package/lib/components/agreement/index.js +0 -82
  192. package/lib/components/agreement/index.less +0 -20
  193. package/lib/components/avatar/index.d.ts +0 -13
  194. package/lib/components/button/index.js +0 -36
  195. package/lib/components/card/index.d.ts +0 -5
  196. package/lib/components/card/index.js +0 -42
  197. package/lib/components/card/index.less +0 -9
  198. package/lib/components/checkbox/index.d.ts +0 -20
  199. package/lib/components/checkbox/index.js +0 -36
  200. package/lib/components/configProvider/index.d.ts +0 -113
  201. package/lib/components/configProvider/index.js +0 -159
  202. package/lib/components/datePicker/index.d.ts +0 -9
  203. package/lib/components/datePicker/index.js +0 -31
  204. package/lib/components/index.d.ts +0 -30
  205. package/lib/components/index.js +0 -83
  206. package/lib/components/input/index.d.ts +0 -35
  207. package/lib/components/input/index.js +0 -53
  208. package/lib/components/inputNumber/index.d.ts +0 -9
  209. package/lib/components/inputNumber/index.js +0 -31
  210. package/lib/components/pagination/index.d.ts +0 -10
  211. package/lib/components/pagination/index.js +0 -42
  212. package/lib/components/radio/index.d.ts +0 -13
  213. package/lib/components/radio/index.js +0 -36
  214. package/lib/components/select/index.d.ts +0 -9
  215. package/lib/components/select/index.js +0 -36
  216. package/lib/components/switch/index.d.ts +0 -10
  217. package/lib/components/switch/index.js +0 -42
  218. package/lib/config/index.d.ts +0 -30
  219. package/lib/config/index.js +0 -39
  220. package/lib/config/request.d.ts +0 -7
  221. package/lib/config/request.js +0 -76
  222. package/lib/config/utils.d.ts +0 -0
  223. package/lib/config/utils.js +0 -0
  224. package/lib/hooks/index.d.ts +0 -8
  225. package/lib/hooks/index.js +0 -57
  226. package/lib/hooks/useCountDown/index.d.ts +0 -10
  227. package/lib/hooks/useCountDown/index.js +0 -57
  228. package/lib/hooks/useDocumentScroll/index.d.ts +0 -8
  229. package/lib/hooks/useDocumentScroll/index.js +0 -54
  230. package/lib/hooks/useDocumentScroll/index.less +0 -0
  231. package/lib/hooks/useMousemove/index.d.ts +0 -8
  232. package/lib/hooks/useMousemove/index.js +0 -70
  233. package/lib/hooks/useResponsive/index.d.ts +0 -2
  234. package/lib/hooks/useResponsive/index.js +0 -47
  235. package/lib/hooks/useResponsive/index.less +0 -0
  236. package/lib/hooks/useSize/index.d.ts +0 -2
  237. package/lib/hooks/useSize/index.js +0 -45
  238. package/lib/hooks/useSize/index.less +0 -0
  239. package/lib/hooks/useStateMulti/index.d.ts +0 -2
  240. package/lib/hooks/useStateMulti/index.js +0 -43
  241. package/lib/hooks/useStateWithCb/index.d.ts +0 -2
  242. package/lib/hooks/useStateWithCb/index.js +0 -53
  243. package/lib/hooks/useTable/index.d.ts +0 -12
  244. package/lib/hooks/useTable/index.js +0 -75
  245. package/lib/hooks/useTable/index.less +0 -0
  246. package/lib/hooks/useTableModal/index.d.ts +0 -12
  247. package/lib/hooks/useTableModal/index.js +0 -43
  248. package/lib/hooks/useTableModal/index.less +0 -0
  249. package/lib/hooks/useUrlState/index.d.ts +0 -2
  250. package/lib/hooks/useUrlState/index.js +0 -59
  251. package/lib/hooks/useWebSocket/index.d.ts +0 -13
  252. package/lib/hooks/useWebSocket/index.js +0 -91
  253. package/lib/index.d.ts +0 -4
  254. package/lib/index.js +0 -22
  255. package/lib/locales/en-US.d.ts +0 -11
  256. package/lib/locales/en-US.js +0 -36
  257. package/lib/locales/index.d.ts +0 -1
  258. package/lib/locales/index.js +0 -59
  259. package/lib/locales/zh-CN.d.ts +0 -11
  260. package/lib/locales/zh-CN.js +0 -36
  261. package/lib/locales/zh-TW.d.ts +0 -11
  262. package/lib/locales/zh-TW.js +0 -36
  263. package/lib/script/constants/index.js +0 -35
  264. package/lib/script/deploy.js +0 -61
  265. package/lib/script/index.js +0 -61
  266. package/lib/script/package.json +0 -4
  267. package/lib/script/release/index.js +0 -116
  268. package/lib/script/release/release.js +0 -89
  269. package/lib/script/uploadCode/index.js +0 -202
  270. package/lib/script/uploadCode/uploadCode.js +0 -208
  271. package/lib/script/utils/index.js +0 -248
  272. package/lib/utils/index.d.ts +0 -3
  273. package/lib/utils/index.js +0 -21
  274. package/lib/utils/otherUtils.d.ts +0 -8
  275. package/lib/utils/otherUtils.js +0 -31
  276. package/lib/utils/storage.d.ts +0 -30
  277. package/lib/utils/storage.js +0 -63
  278. package/lib/utils/typeUtils.d.ts +0 -42
  279. package/lib/utils/typeUtils.js +0 -75
@@ -1,25 +0,0 @@
1
- import type { SelectProps } from 'antd5';
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>) => import("react/jsx-runtime").JSX.Element;
25
- export default SelectTag;
@@ -1,179 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
- import { Select, Tag } from 'antd5';
14
- import React, { useCallback, useImperativeHandle, useMemo } from 'react';
15
- import { useTagModal } from "../../business-hooks";
16
- import DragSort from "../../components/DragSort";
17
- import IconFont from "../../components/Iconfont";
18
- import { getText } from "../../locales";
19
- import { isArr, isFunction, isNumber, isString } from "../../utils";
20
- import ColorInput from "../colorInput";
21
- import "./index.less";
22
- import { jsx as _jsx } from "react/jsx-runtime";
23
- import { jsxs as _jsxs } from "react/jsx-runtime";
24
- import { Fragment as _Fragment } from "react/jsx-runtime";
25
- var defaultColor = '#000';
26
- var prefix = 'pisell-';
27
- var SelectTag = function SelectTag(props) {
28
- var selectTagRef = props.selectTagRef,
29
- value = props.value,
30
- _onChange = props.onChange,
31
- options = props.options,
32
- isColorSelect = props.isColorSelect;
33
- var tagValue = useMemo(function () {
34
- if (!isArr(value)) {
35
- return [];
36
- }
37
- if (value.every(function (item) {
38
- return isString(item) || isNumber(item);
39
- })) {
40
- return value;
41
- }
42
- return value.map(function (item) {
43
- return item.value;
44
- });
45
- }, [value]);
46
- var valueColorMap = useMemo(function () {
47
- if (!isColorSelect || !isArr(value)) {
48
- return {};
49
- }
50
- return value.reduce(function (pre, cur) {
51
- return _objectSpread(_objectSpread({}, pre), {}, _defineProperty({}, cur.value, cur.color));
52
- }, {});
53
- }, [value, options]);
54
- var valueLabelMap = useMemo(function () {
55
- return options.reduce(function (pre, cur) {
56
- return _objectSpread(_objectSpread({}, pre), {}, _defineProperty({}, cur.value, cur.label));
57
- }, {});
58
- }, [options]);
59
- var handleTagChange = useCallback(function (val) {
60
- if (isColorSelect) {
61
- var _value = val.map(function (item) {
62
- return {
63
- color: valueColorMap[item] || defaultColor,
64
- value: item
65
- };
66
- });
67
- isFunction(_onChange) && _onChange(_value);
68
- return;
69
- }
70
- isFunction(_onChange) && _onChange(val);
71
- }, [isColorSelect, _onChange, valueColorMap]);
72
- var _useTagModal = useTagModal({
73
- value: tagValue,
74
- onChange: handleTagChange,
75
- data: options,
76
- onOk: function onOk() {
77
- hideModal();
78
- },
79
- title: getText('pisell-design.select.tag.modal.title'),
80
- onCancel: function onCancel() {
81
- hideModal();
82
- }
83
- }),
84
- content = _useTagModal.content,
85
- hideModal = _useTagModal.hideModal,
86
- showModal = _useTagModal.showModal;
87
- useImperativeHandle(selectTagRef, function () {
88
- return {
89
- showModal: showModal,
90
- hideModal: hideModal
91
- };
92
- });
93
- var tagRender = function tagRender(props) {
94
- var label = props.label,
95
- value = props.value,
96
- closable = props.closable,
97
- onClose = props.onClose;
98
- var onPreventMouseDown = function onPreventMouseDown(event) {
99
- event.preventDefault();
100
- event.stopPropagation();
101
- };
102
- return /*#__PURE__*/_jsx(Tag, {
103
- onMouseDown: onPreventMouseDown,
104
- closable: closable,
105
- onClose: onClose,
106
- className: "".concat(prefix, "select-tag"),
107
- style: {
108
- color: valueColorMap[value] || defaultColor
109
- },
110
- children: label
111
- });
112
- };
113
- var handleSelectChange = useCallback(function (val) {
114
- var newVal = val;
115
- if (isColorSelect) {
116
- newVal = val.map(function (item) {
117
- return {
118
- value: item,
119
- color: valueColorMap[item] || defaultColor
120
- };
121
- });
122
- }
123
- isFunction(_onChange) && _onChange(newVal);
124
- }, [isColorSelect, valueColorMap]);
125
- var selectValue = useMemo(function () {
126
- if (!isArr(value)) {
127
- return [];
128
- }
129
- if (value.every(function (item) {
130
- return isString(item) || isNumber(item);
131
- })) {
132
- return value;
133
- }
134
- if (isColorSelect) {
135
- return value.map(function (item) {
136
- return item.value;
137
- });
138
- }
139
- }, [value, isColorSelect]);
140
- return /*#__PURE__*/_jsxs(_Fragment, {
141
- children: [/*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({}, props), {}, {
142
- value: selectValue,
143
- mode: "tags",
144
- options: options,
145
- onChange: handleSelectChange,
146
- tagRender: tagRender
147
- })), isColorSelect && /*#__PURE__*/_jsx(DragSort, {
148
- list: value || [],
149
- droppableId: "addressSort",
150
- draggableIdKey: "value",
151
- onChange: function onChange(_list) {
152
- isFunction(_onChange) && _onChange(_list);
153
- },
154
- children: function children(item, index) {
155
- return /*#__PURE__*/_jsxs("div", {
156
- className: "".concat(prefix, "sort-item"),
157
- children: [/*#__PURE__*/_jsx(IconFont, {
158
- type: "icon-drag",
159
- className: "".concat(prefix, "icon")
160
- }), /*#__PURE__*/_jsx("span", {
161
- className: "".concat(prefix, "sort-content"),
162
- children: /*#__PURE__*/_jsx("span", {
163
- className: "".concat(prefix, "tag-content"),
164
- children: valueLabelMap[item.value]
165
- })
166
- }), /*#__PURE__*/_jsx(ColorInput, {
167
- value: item.color,
168
- onChange: function onChange(val) {
169
- var _value = value ? _toConsumableArray(value) : [];
170
- _value[index].color = val;
171
- isFunction(_onChange) && _onChange(_value);
172
- }
173
- })]
174
- }, item.value);
175
- }
176
- }), content]
177
- });
178
- };
179
- export default SelectTag;
@@ -1,22 +0,0 @@
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
- }
@@ -1,30 +0,0 @@
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>) => import("react/jsx-runtime").JSX.Element;
30
- export default SortModal;
@@ -1,85 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import React, { useCallback, useEffect, useImperativeHandle, useMemo, useState } from 'react';
8
- import { isFunction } from "../../utils";
9
- import useModal from "../../business-hooks/useModal";
10
- import { DragSort, IconFont } from "../../components";
11
- import "./index.less";
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { jsxs as _jsxs } from "react/jsx-runtime";
14
- var prefix = 'pisell-';
15
- var SortModal = function SortModal(props) {
16
- var title = props.title,
17
- items = props.items,
18
- renderSortItem = props.renderSortItem,
19
- field = props.field,
20
- isShowIndex = props.isShowIndex,
21
- onOk = props.onOk,
22
- sortModalRef = props.sortModalRef,
23
- renderContent = props.renderContent;
24
- var _useState = useState(items),
25
- _useState2 = _slicedToArray(_useState, 2),
26
- sortItems = _useState2[0],
27
- setSortItems = _useState2[1];
28
- useEffect(function () {
29
- setSortItems(items);
30
- }, [items]);
31
- var RenderSortItem = useCallback(function (item, index) {
32
- return /*#__PURE__*/_jsxs("div", {
33
- className: "".concat(prefix, "sort-item"),
34
- children: [/*#__PURE__*/_jsx(IconFont, {
35
- type: "icon-drag",
36
- className: "".concat(prefix, "item")
37
- }), /*#__PURE__*/_jsxs("span", {
38
- className: "".concat(prefix, "sort-content"),
39
- children: [isShowIndex && index + 1, /*#__PURE__*/_jsx("span", {
40
- className: "".concat(prefix, "tag-content"),
41
- children: item[field.name]
42
- })]
43
- })]
44
- }, item[field.key]);
45
- }, [props]);
46
- var ModalContent = useMemo(function () {
47
- var content = /*#__PURE__*/_jsx(DragSort, {
48
- list: sortItems,
49
- droppableId: "addressSort",
50
- draggableIdKey: field.id,
51
- className: "".concat(prefix, "sort-list"),
52
- onChange: function onChange(_list) {
53
- setSortItems(_list);
54
- },
55
- children: isFunction(renderSortItem) ? renderSortItem : RenderSortItem
56
- });
57
- if (isFunction(renderContent)) {
58
- return renderContent(sortItems, content);
59
- }
60
- if (renderContent) {
61
- return renderContent;
62
- }
63
- return content;
64
- }, [sortItems, renderSortItem, RenderSortItem, renderContent]);
65
- var handleOk = useCallback(function () {
66
- isFunction(onOk) && onOk(sortItems);
67
- }, [onOk, sortItems]);
68
- var _useModal = useModal({
69
- children: ModalContent,
70
- title: title,
71
- onOk: handleOk
72
- }),
73
- content = _useModal.content,
74
- hideModal = _useModal.hideModal,
75
- visible = _useModal.visible,
76
- showModal = _useModal.showModal;
77
- useImperativeHandle(sortModalRef, function () {
78
- return {
79
- showModal: showModal,
80
- hideModal: hideModal
81
- };
82
- });
83
- return content;
84
- };
85
- export default SortModal;
@@ -1,29 +0,0 @@
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
- }
@@ -1,12 +0,0 @@
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;
@@ -1,38 +0,0 @@
1
- import { Skeleton } from 'antd5';
2
- import classNames from 'classnames';
3
- import React from 'react';
4
- import { useResponsive } from "../../hooks";
5
- import "./index.less";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- import { jsxs as _jsxs } from "react/jsx-runtime";
8
- var Statistics = function Statistics(props) {
9
- var loading = props.loading,
10
- _props$options = props.options,
11
- options = _props$options === void 0 ? [] : _props$options;
12
- var responsive = useResponsive();
13
- return /*#__PURE__*/_jsx("div", {
14
- className: classNames('pisell-statistics', 'pisell-scrollbar', props.className, {
15
- 'phone-wrap': responsive === 'phone'
16
- }),
17
- style: props.style,
18
- children: /*#__PURE__*/_jsx("div", {
19
- className: 'pisell-statistics-options',
20
- children: options.map(function (d, i) {
21
- return /*#__PURE__*/_jsxs("div", {
22
- className: 'pisell-statistics-item',
23
- children: [/*#__PURE__*/_jsx("div", {
24
- className: 'pisell-statistics-label',
25
- children: d.label
26
- }), /*#__PURE__*/_jsx("div", {
27
- className: 'pisell-statistics-value',
28
- children: loading ? /*#__PURE__*/_jsx(Skeleton.Input, {
29
- active: true,
30
- size: 'default'
31
- }) : d.value
32
- })]
33
- }, i);
34
- })
35
- })
36
- });
37
- };
38
- export default Statistics;
@@ -1,64 +0,0 @@
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
- }
@@ -1,17 +0,0 @@
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>) => import("react/jsx-runtime").JSX.Element;
17
- export default TagModal;
@@ -1,58 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _excluded = ["data", "onChange", "value", "tagModalRef"];
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
- import { Checkbox, Col, Row } from 'antd5';
11
- import React, { useImperativeHandle, useMemo } from 'react';
12
- import useModal from "../../business-hooks/useModal";
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- var TagModal = function TagModal(props) {
15
- var data = props.data,
16
- _onChange = props.onChange,
17
- value = props.value,
18
- tagModalRef = props.tagModalRef,
19
- others = _objectWithoutProperties(props, _excluded);
20
- var Content = useMemo(function () {
21
- return /*#__PURE__*/_jsx(Checkbox.Group, {
22
- style: {
23
- width: '100%'
24
- },
25
- onChange: function onChange(val) {
26
- return _onChange(val);
27
- },
28
- value: value,
29
- children: /*#__PURE__*/_jsx(Row, {
30
- gutter: 10,
31
- children: data.map(function (d, i) {
32
- return /*#__PURE__*/_jsx(Col, {
33
- span: 8,
34
- children: /*#__PURE__*/_jsx(Checkbox, {
35
- value: d.value,
36
- children: d.label
37
- })
38
- }, i);
39
- })
40
- })
41
- });
42
- }, [data]);
43
- var _useModal = useModal(_objectSpread(_objectSpread({}, others), {}, {
44
- children: Content,
45
- destroyOnClose: true
46
- })),
47
- showModal = _useModal.showModal,
48
- hideModal = _useModal.hideModal,
49
- content = _useModal.content;
50
- useImperativeHandle(tagModalRef, function () {
51
- return {
52
- showModal: showModal,
53
- hideModal: hideModal
54
- };
55
- });
56
- return content;
57
- };
58
- export default TagModal;
@@ -1,2 +0,0 @@
1
- export { default as useModal } from './useModal';
2
- export { default as useTagModal } from './useTagModal';
@@ -1,2 +0,0 @@
1
- export { default as useModal } from "./useModal";
2
- export { default as useTagModal } from "./useTagModal";
@@ -1,31 +0,0 @@
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: import("react/jsx-runtime").JSX.Element;
30
- };
31
- export default useModal;