@zykj2024/much-library 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -0
  3. package/dist/McCascader/city.js +909 -0
  4. package/dist/McCascader/index.css +60 -0
  5. package/dist/McCascader/index.d.ts +19 -0
  6. package/dist/McCascader/index.js +221 -0
  7. package/dist/McContainer/demo/actionBar.d.ts +8 -0
  8. package/dist/McContainer/demo/actionBar.js +70 -0
  9. package/dist/McContainer/demo/base.d.ts +8 -0
  10. package/dist/McContainer/demo/base.js +80 -0
  11. package/dist/McContainer/demo/batch.d.ts +8 -0
  12. package/dist/McContainer/demo/batch.js +89 -0
  13. package/dist/McContainer/demo/collapse.d.ts +8 -0
  14. package/dist/McContainer/demo/collapse.js +76 -0
  15. package/dist/McContainer/demo/expand.d.ts +8 -0
  16. package/dist/McContainer/demo/expand.js +90 -0
  17. package/dist/McContainer/demo/pagination.d.ts +7 -0
  18. package/dist/McContainer/demo/pagination.js +93 -0
  19. package/dist/McContainer/demo/search.d.ts +7 -0
  20. package/dist/McContainer/demo/search.js +101 -0
  21. package/dist/McContainer/demo/standard.d.ts +7 -0
  22. package/dist/McContainer/demo/standard.js +168 -0
  23. package/dist/McContainer/index.css +123 -0
  24. package/dist/McContainer/index.d.ts +49 -0
  25. package/dist/McContainer/index.js +407 -0
  26. package/dist/McDateRange/demo/base.d.ts +6 -0
  27. package/dist/McDateRange/demo/base.js +22 -0
  28. package/dist/McDateRange/demo/cancelPresets.d.ts +6 -0
  29. package/dist/McDateRange/demo/cancelPresets.js +23 -0
  30. package/dist/McDateRange/demo/overlap.d.ts +2 -0
  31. package/dist/McDateRange/demo/overlap.js +32 -0
  32. package/dist/McDateRange/index.css +31 -0
  33. package/dist/McDateRange/index.d.ts +28 -0
  34. package/dist/McDateRange/index.js +167 -0
  35. package/dist/McFonts/index.d.ts +7 -0
  36. package/dist/McFonts/index.js +10 -0
  37. package/dist/McFonts/public/FF DIN Pro Bold.otf +0 -0
  38. package/dist/McFonts/public/SourceHanSansCN-Bold.otf +0 -0
  39. package/dist/McFonts/public/SourceHanSansCN-Light.otf +0 -0
  40. package/dist/McFonts/public/SourceHanSansCN-Medium.otf +0 -0
  41. package/dist/McFonts/public/SourceHanSansCN-Regular.otf +0 -0
  42. package/dist/McGroupPanel/comps/SelectedItem/index.d.ts +4 -0
  43. package/dist/McGroupPanel/comps/SelectedItem/index.js +76 -0
  44. package/dist/McGroupPanel/index.css +162 -0
  45. package/dist/McGroupPanel/index.d.ts +29 -0
  46. package/dist/McGroupPanel/index.js +411 -0
  47. package/dist/McIconFont/iconfont.js +1 -0
  48. package/dist/McIconFont/index.d.ts +5 -0
  49. package/dist/McIconFont/index.js +8 -0
  50. package/dist/McIcons/business.json +137 -0
  51. package/dist/McInput/Input.d.ts +19 -0
  52. package/dist/McInput/Input.js +48 -0
  53. package/dist/McInput/Search.d.ts +39 -0
  54. package/dist/McInput/Search.js +81 -0
  55. package/dist/McInput/TextArea.d.ts +11 -0
  56. package/dist/McInput/TextArea.js +37 -0
  57. package/dist/McInput/demo/Input/addonBefore.d.ts +3 -0
  58. package/dist/McInput/demo/Input/addonBefore.js +67 -0
  59. package/dist/McInput/demo/Input/base.d.ts +2 -0
  60. package/dist/McInput/demo/Input/base.js +31 -0
  61. package/dist/McInput/demo/Input/isTrim.d.ts +2 -0
  62. package/dist/McInput/demo/Input/isTrim.js +22 -0
  63. package/dist/McInput/demo/Input/label.d.ts +2 -0
  64. package/dist/McInput/demo/Input/label.js +26 -0
  65. package/dist/McInput/demo/Input/ref.d.ts +3 -0
  66. package/dist/McInput/demo/Input/ref.js +53 -0
  67. package/dist/McInput/demo/Input/status.d.ts +2 -0
  68. package/dist/McInput/demo/Input/status.js +23 -0
  69. package/dist/McInput/demo/Search/search-base.d.ts +2 -0
  70. package/dist/McInput/demo/Search/search-base.js +38 -0
  71. package/dist/McInput/demo/TextArea/text-area-base.d.ts +2 -0
  72. package/dist/McInput/demo/TextArea/text-area-base.js +38 -0
  73. package/dist/McInput/index.css +44 -0
  74. package/dist/McInput/index.d.ts +13 -0
  75. package/dist/McInput/index.js +7 -0
  76. package/dist/McInputNumber/demo/index.d.ts +2 -0
  77. package/dist/McInputNumber/demo/index.js +28 -0
  78. package/dist/McInputNumber/demo/label.d.ts +2 -0
  79. package/dist/McInputNumber/demo/label.js +26 -0
  80. package/dist/McInputNumber/demo/precision.d.ts +2 -0
  81. package/dist/McInputNumber/demo/precision.js +20 -0
  82. package/dist/McInputNumber/index.css +9 -0
  83. package/dist/McInputNumber/index.d.ts +13 -0
  84. package/dist/McInputNumber/index.js +43 -0
  85. package/dist/McModalProvider/index.d.ts +174 -0
  86. package/dist/McModalProvider/index.js +498 -0
  87. package/dist/McPeriodSelect/demo/base.d.ts +6 -0
  88. package/dist/McPeriodSelect/demo/base.js +19 -0
  89. package/dist/McPeriodSelect/demo/half.d.ts +6 -0
  90. package/dist/McPeriodSelect/demo/half.js +20 -0
  91. package/dist/McPeriodSelect/index.css +189 -0
  92. package/dist/McPeriodSelect/index.d.ts +13 -0
  93. package/dist/McPeriodSelect/index.js +305 -0
  94. package/dist/McPopoverButton/index.d.ts +14 -0
  95. package/dist/McPopoverButton/index.js +52 -0
  96. package/dist/McPopoverForm/index.d.ts +14 -0
  97. package/dist/McPopoverForm/index.js +95 -0
  98. package/dist/McResult/default.d.ts +1 -0
  99. package/dist/McResult/default.js +84 -0
  100. package/dist/McResult/demo/403.d.ts +6 -0
  101. package/dist/McResult/demo/403.js +17 -0
  102. package/dist/McResult/demo/404.d.ts +6 -0
  103. package/dist/McResult/demo/404.js +17 -0
  104. package/dist/McResult/demo/500.d.ts +6 -0
  105. package/dist/McResult/demo/500.js +17 -0
  106. package/dist/McResult/demo/building.d.ts +6 -0
  107. package/dist/McResult/demo/building.js +12 -0
  108. package/dist/McResult/demo/empty.d.ts +2 -0
  109. package/dist/McResult/demo/empty.js +11 -0
  110. package/dist/McResult/demo/noFunction.d.ts +2 -0
  111. package/dist/McResult/demo/noFunction.js +11 -0
  112. package/dist/McResult/demo/noUser.d.ts +6 -0
  113. package/dist/McResult/demo/noUser.js +12 -0
  114. package/dist/McResult/demo/preview.d.ts +2 -0
  115. package/dist/McResult/demo/preview.js +14 -0
  116. package/dist/McResult/icon.d.ts +25 -0
  117. package/dist/McResult/icon.js +946 -0
  118. package/dist/McResult/index.css +20 -0
  119. package/dist/McResult/index.d.ts +27 -0
  120. package/dist/McResult/index.js +103 -0
  121. package/dist/McResult/public/403.svg +164 -0
  122. package/dist/McResult/public/404.svg +123 -0
  123. package/dist/McResult/public/500.svg +129 -0
  124. package/dist/McResult/public/building.svg +127 -0
  125. package/dist/McResult/public/code403.svg +7 -0
  126. package/dist/McResult/public/code404.svg +5 -0
  127. package/dist/McResult/public/code500.svg +5 -0
  128. package/dist/McResult/public/empty.svg +1 -0
  129. package/dist/McResult/public/noFunction.svg +1 -0
  130. package/dist/McResult/public/noUser.svg +90 -0
  131. package/dist/McSelect/demo/base.d.ts +2 -0
  132. package/dist/McSelect/demo/base.js +63 -0
  133. package/dist/McSelect/demo/changeOnHidden.d.ts +2 -0
  134. package/dist/McSelect/demo/changeOnHidden.js +43 -0
  135. package/dist/McSelect/demo/dropdownRender.d.ts +7 -0
  136. package/dist/McSelect/demo/dropdownRender.js +78 -0
  137. package/dist/McSelect/demo/fetchOptions.d.ts +7 -0
  138. package/dist/McSelect/demo/fetchOptions.js +210 -0
  139. package/dist/McSelect/demo/inexistent.d.ts +2 -0
  140. package/dist/McSelect/demo/inexistent.js +79 -0
  141. package/dist/McSelect/demo/labelInValue.d.ts +2 -0
  142. package/dist/McSelect/demo/labelInValue.js +72 -0
  143. package/dist/McSelect/demo/maxTagCount.d.ts +3 -0
  144. package/dist/McSelect/demo/maxTagCount.js +51 -0
  145. package/dist/McSelect/demo/multiple.d.ts +2 -0
  146. package/dist/McSelect/demo/multiple.js +46 -0
  147. package/dist/McSelect/demo/optionRender.d.ts +3 -0
  148. package/dist/McSelect/demo/optionRender.js +51 -0
  149. package/dist/McSelect/demo/tagRender.d.ts +3 -0
  150. package/dist/McSelect/demo/tagRender.js +51 -0
  151. package/dist/McSelect/index.css +60 -0
  152. package/dist/McSelect/index.d.ts +40 -0
  153. package/dist/McSelect/index.js +350 -0
  154. package/dist/McThemeConfig/customToken.json +38 -0
  155. package/dist/McThemeConfig/demo/button.d.ts +2 -0
  156. package/dist/McThemeConfig/demo/button.js +226 -0
  157. package/dist/McThemeConfig/demo/drawer.d.ts +2 -0
  158. package/dist/McThemeConfig/demo/drawer.js +59 -0
  159. package/dist/McThemeConfig/demo/modal.d.ts +2 -0
  160. package/dist/McThemeConfig/demo/modal.js +78 -0
  161. package/dist/McThemeConfig/demo/radio.d.ts +2 -0
  162. package/dist/McThemeConfig/demo/radio.js +97 -0
  163. package/dist/McThemeConfig/demo/switch.d.ts +2 -0
  164. package/dist/McThemeConfig/demo/switch.js +96 -0
  165. package/dist/McThemeConfig/demo/tabs.d.ts +2 -0
  166. package/dist/McThemeConfig/demo/tabs.js +35 -0
  167. package/dist/McThemeConfig/globalStyle.d.ts +2 -0
  168. package/dist/McThemeConfig/globalStyle.js +172 -0
  169. package/dist/McThemeConfig/index.d.ts +9 -0
  170. package/dist/McThemeConfig/index.js +16 -0
  171. package/dist/McThemeConfig/layoutStyle.d.ts +2 -0
  172. package/dist/McThemeConfig/layoutStyle.js +1 -0
  173. package/dist/McThemeConfig/provider.d.ts +7 -0
  174. package/dist/McThemeConfig/provider.js +19 -0
  175. package/dist/McThemeConfig/themeToken.json +149 -0
  176. package/dist/McTreePanel/SelectedItem.d.ts +4 -0
  177. package/dist/McTreePanel/SelectedItem.js +75 -0
  178. package/dist/McTreePanel/demo/base.d.ts +6 -0
  179. package/dist/McTreePanel/demo/base.js +45 -0
  180. package/dist/McTreePanel/demo/fieldNames.d.ts +6 -0
  181. package/dist/McTreePanel/demo/fieldNames.js +37 -0
  182. package/dist/McTreePanel/demo/inexistent.d.ts +6 -0
  183. package/dist/McTreePanel/demo/inexistent.js +56 -0
  184. package/dist/McTreePanel/demo/labelInValue.d.ts +6 -0
  185. package/dist/McTreePanel/demo/labelInValue.js +56 -0
  186. package/dist/McTreePanel/demo/sortable.d.ts +6 -0
  187. package/dist/McTreePanel/demo/sortable.js +34 -0
  188. package/dist/McTreePanel/index.css +110 -0
  189. package/dist/McTreePanel/index.d.ts +27 -0
  190. package/dist/McTreePanel/index.js +315 -0
  191. package/dist/McTreeSelect/demo/base.d.ts +5 -0
  192. package/dist/McTreeSelect/demo/base.js +58 -0
  193. package/dist/McTreeSelect/demo/inexistent.d.ts +5 -0
  194. package/dist/McTreeSelect/demo/inexistent.js +63 -0
  195. package/dist/McTreeSelect/demo/label.d.ts +5 -0
  196. package/dist/McTreeSelect/demo/label.js +60 -0
  197. package/dist/McTreeSelect/demo/multiple.d.ts +5 -0
  198. package/dist/McTreeSelect/demo/multiple.js +71 -0
  199. package/dist/McTreeSelect/index.css +60 -0
  200. package/dist/McTreeSelect/index.d.ts +13 -0
  201. package/dist/McTreeSelect/index.js +182 -0
  202. package/dist/Utils/index.d.ts +4 -0
  203. package/dist/Utils/index.js +26 -0
  204. package/dist/index.d.ts +19 -0
  205. package/dist/index.js +19 -0
  206. package/dist/typings.d.ts +20 -0
  207. package/package.json +82 -0
