@bit-sun/business-component 3.2.0-alpha.2 → 3.2.0-alpha.3

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.
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { CollapsePanelProps } from 'antd';
3
+ import './index.less';
4
+ export interface ExtendedPanelProps extends CollapsePanelProps {
5
+ extra?: React.ReactNode;
6
+ titleExtra?: React.ReactNode;
7
+ isActive?: boolean;
8
+ }
9
+ declare const ExtendedPanel: React.FC<ExtendedPanelProps>;
10
+ export default ExtendedPanel;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { CollapseProps } from 'antd';
3
+ import './index.less';
4
+ declare const _default: React.FC<CollapseProps> & {
5
+ Board: React.FC<import("./ExtendedPanel").ExtendedPanelProps>;
6
+ };
7
+ export default _default;
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import type { PropsWithChildren } from 'react';
3
+ import type { TooltipProps } from 'antd';
4
+ export interface copyableProps {
5
+ text: string;
6
+ onCopy: (event: any) => void;
7
+ icon: React.ReactNode;
8
+ tooltips: false | [React.ReactNode, React.ReactNode];
9
+ format: 'text/plain' | 'text/html';
10
+ }
11
+ export interface ellipsisProps {
12
+ rows: number;
13
+ expandable: boolean;
14
+ suffix?: string;
15
+ symbol?: React.ReactNode;
16
+ tooltip?: boolean | React.ReactNode | TooltipProps;
17
+ onExpand?: (event: React.MouseEvent<HTMLElement>) => void;
18
+ onEllipsis?: (ellipsis: boolean) => void;
19
+ }
20
+ interface IProps {
21
+ label: React.ReactNode | string;
22
+ children: React.ReactNode | string;
23
+ copyable?: boolean | copyableProps;
24
+ icon?: string | React.ReactNode;
25
+ ellipsis?: ellipsisProps;
26
+ }
27
+ export type SectionProps = PropsWithChildren<IProps>;
28
+ declare const Section: ({ children, copyable, label, icon, ellipsis, }: SectionProps) => React.JSX.Element;
29
+ export default Section;
package/dist/index.d.ts CHANGED
@@ -29,3 +29,5 @@ export { default as EllipsisTooltip } from './components/Functional/EllipsisTool
29
29
  export * from './components/Functional/BsAntdSula/index';
30
30
  export { default as RuleComponent } from './components/Solution/RuleComponent';
31
31
  export { default as RuleSetter } from './components/Solution/RuleSetter';
32
+ export { default as ExtendedCollapse } from './components/Common/ExtendedCollapse';
33
+ export { default as Section } from './components/Common/Section';
package/dist/index.esm.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import axios from 'axios';
2
2
  import request$1 from 'umi-request';
3
3
  import cookie from 'js-cookie';
4
- import { message as message$1, Tooltip, Image, Popover, Card, Avatar, Badge, Menu, Input, InputNumber, Space, Button, Dropdown, Upload, Checkbox, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, Typography, Alert, Breadcrumb, Drawer as Drawer$1, List, Radio, Tree, Row, Col, Result, Tabs, Affix, Cascader, DatePicker, TimePicker, Switch } from 'antd';
4
+ import { message as message$1, Tooltip, Image, Popover, Card, Avatar, Badge, Menu, Input, InputNumber, Space, Button, Dropdown, Upload, Checkbox, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, Typography, Alert, Breadcrumb, Drawer as Drawer$1, List, Radio, Tree, Row, Col, Result, Tabs, Affix, Cascader, DatePicker, TimePicker, Switch, Collapse } from 'antd';
5
5
  import _, { isNil, escapeRegExp, omit, debounce, cloneDeep as cloneDeep$1, throttle, isEmpty } from 'lodash';
6
6
  import memoizeOne from 'memoize-one';
7
7
  import { formatMessage, history, useLocation, Link, useModel, setLocale, useIntl, request as request$3 } from 'umi';
8
8
  import isEqual from 'lodash/isEqual';
9
9
  import React$1, { useState, useEffect, forwardRef, useImperativeHandle, useRef, useMemo, Component, useLayoutEffect, createRef } from 'react';
10
10
  import moment$1 from 'moment';
11
- import { EyeOutlined, DeleteOutlined, EditOutlined, CopyOutlined, CloseSquareOutlined, WarningOutlined, SendOutlined, ProfileTwoTone, ExclamationCircleOutlined, DownOutlined, UnorderedListOutlined, SearchOutlined, CaretLeftOutlined, CloseCircleOutlined, ArrowLeftOutlined, FolderOutlined, EllipsisOutlined, CaretDownOutlined, HomeOutlined, DoubleLeftOutlined, DoubleRightOutlined, MenuUnfoldOutlined, DashOutlined, SettingOutlined, BulbOutlined, PlayCircleOutlined, SaveOutlined, FullscreenExitOutlined, MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons';
11
+ import { EyeOutlined, DeleteOutlined, EditOutlined, CopyOutlined, CloseSquareOutlined, WarningOutlined, SendOutlined, ProfileTwoTone, ExclamationCircleOutlined, DownOutlined, UnorderedListOutlined, SearchOutlined, CaretLeftOutlined, CloseCircleOutlined, ArrowLeftOutlined, FolderOutlined, EllipsisOutlined, CaretDownOutlined, HomeOutlined, DoubleLeftOutlined, DoubleRightOutlined, MenuUnfoldOutlined, DashOutlined, SettingOutlined, BulbOutlined, PlayCircleOutlined, SaveOutlined, FullscreenExitOutlined, MinusCircleOutlined, PlusCircleOutlined, DownCircleFilled } from '@ant-design/icons';
12
12
  import { request as request$2, Table as Table$1, QueryTable, Form as Form$1 } from 'bssula';
13
13
  import 'qs';
14
14
  import { utils, writeFile, read } from 'xlsx';
@@ -36453,4 +36453,109 @@ var index$7 = /*#__PURE__*/forwardRef(function (props, ref) {
36453
36453
  })));
