@zykj2024/much-library 1.0.9 → 1.0.10-beta.10

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 (58) hide show
  1. package/README.md +23 -23
  2. package/dist/McContainer/index.css +9 -8
  3. package/dist/McContainer/index.d.ts +8 -2
  4. package/dist/McContainer/index.js +12 -6
  5. package/dist/McDateRange/index.d.ts +1 -1
  6. package/dist/McDateRange/index.js +1 -1
  7. package/dist/McInput/index.css +25 -0
  8. package/dist/McLazyLoader/demo/basic.d.ts +2 -0
  9. package/dist/McLazyLoader/demo/basic.js +33 -0
  10. package/dist/McLazyLoader/demo/form.d.ts +2 -0
  11. package/dist/McLazyLoader/demo/form.js +38 -0
  12. package/dist/McLazyLoader/demo/has-root.d.ts +2 -0
  13. package/dist/McLazyLoader/demo/has-root.js +44 -0
  14. package/dist/McLazyLoader/index.d.ts +28 -0
  15. package/dist/McLazyLoader/index.js +69 -0
  16. package/dist/McProSelect/demo/async.d.ts +2 -0
  17. package/dist/McProSelect/demo/async.js +66 -0
  18. package/dist/McProSelect/demo/base.d.ts +2 -0
  19. package/dist/McProSelect/demo/base.js +29 -0
  20. package/dist/McProSelect/demo/exclusion-async-rename.d.ts +3 -0
  21. package/dist/McProSelect/demo/exclusion-async-rename.js +103 -0
  22. package/dist/McProSelect/demo/exclusion-rename.d.ts +3 -0
  23. package/dist/McProSelect/demo/exclusion-rename.js +74 -0
  24. package/dist/McProSelect/demo/exclusion.d.ts +3 -0
  25. package/dist/McProSelect/demo/exclusion.js +70 -0
  26. package/dist/McProSelect/demo/require.d.ts +2 -0
  27. package/dist/McProSelect/demo/require.js +82 -0
  28. package/dist/McProSelect/index.d.ts +35 -0
  29. package/dist/McProSelect/index.js +152 -0
  30. package/dist/McSelect/components/PanelSearchInput/index.css +6 -0
  31. package/dist/McSelect/components/PanelSearchInput/index.d.ts +12 -0
  32. package/dist/McSelect/components/PanelSearchInput/index.js +45 -0
  33. package/dist/McSelect/demo/exclusion.d.ts +3 -0
  34. package/dist/McSelect/demo/exclusion.js +64 -0
  35. package/dist/McSelect/demo/fetchOptions.js +1 -0
  36. package/dist/McSelect/index.d.ts +9 -2
  37. package/dist/McSelect/index.js +101 -15
  38. package/dist/McTag/demo/demo1.d.ts +2 -0
  39. package/dist/McTag/demo/demo1.js +18 -0
  40. package/dist/McTag/demo/demo2.d.ts +2 -0
  41. package/dist/McTag/demo/demo2.js +20 -0
  42. package/dist/McTag/demo/demo3.d.ts +2 -0
  43. package/dist/McTag/demo/demo3.js +19 -0
  44. package/dist/McTag/demo/demo4.d.ts +2 -0
  45. package/dist/McTag/demo/demo4.js +22 -0
  46. package/dist/McTag/index.d.ts +22 -0
  47. package/dist/McTag/index.js +59 -0
  48. package/dist/McThemeConfig/customToken.json +2 -1
  49. package/dist/McThemeConfig/demo/radio.js +39 -0
  50. package/dist/McThemeConfig/globalStyle.js +10 -4
  51. package/dist/McThemeConfig/layoutStyle.d.ts +1 -1
  52. package/dist/McThemeConfig/layoutStyle.js +1 -1
  53. package/dist/McThemeConfig/themeToken.json +4 -3
  54. package/dist/Utils/index.d.ts +5 -4
  55. package/dist/Utils/index.js +6 -26
  56. package/dist/index.d.ts +15 -7
  57. package/dist/index.js +15 -7
  58. package/package.json +4 -2
package/README.md CHANGED
@@ -1,35 +1,35 @@
1
1
  # much-library
2
2
 
3
- ## Usage
3
+ 基于 ant-design 和 web 端一体化设计标准 实现的 React 组件库,旨在提高 B 端平台开发效率以及通用组件标准化。
4
4
 
5
- TODO
5
+ ## 主要目录
6
6
 
