@pisell/common 0.0.4 → 0.0.6

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.
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
1
  import type { ColProps } from 'antd/lib/col';
3
- import type { FormListFieldData, FormListProps } from 'antd/lib/form/FormList';
4
2
  import type { FormItemProps } from 'antd/lib/form/FormItem';
3
+ import type { FormListFieldData, FormListProps } from 'antd/lib/form/FormList';
4
+ import React from 'react';
5
5
  import type { SortModalProps } from '../sortModal';
6
6
  import type { FormInstance } from 'antd/es/form/hooks/useForm';
7
7
  export interface RechargeOptionProps {
@@ -4,11 +4,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import React, { useCallback, useImperativeHandle, useMemo, useRef } from 'react';
7
+ import { DeleteOutlined } from '@ant-design/icons';
8
8
  import { Button, Col, Form, Input, Row } from 'antd';
9
+ import React, { useCallback, useImperativeHandle, useMemo, useRef } from 'react';
9
10
  import { getUniqueId, isFunction } from "../../utils";
10
- import { DeleteOutlined } from '@ant-design/icons';
11
- import SortModal from "../sortModal";
12
11
  import { getText } from "../../locales";
13
12
  import { jsx as _jsx } from "react/jsx-runtime";
14
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -26,9 +25,7 @@ var RechargeOption = function RechargeOption(props) {
26
25
  addBtnText = props.addBtnText,
27
26
  editBtnText = props.editBtnText,
28
27
  onEditClick = props.onEditClick,
29
- rechargeOptionRef = props.rechargeOptionRef,
30
- sortModalProps = props.sortModalProps,
31
- form = props.form;
28
+ rechargeOptionRef = props.rechargeOptionRef;
32
29
  var sortModalRef = useRef(null);
33
30
  var genDefaultData = useCallback(function (others) {
34
31
  return columnOption.reduce(function (acc, cur) {
@@ -50,13 +47,19 @@ var RechargeOption = function RechargeOption(props) {
50
47
  }
51
48
  };
52
49
  });
53
- var handleSortModalOk = useCallback(function (list) {
54
- var _sortModalRef$current2;
55
- form.setFieldsValue(_defineProperty({}, name, list));
56
- (_sortModalRef$current2 = sortModalRef.current) === null || _sortModalRef$current2 === void 0 ? void 0 : _sortModalRef$current2.hideModal();
57
- }, [name]);
58
- return /*#__PURE__*/_jsxs("div", {
59
- children: [/*#__PURE__*/_jsxs("div", {
50
+
51
+ // const handleSortModalOk = useCallback(
52
+ // (list: any[]) => {
53
+ // form.setFieldsValue({
54
+ // [name as string]: list,
55
+ // });
56
+ // sortModalRef.current?.hideModal();
57
+ // },
58
+ // [name]
59
+ // );
60
+
61
+ return /*#__PURE__*/_jsx("div", {
62
+ children: /*#__PURE__*/_jsxs("div", {
60
63
  children: [/*#__PURE__*/_jsx(Row, {
61
64
  gutter: 10,
62
65
  style: {
@@ -123,14 +126,7 @@ var RechargeOption = function RechargeOption(props) {
123
126
  });
124
127
  }
125
128
  })]
126
- }), /*#__PURE__*/_jsx(SortModal, {
127
- isShowIndex: false,
128
- field: sortModalProps === null || sortModalProps === void 0 ? void 0 : sortModalProps.field,
129
- title: sortModalProps === null || sortModalProps === void 0 ? void 0 : sortModalProps.title,
130
- items: form.getFieldValue(name) || [],
131
- sortModalRef: sortModalRef,
132
- onOk: handleSortModalOk
133
- })]
129
+ })
134
130
  });
135
131
  };
136
132
  export default RechargeOption;
@@ -83,7 +83,6 @@ var SelectTag = function SelectTag(props) {
83
83
  }),
84
84
  content = _useTagModal.content,
85
85
  hideModal = _useTagModal.hideModal,
86
- visible = _useTagModal.visible,
87
86
  showModal = _useTagModal.showModal;
88
87
  useImperativeHandle(selectTagRef, function () {
89
88
  return {
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
1
  import { Skeleton } from 'antd';
3
2
  import classNames from 'classnames';
3
+ import React from 'react';
4
4
  import { useResponsive } from "../../hooks";
5
5
  import "./index.less";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -7,8 +7,8 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
7
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
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
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 React, { useImperativeHandle, useMemo } from 'react';
11
10
  import { Checkbox, Col, Row } from 'antd';
11
+ import React, { useImperativeHandle, useMemo } from 'react';
12
12
  import useModal from "../../business-hooks/useModal";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  var TagModal = function TagModal(props) {
@@ -45,7 +45,6 @@ var TagModal = function TagModal(props) {
45
45
  destroyOnClose: true
46
46
  })),
47
47
  showModal = _useModal.showModal,
48
- visible = _useModal.visible,
49
48
  hideModal = _useModal.hideModal,
50
49
  content = _useModal.content;
51
50
  useImperativeHandle(tagModalRef, function () {
@@ -7,9 +7,9 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
7
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
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
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 useModal from "../useModal";
11
- import React, { useMemo } from 'react';
12
10
  import { Checkbox, Col, Row } from 'antd';
11
+ import { useMemo } from 'react';
12
+ import useModal from "../useModal";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  var useTagModal = function useTagModal(props) {
15
15
  var data = props.data,
@@ -1,4 +1,5 @@
1
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 _getConfig, _getConfig$ENV;
2
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; }
3
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; }
4
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; }
@@ -17,7 +18,7 @@ import React from 'react';
17
18
  import { getConfig } from "../../config";
18
19
  import { jsx as _jsx } from "react/jsx-runtime";
19
20
  var MyIcon = createFromIconfontCN({
20
- scriptUrl: getConfig().ENV.static + '/static/fonts/iconfont/iconfont.js?q=' + new Date().getTime() // 在 iconfont.cn 上生成
21
+ scriptUrl: ((_getConfig = getConfig()) === null || _getConfig === void 0 ? void 0 : (_getConfig$ENV = _getConfig.ENV) === null || _getConfig$ENV === void 0 ? void 0 : _getConfig$ENV.static) + '/static/fonts/iconfont/iconfont.js?q=' + new Date().getTime() // 在 iconfont.cn 上生成
21
22
  });
22
23
 
23
24
  var IconFont = function IconFont(props) {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { ButtonProps } from 'antd';
3
2
  declare const TestButton: (props: ButtonProps) => JSX.Element;
4
3
  export default TestButton;
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
1
  import type { ColProps } from 'antd/lib/col';
3
- import type { FormListFieldData, FormListProps } from 'antd/lib/form/FormList';
4
2
  import type { FormItemProps } from 'antd/lib/form/FormItem';
3
+ import type { FormListFieldData, FormListProps } from 'antd/lib/form/FormList';
4
+ import React from 'react';
5
5
  import type { SortModalProps } from '../sortModal';
6
6
  import type { FormInstance } from 'antd/es/form/hooks/useForm';
7
7
  export interface RechargeOptionProps {
@@ -32,11 +32,10 @@ __export(rechargeOption_exports, {
32
32
  default: () => rechargeOption_default
33
33
  });
34
34
  module.exports = __toCommonJS(rechargeOption_exports);
35
- var import_react = __toESM(require("react"));
35
+ var import_icons = require("@ant-design/icons");
36
36
  var import_antd = require("antd");
37
+ var import_react = __toESM(require("react"));
37
38
  var import_utils = require("../../utils");
38
- var import_icons = require("@ant-design/icons");
39
- var import_sortModal = __toESM(require("../sortModal"));
40
39
  var import_locales = require("../../locales");
41
40
  var RechargeOption = (props) => {
42
41
  const {
@@ -46,9 +45,9 @@ var RechargeOption = (props) => {
46
45
  addBtnText,
47
46
  editBtnText,
48
47
  onEditClick,
49
- rechargeOptionRef,
50
- sortModalProps,
51
- form
48
+ rechargeOptionRef
49
+ // sortModalProps,
50
+ // form,
52
51
  } = props;
53
52
  const sortModalRef = (0, import_react.useRef)(null);
54
53
  const genDefaultData = (0, import_react.useCallback)(
@@ -67,16 +66,6 @@ var RechargeOption = (props) => {
67
66
  (_a = sortModalRef.current) == null ? void 0 : _a.showModal();
68
67
  }
69
68
  }));
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
69
  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
70
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: item.span, key: item.label }, item.label);
82
71
  })), /* @__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) => {
@@ -116,17 +105,7 @@ var RechargeOption = (props) => {
116
105
  }
117
106
  },
118
107
  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
- ));
108
+ )))));
130
109
  };
131
110
  var rechargeOption_default = RechargeOption;
132
111
  // Annotate the CommonJS export names for ESM import in node:
@@ -83,7 +83,7 @@ var SelectTag = (props) => {
83
83
  },
84
84
  [isColorSelect, onChange, valueColorMap]
85
85
  );
86
- const { content, hideModal, visible, showModal } = (0, import_business_hooks.useTagModal)({
86
+ const { content, hideModal, showModal } = (0, import_business_hooks.useTagModal)({
87
87
  value: tagValue,
88
88
  onChange: handleTagChange,
89
89
  data: options,
@@ -32,9 +32,9 @@ __export(statistics_exports, {
32
32
  default: () => statistics_default
33
33
  });
34
34
  module.exports = __toCommonJS(statistics_exports);
35
- var import_react = __toESM(require("react"));
36
35
  var import_antd = require("antd");
37
36
  var import_classnames = __toESM(require("classnames"));
37
+ var import_react = __toESM(require("react"));
38
38
  var import_hooks = require("../../hooks");
39
39
  var import_index = require("./index.less");
40
40
  var Statistics = (props) => {
@@ -32,8 +32,8 @@ __export(tagModal_exports, {
32
32
  default: () => tagModal_default
33
33
  });
34
34
  module.exports = __toCommonJS(tagModal_exports);
35
- var import_react = __toESM(require("react"));
36
35
  var import_antd = require("antd");
36
+ var import_react = __toESM(require("react"));
37
37
  var import_useModal = __toESM(require("../../business-hooks/useModal"));
38
38
  var TagModal = (props) => {
39
39
  const { data, onChange, value, tagModalRef, ...others } = props;
@@ -50,7 +50,7 @@ var TagModal = (props) => {
50
50
  }))
51
51
  );
52
52
  }, [data]);
53
- const { showModal, visible, hideModal, content } = (0, import_useModal.default)({
53
+ const { showModal, hideModal, content } = (0, import_useModal.default)({
54
54
  ...others,
55
55
  children: Content,
56
56
  destroyOnClose: true
@@ -32,21 +32,21 @@ __export(useTagModal_exports, {
32
32
  default: () => useTagModal_default
33
33
  });
34
34
  module.exports = __toCommonJS(useTagModal_exports);
35
- var import_useModal = __toESM(require("../useModal"));
36
- var import_react = __toESM(require("react"));
37
35
  var import_antd = require("antd");
36
+ var import_react = require("react");
37
+ var import_useModal = __toESM(require("../useModal"));
38
38
  var useTagModal = (props) => {
39
39
  const { data, onChange, value, ...others } = props;
40
40
  const Content = (0, import_react.useMemo)(() => {
41
- return /* @__PURE__ */ import_react.default.createElement(
41
+ return /* @__PURE__ */ React.createElement(
42
42
  import_antd.Checkbox.Group,
43
43
  {
44
44
  style: { width: "100%" },
45
45
  onChange: (val) => onChange == null ? void 0 : onChange(val),
46
46
  value
47
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));
48
+ /* @__PURE__ */ React.createElement(import_antd.Row, { gutter: 10 }, data.map((d, i) => {
49
+ return /* @__PURE__ */ React.createElement(import_antd.Col, { span: 8, key: i }, /* @__PURE__ */ React.createElement(import_antd.Checkbox, { value: d.value }, d.label));
50
50
  }))
51
51
  );
52
52
  }, [data, value]);
