@ccs-ui/rc-pro 2.3.6-beta-10 → 2.3.6-beta-13

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/es/index.d.ts CHANGED
@@ -24,6 +24,7 @@ export { default as CcsProTabs } from './pro-tabs';
24
24
  export { default as CcsResizeObserver } from './resize-observer';
25
25
  export { default as CcsResult } from './result';
26
26
  export { default as CcsApiSelect } from './select';
27
+ export { default as CcsSelectCustomize } from './select-customize';
27
28
  export { default as CcsStatusTag } from './status-tag';
28
29
  export { default as CcsTable } from './table';
29
30
  export { default as CcsTimePicker } from './time-picker';
package/es/index.js CHANGED
@@ -24,6 +24,7 @@ export { default as CcsProTabs } from "./pro-tabs";
24
24
  export { default as CcsResizeObserver } from "./resize-observer";
25
25
  export { default as CcsResult } from "./result";
26
26
  export { default as CcsApiSelect } from "./select";
27
+ export { default as CcsSelectCustomize } from "./select-customize";
27
28
  export { default as CcsStatusTag } from "./status-tag";
28
29
  export { default as CcsTable } from "./table";
29
30
  export { default as CcsTimePicker } from "./time-picker";
@@ -0,0 +1,26 @@
1
+ import { SelectProps } from 'antd';
2
+ import { ReactElement } from 'react';
3
+ export type SelectCustomInstance = {
4
+ value?: any;
5
+ onClose?: () => void;
6
+ onChange?: (value: any) => void;
7
+ onChangeLabel?: (label?: string) => void;
8
+ };
9
+ interface SelectCustomizeProps extends SelectProps {
10
+ /** 选择触发器宽度 */
11
+ width?: number;
12
+ /** 内容宽度 */
13
+ contentWidth?: number;
14
+ /** 选择模式,下拉或弹框 */
15
+ customMode?: 'select' | 'modal';
16
+ /** 自定义内容 */
17
+ children: ReactElement;
18
+ /** form item value */
19
+ value?: any;
20
+ /** 隐藏确定 */
21
+ hideOk?: boolean;
22
+ /** form item onChange */
23
+ onChange?: (e: any) => void;
24
+ }
25
+ export default function CcsSelectCustomize({ width, title, hideOk, children, customMode, contentWidth, value, onChange, style, ...otherProps }: SelectCustomizeProps): import("react/jsx-runtime").JSX.Element;
26
+ export {};
@@ -0,0 +1,140 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["width", "title", "hideOk", "children", "customMode", "contentWidth", "value", "onChange", "style"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
+ 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."); }
10
+ 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); }
11
+ 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; }
12
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+ 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; }
15
+ 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; }
16
+ import { CloseOutlined, SelectOutlined } from '@ant-design/icons';
17
+ import { Button, Modal, Select, Space } from 'antd';
18
+ import React, { useState } from 'react';
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
+ import { jsxs as _jsxs } from "react/jsx-runtime";
21
+ import { Fragment as _Fragment } from "react/jsx-runtime";
22
+ export default function CcsSelectCustomize(_ref) {
23
+ var width = _ref.width,
24
+ title = _ref.title,
25
+ hideOk = _ref.hideOk,
26
+ children = _ref.children,
27
+ _ref$customMode = _ref.customMode,
28
+ customMode = _ref$customMode === void 0 ? 'select' : _ref$customMode,
29
+ contentWidth = _ref.contentWidth,
30
+ value = _ref.value,
31
+ onChange = _ref.onChange,
32
+ style = _ref.style,
33
+ otherProps = _objectWithoutProperties(_ref, _excluded);
34
+ var _useState = useState(false),
35
+ _useState2 = _slicedToArray(_useState, 2),
36
+ open = _useState2[0],
37
+ setOpen = _useState2[1];
38
+ var onClick = function onClick() {
39
+ setOpen(true);
40
+ };
41
+
42
+ // 选择说明
43
+ var _useState3 = useState(undefined),
44
+ _useState4 = _slicedToArray(_useState3, 2),
45
+ selectedLabel = _useState4[0],
46
+ setSelectedLabel = _useState4[1];
47
+
48
+ // 确定按钮
49
+ var onClose = function onClose(e) {
50
+ e === null || e === void 0 || e.stopPropagation();
51
+ setOpen(false);
52
+ };
53
+ var isModal = customMode === 'modal';
54
+ return /*#__PURE__*/_jsxs(_Fragment, {
55
+ children: [/*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({
56
+ allowClear: true,
57
+ suffixIcon: /*#__PURE__*/_jsx(SelectOutlined, {})
58
+ }, otherProps), {}, {
59
+ open: isModal ? false : open,
60
+ popupMatchSelectWidth: contentWidth,
61
+ onClear: function onClear() {
62
+ onChange === null || onChange === void 0 || onChange(undefined);
63
+ setSelectedLabel(undefined);
64
+ },
65
+ dropdownRender: function dropdownRender() {
66
+ return isModal ? /*#__PURE__*/_jsx("div", {}) : /*#__PURE__*/_jsxs("div", {
67
+ children: [title && /*#__PURE__*/_jsxs("div", {
68
+ style: {
69
+ padding: 10,
70
+ borderBottom: '1px solid #f5f5f5',
71
+ display: 'flex',
72
+ justifyContent: 'space-between'
73
+ },
74
+ children: [/*#__PURE__*/_jsx("div", {
75
+ children: title
76
+ }), /*#__PURE__*/_jsx(Button, {
77
+ type: "text",
78
+ size: "small",
79
+ onClick: onClose,
80
+ children: /*#__PURE__*/_jsx(CloseOutlined, {
81
+ style: {
82
+ color: 'rgba(0,0,0,0.55)'
83
+ }
84
+ })
85
+ })]
86
+ }), /*#__PURE__*/_jsx("div", {
87
+ children: children && /*#__PURE__*/React.cloneElement(children, {
88
+ value: value,
89
+ onClose: onClose,
90
+ onChange: onChange,
91
+ onChangeLabel: setSelectedLabel
92
+ })
93
+ }), !hideOk && /*#__PURE__*/_jsx("div", {
94
+ style: {
95
+ textAlign: 'right',
96
+ padding: 10,
97
+ borderTop: '1px solid #f5f5f5'
98
+ },
99
+ children: /*#__PURE__*/_jsx(Space, {
100
+ children: /*#__PURE__*/_jsx(Button, {
101
+ type: "primary",
102
+ onClick: onClose,
103
+ children: "\u786E\u5B9A"
104
+ })
105
+ })
106
+ })]
107
+ });
108
+ },
109
+ value: selectedLabel,
110
+ onClick: onClick,
111
+ style: _objectSpread(_objectSpread({}, style), {}, {
112
+ width: width
113
+ })
114
+ })), isModal && /*#__PURE__*/_jsxs(Modal, {
115
+ open: open,
116
+ title: title,
117
+ width: contentWidth,
118
+ onCancel: onClose,
119
+ footer: null,
120
+ children: [children && /*#__PURE__*/React.cloneElement(children, {
121
+ value: value,
122
+ onClose: onClose,
123
+ onChange: onChange,
124
+ onChangeLabel: setSelectedLabel
125
+ }), !hideOk && /*#__PURE__*/_jsx("div", {
126
+ onClick: onClose,
127
+ style: {
128
+ textAlign: 'right',
129
+ padding: '8px 12px 8px 0',
130
+ borderTop: '1px solid rgba(0,0,0,0.1)',
131
+ marginTop: 12
132
+ },
133
+ children: /*#__PURE__*/_jsx(Button, {
134
+ type: "primary",
135
+ children: "\u786E\u5B9A"
136
+ })
137
+ })]
138
+ })]
139
+ });
140
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "2.3.6-beta-10",
3
+ "version": "2.3.6-beta-13",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": {