@zykj2024/much-library 1.2.3 → 1.2.4-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/McDateRangePro/comps/ShortcutItem.js +5 -5
- package/dist/McDateRangePro/index.css +2 -2
- package/dist/McDateRangePro/index.d.ts +2 -2
- package/dist/McDateRangePro/index.js +50 -53
- package/dist/McListSelect/comps/SelectedItem.js +1 -1
- package/dist/McListSelect/index.css +8 -2
- package/package.json +1 -1
@@ -29,6 +29,11 @@ var ShortcutItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
29
29
|
onActive = _ref.onActive,
|
30
30
|
onInactive = _ref.onInactive,
|
31
31
|
onSelected = _ref.onSelected;
|
32
|
+
useImperativeHandle(ref, function () {
|
33
|
+
return {
|
34
|
+
resetNs: resetNs
|
35
|
+
};
|
36
|
+
});
|
32
37
|
var _useState = useState(),
|
33
38
|
_useState2 = _slicedToArray(_useState, 2),
|
34
39
|
n1 = _useState2[0],
|
@@ -97,11 +102,6 @@ var ShortcutItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
97
102
|
setN2(n);
|
98
103
|
}
|
99
104
|
};
|
100
|
-
useImperativeHandle(ref, function () {
|
101
|
-
return {
|
102
|
-
resetNs: resetNs
|
103
|
-
};
|
104
|
-
});
|
105
105
|
return /*#__PURE__*/_jsxs("div", {
|
106
106
|
className: classNames('mc-date-range-pro__presets__item', active && 'mc-date-range-pro__presets__item--active'),
|
107
107
|
onMouseEnter: activeHandle,
|
@@ -75,7 +75,7 @@
|
|
75
75
|
height: 100%;
|
76
76
|
}
|
77
77
|
.mc-date-range-pro__presets__types .ant-tabs-nav {
|
78
|
-
margin-bottom:
|
78
|
+
margin-bottom: 0px;
|
79
79
|
padding: 0 8px;
|
80
80
|
}
|
81
81
|
.mc-date-range-pro__presets__types .ant-tabs-nav .ant-tabs-tab {
|
@@ -128,7 +128,7 @@
|
|
128
128
|
bottom: 0;
|
129
129
|
left: 0;
|
130
130
|
width: auto;
|
131
|
-
background: #
|
131
|
+
background: #ffffff !important;
|
132
132
|
border-color: transparent !important;
|
133
133
|
-webkit-box-shadow: none !important;
|
134
134
|
box-shadow: none !important;
|
@@ -2,7 +2,7 @@ import { RangePickerProps } from 'antd/es/date-picker';
|
|
2
2
|
import { FC, ReactNode } from 'react';
|
3
3
|
import './index.less';
|
4
4
|
export declare const getDynamicLabel: (dynamicValue?: string) => any;
|
5
|
-
|
5
|
+
type PropsType = Omit<RangePickerProps, 'value' | 'onChange' | 'open' | 'onOpenChange' | 'presets' | 'renderExtraFooter' | 'needConfirm'> & {
|
6
6
|
/** 查询项的字段名(配合McContainer组件的查询功能使用) */
|
7
7
|
name?: string;
|
8
8
|
/** 查询项的标签文字(若未设置,样式为表单项形态) */
|
@@ -19,5 +19,5 @@ export type McDateRangeProProps = Omit<RangePickerProps, 'value' | 'onChange' |
|
|
19
19
|
onChange?: (value?: string | string[], dateStrings?: string[]) => void;
|
20
20
|
ref?: any;
|
21
21
|
};
|
22
|
-
declare const McDateRangePro: FC<
|
22
|
+
declare const McDateRangePro: FC<PropsType>;
|
23
23
|
export default McDateRangePro;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
|
-
var _excluded = ["style", "className", "label", "valueFormat", "dateType", "dynamic", "showTime", "disabled", "value", "onChange"];
|
4
|
+
var _excluded = ["style", "className", "label", "valueFormat", "dateType", "dynamic", "showTime", "disabled", "value", "onChange", "needConfirm"];
|
5
5
|
import { useEmotionCss } from '@ant-design/use-emotion-css';
|
6
6
|
import { DatePicker, Tabs } from 'antd';
|
7
7
|
import classNames from 'classnames';
|
@@ -72,6 +72,7 @@ var McDateRangePro = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
72
72
|
disabled = props.disabled,
|
73
73
|
value = props.value,
|
74
74
|
onChange = props.onChange,
|
75
|
+
needConfirm = props.needConfirm,
|
75
76
|
rest = _objectWithoutProperties(props, _excluded);
|
76
77
|
var _valueFormat = valueFormat || (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD');
|
77
78
|
var _dynamic = dateType && dynamic;
|
@@ -133,12 +134,10 @@ var McDateRangePro = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
133
134
|
return getDynamicLabel(dynamicValue);
|
134
135
|
}, [dynamicValue]);
|
135
136
|
|
136
|
-
//
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
}));
|
141
|
-
};
|
137
|
+
// 监听value值变化,处理回显逻辑
|
138
|
+
useEffect(function () {
|
139
|
+
echo();
|
140
|
+
}, [value]);
|
142
141
|
|
143
142
|
// 回显的方法
|
144
143
|
var echo = function echo() {
|
@@ -239,6 +238,13 @@ var McDateRangePro = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
239
238
|
newValue.current = _v;
|
240
239
|
};
|
241
240
|
|
241
|
+
// 异常数据抛出静态日期
|
242
|
+
var changeToStatic = function changeToStatic(v) {
|
243
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(v.map(function (i) {
|
244
|
+
return i === null || i === void 0 ? void 0 : i.format(_valueFormat);
|
245
|
+
}));
|
246
|
+
};
|
247
|
+
|
242
248
|
// 日期范围变化事件
|
243
249
|
var change = function change(dates) {
|
244
250
|
set_value(dates);
|
@@ -248,25 +254,23 @@ var McDateRangePro = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
248
254
|
dates === null && (onChange === null || onChange === void 0 ? void 0 : onChange(undefined));
|
249
255
|
};
|
250
256
|
|
251
|
-
//
|
252
|
-
var
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
panelsEl === null || panelsEl === void 0 || panelsEl.addEventListener('mouseenter', function () {
|
264
|
-
setInActiveArea(true);
|
265
|
-
setActiveCode(undefined);
|
257
|
+
// 日历面板显隐事件
|
258
|
+
var openChange = function openChange(open) {
|
259
|
+
setOpen(open);
|
260
|
+
initMouseEnterLeave();
|
261
|
+
if (open) {
|
262
|
+
// 显示时初始化左侧快捷栏
|
263
|
+
setType(oldType.current);
|
264
|
+
newType.current = oldType.current;
|
265
|
+
setActiveCode(oldActiveCode.current);
|
266
|
+
oldType.current === 'dynamic' && setTimeout(function () {
|
267
|
+
var _shortcutItemRefs$cur;
|
268
|
+
(_shortcutItemRefs$cur = shortcutItemRefs.current[oldActiveCode.current]) === null || _shortcutItemRefs$cur === void 0 || (_shortcutItemRefs$cur = _shortcutItemRefs$cur.current) === null || _shortcutItemRefs$cur === void 0 || _shortcutItemRefs$cur.resetNs(value);
|
266
269
|
});
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
+
} else {
|
271
|
+
// 隐藏时触发改变值的方法
|
272
|
+
changeHandle(newValue.current);
|
273
|
+
}
|
270
274
|
};
|
271
275
|
|
272
276
|
// 改变值的方法
|
@@ -293,25 +297,6 @@ var McDateRangePro = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
293
297
|
}
|
294
298
|
};
|
295
299
|
|
296
|
-
// 日历面板显隐事件
|
297
|
-
var openChange = function openChange(open) {
|
298
|
-
setOpen(open);
|
299
|
-
initMouseEnterLeave();
|
300
|
-
if (open) {
|
301
|
-
// 显示时初始化左侧快捷栏
|
302
|
-
setType(oldType.current);
|
303
|
-
newType.current = oldType.current;
|
304
|
-
setActiveCode(oldActiveCode.current);
|
305
|
-
oldType.current === 'dynamic' && setTimeout(function () {
|
306
|
-
var _shortcutItemRefs$cur;
|
307
|
-
(_shortcutItemRefs$cur = shortcutItemRefs.current[oldActiveCode.current]) === null || _shortcutItemRefs$cur === void 0 || (_shortcutItemRefs$cur = _shortcutItemRefs$cur.current) === null || _shortcutItemRefs$cur === void 0 || _shortcutItemRefs$cur.resetNs(value);
|
308
|
-
});
|
309
|
-
} else {
|
310
|
-
// 隐藏时触发改变值的方法
|
311
|
-
changeHandle(newValue.current);
|
312
|
-
}
|
313
|
-
};
|
314
|
-
|
315
300
|
// 快捷项激活事件
|
316
301
|
var activeHandle = function activeHandle(code, dates) {
|
317
302
|
setInActiveArea(true);
|
@@ -321,6 +306,13 @@ var McDateRangePro = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
321
306
|
}));
|
322
307
|
};
|
323
308
|
|
309
|
+
// 快捷项取消激活事件
|
310
|
+
var inActiveHandle = function inActiveHandle() {
|
311
|
+
setInActiveArea(false);
|
312
|
+
setActiveCode(newType.current === 'dynamic' ? oldActiveCode.current : undefined);
|
313
|
+
props.hasOwnProperty('value') && set_value(oldValue.current);
|
314
|
+
};
|
315
|
+
|
324
316
|
// 快捷项选择事件
|
325
317
|
var selectHandle = function selectHandle(dates) {
|
326
318
|
var newValue = dates.map(function (v, i) {
|
@@ -332,10 +324,19 @@ var McDateRangePro = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
332
324
|
setOpen(false);
|
333
325
|
};
|
334
326
|
|
335
|
-
//
|
336
|
-
|
337
|
-
|
338
|
-
|
327
|
+
// 初始化监听日历选择面板的鼠标移入移出事件
|
328
|
+
var initMouseEnterLeave = function initMouseEnterLeave() {
|
329
|
+
if (isInit.current) return;
|
330
|
+
setTimeout(function () {
|
331
|
+
var panelsEl = document.querySelector('.mc-date-range-pro__popup .ant-picker-panels');
|
332
|
+
panelsEl === null || panelsEl === void 0 || panelsEl.addEventListener('mouseenter', function () {
|
333
|
+
setInActiveArea(true);
|
334
|
+
setActiveCode(undefined);
|
335
|
+
});
|
336
|
+
panelsEl === null || panelsEl === void 0 || panelsEl.addEventListener('mouseleave', inActiveHandle);
|
337
|
+
isInit.current = true;
|
338
|
+
});
|
339
|
+
};
|
339
340
|
return /*#__PURE__*/_jsxs("div", {
|
340
341
|
style: style,
|
341
342
|
className: "".concat(classNames('mc-date-range-pro', className)),
|
@@ -349,11 +350,7 @@ var McDateRangePro = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
349
350
|
paddingLeft: paddingLeft
|
350
351
|
},
|
351
352
|
className: "mc-date-range-pro__content",
|
352
|
-
|
353
|
-
popup: {
|
354
|
-
root: classNames('mc-date-range-pro__popup', showTime && 'mc-date-range-pro__popup--time', dateType && 'mc-date-range-pro__popup--preset', rootClassName)
|
355
|
-
}
|
356
|
-
},
|
353
|
+
popupClassName: classNames('mc-date-range-pro__popup', showTime && 'mc-date-range-pro__popup--time', dateType && 'mc-date-range-pro__popup--preset', rootClassName),
|
357
354
|
showTime: showTime,
|
358
355
|
disabled: disabled,
|
359
356
|
minDate: dateType === 'future' ? dayjs() : undefined,
|
@@ -51,8 +51,8 @@ var SelectedItem = function SelectedItem(_ref) {
|
|
51
51
|
type: "text",
|
52
52
|
icon: /*#__PURE__*/_jsx(MenuOutlined, {})
|
53
53
|
})), /*#__PURE__*/_jsx(McEllipsis, {
|
54
|
+
className: "mc-list-select-panel__selected-item__text",
|
54
55
|
style: {
|
55
|
-
margin: '0 auto 0 4px',
|
56
56
|
color: getColor()
|
57
57
|
},
|
58
58
|
text: label,
|
@@ -243,17 +243,23 @@
|
|
243
243
|
.mc-list-select-panel__selected-item__drag {
|
244
244
|
-ms-flex-negative: 0;
|
245
245
|
flex-shrink: 0;
|
246
|
-
margin
|
246
|
+
margin: 0 4px 0 -4px;
|
247
247
|
color: #8c8c8c;
|
248
248
|
}
|
249
249
|
.mc-list-select-panel__selected-item__drag:hover {
|
250
250
|
background: rgba(38, 38, 38, 0.15) !important;
|
251
251
|
cursor: move;
|
252
252
|
}
|
253
|
+
.mc-list-select-panel__selected-item__text {
|
254
|
+
-webkit-box-flex: 1;
|
255
|
+
-ms-flex: 1;
|
256
|
+
flex: 1;
|
257
|
+
margin-right: auto;
|
258
|
+
}
|
253
259
|
.mc-list-select-panel__selected-item__remove {
|
254
260
|
-ms-flex-negative: 0;
|
255
261
|
flex-shrink: 0;
|
256
|
-
margin-left:
|
262
|
+
margin-left: 4px;
|
257
263
|
color: #8c8c8c;
|
258
264
|
}
|
259
265
|
.mc-list-select-panel__selected-item__remove:hover {
|