36454
36454
  });
36455
36455
 
36456
- export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, AuthButton, BillEntry, BsCascader, index$5 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$1 as CheckOneUser, ColumnSettingTable, ColumnsEdit, CommodityEntry, DataImport, DataValidation, index$3 as DetailPageWrapper, EllipsisTooltip, ExportIcon, GuideWrapper, HandleTotalCount, index$4 as HomePageWrapper, JsonQueryTable, index$6 as MoreTreeTable, QueryMutipleInput, RuleObjectComponent as RuleComponent, index$7 as RuleSetter, SearchSelect, index$2 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, TableColumnSetting, TreeSearchSelect, authFunc, calculateValidPeriod, checkQuantityAccuracy, createUniqID, downloadExcel, ergodicMenuRoutes, formatter, getAccountID, getAccountId, getBreadcrumbNameMap, getCommonInfoKey, getConfigTableColumns, getCurrentTargetBgId, getCurrentTenantId, getDictionarySource, getDictionaryTextByValue, getEmployeeCode, getEmployeeId, getItemDefaultWidth$1 as getItemDefaultWidth, getJoinDictionaryText, getLastKey, getLimitMenuDataKey, getLocalStorageSaveKey, getMenuAuthDataKey, getSessionId, getSkuImg, getTenantList, getUserId, getUserName, go2BackAndClose, handleAntdColumnsSpecialParams, handleBaseUrlPre, handleBeforeUpload, handleBssulaColumnsSpecialParams, handleCommonTimeRender$1 as handleCommonTimeRender, handleConvertResponse, handleError, handleExport, handleExportBarCode, handleJudgeAuthButtons, handleOssUrl, handleRequestAuthHeader, handleRequestHeader, handleRequestUrl, handleStatusBadge, handleTextBreakSpaces, handleTextDouble$1 as handleTextDouble, handleTextDoubleOrId, handleTextLineFeed$1 as handleTextLineFeed, handleTextOverflow$1 as handleTextOverflow, handleTextTooltip, handleTextWarp, handleTextWarpCustom, handleTooltip$1 as handleTooltip, handleTooltipHours$1 as handleTooltipHours, handleUserPhone, judgeIsEmpty, judgeIsRequestError, judgeIsRequestSuccess, keyToWord, memoizeOneFormatter, noEmptyArr, noEmptyArray, paramsControl, parseWidth, precisionQuantity, randomString, readerXlsxToList, removeCurrentTenantId, removeTenantList, renderFixed2, renderNumberText, saveCurrentTenantId, saveTenantList, setConfigTableColumns, shouldUseAuth, socketFunctions, sulaTableRenderTooltip, tableColumnsImage$1 as tableColumnsImage, textIcon, updateGuanDate, userColumns$1 as userColumns, userInfoCard$1 as userInfoCard, uuid, writeListToXlsx };
36456
+ var css_248z$v = ".bs-collapse-wrap {\n border-radius: 4px;\n overflow: hidden;\n}\n.bs-collapse-wrap .bs-collapse-header-wrap {\n background: #fff;\n}\n.bs-collapse-wrap .bs-collapse-icon {\n color: #b6b6b6;\n transition: transform 0.3s;\n}\n.bs-collapse-wrap .bs-guidewrap-icon-toogle {\n transform: rotate(180deg);\n}\n.bs-collapse-wrap .bs-collapse-header-title {\n font-weight: 500;\n font-size: 14px;\n color: #000000;\n}\n.bs-collapse-wrap .bs-collapse-header-divider {\n width: 3px;\n height: 20px;\n background: #02aa4c;\n}\n.bs-collapse-header-boder .ant-collapse .ant-collapse-item > .ant-collapse-header {\n border-bottom: 1px solid #f0f0f0;\n padding: 8px 16px;\n}\n";
36457
+ styleInject(css_248z$v);
36458
+
36459
+ var _excluded$k = ["titleExtra", "header", "showArrow"];
36460
+ var Panel = Collapse.Panel;
36461
+ var ExtendedPanel = function ExtendedPanel(_ref) {
36462
+ var titleExtra = _ref.titleExtra,
36463
+ header = _ref.header,
36464
+ _ref$showArrow = _ref.showArrow,
36465
+ showArrow = _ref$showArrow === void 0 ? false : _ref$showArrow,
36466
+ props = _objectWithoutProperties(_ref, _excluded$k);
36467
+ var renderHeader = function renderHeader() {
36468
+ return /*#__PURE__*/React$1.createElement(Space, {
36469
+ align: "center"
36470
+ }, /*#__PURE__*/React$1.createElement("div", {
36471
+ className: "bs-collapse-header-divider"
36472
+ }), /*#__PURE__*/React$1.createElement("div", {
36473
+ className: "bs-collapse-header-title"
36474
+ }, header), /*#__PURE__*/React$1.createElement(DownCircleFilled, {
36475
+ className: classNames({
36476
+ 'bs-guidewrap-icon-toogle': props.isActive,
36477
+ 'bs-collapse-icon': true
36478
+ })
36479
+ }), titleExtra && /*#__PURE__*/React$1.createElement("div", {
36480
+ className: "title-extra"
36481
+ }, titleExtra));
36482
+ };
36483
+ return /*#__PURE__*/React$1.createElement(Panel, _objectSpread2(_objectSpread2({}, props), {}, {
36484
+ header: renderHeader(),
36485
+ className: "bs-collapse-header-wrap",
36486
+ showArrow: showArrow
36487
+ }), props.children);
36488
+ };
36489
+
36490
+ var _excluded$l = ["children", "bordered"];
36491
+ var ExtendedCollapse = function ExtendedCollapse(props) {
36492
+ var children = props.children,
36493
+ bordered = props.bordered,
36494
+ restProps = _objectWithoutProperties(props, _excluded$l);
36495
+ return /*#__PURE__*/React$1.createElement("div", {
36496
+ className: classNames({
36497
+ 'bs-collapse-wrap': true,
36498
+ 'bs-collapse-header-boder': !bordered // 无边框模式的时候默认添加头部底部边框
36499
+ })
36500
+ }, /*#__PURE__*/React$1.createElement(Collapse, _objectSpread2(_objectSpread2({}, restProps), {}, {
36501
+ bordered: bordered
36502
+ }), children));
36503
+ };
36504
+ var index$8 = Object.assign(ExtendedCollapse, {
36505
+ Board: ExtendedPanel
36506
+ });
36507
+
36508
+ var css_248z$w = ".index-module_paragraphCopyWrapper__3rGOI {\n display: flex;\n margin-bottom: 4px;\n}\n.index-module_paragraphCopyWrapper__3rGOI .index-module_paragraphCopyLabel__1Qb8u {\n color: #8c8e91;\n font-size: 12px;\n white-space: nowrap;\n}\n.index-module_paragraphCopyWrapper__3rGOI .index-module_paragraphCopy__1y7Jo {\n min-width: 100px;\n margin-bottom: 0;\n font-size: 12px;\n flex: 1;\n}\n";
36509
+ var styles = {"paragraphCopyWrapper":"index-module_paragraphCopyWrapper__3rGOI","paragraphCopyLabel":"index-module_paragraphCopyLabel__1Qb8u","paragraphCopy":"index-module_paragraphCopy__1y7Jo"};
36510
+ styleInject(css_248z$w);
36511
+
36512
+ var Paragraph = Typography.Paragraph;
36513
+ var Section = function Section(_ref) {
36514
+ var children = _ref.children,
36515
+ copyable = _ref.copyable,
36516
+ label = _ref.label,
36517
+ icon = _ref.icon,
36518
+ _ref$ellipsis = _ref.ellipsis,
36519
+ ellipsis = _ref$ellipsis === void 0 ? {
36520
+ rows: 1,
36521
+ expandable: false,
36522
+ tooltip: true,
36523
+ suffix: ''
36524
+ } : _ref$ellipsis;
36525
+ var copyableProps = {
36526
+ tooltips: ['点击复制', '复制成功']
36527
+ };
36528
+ /**
36529
+ * 渲染icon
36530
+ */
36531
+ var renderIcon = function renderIcon(icon) {
36532
+ if (!icon) {
36533
+ return null;
36534
+ }
36535
+ if (typeof icon === 'string') {
36536
+ return /*#__PURE__*/React$1.createElement("img", {
36537
+ src: icon,
36538
+ width: 12
36539
+ });
36540
+ }
36541
+ return /*#__PURE__*/React$1.createElement("span", {
36542
+ style: {
36543
+ paddingRight: '5px',
36544
+ lineHeight: 0,
36545
+ display: 'inline-block',
36546
+ height: '14px'
36547
+ }
36548
+ }, icon);
36549
+ };
36550
+ return /*#__PURE__*/React$1.createElement("div", {
36551
+ className: styles.paragraphCopyWrapper
36552
+ }, /*#__PURE__*/React$1.createElement("div", {
36553
+ className: styles.paragraphCopyLabel
36554
+ }, label), renderIcon(icon), /*#__PURE__*/React$1.createElement(Paragraph, {
36555
+ className: styles.paragraphCopy,
36556
+ copyable: copyable ? copyableProps : false,
36557
+ ellipsis: ellipsis
36558
+ }, children));
36559
+ };
36560
+
36561
+ export { AddSelect, AddSkcSelect, AddSkuSelect, AddSpuSelect, AuthButton, BillEntry, BsCascader, index$5 as BsLayout, BsSulaQueryTable, BusinessSearchSelect$1 as BusinessSearchSelect, BusinessTreeSearchSelect$1 as BusinessTreeSearchSelect, index$1 as CheckOneUser, ColumnSettingTable, ColumnsEdit, CommodityEntry, DataImport, DataValidation, index$3 as DetailPageWrapper, EllipsisTooltip, ExportIcon, index$8 as ExtendedCollapse, GuideWrapper, HandleTotalCount, index$4 as HomePageWrapper, JsonQueryTable, index$6 as MoreTreeTable, QueryMutipleInput, RuleObjectComponent as RuleComponent, index$7 as RuleSetter, SearchSelect, Section, index$2 as StateFlow, ColumnSettingSulaTable as SulaColumnSettingTable, TableColumnSetting, TreeSearchSelect, authFunc, calculateValidPeriod, checkQuantityAccuracy, createUniqID, downloadExcel, ergodicMenuRoutes, formatter, getAccountID, getAccountId, getBreadcrumbNameMap, getCommonInfoKey, getConfigTableColumns, getCurrentTargetBgId, getCurrentTenantId, getDictionarySource, getDictionaryTextByValue, getEmployeeCode, getEmployeeId, getItemDefaultWidth$1 as getItemDefaultWidth, getJoinDictionaryText, getLastKey, getLimitMenuDataKey, getLocalStorageSaveKey, getMenuAuthDataKey, getSessionId, getSkuImg, getTenantList, getUserId, getUserName, go2BackAndClose, handleAntdColumnsSpecialParams, handleBaseUrlPre, handleBeforeUpload, handleBssulaColumnsSpecialParams, handleCommonTimeRender$1 as handleCommonTimeRender, handleConvertResponse, handleError, handleExport, handleExportBarCode, handleJudgeAuthButtons, handleOssUrl, handleRequestAuthHeader, handleRequestHeader, handleRequestUrl, handleStatusBadge, handleTextBreakSpaces, handleTextDouble$1 as handleTextDouble, handleTextDoubleOrId, handleTextLineFeed$1 as handleTextLineFeed, handleTextOverflow$1 as handleTextOverflow, handleTextTooltip, handleTextWarp, handleTextWarpCustom, handleTooltip$1 as handleTooltip, handleTooltipHours$1 as handleTooltipHours, handleUserPhone, judgeIsEmpty, judgeIsRequestError, judgeIsRequestSuccess, keyToWord, memoizeOneFormatter, noEmptyArr, noEmptyArray, paramsControl, parseWidth, precisionQuantity, randomString, readerXlsxToList, removeCurrentTenantId, removeTenantList, renderFixed2, renderNumberText, saveCurrentTenantId, saveTenantList, setConfigTableColumns, shouldUseAuth, socketFunctions, sulaTableRenderTooltip, tableColumnsImage$1 as tableColumnsImage, textIcon, updateGuanDate, userColumns$1 as userColumns, userInfoCard$1 as userInfoCard, uuid, writeListToXlsx };
package/dist/index.js CHANGED
@@ -36476,6 +36476,111 @@ var index$7 = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
36476
36476
  })));