@@ -35,8 +35,9 @@ module.exports = __toCommonJS(Iconfont_exports);
35
35
  var import_icons = require("@ant-design/icons");
36
36
  var import_react = __toESM(require("react"));
37
37
  var import_config = require("../../config");
38
+ var _a, _b;
38
39
  var MyIcon = (0, import_icons.createFromIconfontCN)({
39
- scriptUrl: (0, import_config.getConfig)().ENV.static + "/static/fonts/iconfont/iconfont.js?q=" + new Date().getTime()
40
+ scriptUrl: ((_b = (_a = (0, import_config.getConfig)()) == null ? void 0 : _a.ENV) == null ? void 0 : _b.static) + "/static/fonts/iconfont/iconfont.js?q=" + new Date().getTime()
40
41
  // 在 iconfont.cn 上生成
41
42
  });
42
43
  var IconFont = (props) => {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { ButtonProps } from 'antd';
3
2
  declare const TestButton: (props: ButtonProps) => JSX.Element;
4
3
  export default TestButton;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/common",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "A collection of reusable UI components for web development",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
@@ -55,7 +55,7 @@
55
55
  ]
56
56
  },
57
57
  "dependencies": {
58
- "antd": "5.5.0",
58
+ "antd": "^5.5.0",
59
59
  "array-move": "^3.0.1",
60
60
  "react-beautiful-dnd": "^13.1.0",
61
61
  "react-color": "^2.19.3"
@@ -88,6 +88,7 @@
88
88
  "peerDependencies": {
89
89
  "@ant-design/icons": "^4.8.0",
90
90
  "ahooks": "^2.10.0",
91
+ "antd": "^5.5.0",
91
92
  "classnames": "^2.3.1",
92
93
  "react": ">=17.0",
93
94
  "react-dom": ">=17.0",