7
- ## Options
7
+ - /src 组件开发目录
8
+ - /script 组件构建脚本目录
9
+ - /docs 文档目录
8
10
 
9
- TODO
11
+ ## 开发流程
10
12
 
11
- ## Development
13
+ - 从 `main` 分支拉取组件分支 `feature/*`,例如:McInput 组件分支`feature/tree_panel`,若多人维护则增加个人标识`feature/tree_panel-csy`
14
+ - 在 /src 中新建对应组件目录,书写组件.tsx 以及 文档.md,可执行 `npm run dev` 在文档 demo 上直接调试
15
+ - css 采用约定命名规则,使用 less 语法,遵守 BEM 规范,给组件一个外层类名 `.mc-*`
16
+ - /src/index.ts 导入组件,组件库支持按需引入
17
+ - 更新 `log.md` 文件
18
+ - 本地开发完毕后执行`npm run doctor` 校验,校验通过后可提交`develop`分支 MR,指向对应同学进行 Review 合并
12
19
 
13
- ```bash
14
- # install dependencies
15
- $ yarn install
20
+ ## 发布流程
16
21
 
17
- # develop library by docs demo
18
- $ yarn start
22
+ - npm 包发布,更新 version 版本号,执行`npm publish`即可。[much-library](https://www.npmjs.com/package/much-library)
23
+ - docs 发布,执行`npm run docs:build`,通过 ssh 部署 docs-dist。[much-docs](http://frontend.yunxiacn.com/much-docs/)
24
+ - 相关账号配置联系 @陈书妍(一匠)
19
25
 
20
- # build library source code
21
- $ yarn run build
26
+ ## 问题反馈
22
27
 
23
- # build library source code in watch mode
24
- $ yarn run build:watch
28
+ - 使用过程中有任何问题,可到对应仓库提交 [issue](http://gitlab.yunxiacn.com/data-group-front/much-library/-/issues)
29
+ - 需添加使用场景,是否必现,复现路径等细节
30
+ - 紧急情况下,可以自行进行实行,提交 MR 即可
25
31
 
26
- # build docs
27
- $ yarn run docs:build
32
+ ## 关联资源
28
33
 
29
- # check your project for potential problems
30
- $ yarn run doctor
31
- ```
32
-
33
- ## LICENSE
34
-
35
- MIT
34
+ - [web 端一体化设计](https://mastergo.com/file/124592686063679?fileOpenFrom=project&page_id=116%3A9034) @张乐(卡卡)
35
+ - [dumi 组件框架](https://d.umijs.org/)
@@ -2,17 +2,18 @@
2
2
  position: relative;
3
3
  }
4
4
  .mc-container__ceiling {
5
- width: calc(100% - 48px);
5
+ width: calc(100% - 40px);
6
6
  height: 24px;
7
7
  position: absolute;
8
8
  top: 0;
9
- left: 24px;
9
+ left: 16px;
10
10
  z-index: 9;
11
11
  }
12
12
  .mc-container__wrapper {
13
13
  height: 100%;
14
- padding: 24px 24px 64px;
15
- overflow: auto;
14
+ padding: 24px 24px 50px 16px;
15
+ overflow-y: auto;
16
+ border-top-right-radius: 12px;
16
17
  }
17
18
  .mc-container__query {
18
19
  display: -webkit-box;
@@ -27,7 +28,7 @@
27
28
  .mc-container__query .mc-select,
28
29
  .mc-container__query .mc-cascader,
29
30
  .mc-container__query .mc-input-number {
30
- width: 280px;
31
+ width: 270px;
31
32
  }
32
33
  .mc-container__query .mc-date-range {
33
34
  width: 330px;
@@ -113,11 +114,11 @@
113
114
  transition: all 0.3s;
114
115
  }
115
116
  .mc-container__pagination {
116
- padding: 16px 0 24px;
117
+ padding: 8px 0 16px;
117
118
  margin: 0 !important;
118
- width: calc(100% - 48px);
119
+ width: calc(100% - 40px);
119
120
  position: absolute;
120
- left: 24px;
121
+ left: 16px;
121
122
  bottom: 0;
122
123
  z-index: 9;
123
124
  }
@@ -1,11 +1,15 @@
1
1
  import { TableProps } from 'antd';
2
2
  import { CSSProperties, FC, ReactElement, ReactNode } from 'react';
3
3
  import './index.less';
4
- export type PropsType = {
4
+ export type McContainerPropsType = {
5
5
  style?: CSSProperties;
6
6
  className?: string;
7
7
  height?: string;
8
8
  backgroundColor?: string;
9
+ /**
10
+ * 是否展示头部遮罩,默认显示
11
+ */
12
+ showCell?: boolean;
9
13
  immediateQuery?: boolean;
10
14
  loading?: boolean;
11
15
  queryItems?: ReactElement;
@@ -30,6 +34,8 @@ export type PropsType = {
30
34
  onCancel?: () => void;
31
35
  tableProps?: TableProps<any>;
32
36
  tableRender?: ReactNode;
37
+ /** 折叠事件的回调 */
38
+ onCollapse?: (v: boolean) => void;
33
39
  [key: string]: any;
34
40
  };
35
41
  export type McContainerRef = {
@@ -45,5 +51,5 @@ export type McContainerRef = {
45
51
  getQueryParams: () => any;
46
52
  resetQueryParams: () => void;
47
53
  };
48
- declare const McContainer: FC<PropsType>;
54
+ declare const McContainer: FC<McContainerPropsType>;
49
55
  export default McContainer;
@@ -15,6 +15,8 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
15
15
  height = _props$height === void 0 ? 'calc(100vh - 88px)' : _props$height,
16
16
  _props$backgroundColo = props.backgroundColor,
17
17
  backgroundColor = _props$backgroundColo === void 0 ? '#ffffff' : _props$backgroundColo,
18
+ _props$showCell = props.showCell,
19
+ showCell = _props$showCell === void 0 ? true : _props$showCell,
18
20
  _props$immediateQuery = props.immediateQuery,
19
21
  immediateQuery = _props$immediateQuery === void 0 ? true : _props$immediateQuery,
20
22
  _props$loading = props.loading,
@@ -36,7 +38,8 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
36
38
  batchBtns = props.batchBtns,
37
39
  onCancel = props.onCancel,
38
40
  tableProps = props.tableProps,
39
- tableRender = props.tableRender;
41
+ tableRender = props.tableRender,
42
+ onCollapse = props.onCollapse;
40
43
  var _useState = useState(false),
41
44
  _useState2 = _slicedToArray(_useState, 2),
42
45
  collapse = _useState2[0],
@@ -67,6 +70,9 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
67
70
  return actionBarResizeObserver.disconnect();
68
71
  };
69
72
  }, []);
73
+ useEffect(function () {
74
+ onCollapse === null || onCollapse === void 0 || onCollapse(collapse);
75
+ }, [collapse]);
70
76
 
71
77
  // 为设置过name属性的查询项添加value属性和onChange事件,从而收集查询项的值(查询项自身已绑定value属性的除外,需自行编写相关业务逻辑代码进行状态管理)
72
78
  var mapQuerys = function mapQuerys(items) {
@@ -265,7 +271,7 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
265
271
  height: height,
266
272
  backgroundColor: backgroundColor
267
273
  }, style),
268
- children: [/*#__PURE__*/_jsx("div", {
274
+ children: [showCell && /*#__PURE__*/_jsx("div", {
269
275
  className: "mc-container__ceiling",
270
276
  style: {
271
277
  backgroundColor: backgroundColor
@@ -273,7 +279,7 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
273
279
  }), /*#__PURE__*/_jsxs("div", {
274
280
  className: "mc-container__wrapper",
275
281
  style: {
276
- paddingBottom: tableRender || tableRender === null || (tableProps === null || tableProps === void 0 ? void 0 : tableProps.pagination) === false ? 24 : 64
282
+ paddingBottom: tableRender || tableRender === null || (tableProps === null || tableProps === void 0 ? void 0 : tableProps.pagination) === false ? 16 : 50
277
283
  },
278
284
  children: [queryRender || queryRender === null ? queryRender : /*#__PURE__*/_jsxs("div", {
279
285
  className: "mc-container__query",
@@ -300,7 +306,8 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
300
306
  style: {
301
307
  marginLeft: 16,
302
308
  fontSize: 12,
303
- padding: 0
309
+ padding: 0,
310
+ gap: 4
304
311
  },
305
312
  onClick: function onClick() {
306
313
  return setCollapse(function (os) {
@@ -309,8 +316,7 @@ var McContainer = /*#__PURE__*/forwardRef(function (props, ref) {
309
316
  },
310
317
  children: [collapse ? '展开' : '收起', /*#__PURE__*/_jsx(DoubleLeftOutlined, {
311
318
  style: {
312
- fontSize: 12,
313
- marginLeft: 2
319
+ fontSize: 12
314
320
  },
315
321
  rotate: collapse ? -90 : 90
316
322
  })]
@@ -10,7 +10,7 @@ declare const shortcutValueMap: {
10
10
  last60days: string[];
11
11
  last90days: string[];
12
12
  };
13
- export declare const SHORTCUTprivateValue_MAP: typeof shortcutValueMap & {
13
+ export declare const SHORTCUT_VALUE_MAP: typeof shortcutValueMap & {
14
14
  [key: string]: any;
15
15
  };
16
16
  export type McDateRangeProps = Omit<RangePickerProps, 'value' | 'onChange'> & {
@@ -18,7 +18,7 @@ var shortcutValueMap = {
18
18
  last60days: [dayjs().add(-59, 'd').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
19
19
  last90days: [dayjs().add(-89, 'd').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')]
20
20
  };
21
- export var SHORTCUTprivateValue_MAP = shortcutValueMap;
21
+ export var SHORTCUT_VALUE_MAP = shortcutValueMap;
22
22
  var McDateRange = /*#__PURE__*/forwardRef(function (props, ref) {
23
23
  var style = props.style,
24
24
  className = props.className,
@@ -42,3 +42,28 @@
42
42
  color: #b3b3b3;
43
43
  font-size: 12px;
44
44
  }
45
+ .mc-input .ant-input-wrapper .ant-input-group-addon:nth-child(1)::after,
46
+ .mc-input .ant-input-wrapper .ant-input-group-addon:nth-last-child(1)::before {
47
+ content: '';
48
+ position: absolute;
49
+ top: 50%;
50
+ /* 居中对齐 */
51
+ -webkit-transform: translateY(-50%);
52
+ -ms-transform: translateY(-50%);
53
+ transform: translateY(-50%);
54
+ /* 垂直居中 */
55
+ height: 50%;
56
+ /* 竖线高度为输入框高度的 50% */
57
+ width: 1px;
58
+ /* 竖线宽度 */
59
+ background-color: #d8d8d8;
60
+ /* 竖线颜色 */
61
+ }
62
+ .mc-input .ant-input-wrapper .ant-input-group-addon:nth-child(1)::after {
63
+ right: 0;
64
+ /* 定位到右侧 */
65
+ }
66
+ .mc-input .ant-input-wrapper .ant-input-group-addon:nth-last-child(1)::before {
67
+ left: 0;
68
+ /* 定位到右侧 */
69
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * title: 基本用法
3
+ * description: 元素出现在视窗时渲染, 日志见console.log。
4
+ */
5
+ import { McLazyLoader } from "../..";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ var textList = Array.from({
8
+ length: 100
9
+ }, function (_, index) {
10
+ return index;
11
+ });
12
+ export default (function () {
13
+ return /*#__PURE__*/_jsx("div", {
14
+ children: /*#__PURE__*/_jsx(McLazyLoader, {
15
+ style: {
16
+ height: 200,
17
+ overflow: 'auto'
18
+ },
19
+ itemMinHeight: 50,
20
+ children: textList.map(function (v) {
21
+ return /*#__PURE__*/_jsx("img", {
22
+ width: "auto",
23
+ height: 50,
24
+ onLoad: function onLoad() {
25
+ console.log('[window root: loaded]', new Date(), v);
26
+ },
27
+ src: "http://pre.data.muchcloud.com/static/img/logo-t.34c4816d.png",
28
+ alt: v.toString()
29
+ }, v);
30
+ })
31
+ })
32
+ });
33
+ });
@@ -0,0 +1,2 @@
1
+ declare const FormDemo: () => import("react/jsx-runtime").JSX.Element;
2
+ export default FormDemo;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * title: 基本用法 - 渲染表单项
3
+ * description: 元素出现在视窗时渲染, 日志见console.log。
4
+ */
5
+ import { Form } from 'antd';
6
+ import { McInput, McLazyLoader } from "../..";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ var textList = Array.from({
9
+ length: 100
10
+ }, function (_, index) {
11
+ return index;
12
+ });
13
+ var FormDemo = function FormDemo() {
14
+ return /*#__PURE__*/_jsx("div", {
15
+ children: /*#__PURE__*/_jsx(Form, {
16
+ children: /*#__PURE__*/_jsx(McLazyLoader, {
17
+ style: {
18
+ height: 200,
19
+ overflow: 'auto'
20
+ },
21
+ itemMinHeight: 50,
22
+ children: textList.map(function (v) {
23
+ return /*#__PURE__*/_jsx(Form.Item, {
24
+ shouldUpdate: true,
25
+ children: function children() {
26
+ // 写成方法形式,是为了打日志。实际运用时正常写就行
27
+ console.log('[form item: loaded]', new Date(), v);
28
+ return /*#__PURE__*/_jsx(McInput, {
29
+ defaultValue: v
30
+ });
31
+ }
32
+ }, v);
33
+ })
34
+ })
35
+ })
36
+ });
37
+ };
38
+ export default FormDemo;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ /**
3
+ * title: 基本用法
4
+ * description: 元素出现在当前父组件(div)时渲染, 日志见console.log。和root=window不同的是,尽管元素没出现在浏览器视窗内,也会被render。
5
+ */
6
+ import { McLazyLoader } from "../..";
7
+ import { useEffect, useState } from 'react';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ var textList = Array.from({
10
+ length: 100
11
+ }, function (_, index) {
12
+ return index;
13
+ });
14
+ export default (function () {
15
+ var _useState = useState(),
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ root = _useState2[0],
18
+ setRoot = _useState2[1];
19
+ useEffect(function () {
20
+ setRoot(document.getElementById('example1'));
21
+ }, []);
22
+ return /*#__PURE__*/_jsx("div", {
23
+ id: "example1",
24
+ children: /*#__PURE__*/_jsx(McLazyLoader, {
25
+ style: {
26
+ height: 200,
27
+ overflow: 'auto'
28
+ },
29
+ itemMinHeight: 50,
30
+ root: root,
31
+ children: textList.map(function (v) {
32
+ return /*#__PURE__*/_jsx("img", {
33
+ width: "auto",
34
+ height: 50,
35
+ onLoad: function onLoad() {
36
+ console.log('[div root: loaded]', new Date(), v);
37
+ },
38
+ src: "http://pre.data.muchcloud.com/static/img/logo-t.34c4816d.png",
39
+ alt: v.toString()
40
+ }, v);
41
+ })
42
+ })
43
+ });
44
+ });
@@ -0,0 +1,28 @@
1
+ /** 监听容器内的list每个元素,当元素进入视图则展示,展示后不再消失 */
2
+ import React from 'react';
3
+ interface ObserverInsertionWrapperProps {
4
+ children: React.ReactNode[];
5
+ /**
6
+ * @description 最小高度,不能为0。为0时懒加载可能会无效
7
+ * @default 20
8
+ */
9
+ itemMinHeight?: number;
10
+ /**
11
+ * @description 距离视图多少像素时触发。出于用户体验考虑,建议设置一个正数
12
+ * @default 0
13
+ */
14
+ offset?: number;
15
+ /**
16
+ * @description 重叠比例为多少时触发
17
+ * @default 0
18
+ */
19
+ threshold?: number;
20
+ /**
21
+ * @description 监听的根元素,不传则监听浏览器窗口
22
+ * @default null
23
+ */
24
+ root?: Element | Document | null;
25
+ style?: React.CSSProperties;
26
+ }
27
+ declare const ObserverInsertionWrapper: React.FC<ObserverInsertionWrapperProps>;
28
+ export default ObserverInsertionWrapper;
@@ -0,0 +1,69 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ /** 监听容器内的list每个元素,当元素进入视图则展示,展示后不再消失 */
4
+
5
+ import React, { useEffect, useRef, useState } from 'react';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ var ObserverInsertionWrapper = function ObserverInsertionWrapper(_ref) {
8
+ var children = _ref.children,
9
+ style = _ref.style,
10
+ _ref$offset = _ref.offset,
11
+ offset = _ref$offset === void 0 ? 0 : _ref$offset,
12
+ _ref$threshold = _ref.threshold,
13
+ threshold = _ref$threshold === void 0 ? 0 : _ref$threshold,
14
+ _ref$root = _ref.root,
15
+ root = _ref$root === void 0 ? null : _ref$root,
16
+ _ref$itemMinHeight = _ref.itemMinHeight,
17
+ itemMinHeight = _ref$itemMinHeight === void 0 ? 20 : _ref$itemMinHeight;
18
+ var wrapperRef = useRef(null);
19
+ var _useState = useState(new Array(children.length).fill(false)),
20
+ _useState2 = _slicedToArray(_useState, 2),
21
+ visibleItems = _useState2[0],
22
+ setVisibleItems = _useState2[1];
23
+ useEffect(function () {
24
+ var _wrapperRef$current;
25
+ var observer = new IntersectionObserver(function (entries) {
26
+ entries.forEach(function (entry) {
27
+ var index = Number(entry.target.getAttribute('data-index'));
28
+ if (entry.isIntersecting) {
29
+ observer.unobserve(entry.target);
30
+ setVisibleItems(function (prev) {
31
+ console.log('in:', index);
32
+ var newVisibleItems = _toConsumableArray(prev);
33
+ newVisibleItems[index] = true;
34
+ return newVisibleItems;
35
+ });
36
+ }
37
+ });
38
+ }, {
39
+ root: root,
40
+ // 监听浏览器窗口
41
+ rootMargin: "".concat(offset, "px"),
42
+ threshold: threshold
43
+ });
44
+ var elements = (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.children;
45
+ elements && Array.from(elements).forEach(function (element) {
46
+ observer.observe(element);
47
+ });
48
+ return function () {
49
+ elements && Array.from(elements).forEach(function (element) {
50
+ observer.unobserve(element);
51
+ });
52
+ };
53
+ }, [offset, threshold, root, children.length]);
54
+ return /*#__PURE__*/_jsx("div", {
55
+ ref: wrapperRef,
56
+ style: style,
57
+ children: React.Children.map(children, function (child, index) {
58
+ var key = /*#__PURE__*/React.isValidElement(child) ? child.key : index;
59
+ return /*#__PURE__*/_jsx("div", {
60
+ style: {
61
+ minHeight: itemMinHeight
62
+ },
63
+ "data-index": index,
64
+ children: visibleItems[index] ? child : null
65
+ }, key);
66
+ })
67
+ });
68
+ };
69
+ export default ObserverInsertionWrapper;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,66 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ /**
5
+ * title: 远程请求 + 设置fieldNames
6
+ * description: 通过远程请求获取数据,同时支持通过fieldNames映射label、value字段。
7
+ */
8
+ import { McProSelect } from "../..";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ var mockDataList = {
11
+ total: 10,
12
+ pageSize: 1,
13
+ current: 1,
14
+ records: [{
15
+ id: 1,
16
+ name: '路由规则1'
17
+ }, {
18
+ id: 2,
19
+ name: '路由规则2'
20
+ }]
21
+ };
22
+ export default (function () {
23
+ var getRoutingList = /*#__PURE__*/function () {
24
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
25
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
26
+ while (1) switch (_context.prev = _context.next) {
27
+ case 0:
28
+ return _context.abrupt("return", new Promise(function (resolve) {
29
+ console.log({
30
+ params: params
31
+ });
32
+ setTimeout(function () {
33
+ resolve(_objectSpread(_objectSpread({}, mockDataList), {}, {
34
+ records: mockDataList.records.filter(function (item) {
35
+ return !params.name || item.name.includes(params.name);
36
+ })
37
+ }));
38
+ }, 200);
39
+ }));
40
+ case 1:
41
+ case "end":
42
+ return _context.stop();
43
+ }
44
+ }, _callee);
45
+ }));
46
+ return function getRoutingList(_x) {
47
+ return _ref.apply(this, arguments);
48
+ };
49
+ }();
50
+ return /*#__PURE__*/_jsx(McProSelect, {
51
+ name: "routing",
52
+ label: "\u8DEF\u7531\u89C4\u5219",
53
+ searchKey: "name",
54
+ request: function request(params) {
55
+ return getRoutingList(_objectSpread(_objectSpread({}, params), {}, {
56
+ status: 1
57
+ }));
58
+ },
59
+ fieldNames: {
60
+ label: 'name',
61
+ value: 'id'
62
+ },
63
+ multiple: false,
64
+ required: true
65
+ });
66
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * title: 基本用法
3
+ * description: 增加name和label,原McSelect的属性放到fieldPros中
4
+ */
5
+ import { McProSelect } from "../..";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ export default (function () {
8
+ return /*#__PURE__*/_jsx(McProSelect, {
9
+ name: "select1",
10
+ label: "select1",
11
+ fieldProps: {
12
+ defaultValue: 'lucy',
13
+ options: [{
14
+ value: 'jack',
15
+ label: 'Jack'
16
+ }, {
17
+ value: 'lucy',
18
+ label: 'Lucy'
19
+ }, {
20
+ value: 'Yiminghe',
21
+ label: 'yiminghe'
22
+ }, {
23
+ value: 'disabled',
24
+ label: 'Disabled',
25
+ disabled: true
26
+ }]
27
+ }
28
+ });
29
+ });
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const App: React.FC;
3
+ export default App;