36477
36477
  });
36478
36478
 
36479
+ var css_248z$v = ".bs-collapse-wrap {\n border-radius: 4px;\n overflow: hidden;\n}\n.bs-collapse-wrap .bs-collapse-header-wrap {\n background: #fff;\n}\n.bs-collapse-wrap .bs-collapse-icon {\n color: #b6b6b6;\n transition: transform 0.3s;\n}\n.bs-collapse-wrap .bs-guidewrap-icon-toogle {\n transform: rotate(180deg);\n}\n.bs-collapse-wrap .bs-collapse-header-title {\n font-weight: 500;\n font-size: 14px;\n color: #000000;\n}\n.bs-collapse-wrap .bs-collapse-header-divider {\n width: 3px;\n height: 20px;\n background: #02aa4c;\n}\n.bs-collapse-header-boder .ant-collapse .ant-collapse-item > .ant-collapse-header {\n border-bottom: 1px solid #f0f0f0;\n padding: 8px 16px;\n}\n";
36480
+ styleInject(css_248z$v);
36481
+
36482
+ var _excluded$k = ["titleExtra", "header", "showArrow"];
36483
+ var Panel = antd.Collapse.Panel;
36484
+ var ExtendedPanel = function ExtendedPanel(_ref) {
36485
+ var titleExtra = _ref.titleExtra,
36486
+ header = _ref.header,
36487
+ _ref$showArrow = _ref.showArrow,
36488
+ showArrow = _ref$showArrow === void 0 ? false : _ref$showArrow,
36489
+ props = _objectWithoutProperties(_ref, _excluded$k);
36490
+ var renderHeader = function renderHeader() {
36491
+ return /*#__PURE__*/React__default['default'].createElement(antd.Space, {
36492
+ align: "center"
36493
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
36494
+ className: "bs-collapse-header-divider"
36495
+ }), /*#__PURE__*/React__default['default'].createElement("div", {
36496
+ className: "bs-collapse-header-title"
36497
+ }, header), /*#__PURE__*/React__default['default'].createElement(icons.DownCircleFilled, {
36498
+ className: classNames__default['default']({
36499
+ 'bs-guidewrap-icon-toogle': props.isActive,
36500
+ 'bs-collapse-icon': true
36501
+ })
36502
+ }), titleExtra && /*#__PURE__*/React__default['default'].createElement("div", {
36503
+ className: "title-extra"
36504
+ }, titleExtra));
36505
+ };
36506
+ return /*#__PURE__*/React__default['default'].createElement(Panel, _objectSpread2(_objectSpread2({}, props), {}, {
36507
+ header: renderHeader(),
36508
+ className: "bs-collapse-header-wrap",
36509
+ showArrow: showArrow
36510
+ }), props.children);
36511
+ };
36512
+
36513
+ var _excluded$l = ["children", "bordered"];
36514
+ var ExtendedCollapse = function ExtendedCollapse(props) {
36515
+ var children = props.children,
36516
+ bordered = props.bordered,
36517
+ restProps = _objectWithoutProperties(props, _excluded$l);
36518
+ return /*#__PURE__*/React__default['default'].createElement("div", {
36519
+ className: classNames__default['default']({
36520
+ 'bs-collapse-wrap': true,
36521
+ 'bs-collapse-header-boder': !bordered // 无边框模式的时候默认添加头部底部边框
36522
+ })
36523
+ }, /*#__PURE__*/React__default['default'].createElement(antd.Collapse, _objectSpread2(_objectSpread2({}, restProps), {}, {
36524
+ bordered: bordered
36525
+ }), children));
36526
+ };
36527
+ var index$8 = Object.assign(ExtendedCollapse, {
36528
+ Board: ExtendedPanel
36529
+ });
36530
+
36531
+ var css_248z$w = ".index-module_paragraphCopyWrapper__3rGOI {\n display: flex;\n margin-bottom: 4px;\n}\n.index-module_paragraphCopyWrapper__3rGOI .index-module_paragraphCopyLabel__1Qb8u {\n color: #8c8e91;\n font-size: 12px;\n white-space: nowrap;\n}\n.index-module_paragraphCopyWrapper__3rGOI .index-module_paragraphCopy__1y7Jo {\n min-width: 100px;\n margin-bottom: 0;\n font-size: 12px;\n flex: 1;\n}\n";
36532
+ var styles = {"paragraphCopyWrapper":"index-module_paragraphCopyWrapper__3rGOI","paragraphCopyLabel":"index-module_paragraphCopyLabel__1Qb8u","paragraphCopy":"index-module_paragraphCopy__1y7Jo"};
36533
+ styleInject(css_248z$w);
36534
+
36535
+ var Paragraph = antd.Typography.Paragraph;
36536
+ var Section = function Section(_ref) {
36537
+ var children = _ref.children,
36538
+ copyable = _ref.copyable,
36539
+ label = _ref.label,
36540
+ icon = _ref.icon,
36541
+ _ref$ellipsis = _ref.ellipsis,
36542
+ ellipsis = _ref$ellipsis === void 0 ? {
36543
+ rows: 1,
36544
+ expandable: false,
36545
+ tooltip: true,
36546
+ suffix: ''
36547
+ } : _ref$ellipsis;
36548
+ var copyableProps = {
36549
+ tooltips: ['点击复制', '复制成功']
36550
+ };
36551
+ /**
36552
+ * 渲染icon
36553
+ */
36554
+ var renderIcon = function renderIcon(icon) {
36555
+ if (!icon) {
36556
+ return null;
36557
+ }
36558
+ if (typeof icon === 'string') {
36559
+ return /*#__PURE__*/React__default['default'].createElement("img", {
36560
+ src: icon,
36561
+ width: 12
36562
+ });
36563
+ }
36564
+ return /*#__PURE__*/React__default['default'].createElement("span", {
36565
+ style: {
36566
+ paddingRight: '5px',
36567
+ lineHeight: 0,
36568
+ display: 'inline-block',
36569
+ height: '14px'
36570
+ }
36571
+ }, icon);
36572
+ };
36573
+ return /*#__PURE__*/React__default['default'].createElement("div", {
36574
+ className: styles.paragraphCopyWrapper
36575
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
36576
+ className: styles.paragraphCopyLabel
36577
+ }, label), renderIcon(icon), /*#__PURE__*/React__default['default'].createElement(Paragraph, {
36578
+ className: styles.paragraphCopy,
36579
+ copyable: copyable ? copyableProps : false,
36580
+ ellipsis: ellipsis
36581
+ }, children));
36582
+ };
36583
+
36479
36584
  exports.AddSelect = AddSelect;