@@ -0,0 +1,60 @@
1
+ .mc-cascader__label {
2
+ color: #262626;
3
+ font-size: 14px;
4
+ position: absolute;
5
+ top: 0;
6
+ left: 11px;
7
+ z-index: 2;
8
+ height: 100%;
9
+ display: -webkit-box;
10
+ display: -ms-flexbox;
11
+ display: flex;
12
+ -webkit-box-align: center;
13
+ -ms-flex-align: center;
14
+ align-items: center;
15
+ }
16
+ .mc-cascader__label::after {
17
+ content: ':';
18
+ margin-left: 2px;
19
+ }
20
+ .mc-cascader__label.mc-cascader--disabled {
21
+ color: rgba(0, 0, 0, 0.25);
22
+ cursor: no-drop;
23
+ }
24
+ .mc-cascader__content {
25
+ width: 100%;
26
+ height: 100%;
27
+ }
28
+ .mc-cascader__content.ant-cascader.ant-select .ant-select-selector {
29
+ padding-left: var(--selector-pl);
30
+ }
31
+ .mc-cascader__content.ant-cascader.ant-select .ant-select-selector .ant-select-selection-overflow-item-rest .ant-select-selection-item {
32
+ color: #fff;
33
+ background: #325cf7;
34
+ padding-left: 4px;
35
+ }
36
+ .mc-cascader__content.ant-cascader.ant-select .ant-select-selector .ant-select-selection-overflow-item-rest .ant-select-selection-item .ant-select-selection-item-content {
37
+ margin-right: 0;
38
+ }
39
+ .mc-cascader__content.ant-cascader.ant-select .ant-select-selector .ant-select-selection-item[title*='「'][title$='」'] {
40
+ color: var(--inexistent-color);
41
+ }
42
+ .mc-cascader__content.ant-cascader.ant-select.ant-select-single .ant-select-selector .ant-select-selection-search {
43
+ left: var(--selector-pl);
44
+ }
45
+ .mc-cascader__content.ant-cascader.ant-select.ant-select-multiple .ant-select-selector .ant-select-selection-placeholder {
46
+ left: var(--selector-pl);
47
+ }
48
+ .mc-cascader__content.ant-cascader.ant-select.ant-select-multiple .ant-select-selector .ant-select-selection-search {
49
+ margin-left: 0;
50
+ }
51
+ .mc-cascader.mc-cascader--inline .ant-select-selection-overflow-item:not(
52
+ .ant-select-selection-overflow-item-rest,
53
+ .ant-select-selection-overflow-item-suffix
54
+ ) {
55
+ -webkit-box-flex: 1;
56
+ -ms-flex: 1;
57
+ flex: 1;
58
+ min-width: 0;
59
+ margin-right: 4px;
60
+ }
@@ -0,0 +1,19 @@
1
+ import { CascaderProps } from 'antd';
2
+ import { CSSProperties, FC, ReactNode } from 'react';
3
+ import './index.less';
4
+ type Inexistent = {
5
+ inexistentText?: string;
6
+ inexistentColor?: string;
7
+ reserveOriginalValue?: boolean;
8
+ };
9
+ export type McCascaderProps = CascaderProps & {
10
+ style?: CSSProperties;
11
+ className?: string;
12
+ name?: string;
13
+ label?: ReactNode;
14
+ inexistent?: boolean | Inexistent;
15
+ city?: boolean;
16
+ [key: string]: any;
17
+ };
18
+ declare const McCascader: FC<McCascaderProps>;
19
+ export default McCascader;
@@ -0,0 +1,221 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ var _excluded = ["style", "className", "label", "inexistent", "city", "value", "onChange", "options", "multiple", "disabled", "fieldNames", "maxTagCount"];
6
+ import { Cascader, Divider, Popover } from 'antd';
7
+ import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
8
+ import { cityData } from "./city";
9
+ import "./index.css";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ var McCascader = /*#__PURE__*/forwardRef(function (props, ref) {
13
+ var style = props.style,
14
+ className = props.className,
15
+ label = props.label,
16
+ _props$inexistent = props.inexistent,
17
+ inexistent = _props$inexistent === void 0 ? false : _props$inexistent,
18
+ _props$city = props.city,
19
+ city = _props$city === void 0 ? false : _props$city,
20
+ value = props.value,
21
+ onChange = props.onChange,
22
+ options = props.options,
23
+ multiple = props.multiple,
24
+ disabled = props.disabled,
25
+ fieldNames = props.fieldNames,
26
+ maxTagCount = props.maxTagCount,
27
+ rest = _objectWithoutProperties(props, _excluded);
28
+ var _ref = typeof inexistent === 'boolean' ? {} : inexistent,
29
+ _ref$inexistentText = _ref.inexistentText,
30
+ inexistentText = _ref$inexistentText === void 0 ? '不存在' : _ref$inexistentText,
31
+ _ref$inexistentColor = _ref.inexistentColor,
32
+ inexistentColor = _ref$inexistentColor === void 0 ? '#ff4d4f' : _ref$inexistentColor,
33
+ _ref$reserveOriginalV = _ref.reserveOriginalValue,
34
+ reserveOriginalValue = _ref$reserveOriginalV === void 0 ? false : _ref$reserveOriginalV;
35
+ var _maxTagCount = useMemo(function () {
36
+ return props.hasOwnProperty('maxTagCount') ? maxTagCount : 1;
37
+ }, [maxTagCount]);
38
+
39
+ /* 对于城市级联的选项以及字段名处理 */
40
+ var _options = useMemo(function () {
41
+ return city ? cityData : options;
42
+ }, [city, options]);
43
+ var _fieldNames = useMemo(function () {
44
+ return city ? {
45
+ label: 'name',
46
+ value: 'name',
47
+ children: 'districts'
48
+ } : fieldNames;
49
+ }, [city, fieldNames]);
50
+
51
+ /* 获取label宽度 */
52
+ var labelRef = useRef();
53
+ var _useState = useState(11),
54
+ _useState2 = _slicedToArray(_useState, 2),
55
+ paddingLeft = _useState2[0],
56
+ setPaddingLeft = _useState2[1];
57
+ var labelResizeObserver = new ResizeObserver(function (entries) {
58
+ setPaddingLeft(entries[0].contentRect.width + 11);
59
+ });
60
+ useEffect(function () {
61
+ labelRef.current && labelResizeObserver.observe(labelRef.current);
62
+ return function () {
63
+ return labelResizeObserver.disconnect();
64
+ };
65
+ }, []);
66
+
67
+ /* 判断value值是否存在于options中 */
68
+ var _useState3 = useState(),
69
+ _useState4 = _slicedToArray(_useState3, 2),
70
+ cascaderValue = _useState4[0],
71
+ setCascaderValue = _useState4[1];
72
+ var _inexistent = useRef(false);
73
+ // 获取所有备选项的值列表
74
+ var _values = useMemo(function () {
75
+ var _ref2 = _fieldNames || {},
76
+ _ref2$value = _ref2.value,
77
+ fieldValue = _ref2$value === void 0 ? 'value' : _ref2$value,
78
+ _ref2$children = _ref2.children,
79
+ fieldChildren = _ref2$children === void 0 ? 'children' : _ref2$children;
80
+ var values = [];
81
+ /* 递归获取当前节点的完整级联数据 */
82
+ var fn = function fn(list, parents) {
83
+ return list === null || list === void 0 ? void 0 : list.forEach(function (item) {
84
+ var v = [].concat(_toConsumableArray(parents), [item[fieldValue]]);
85
+ values.push(v.join(':'));
86
+ fn(item[fieldChildren], v);
87
+ });
88
+ };
89
+ fn(_options, []);
90
+ return values;
91
+ }, [_options, _fieldNames]);
92
+ // 监听值和值列表的变化(执行不存在值的判断逻辑)
93
+ useEffect(function () {
94
+ // 若已执行不存在外抛undefined逻辑,则不再向下执行后续代码,并重置标记
95
+ if (inexistent && _inexistent.current) {
96
+ _inexistent.current = false;
97
+ return;
98
+ }
99
+ var _v = value;
100
+ /* 若inexistent为true,判断不存在情况并重置值 */
101
+ if (inexistent) {
102
+ if (multiple) {
103
+ var _v2;
104
+ _v = ((_v2 = _v) === null || _v2 === void 0 ? void 0 : _v2.map(function (i) {
105
+ var _i$join;
106
+ if (_values.includes(i === null || i === void 0 || (_i$join = i.join) === null || _i$join === void 0 ? void 0 : _i$join.call(i, ':'))) {
107
+ return i;
108
+ } else {
109
+ var _i = _toConsumableArray(i);
110
+ _i[_i.length - 1] = _i[_i.length - 1] + "\u300C".concat(inexistentText, "\u300D");
111
+ return _i;
112
+ }
113
+ })) || [];
114
+ } else {
115
+ var _v3, _v3$join, _v$join, _v4;
116
+ _v = _v ? _values.includes((_v3 = _v) === null || _v3 === void 0 || (_v3$join = _v3.join) === null || _v3$join === void 0 ? void 0 : _v3$join.call(_v3, ':')) ? _v : [((_v$join = (_v4 = _v).join) === null || _v$join === void 0 ? void 0 : _v$join.call(_v4, ' / ')) + "\u300C".concat(inexistentText, "\u300D")] : undefined;
117
+ }
118
+ }
119
+ // 若当前value包含不存在值,且不保留原值时,则向外抛出undefined,并标记_inexistent为true
120
+ if (_v && JSON.stringify(_v).indexOf("\u300C".concat(inexistentText, "\u300D")) !== -1 && !reserveOriginalValue) {
121
+ _inexistent.current = true;
122
+ onChange === null || onChange === void 0 || onChange([], undefined);
123
+ }
124
+ setCascaderValue(_v);
125
+ }, [value, JSON.stringify(_values), inexistent, multiple]);
126
+ // 组件change事件
127
+ var change = function change(v, selectedOptions) {
128
+ var _v = v,
129
+ _selectedOptions = selectedOptions;
130
+ // 若inexistent为true,当重新触发change事件时,将不存在的项移除(仅多选时需处理)
131
+ if (inexistent && multiple) {
132
+ _v = v.filter(function (item) {
133
+ return !item.some(function (i) {
134
+ return ('' + i).indexOf("\u300C".concat(inexistentText, "\u300D")) !== -1;
135
+ });
136
+ });
137
+ _selectedOptions = selectedOptions.filter(function (item) {
138
+ return !item.some(function (i) {
139
+ return !i;
140
+ });
141
+ });
142
+ }
143
+ if (!props.hasOwnProperty('value')) {
144
+ setCascaderValue(_v);
145
+ }
146
+ onChange === null || onChange === void 0 || onChange(_v, _selectedOptions);
147
+ };
148
+ // 扩展全选功能 (继承原有插槽)
149
+ var dropdownRender = function dropdownRender(menus, _dropdownRender) {
150
+ return /*#__PURE__*/_jsxs("div", {
151
+ children: [menus, _dropdownRender, /*#__PURE__*/_jsx(Divider, {
152
+ style: {
153
+ margin: 0
154
+ }
155
+ }), /*#__PURE__*/_jsx("div", {
156
+ style: {
157
+ padding: 8
158
+ },
159
+ onClick: function onClick() {
160
+ // console.log(ref)
161
+ },
162
+ children: "\u5168\u9009"
163
+ })]
164
+ });
165
+ };
166
+ return /*#__PURE__*/_jsxs("div", {
167
+ style: _objectSpread({
168
+ position: label ? 'relative' : 'static',
169
+ height: multiple ? 'auto' : 32,
170
+ '--selector-pl': "".concat(paddingLeft, "px"),
171
+ '--inexistent-color': inexistentColor
172
+ }, style),
173
+ className: "mc-cascader ".concat(multiple && _maxTagCount === 1 ? 'mc-cascader--inline' : '', " ").concat(className || ''),
174
+ children: [label && /*#__PURE__*/_jsx("span", {
175
+ ref: labelRef,
176
+ className: "mc-cascader__label ".concat(disabled ? 'mc-cascader--disabled' : ''),
177
+ children: label
178
+ }), /*#__PURE__*/_jsx(Cascader, _objectSpread({
179
+ ref: ref,
180
+ className: "mc-cascader__content",
181
+ value: cascaderValue,
182
+ onChange: change,
183
+ options: _options,
184
+ multiple: multiple,
185
+ disabled: disabled,
186
+ fieldNames: _fieldNames
187
+ // dropdownRender={dropdownRender}
188
+ ,
189
+ placeholder: "\u8BF7\u9009\u62E9",
190
+ showSearch: true,
191
+ allowClear: true,
192
+ maxTagCount: _maxTagCount,
193
+ maxTagPlaceholder: function maxTagPlaceholder(v) {
194
+ return /*#__PURE__*/_jsx(Popover, {
195
+ overlayStyle: {
196
+ maxWidth: 300
197
+ },
198
+ content: v.map(function (_ref3, index) {
199
+ var _ref4;
200
+ var value = _ref3.value,
201
+ label = _ref3.label;
202
+ return /*#__PURE__*/_jsxs("span", {
203
+ children: [index !== 0 && /*#__PURE__*/_jsx("span", {
204
+ children: ", "
205
+ }), /*#__PURE__*/_jsx("span", {
206
+ style: {
207
+ color: ((_ref4 = '' + value) === null || _ref4 === void 0 ? void 0 : _ref4.indexOf("\u300C".concat(inexistentText, "\u300D"))) === -1 ? 'rgba(0, 0, 0, 0.88)' : inexistentColor
208
+ },
209
+ children: label
210
+ })]
211
+ }, value);
212
+ }),
213
+ children: /*#__PURE__*/_jsx("span", {
214
+ children: '+' + v.length
215
+ })
216
+ });
217
+ }
218
+ }, rest))]
219
+ });
220
+ });
221
+ export default McCascader;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * title: 操作栏区域
3
+ * description: 若未设置该项,则不显示。
4
+ * transform: true
5
+ * compact: true
6
+ */
7
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
8
+ export default _default;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * title: 操作栏区域
3
+ * description: 若未设置该项,则不显示。
4
+ * transform: true
5
+ * compact: true
6
+ */
7
+
8
+ import { Button } from 'antd';
9
+ import { AddOutlined } from 'much-icons';
10
+ import { McContainer, McInput } from "../..";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ export default (function () {
15
+ var dataSource = Array.from({
16
+ length: 5
17
+ }, function (_, index) {
18
+ return {
19
+ id: index + 1,
20
+ name: "\u59D3\u540D".concat(index + 1),
21
+ age: 18 + index
22
+ };
23
+ });
24
+ var columns = [{
25
+ title: 'ID',
26
+ dataIndex: 'id'
27
+ }, {
28
+ title: '姓名',
29
+ dataIndex: 'name'
30
+ }, {
31
+ title: '年龄',
32
+ dataIndex: 'age'
33
+ }, {
34
+ title: '操作',
35
+ dataIndex: 'option',
36
+ width: 100,
37
+ render: function render() {
38
+ return /*#__PURE__*/_jsx("a", {
39
+ children: "\u7F16\u8F91"
40
+ });
41
+ }
42
+ }];
43
+ var queryItems = /*#__PURE__*/_jsx(_Fragment, {
44
+ children: /*#__PURE__*/_jsx(McInput, {
45
+ label: "\u59D3\u540D",
46
+ name: "name",
47
+ style: {
48
+ width: 270
49
+ }
50
+ })
51
+ });
52
+ var actionBar = /*#__PURE__*/_jsxs(_Fragment, {
53
+ children: [/*#__PURE__*/_jsx(Button, {
54
+ type: "primary",
55
+ icon: /*#__PURE__*/_jsx(AddOutlined, {}),
56
+ children: "\u65B0\u589E"
57
+ }), /*#__PURE__*/_jsx(Button, {
58
+ children: "\u4E0A\u4F20"
59
+ })]
60
+ });
61
+ return /*#__PURE__*/_jsx(McContainer, {
62
+ height: "100%",
63
+ queryItems: queryItems,
64
+ actionBar: actionBar,
65
+ tableProps: {
66
+ columns: columns,
67
+ dataSource: dataSource
68
+ }
69
+ });
70
+ });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * title: 基本用法
3
+ * description: 设置 `immediateQuery` 为 `false`,不触发首次查询;`immediateQuery` 默认为 `true`。
4
+ * transform: true
5
+ * compact: true
6
+ */
7
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
8
+ export default _default;
@@ -0,0 +1,80 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ /**
3
+ * title: 基本用法
4
+ * description: 设置 `immediateQuery` 为 `false`,不触发首次查询;`immediateQuery` 默认为 `true`。
5
+ * transform: true
6
+ * compact: true
7
+ */
8
+
9
+ import { McContainer, McInput } from "../..";
10
+ import { useState } from 'react';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { Fragment as _Fragment } from "react/jsx-runtime";
13
+ var tableData = Array.from({
14
+ length: 5
15
+ }, function (_, index) {
16
+ return {
17
+ id: index + 1,
18
+ name: "\u59D3\u540D".concat(index + 1),
19
+ age: 18 + index
20
+ };
21
+ });
22
+ export default (function () {
23
+ var _useState = useState(tableData),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ dataSource = _useState2[0],
26
+ setDataSource = _useState2[1];
27
+ var _useState3 = useState(false),
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ loading = _useState4[0],
30
+ setLoading = _useState4[1];
31
+ var columns = [{
32
+ title: 'ID',
33
+ dataIndex: 'id'
34
+ }, {
35
+ title: '姓名',
36
+ dataIndex: 'name'
37
+ }, {
38
+ title: '年龄',
39
+ dataIndex: 'age'
40
+ }, {
41
+ title: '操作',
42
+ dataIndex: 'option',
43
+ width: 100,
44
+ render: function render() {
45
+ return /*#__PURE__*/_jsx("a", {
46
+ children: "\u7F16\u8F91"
47
+ });
48
+ }
49
+ }];
50
+ var queryItems = /*#__PURE__*/_jsx(_Fragment, {
51
+ children: /*#__PURE__*/_jsx(McInput, {
52
+ label: "\u59D3\u540D",
53
+ name: "name",
54
+ style: {
55
+ width: 270
56
+ }
57
+ })
58
+ });
59
+ var onQuery = function onQuery() {
60
+ return new Promise(function (resolve) {
61
+ setLoading(true);
62
+ setTimeout(function () {
63
+ setDataSource(tableData);
64
+ setLoading(false);
65
+ resolve();
66
+ }, 1000);
67
+ });
68
+ };
69
+ return /*#__PURE__*/_jsx(McContainer, {
70
+ height: "100%",
71
+ immediateQuery: false,
72
+ loading: loading,
73
+ onQuery: onQuery,
74
+ queryItems: queryItems,
75
+ tableProps: {
76
+ columns: columns,
77
+ dataSource: dataSource
78
+ }
79
+ });
80
+ });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * title: 预设批量操作
3
+ * description: 包括多选数据的处理、展示、批量操作区,开启多选功能时,在`tableProps`中进行多选的配置,`rowKey`必须设置且唯一。`batchNum`展示批量操作数、`batchBtns`配置批量操作区、`onCancel`取消批量选中,配合实现多选功能。
4
+ * transform: true
5
+ * compact: true
6
+ */
7
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
8
+ export default _default;
@@ -0,0 +1,89 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ /**
3
+ * title: 预设批量操作
4
+ * description: 包括多选数据的处理、展示、批量操作区,开启多选功能时,在`tableProps`中进行多选的配置,`rowKey`必须设置且唯一。`batchNum`展示批量操作数、`batchBtns`配置批量操作区、`onCancel`取消批量选中,配合实现多选功能。
5
+ * transform: true
6
+ * compact: true
7
+ */
8
+
9
+ import { Button } from 'antd';
10
+ import { McContainer, McInput } from "../..";
11
+ import { useState } from 'react';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { Fragment as _Fragment } from "react/jsx-runtime";
14
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ export default (function () {
16
+ var _selectedRows$length;
17
+ var _useState = useState([]),
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ selectedRows = _useState2[0],
20
+ setSelectedRows = _useState2[1];
21
+ var dataSource = Array.from({
22
+ length: 5
23
+ }, function (_, index) {
24
+ return {
25
+ id: index + 1,
26
+ name: "\u59D3\u540D".concat(index + 1),
27
+ age: 18 + index
28
+ };
29
+ });
30
+ var columns = [{
31
+ title: 'ID',
32
+ dataIndex: 'id'
33
+ }, {
34
+ title: '姓名',
35
+ dataIndex: 'name'
36
+ }, {
37
+ title: '年龄',
38
+ dataIndex: 'age'
39
+ }, {
40
+ title: '操作',
41
+ dataIndex: 'option',
42
+ width: 100,
43
+ render: function render() {
44
+ return /*#__PURE__*/_jsx("a", {
45
+ children: "\u7F16\u8F91"
46
+ });
47
+ }
48
+ }];
49
+ var queryItems = /*#__PURE__*/_jsx(_Fragment, {
50
+ children: /*#__PURE__*/_jsx(McInput, {
51
+ label: "\u59D3\u540D",
52
+ name: "name",
53
+ style: {
54
+ width: 270
55
+ }
56
+ })
57
+ });
58
+ return /*#__PURE__*/_jsx(McContainer, {
59
+ height: "100%",
60
+ queryItems: queryItems,
61
+ batchNum: (_selectedRows$length = selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length) !== null && _selectedRows$length !== void 0 ? _selectedRows$length : 0,
62
+ onCancel: function onCancel() {
63
+ return setSelectedRows([]);
64
+ },
65
+ batchBtns: /*#__PURE__*/_jsxs(_Fragment, {
66
+ children: [/*#__PURE__*/_jsx(Button, {
67
+ type: "primary",
68
+ children: "\u6279\u91CF\u64CD\u4F5C1"
69
+ }), /*#__PURE__*/_jsx(Button, {
70
+ type: "primary",
71
+ children: "\u6279\u91CF\u64CD\u4F5C2"
72
+ })]
73
+ }),
74
+ tableProps: {
75
+ columns: columns,
76
+ dataSource: dataSource,
77
+ rowKey: 'id',
78
+ rowSelection: {
79
+ selectedRowKeys: selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.map(function (item) {
80
+ return item.id;
81
+ }),
82
+ preserveSelectedRowKeys: true,
83
+ onChange: function onChange(selectedRowKeys, selectedRows) {
84
+ return setSelectedRows(selectedRows);
85
+ }
86
+ }
87
+ }
88
+ });
89
+ });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * title: 可折叠的搜索栏
3
+ * description: 将 `showCollapse` 和 `collapsibleQueryItems` 搭配使用,可以实现搜索区域的展开收起的功能。
4
+ * transform: true
5
+ * compact: true
6
+ */
7
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
8
+ export default _default;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * title: 可折叠的搜索栏
3
+ * description: 将 `showCollapse` 和 `collapsibleQueryItems` 搭配使用,可以实现搜索区域的展开收起的功能。
4
+ * transform: true
5
+ * compact: true
6
+ */
7
+
8
+ import { McCascader, McContainer, McDateRange, McInput } from "../..";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { Fragment as _Fragment } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ export default (function () {
13
+ var dataSource = Array.from({
14
+ length: 5
15
+ }, function (_, index) {
16
+ return {
17
+ id: index + 1,
18
+ name: "\u59D3\u540D".concat(index + 1),
19
+ city: "\u57CE\u5E02".concat(index + 1),
20
+ date: "2024-01-0".concat(index + 1, " 12:00:00")
21
+ };
22
+ });
23
+ var columns = [{
24
+ title: 'ID',
25
+ dataIndex: 'id'
26
+ }, {
27
+ title: '姓名',
28
+ dataIndex: 'name'
29
+ }, {
30
+ title: '城市',
31
+ dataIndex: 'city'
32
+ }, {
33
+ title: '日期',
34
+ dataIndex: 'date'
35
+ }];
36
+ var queryItems = /*#__PURE__*/_jsxs(_Fragment, {
37
+ children: [/*#__PURE__*/_jsx(McInput.Search, {
38
+ name: "name",
39
+ style: {
40
+ width: 270
41
+ }
42
+ }), /*#__PURE__*/_jsx(McCascader, {
43
+ label: "\u57CE\u5E02",
44
+ name: "city",
45
+ city: true,
46
+ style: {
47
+ width: 270
48
+ }
49
+ })]
50
+ });
51
+ var collapsibleQueryItems = /*#__PURE__*/_jsxs(_Fragment, {
52
+ children: [/*#__PURE__*/_jsx(McDateRange, {
53
+ label: "\u65E5\u671F",
54
+ name: "date",
55
+ style: {
56
+ width: 270
57
+ }
58
+ }), /*#__PURE__*/_jsx(McInput, {
59
+ label: "ID",
60
+ name: "id",
61
+ style: {
62
+ width: 270
63
+ }
64
+ })]
65
+ });
66
+ return /*#__PURE__*/_jsx(McContainer, {
67
+ height: "100%",
68
+ queryItems: queryItems,
69
+ collapsibleQueryItems: collapsibleQueryItems,
70
+ showCollapse: true,
71
+ tableProps: {
72
+ columns: columns,
73
+ dataSource: dataSource
74
+ }
75
+ });
76
+ });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * title: 树形数据展示
3
+ * description: 表格支持树形数据的展示,当数据中有 `children` 字段时会自动展示为树形表格,如果不需要或配置为其他字段可以用 `childrenColumnName` 进行配置,`rowKey`必须设置且唯一。
4
+ * transform: true
5
+ * compact: true
6
+ */
7
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
8
+ export default _default;