@zykj2024/much-library 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/README.md +23 -23
  2. package/dist/McLazyLoader/demo/basic.d.ts +2 -0
  3. package/dist/McLazyLoader/demo/basic.js +33 -0
  4. package/dist/McLazyLoader/demo/form.d.ts +2 -0
  5. package/dist/McLazyLoader/demo/form.js +38 -0
  6. package/dist/McLazyLoader/demo/has-root.d.ts +2 -0
  7. package/dist/McLazyLoader/demo/has-root.js +44 -0
  8. package/dist/McLazyLoader/index.d.ts +28 -0
  9. package/dist/McLazyLoader/index.js +75 -0
  10. package/dist/McProSelect/demo/async.d.ts +2 -0
  11. package/dist/McProSelect/demo/async.js +66 -0
  12. package/dist/McProSelect/demo/base.d.ts +2 -0
  13. package/dist/McProSelect/demo/base.js +29 -0
  14. package/dist/McProSelect/demo/exclusion-async-rename.d.ts +3 -0
  15. package/dist/McProSelect/demo/exclusion-async-rename.js +103 -0
  16. package/dist/McProSelect/demo/exclusion-rename.d.ts +3 -0
  17. package/dist/McProSelect/demo/exclusion-rename.js +74 -0
  18. package/dist/McProSelect/demo/exclusion.d.ts +3 -0
  19. package/dist/McProSelect/demo/exclusion.js +70 -0
  20. package/dist/McProSelect/demo/require.d.ts +2 -0
  21. package/dist/McProSelect/demo/require.js +82 -0
  22. package/dist/McProSelect/index.d.ts +35 -0
  23. package/dist/McProSelect/index.js +152 -0
  24. package/dist/McSelect/demo/exclusion.d.ts +3 -0
  25. package/dist/McSelect/demo/exclusion.js +64 -0
  26. package/dist/McSelect/index.d.ts +2 -2
  27. package/dist/McSelect/index.js +8 -6
  28. package/dist/McTag/demo/demo1.d.ts +2 -0
  29. package/dist/McTag/demo/demo1.js +18 -0
  30. package/dist/McTag/demo/demo2.d.ts +2 -0
  31. package/dist/McTag/demo/demo2.js +20 -0
  32. package/dist/McTag/demo/demo3.d.ts +2 -0
  33. package/dist/McTag/demo/demo3.js +19 -0
  34. package/dist/McTag/demo/demo4.d.ts +2 -0
  35. package/dist/McTag/demo/demo4.js +22 -0
  36. package/dist/McTag/index.d.ts +22 -0
  37. package/dist/McTag/index.js +59 -0
  38. package/dist/McThemeConfig/customToken.json +2 -1
  39. package/dist/McThemeConfig/demo/radio.js +39 -0
  40. package/dist/McThemeConfig/globalStyle.js +2 -4
  41. package/dist/Utils/index.d.ts +5 -4
  42. package/dist/Utils/index.js +6 -26
  43. package/dist/index.d.ts +5 -2
  44. package/dist/index.js +5 -2
  45. package/package.json +3 -1
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/)
@@ -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,75 @@
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
+ console.log({
20
+ itemMinHeight: itemMinHeight
21
+ });
22
+ var _useState = useState(new Array(children.length).fill(false)),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ visibleItems = _useState2[0],
25
+ setVisibleItems = _useState2[1];
26
+ console.log({
27
+ root: root
28
+ }, document.getElementById('example1'));
29
+ useEffect(function () {
30
+ var _wrapperRef$current;
31
+ var observer = new IntersectionObserver(function (entries) {
32
+ entries.forEach(function (entry) {
33
+ var index = Number(entry.target.getAttribute('data-index'));
34
+ if (entry.isIntersecting) {
35
+ observer.unobserve(entry.target);
36
+ setVisibleItems(function (prev) {
37
+ console.log('in:', index);
38
+ var newVisibleItems = _toConsumableArray(prev);
39
+ newVisibleItems[index] = true;
40
+ return newVisibleItems;
41
+ });
42
+ }
43
+ });
44
+ }, {
45
+ root: root,
46
+ // 监听浏览器窗口
47
+ rootMargin: "".concat(offset, "px"),
48
+ threshold: threshold
49
+ });
50
+ var elements = (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.children;
51
+ elements && Array.from(elements).forEach(function (element) {
52
+ observer.observe(element);
53
+ });
54
+ return function () {
55
+ elements && Array.from(elements).forEach(function (element) {
56
+ observer.unobserve(element);
57
+ });
58
+ };
59
+ }, [offset, threshold, root, children.length]);
60
+ return /*#__PURE__*/_jsx("div", {
61
+ ref: wrapperRef,
62
+ style: style,
63
+ children: React.Children.map(children, function (child, index) {
64
+ var key = /*#__PURE__*/React.isValidElement(child) ? child.key : index;
65
+ return /*#__PURE__*/_jsx("div", {
66
+ style: {
67
+ minHeight: itemMinHeight
68
+ },
69
+ "data-index": index,
70
+ children: visibleItems[index] ? child : null
71
+ }, key);
72
+ })
73
+ });
74
+ };
75
+ 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;
@@ -0,0 +1,103 @@
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: 动态option + 两个互斥的select + 设置fieldNames
6
+ * description: 基于远程请求,其他同上一个demo
7
+ */
8
+ import { Form } from 'antd';
9
+ import { McProSelect } from "../..";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ var mockDataList = {
13
+ total: 10,
14
+ pageSize: 1,
15
+ current: 1,
16
+ records: [{
17
+ id: 1,
18
+ name: '路由规则1'
19
+ }, {
20
+ id: 2,
21
+ name: '路由规则2'
22
+ }]
23
+ };
24
+ var App = function App() {
25
+ var getRoutingList = /*#__PURE__*/function () {
26
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
27
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
28
+ while (1) switch (_context.prev = _context.next) {
29
+ case 0:
30
+ return _context.abrupt("return", new Promise(function (resolve) {
31
+ console.log({
32
+ params: params
33
+ });
34
+ setTimeout(function () {
35
+ resolve(_objectSpread(_objectSpread({}, mockDataList), {}, {
36
+ records: mockDataList.records.filter(function (item) {
37
+ return !params.name || item.name.includes(params.name);
38
+ })
39
+ }));
40
+ }, 200);
41
+ }));
42
+ case 1:
43
+ case "end":
44
+ return _context.stop();
45
+ }
46
+ }, _callee);
47
+ }));
48
+ return function getRoutingList(_x) {
49
+ return _ref.apply(this, arguments);
50
+ };
51
+ }();
52
+ return /*#__PURE__*/_jsxs(Form, {
53
+ name: "exclusion3",
54
+ children: [/*#__PURE__*/_jsx(Form.Item, {
55
+ noStyle: true,
56
+ dependencies: ['select2'],
57
+ children: function children(_ref2) {
58
+ var _getFieldValue;
59
+ var getFieldValue = _ref2.getFieldValue;
60
+ return /*#__PURE__*/_jsx(McProSelect, {
61
+ label: "select1",
62
+ name: "select1",
63
+ searchKey: "name",
64
+ request: function request(params) {
65
+ return getRoutingList(_objectSpread(_objectSpread({}, params), {}, {
66
+ status: 1
67
+ }));
68
+ },
69
+ fieldNames: {
70
+ label: 'name',
71
+ value: 'id'
72
+ },
73
+ tooltip: "\u7531JAVA spring\u6846\u67B6\u7BA1\u7406\u7684bean\u5B9E\u4F8B\u540D\u79F0",
74
+ excludeIds: [(_getFieldValue = getFieldValue('select2')) === null || _getFieldValue === void 0 ? void 0 : _getFieldValue.id]
75
+ });
76
+ }
77
+ }), /*#__PURE__*/_jsx(Form.Item, {
78
+ noStyle: true,
79
+ dependencies: ['select1'],
80
+ children: function children(_ref3) {
81
+ var _getFieldValue2;
82
+ var getFieldValue = _ref3.getFieldValue;
83
+ return /*#__PURE__*/_jsx(McProSelect, {
84
+ label: "select2",
85
+ name: "select2",
86
+ searchKey: "name",
87
+ request: function request(params) {
88
+ return getRoutingList(_objectSpread(_objectSpread({}, params), {}, {
89
+ status: 1
90
+ }));
91
+ },
92
+ fieldNames: {
93
+ label: 'name',
94
+ value: 'id'
95
+ },
96
+ tooltip: "\u7531JAVA spring\u6846\u67B6\u7BA1\u7406\u7684bean\u5B9E\u4F8B\u540D\u79F02",
97
+ excludeIds: [(_getFieldValue2 = getFieldValue('select1')) === null || _getFieldValue2 === void 0 ? void 0 : _getFieldValue2.id]
98
+ });
99
+ }
100
+ })]
101
+ });
102
+ };
103
+ export default App;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const App: React.FC;
3
+ export default App;
@@ -0,0 +1,74 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ /**
3
+ * title: 静态option + 两个互斥的select + 设置fieldNames
4
+ * description: 上两种情况的组合
5
+ */
6
+ import { Form } from 'antd';
7
+ import { useForm } from 'antd/es/form/Form';
8
+ import { McProSelect } from "../..";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ var options = [{
12
+ name: 'goldLabel',
13
+ id: 'gold'
14
+ }, {
15
+ name: 'limeLabel',
16
+ id: 'lime'
17
+ }, {
18
+ name: 'greenLabel',
19
+ id: 'green'
20
+ }, {
21
+ name: 'cyanLabel',
22
+ id: 'cyan'
23
+ }];
24
+ var App = function App() {
25
+ var _useForm = useForm(),
26
+ _useForm2 = _slicedToArray(_useForm, 1),
27
+ form = _useForm2[0];
28
+ return /*#__PURE__*/_jsxs(Form, {
29
+ form: form,
30
+ name: "exclusion2",
31
+ children: [/*#__PURE__*/_jsx(Form.Item, {
32
+ noStyle: true,
33
+ dependencies: ['select2'],
34
+ children: function children(_ref) {
35
+ var _getFieldValue;
36
+ var getFieldValue = _ref.getFieldValue;
37
+ return /*#__PURE__*/_jsx(McProSelect, {
38
+ label: "select1",
39
+ name: "select1",
40
+ tooltip: "\u7531JAVA spring\u6846\u67B6\u7BA1\u7406\u7684bean\u5B9E\u4F8B\u540D\u79F0",
41
+ excludeIds: [(_getFieldValue = getFieldValue('select2')) === null || _getFieldValue === void 0 ? void 0 : _getFieldValue.id],
42
+ fieldNames: {
43
+ label: 'name',
44
+ value: 'id'
45
+ },
46
+ fieldProps: {
47
+ options: options
48
+ }
49
+ });
50
+ }
51
+ }), /*#__PURE__*/_jsx(Form.Item, {
52
+ noStyle: true,
53
+ dependencies: ['select1'],
54
+ children: function children(_ref2) {
55
+ var _getFieldValue2;
56
+ var getFieldValue = _ref2.getFieldValue;
57
+ return /*#__PURE__*/_jsx(McProSelect, {
58
+ label: "select2",
59
+ name: "select2",
60
+ tooltip: "\u7531JAVA spring\u6846\u67B6\u7BA1\u7406\u7684bean\u5B9E\u4F8B\u540D\u79F02",
61
+ excludeIds: [(_getFieldValue2 = getFieldValue('select1')) === null || _getFieldValue2 === void 0 ? void 0 : _getFieldValue2.id],
62
+ fieldNames: {
63
+ label: 'name',
64
+ value: 'id'
65
+ },
66
+ fieldProps: {
67
+ options: options
68
+ }
69
+ });
70
+ }
71
+ })]
72
+ });
73
+ };
74
+ export default App;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const App: React.FC;
3
+ export default App;
@@ -0,0 +1,70 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ /**
3
+ * title: 静态option + 两个互斥的select
4
+ * description: select1中选择的选项会在select2中被排除,反之亦然。此方法同样支持远程select。
5
+ */
6
+ import { Form } from 'antd';
7
+ import { useForm } from 'antd/es/form/Form';
8
+ import { McProSelect } from "../..";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ var options = [{
12
+ label: 'goldLabel',
13
+ value: 'gold'
14
+ }, {
15
+ label: 'limeLabel',
16
+ value: 'lime'
17
+ }, {
18
+ label: 'greenLabel',
19
+ value: 'green'
20
+ }, {
21
+ label: 'cyanLabel',
22
+ value: 'cyan'
23
+ }];
24
+ var App = function App() {
25
+ var _useForm = useForm(),
26
+ _useForm2 = _slicedToArray(_useForm, 1),
27
+ form = _useForm2[0];
28
+ return /*#__PURE__*/_jsxs(Form, {
29
+ form: form,
30
+ name: "exclusion2",
31
+ children: [/*#__PURE__*/_jsx(Form.Item, {
32
+ noStyle: true
33
+ // 也可以用dependencies
34
+ ,
35
+ shouldUpdate: function shouldUpdate(prev, next) {
36
+ return prev['select2'] !== next['select2'];
37
+ },
38
+ children: function children(_ref) {
39
+ var _getFieldValue;
40
+ var getFieldValue = _ref.getFieldValue;
41
+ return /*#__PURE__*/_jsx(McProSelect, {
42
+ label: "select1",
43
+ name: "select1",
44
+ tooltip: "\u7531JAVA spring\u6846\u67B6\u7BA1\u7406\u7684bean\u5B9E\u4F8B\u540D\u79F0",
45
+ excludeIds: [(_getFieldValue = getFieldValue('select2')) === null || _getFieldValue === void 0 ? void 0 : _getFieldValue.value],
46
+ fieldProps: {
47
+ options: options
48
+ }
49
+ });
50
+ }
51
+ }), /*#__PURE__*/_jsx(Form.Item, {
52
+ noStyle: true,
53
+ dependencies: ['select1'],
54
+ children: function children(_ref2) {
55
+ var _getFieldValue2;
56
+ var getFieldValue = _ref2.getFieldValue;
57
+ return /*#__PURE__*/_jsx(McProSelect, {
58
+ label: "select2",
59
+ name: "select2",
60
+ tooltip: "\u7531JAVA spring\u6846\u67B6\u7BA1\u7406\u7684bean\u5B9E\u4F8B\u540D\u79F02",
61
+ excludeIds: [(_getFieldValue2 = getFieldValue('select1')) === null || _getFieldValue2 === void 0 ? void 0 : _getFieldValue2.value],
62
+ fieldProps: {
63
+ options: options
64
+ }
65
+ });
66
+ }
67
+ })]
68
+ });
69
+ };
70
+ export default App;
@@ -0,0 +1,2 @@
1
+ declare const requireDemo: () => import("react/jsx-runtime").JSX.Element;
2
+ export default requireDemo;