36480
36585
  exports.AddSkcSelect = AddSkcSelect;
36481
36586
  exports.AddSkuSelect = AddSkuSelect;
@@ -36496,6 +36601,7 @@ exports.DataValidation = DataValidation;
36496
36601
  exports.DetailPageWrapper = index$3;
36497
36602
  exports.EllipsisTooltip = EllipsisTooltip;
36498
36603
  exports.ExportIcon = ExportIcon;
36604
+ exports.ExtendedCollapse = index$8;
36499
36605
  exports.GuideWrapper = GuideWrapper;
36500
36606
  exports.HandleTotalCount = HandleTotalCount;
36501
36607
  exports.HomePageWrapper = index$4;
@@ -36505,6 +36611,7 @@ exports.QueryMutipleInput = QueryMutipleInput;
36505
36611
  exports.RuleComponent = RuleObjectComponent;
36506
36612
  exports.RuleSetter = index$7;
36507
36613
  exports.SearchSelect = SearchSelect;
36614
+ exports.Section = Section;
36508
36615
  exports.StateFlow = index$2;
36509
36616
  exports.SulaColumnSettingTable = ColumnSettingSulaTable;
36510
36617
  exports.TableColumnSetting = TableColumnSetting;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "3.2.0-alpha.2",
3
+ "version": "3.2.0-alpha.3",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { Collapse, Space } from 'antd';
3
+ import { CollapsePanelProps } from 'antd';
4
+ import { DownCircleFilled } from '@ant-design/icons';
5
+ import classNames from 'classnames';
6
+ import './index.less';
7
+
8
+ const { Panel } = Collapse;
9
+
10
+ export interface ExtendedPanelProps extends CollapsePanelProps {
11
+ extra?: React.ReactNode;
12
+ titleExtra?: React.ReactNode;
13
+ isActive?: boolean;
14
+ }
15
+
16
+ const ExtendedPanel: React.FC<ExtendedPanelProps> = ({
17
+ titleExtra,
18
+ header,
19
+ showArrow=false,
20
+ ...props
21
+ }) => {
22
+
23
+ const renderHeader = () => {
24
+ return (
25
+ <Space align="center">
26
+ <div className="bs-collapse-header-divider" />
27
+ <div className="bs-collapse-header-title">{header}</div>
28
+ <DownCircleFilled
29
+ className={classNames({
30
+ 'bs-guidewrap-icon-toogle': props.isActive,
31
+ 'bs-collapse-icon': true,
32
+ })}
33
+ />
34
+ {titleExtra && <div className="title-extra">{titleExtra}</div>}
35
+ </Space>
36
+ );
37
+ };
38
+
39
+ return (
40
+ <Panel
41
+ {...props}
42
+ header={renderHeader()}
43
+ className="bs-collapse-header-wrap"
44
+ showArrow={showArrow}
45
+ >
46
+ {props.children}
47
+ </Panel>
48
+ );
49
+ };
50
+
51
+ export default ExtendedPanel;
@@ -0,0 +1,33 @@
1
+ .bs-collapse-wrap {
2
+ border-radius: 4px;
3
+ overflow: hidden;
4
+ .bs-collapse-header-wrap {
5
+ background: #fff;
6
+ }
7
+ .bs-collapse-icon {
8
+ color: #b6b6b6;
9
+ transition: transform 0.3s;
10
+ }
11
+ .bs-guidewrap-icon-toogle {
12
+ transform: rotate(180deg);
13
+ }
14
+ .bs-collapse-header-title {
15
+ font-weight: 500;
16
+ font-size: 14px;
17
+ color: #000000;
18
+ }
19
+
20
+ .bs-collapse-header-divider {
21
+ width: 3px;
22
+ height: 20px;
23
+ background: #02aa4c;
24
+ }
25
+ }
26
+
27
+ // 层叠原有antd样式
28
+ .bs-collapse-header-boder {
29
+ .ant-collapse .ant-collapse-item > .ant-collapse-header {
30
+ border-bottom: 1px solid #f0f0f0;
31
+ padding: 8px 16px;
32
+ }
33
+ }
@@ -0,0 +1,136 @@
1
+ ---
2
+ nav:
3
+ title: '组件'
4
+ order: 1
5
+ group:
6
+ title: 通用
7
+ order: 1
8
+ title: ExtendedCollapse 详情折叠面板
9
+ order: 1
10
+ ---
11
+
12
+ # 详情折叠面板
13
+
14
+ 可以折叠/展开的内容区域,基于 antd 的 Collapse 封装,封装了自定义样式,支持所有 Collapse 的属性与方法,修改了 Panel 的属性,禁用了自定义icon,支持自定义 header,支持自定义 extra,支持自定义 titleExtra;
15
+ 例子中只展示了业务中常用的几种,其他例子可参考 antd 官方示例。
16
+
17
+ ## 何时使用
18
+
19
+ - 对复杂区域进行分组和隐藏,保持页面的整洁。
20
+ - 手风琴 是一种特殊的折叠面板,只允许单个内容区域展开。
21
+
22
+ ## 代码演示
23
+
24
+ ```tsx
25
+ /**
26
+ * title: 折叠面板组件
27
+ * desc: 可以同时展开多个面板,这个例子默认展开了第一个。
28
+ */
29
+ import React from 'react';
30
+ import { ExtendedCollapse } from '@bit-sun/business-component';
31
+
32
+ export default () => {
33
+ const { Board } = ExtendedCollapse;
34
+
35
+ return (
36
+ <ExtendedCollapse defaultActiveKey="1">
37
+ <Board header="基本信息1" key="1">
38
+ A dog is a type of domesticated animal. Known for its loyalty and
39
+ faithfulness, it can be found as a welcome guest in many households
40
+ across the world.
41
+ </Board>
42
+ <Board header="基本信息2" key="2">
43
+ two dog is a type of domesticated animal. Known for its loyalty and
44
+ faithfulness, it can be found as a welcome guest in many households
45
+ across the world.
46
+ </Board>
47
+ </ExtendedCollapse>
48
+ );
49
+ };
50
+ ```
51
+
52
+ ```tsx
53
+ /**
54
+ * title: 手风琴模式
55
+ * desc: 手风琴,每次只打开一个 tab。
56
+ */
57
+ import React from 'react';
58
+ import { ExtendedCollapse } from '@bit-sun/business-component';
59
+
60
+ export default () => {
61
+ const { Board } = ExtendedCollapse;
62
+
63
+ return (
64
+ <ExtendedCollapse defaultActiveKey="1" accordion>
65
+ <Board header="基本信息1" key="1" >
66
+ A dog is a type of domesticated animal. Known for its loyalty and
67
+ faithfulness, it can be found as a welcome guest in many households
68
+ across the world.
69
+ </Board>
70
+ <Board header="基本信息2" key="2">
71
+ two dog is a type of domesticated animal. Known for its loyalty and
72
+ faithfulness, it can be found as a welcome guest in many households
73
+ across the world.
74
+ </Board>
75
+ </ExtendedCollapse>
76
+ );
77
+ };
78
+ ```
79
+
80
+ ```tsx
81
+ /**
82
+ * title: 拓展头部操作栏
83
+ * desc: 可以拓展头部操作栏。
84
+ */
85
+ import React from 'react';
86
+ import { Tag, Space } from 'antd';
87
+ import { ExtendedCollapse } from '@bit-sun/business-component';
88
+
89
+ export default () => {
90
+ const { Board } = ExtendedCollapse;
91
+
92
+ const renderExtra = () => (<a href="#">More</a>);
93
+
94
+ const renderTag = () => (<Space direction="horizontal" align="center"><Tag color="blue">blue</Tag><Tag color="red">red</Tag></Space>);
95
+
96
+ return (
97
+ <ExtendedCollapse defaultActiveKey="1" bordered={false}>
98
+ <Board header="基本信息1" key="1" extra={renderExtra()} titleExtra={renderTag()} >
99
+ A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
100
+ </Board>
101
+ <Board header="基本信息2" key="2">
102
+ two dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
103
+ </Board>
104
+ </ExtendedCollapse>
105
+ );
106
+ };
107
+ ```
108
+
109
+ ## API
110
+
111
+ ### Collapse
112
+
113
+ | 参数 | 说明 | 类型 | 默认值 | 版本 | 备注 |
114
+ | -------------------- | ---------------------------------------- | --------------------------------------------- | -------------------------------------- | ----- | ---- |
115
+ | accordion | 手风琴模式 | boolean | false | |
116
+ | activeKey | 当前激活 tab 面板的 key | string\[] \| string <br/> number\[] \| number | 默认无,accordion 模式下默认第一个元素 | |
117
+ | bordered | 带边框风格的折叠面板 | boolean | true | |
118
+ | collapsible | 所有子面板是否可折叠或指定可折叠触发区域 | `header` \| `disabled` | - | 4.9.0 |
119
+ | defaultActiveKey | 初始化选中面板的 key | string\[] \| string<br/> number\[] \| number | - | |
120
+ | destroyInactivePanel | 销毁折叠隐藏的面板 | boolean | false | |
121
+ | expandIcon | 自定义切换图标 | (panelProps) => ReactNode | - | |
122
+ | expandIconPosition | 设置图标位置 | `left` \| `right` | - | |
123
+ | ghost | 使折叠面板透明且无边框 | boolean | false | 4.4.0 |
124
+ | onChange | 切换面板的回调 | function | - | |
125
+
126
+ ### Collapse.Board
127
+
128
+ | 参数 | 说明 | 类型 | 默认值 | 版本 | 备注 |
129
+ | ------------------------------------------- | ------------------------------ | ---------------------- | ------ | ----- | ---- |
130
+ | <span style="color: red;">titleExtra</span> | 标题后的自定义内容 | ReactNode | - | | 新增 |
131
+ | extra | 自定义渲染每个面板右上角的内容 | ReactNode | - | |
132
+ | collapsible | 是否可折叠或指定可折叠触发区域 | `header` \| `disabled` | - | 4.9.0 |
133
+ | forceRender | 被隐藏时是否渲染 DOM 结构 | boolean | false | |
134
+ | header | 面板头内容 | ReactNode | - | |
135
+ | key | 对应 activeKey | string \| number | - | |
136
+ | showArrow | 是否展示当前面板上的箭头 | boolean | true | |
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { Collapse } from 'antd';
3
+ import { CollapseProps } from 'antd';
4
+ import classNames from 'classnames';
5
+ import ExtendedPanel from './ExtendedPanel';
6
+ import './index.less';
7
+
8
+ const ExtendedCollapse: React.FC<CollapseProps> = (props) => {
9
+ const { children, bordered, ...restProps } = props;
10
+
11
+ return (
12
+ <div
13
+ className={classNames({
14
+ 'bs-collapse-wrap': true,
15
+ 'bs-collapse-header-boder': !bordered, // 无边框模式的时候默认添加头部底部边框
16
+ })}
17
+ >
18
+ <Collapse {...restProps} bordered={bordered}>
19
+ {children}
20
+ </Collapse>
21
+ </div>
22
+ );
23
+ };
24
+
25
+ export default Object.assign(ExtendedCollapse, { Board: ExtendedPanel });
@@ -0,0 +1,120 @@
1
+ ---
2
+ nav:
3
+ title: '组件'
4
+ order: 1
5
+ group:
6
+ title: 通用
7
+ order: 1
8
+ title: Section 段落排版
9
+ order: 2
10
+ ---
11
+
12
+ # 段落排版
13
+
14
+ 用户展示详情页面中的段落样式,基于 antd 的 Paragraph 封装,封装了自定义样式,增加了自定义图标,空数据适配等功能
15
+
16
+ ## 何时使用
17
+
18
+ - 详情页面展示态。
19
+
20
+ ## 代码演示
21
+
22
+ ```tsx
23
+ /**
24
+ * title: 基本使用
25
+ * desc: 开启复制功能
26
+ */
27
+ import React from 'react';
28
+ import { Section } from '@bit-sun/business-component';
29
+
30
+ export default () => {
31
+ const mock = {
32
+ label: '订单号:',
33
+ value: 'RO24081500000031',
34
+ copyable: true,
35
+ };
36
+
37
+ return <Section {...mock}>{mock.value}</Section>;
38
+ };
39
+ ```
40
+
41
+ ```tsx
42
+ /**
43
+ * title: 带图标功能
44
+ * desc: 添加内容图标
45
+ */
46
+ import React from 'react';
47
+ import { PieChartOutlined } from '@ant-design/icons';
48
+ import { Section } from '@bit-sun/business-component';
49
+
50
+ export default () => {
51
+ const mock = {
52
+ label: '订单号:',
53
+ value: 'RO24081500000031',
54
+ copyable: true,
55
+ icon: <PieChartOutlined />,
56
+ };
57
+
58
+ return <Section {...mock}>{mock.value}</Section>;
59
+ };
60
+ ```
61
+
62
+ ```tsx
63
+ /**
64
+ * title: 溢出隐藏
65
+ * desc: 内容超出隐藏支持自定义展开样式
66
+ */
67
+ import React from 'react';
68
+ import { PieChartOutlined } from '@ant-design/icons';
69
+ import { Section } from '@bit-sun/business-component';
70
+
71
+ export default () => {
72
+ const mock = {
73
+ label: '订单号:',
74
+ value:
75
+ '三国(220年-280年)是中国历史上位于汉朝之后,晋朝之前的一段历史时期。这一个时期,先后出现了曹魏、蜀汉、东吴三个主要政权。190年,汉朝的中央集权制度崩溃,军阀四起,天下大乱。208年发生赤壁之战,曹操被孙刘联军击败,奠定了三国鼎立的雏型。220年,汉朝丞相曹丕迫使汉献帝禅让帝位,定都洛阳,国号“魏”,史称曹魏,标志着汉朝时代的正式结束。221年刘备称帝,定都成都,史称蜀汉。229年孙权称帝,定都建邺,国号“吴”,史称东吴',
76
+ ellipsis: { rows: 2, expandable: false, tooltip: true, suffix: ' ' },
77
+ };
78
+
79
+ return <Section {...mock}>{mock.value}</Section>;
80
+ };
81
+ ```
82
+
83
+ ## API
84
+
85
+ | 参数 | 说明 | 类型 | 默认值 | 备注 |
86
+ | -------- | ---------------------------------------------------------------------------- | -------------------------------- | ------ | ---- |
87
+ | label | 标题内容 | React.ReactNode\| string | false |
88
+ | copyable | 是否可拷贝,为对象时可进行各种自定义,开启拷贝功能需要保证内容为 string 类型 | boolean \| [copyable](#copyable) | false |
89
+ | icon | 内容图标 | string \| React.ReactNode | 无 |
90
+ | ellipsis | 自动溢出省略,为对象时可设置省略行数、是否可展开、添加后缀等 | boolean\| [ellipsis](#ellipsis) | false |
91
+
92
+ ### copyable
93
+
94
+ <a name="copyable"></a>
95
+
96
+ ```js
97
+ {
98
+ text: string,
99
+ onCopy: function(event),
100
+ icon: ReactNode,
101
+ tooltips: false | [ReactNode, ReactNode],
102
+ format: 'text/plain' | 'text/html',
103
+ }
104
+ ```
105
+
106
+ ### ellipsis
107
+
108
+ <a name="ellipsis"></a>
109
+
110
+ ```js
111
+ {
112
+ rows: number,
113
+ expandable: boolean,
114
+ suffix: string,
115
+ symbol: ReactNode,
116
+ tooltip: boolean | ReactNode | TooltipProps,
117
+ onExpand: function(event),
118
+ onEllipsis: function(ellipsis),
119
+ }
120
+ ```
@@ -0,0 +1,16 @@
1
+ .paragraphCopyWrapper {
2
+ display: flex;
3
+ margin-bottom: 4px;
4
+ .paragraphCopyLabel {
5
+ color: #8c8e91;
6
+ font-size: 12px;
7
+ white-space: nowrap;
8
+ }
9
+
10
+ .paragraphCopy {
11
+ min-width: 100px;
12
+ margin-bottom: 0;
13
+ font-size: 12px;
14
+ flex: 1;
15
+ }
16
+ }
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import type { PropsWithChildren } from 'react';
3
+ import { Typography } from 'antd';
4
+ import type { TooltipProps } from 'antd';
5
+ import styles from './index.module.less';
6
+
7
+
8
+ export interface copyableProps {
9
+ text: string,
10
+ onCopy: (event: any) => void;
11
+ icon: React.ReactNode,
12
+ tooltips: false | [React.ReactNode, React.ReactNode],
13
+ format: 'text/plain' | 'text/html',
14
+ }
15
+
16
+ export interface ellipsisProps {
17
+ rows: number,
18
+ expandable: boolean,
19
+ suffix?: string,
20
+ symbol?: React.ReactNode,
21
+ tooltip?: boolean | React.ReactNode | TooltipProps,
22
+ onExpand?: (event: React.MouseEvent<HTMLElement>) => void,
23
+ onEllipsis?: (ellipsis: boolean) => void,
24
+ }
25
+
26
+ interface IProps{
27
+ label: React.ReactNode | string;
28
+ children: React.ReactNode | string;
29
+ copyable?: boolean | copyableProps; // 启用复制功能的时候需要保证value为字符串
30
+ icon?: string | React.ReactNode;
31
+ ellipsis?: ellipsisProps;
32
+ }
33
+
34
+ export type SectionProps = PropsWithChildren<IProps>;
35
+
36
+ const { Paragraph } = Typography;
37
+ const Section = ({ children, copyable, label, icon, ellipsis={ rows: 1, expandable: false, tooltip: true, suffix: '' }, }: SectionProps) => {
38
+ const copyableProps = {
39
+ tooltips: ['点击复制', '复制成功'],
40
+ };
41
+
42
+ /**
43
+ * 渲染icon
44
+ */
45
+ const renderIcon = (icon: string | React.ReactNode) => {
46
+ if (!icon) {
47
+ return null;
48
+ }
49
+ if (typeof icon === 'string') {
50
+ return <img src={icon} width={12} />;
51
+ }
52
+ return <span style={{ paddingRight: '5px', lineHeight: 0, display: 'inline-block', height: '14px' }}>{icon}</span>;
53
+ };
54
+
55
+ return (
56
+ <div className={styles.paragraphCopyWrapper}>
57
+ <div className={styles.paragraphCopyLabel}>{label}</div>
58
+ {renderIcon(icon)}
59
+ <Paragraph
60
+ className={styles.paragraphCopy}
61
+ copyable={copyable ? copyableProps : false}
62
+ ellipsis={ellipsis}
63
+ >
64
+ {children}
65
+ </Paragraph>
66
+ </div>
67
+ );
68
+ };
69
+
70
+ export default Section;
package/src/index.ts CHANGED
@@ -39,3 +39,7 @@ export { default as EllipsisTooltip} from './components/Functional/EllipsisToolt
39
39
  export * from './components/Functional/BsAntdSula/index';
40
40
  export { default as RuleComponent} from './components/Solution/RuleComponent';
41
41
  export { default as RuleSetter} from './components/Solution/RuleSetter';
42
+
43
+ // 通用组件
44
+ export { default as ExtendedCollapse } from './components/Common/ExtendedCollapse';
45
+ export { default as Section } from './components/Common/Section';