add all frontend files

This commit is contained in:
2026-01-17 15:16:36 -05:00
parent ff16ae7858
commit e40287e4aa
25704 changed files with 1935289 additions and 0 deletions

27
node_modules/rc-slider/es/Handles/Handle.d.ts generated vendored Normal file
View File

@@ -0,0 +1,27 @@
import * as React from 'react';
import type { OnStartMove } from '../interface';
interface RenderProps {
index: number;
prefixCls: string;
value: number;
dragging: boolean;
draggingDelete: boolean;
}
export interface HandleProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onFocus' | 'onMouseEnter'> {
prefixCls: string;
style?: React.CSSProperties;
value: number;
valueIndex: number;
dragging: boolean;
draggingDelete: boolean;
onStartMove: OnStartMove;
onDelete?: (index: number) => void;
onOffsetChange: (value: number | 'min' | 'max', valueIndex: number) => void;
onFocus: (e: React.FocusEvent<HTMLDivElement>, index: number) => void;
onMouseEnter: (e: React.MouseEvent<HTMLDivElement>, index: number) => void;
render?: (origin: React.ReactElement<React.HTMLAttributes<HTMLDivElement>>, props: RenderProps) => React.ReactElement;
onChangeComplete?: () => void;
mock?: boolean;
}
declare const Handle: React.ForwardRefExoticComponent<HandleProps & React.RefAttributes<HTMLDivElement>>;
export default Handle;

164
node_modules/rc-slider/es/Handles/Handle.js generated vendored Normal file
View File

@@ -0,0 +1,164 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["prefixCls", "value", "valueIndex", "onStartMove", "onDelete", "style", "render", "dragging", "draggingDelete", "onOffsetChange", "onChangeComplete", "onFocus", "onMouseEnter"];
import cls from 'classnames';
import KeyCode from "rc-util/es/KeyCode";
import * as React from 'react';
import SliderContext from "../context";
import { getDirectionStyle, getIndex } from "../util";
var Handle = /*#__PURE__*/React.forwardRef(function (props, ref) {
var prefixCls = props.prefixCls,
value = props.value,
valueIndex = props.valueIndex,
onStartMove = props.onStartMove,
onDelete = props.onDelete,
style = props.style,
render = props.render,
dragging = props.dragging,
draggingDelete = props.draggingDelete,
onOffsetChange = props.onOffsetChange,
onChangeComplete = props.onChangeComplete,
onFocus = props.onFocus,
onMouseEnter = props.onMouseEnter,
restProps = _objectWithoutProperties(props, _excluded);
var _React$useContext = React.useContext(SliderContext),
min = _React$useContext.min,
max = _React$useContext.max,
direction = _React$useContext.direction,
disabled = _React$useContext.disabled,
keyboard = _React$useContext.keyboard,
range = _React$useContext.range,
tabIndex = _React$useContext.tabIndex,
ariaLabelForHandle = _React$useContext.ariaLabelForHandle,
ariaLabelledByForHandle = _React$useContext.ariaLabelledByForHandle,
ariaRequired = _React$useContext.ariaRequired,
ariaValueTextFormatterForHandle = _React$useContext.ariaValueTextFormatterForHandle,
styles = _React$useContext.styles,
classNames = _React$useContext.classNames;
var handlePrefixCls = "".concat(prefixCls, "-handle");
// ============================ Events ============================
var onInternalStartMove = function onInternalStartMove(e) {
if (!disabled) {
onStartMove(e, valueIndex);
}
};
var onInternalFocus = function onInternalFocus(e) {
onFocus === null || onFocus === void 0 || onFocus(e, valueIndex);
};
var onInternalMouseEnter = function onInternalMouseEnter(e) {
onMouseEnter(e, valueIndex);
};
// =========================== Keyboard ===========================
var onKeyDown = function onKeyDown(e) {
if (!disabled && keyboard) {
var offset = null;
// Change the value
switch (e.which || e.keyCode) {
case KeyCode.LEFT:
offset = direction === 'ltr' || direction === 'btt' ? -1 : 1;
break;
case KeyCode.RIGHT:
offset = direction === 'ltr' || direction === 'btt' ? 1 : -1;
break;
// Up is plus
case KeyCode.UP:
offset = direction !== 'ttb' ? 1 : -1;
break;
// Down is minus
case KeyCode.DOWN:
offset = direction !== 'ttb' ? -1 : 1;
break;
case KeyCode.HOME:
offset = 'min';
break;
case KeyCode.END:
offset = 'max';
break;
case KeyCode.PAGE_UP:
offset = 2;
break;
case KeyCode.PAGE_DOWN:
offset = -2;
break;
case KeyCode.BACKSPACE:
case KeyCode.DELETE:
onDelete === null || onDelete === void 0 || onDelete(valueIndex);
break;
}
if (offset !== null) {
e.preventDefault();
onOffsetChange(offset, valueIndex);
}
}
};
var handleKeyUp = function handleKeyUp(e) {
switch (e.which || e.keyCode) {
case KeyCode.LEFT:
case KeyCode.RIGHT:
case KeyCode.UP:
case KeyCode.DOWN:
case KeyCode.HOME:
case KeyCode.END:
case KeyCode.PAGE_UP:
case KeyCode.PAGE_DOWN:
onChangeComplete === null || onChangeComplete === void 0 || onChangeComplete();
break;
}
};
// ============================ Offset ============================
var positionStyle = getDirectionStyle(direction, value, min, max);
// ============================ Render ============================
var divProps = {};
if (valueIndex !== null) {
var _getIndex;
divProps = {
tabIndex: disabled ? null : getIndex(tabIndex, valueIndex),
role: 'slider',
'aria-valuemin': min,
'aria-valuemax': max,
'aria-valuenow': value,
'aria-disabled': disabled,
'aria-label': getIndex(ariaLabelForHandle, valueIndex),
'aria-labelledby': getIndex(ariaLabelledByForHandle, valueIndex),
'aria-required': getIndex(ariaRequired, valueIndex),
'aria-valuetext': (_getIndex = getIndex(ariaValueTextFormatterForHandle, valueIndex)) === null || _getIndex === void 0 ? void 0 : _getIndex(value),
'aria-orientation': direction === 'ltr' || direction === 'rtl' ? 'horizontal' : 'vertical',
onMouseDown: onInternalStartMove,
onTouchStart: onInternalStartMove,
onFocus: onInternalFocus,
onMouseEnter: onInternalMouseEnter,
onKeyDown: onKeyDown,
onKeyUp: handleKeyUp
};
}
var handleNode = /*#__PURE__*/React.createElement("div", _extends({
ref: ref,
className: cls(handlePrefixCls, _defineProperty(_defineProperty(_defineProperty({}, "".concat(handlePrefixCls, "-").concat(valueIndex + 1), valueIndex !== null && range), "".concat(handlePrefixCls, "-dragging"), dragging), "".concat(handlePrefixCls, "-dragging-delete"), draggingDelete), classNames.handle),
style: _objectSpread(_objectSpread(_objectSpread({}, positionStyle), style), styles.handle)
}, divProps, restProps));
// Customize
if (render) {
handleNode = render(handleNode, {
index: valueIndex,
prefixCls: prefixCls,
value: value,
dragging: dragging,
draggingDelete: draggingDelete
});
}
return handleNode;
});
if (process.env.NODE_ENV !== 'production') {
Handle.displayName = 'Handle';
}
export default Handle;

29
node_modules/rc-slider/es/Handles/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
import * as React from 'react';
import type { OnStartMove } from '../interface';
import type { HandleProps } from './Handle';
export interface HandlesProps {
prefixCls: string;
style?: React.CSSProperties | React.CSSProperties[];
values: number[];
onStartMove: OnStartMove;
onOffsetChange: (value: number | 'min' | 'max', valueIndex: number) => void;
onFocus?: (e: React.FocusEvent<HTMLDivElement>) => void;
onBlur?: (e: React.FocusEvent<HTMLDivElement>) => void;
onDelete?: (index: number) => void;
handleRender?: HandleProps['render'];
/**
* When config `activeHandleRender`,
* it will render another hidden handle for active usage.
* This is useful for accessibility or tooltip usage.
*/
activeHandleRender?: HandleProps['render'];
draggingIndex: number;
draggingDelete: boolean;
onChangeComplete?: () => void;
}
export interface HandlesRef {
focus: (index: number) => void;
hideHelp: VoidFunction;
}
declare const Handles: React.ForwardRefExoticComponent<HandlesProps & React.RefAttributes<HandlesRef>>;
export default Handles;

105
node_modules/rc-slider/es/Handles/index.js generated vendored Normal file
View File

@@ -0,0 +1,105 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["prefixCls", "style", "onStartMove", "onOffsetChange", "values", "handleRender", "activeHandleRender", "draggingIndex", "draggingDelete", "onFocus"];
import * as React from 'react';
import { flushSync } from 'react-dom';
import { getIndex } from "../util";
import Handle from "./Handle";
var Handles = /*#__PURE__*/React.forwardRef(function (props, ref) {
var prefixCls = props.prefixCls,
style = props.style,
onStartMove = props.onStartMove,
onOffsetChange = props.onOffsetChange,
values = props.values,
handleRender = props.handleRender,
activeHandleRender = props.activeHandleRender,
draggingIndex = props.draggingIndex,
draggingDelete = props.draggingDelete,
onFocus = props.onFocus,
restProps = _objectWithoutProperties(props, _excluded);
var handlesRef = React.useRef({});
// =========================== Active ===========================
var _React$useState = React.useState(false),
_React$useState2 = _slicedToArray(_React$useState, 2),
activeVisible = _React$useState2[0],
setActiveVisible = _React$useState2[1];
var _React$useState3 = React.useState(-1),
_React$useState4 = _slicedToArray(_React$useState3, 2),
activeIndex = _React$useState4[0],
setActiveIndex = _React$useState4[1];
var onActive = function onActive(index) {
setActiveIndex(index);
setActiveVisible(true);
};
var onHandleFocus = function onHandleFocus(e, index) {
onActive(index);
onFocus === null || onFocus === void 0 || onFocus(e);
};
var onHandleMouseEnter = function onHandleMouseEnter(e, index) {
onActive(index);
};
// =========================== Render ===========================
React.useImperativeHandle(ref, function () {
return {
focus: function focus(index) {
var _handlesRef$current$i;
(_handlesRef$current$i = handlesRef.current[index]) === null || _handlesRef$current$i === void 0 || _handlesRef$current$i.focus();
},
hideHelp: function hideHelp() {
flushSync(function () {
setActiveVisible(false);
});
}
};
});
// =========================== Render ===========================
// Handle Props
var handleProps = _objectSpread({
prefixCls: prefixCls,
onStartMove: onStartMove,
onOffsetChange: onOffsetChange,
render: handleRender,
onFocus: onHandleFocus,
onMouseEnter: onHandleMouseEnter
}, restProps);
return /*#__PURE__*/React.createElement(React.Fragment, null, values.map(function (value, index) {
var dragging = draggingIndex === index;
return /*#__PURE__*/React.createElement(Handle, _extends({
ref: function ref(node) {
if (!node) {
delete handlesRef.current[index];
} else {
handlesRef.current[index] = node;
}
},
dragging: dragging,
draggingDelete: dragging && draggingDelete,
style: getIndex(style, index),
key: index,
value: value,
valueIndex: index
}, handleProps));
}), activeHandleRender && activeVisible && /*#__PURE__*/React.createElement(Handle, _extends({
key: "a11y"
}, handleProps, {
value: values[activeIndex],
valueIndex: null,
dragging: draggingIndex !== -1,
draggingDelete: draggingDelete,
render: activeHandleRender,
style: {
pointerEvents: 'none'
},
tabIndex: null,
"aria-hidden": true
})));
});
if (process.env.NODE_ENV !== 'production') {
Handles.displayName = 'Handles';
}
export default Handles;

10
node_modules/rc-slider/es/Marks/Mark.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import * as React from 'react';
export interface MarkProps {
prefixCls: string;
children?: React.ReactNode;
style?: React.CSSProperties;
value: number;
onClick: (value: number) => void;
}
declare const Mark: React.FC<MarkProps>;
export default Mark;

35
node_modules/rc-slider/es/Marks/Mark.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import classNames from 'classnames';
import * as React from 'react';
import SliderContext from "../context";
import { getDirectionStyle } from "../util";
var Mark = function Mark(props) {
var prefixCls = props.prefixCls,
style = props.style,
children = props.children,
value = props.value,
_onClick = props.onClick;
var _React$useContext = React.useContext(SliderContext),
min = _React$useContext.min,
max = _React$useContext.max,
direction = _React$useContext.direction,
includedStart = _React$useContext.includedStart,
includedEnd = _React$useContext.includedEnd,
included = _React$useContext.included;
var textCls = "".concat(prefixCls, "-text");
// ============================ Offset ============================
var positionStyle = getDirectionStyle(direction, value, min, max);
return /*#__PURE__*/React.createElement("span", {
className: classNames(textCls, _defineProperty({}, "".concat(textCls, "-active"), included && includedStart <= value && value <= includedEnd)),
style: _objectSpread(_objectSpread({}, positionStyle), style),
onMouseDown: function onMouseDown(e) {
e.stopPropagation();
},
onClick: function onClick() {
_onClick(value);
}
}, children);
};
export default Mark;

15
node_modules/rc-slider/es/Marks/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import * as React from 'react';
export interface MarkObj {
style?: React.CSSProperties;
label?: React.ReactNode;
}
export interface InternalMarkObj extends MarkObj {
value: number;
}
export interface MarksProps {
prefixCls: string;
marks?: InternalMarkObj[];
onClick: (value: number) => void;
}
declare const Marks: React.FC<MarksProps>;
export default Marks;

28
node_modules/rc-slider/es/Marks/index.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import * as React from 'react';
import Mark from "./Mark";
var Marks = function Marks(props) {
var prefixCls = props.prefixCls,
marks = props.marks,
onClick = props.onClick;
var markPrefixCls = "".concat(prefixCls, "-mark");
// Not render mark if empty
if (!marks.length) {
return null;
}
return /*#__PURE__*/React.createElement("div", {
className: markPrefixCls
}, marks.map(function (_ref) {
var value = _ref.value,
style = _ref.style,
label = _ref.label;
return /*#__PURE__*/React.createElement(Mark, {
key: value,
prefixCls: markPrefixCls,
style: style,
value: value,
onClick: onClick
}, label);
}));
};
export default Marks;

82
node_modules/rc-slider/es/Slider.d.ts generated vendored Normal file
View File

@@ -0,0 +1,82 @@
import * as React from 'react';
import type { HandlesProps } from './Handles';
import type { MarkObj } from './Marks';
import type { AriaValueFormat, SliderClassNames, SliderStyles } from './interface';
/**
* New:
* - click mark to update range value
* - handleRender
* - Fix handle with count not correct
* - Fix pushable not work in some case
* - No more FindDOMNode
* - Move all position related style into inline style
* - Key: up is plus, down is minus
* - fix Key with step = null not align with marks
* - Change range should not trigger onChange
* - keyboard support pushable
*/
export type RangeConfig = {
editable?: boolean;
draggableTrack?: boolean;
/** Set min count when `editable` */
minCount?: number;
/** Set max count when `editable` */
maxCount?: number;
};
export interface SliderProps<ValueType = number | number[]> {
prefixCls?: string;
className?: string;
style?: React.CSSProperties;
classNames?: SliderClassNames;
styles?: SliderStyles;
id?: string;
disabled?: boolean;
keyboard?: boolean;
autoFocus?: boolean;
onFocus?: (e: React.FocusEvent<HTMLDivElement>) => void;
onBlur?: (e: React.FocusEvent<HTMLDivElement>) => void;
range?: boolean | RangeConfig;
/** @deprecated Use `range.minCount` or `range.maxCount` to handle this */
count?: number;
min?: number;
max?: number;
step?: number | null;
value?: ValueType;
defaultValue?: ValueType;
onChange?: (value: ValueType) => void;
/** @deprecated It's always better to use `onChange` instead */
onBeforeChange?: (value: ValueType) => void;
/** @deprecated Use `onChangeComplete` instead */
onAfterChange?: (value: ValueType) => void;
onChangeComplete?: (value: ValueType) => void;
allowCross?: boolean;
pushable?: boolean | number;
reverse?: boolean;
vertical?: boolean;
included?: boolean;
startPoint?: number;
/** @deprecated Please use `styles.track` instead */
trackStyle?: React.CSSProperties | React.CSSProperties[];
/** @deprecated Please use `styles.handle` instead */
handleStyle?: React.CSSProperties | React.CSSProperties[];
/** @deprecated Please use `styles.rail` instead */
railStyle?: React.CSSProperties;
dotStyle?: React.CSSProperties | ((dotValue: number) => React.CSSProperties);
activeDotStyle?: React.CSSProperties | ((dotValue: number) => React.CSSProperties);
marks?: Record<string | number, React.ReactNode | MarkObj>;
dots?: boolean;
handleRender?: HandlesProps['handleRender'];
activeHandleRender?: HandlesProps['handleRender'];
track?: boolean;
tabIndex?: number | number[];
ariaLabelForHandle?: string | string[];
ariaLabelledByForHandle?: string | string[];
ariaRequired?: boolean;
ariaValueTextFormatterForHandle?: AriaValueFormat | AriaValueFormat[];
}
export interface SliderRef {
focus: () => void;
blur: () => void;
}
declare const Slider: React.ForwardRefExoticComponent<SliderProps<number | number[]> & React.RefAttributes<SliderRef>>;
export default Slider;

484
node_modules/rc-slider/es/Slider.js generated vendored Normal file
View File

@@ -0,0 +1,484 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import _typeof from "@babel/runtime/helpers/esm/typeof";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import cls from 'classnames';
import useEvent from "rc-util/es/hooks/useEvent";
import useMergedState from "rc-util/es/hooks/useMergedState";
import isEqual from "rc-util/es/isEqual";
import warning from "rc-util/es/warning";
import * as React from 'react';
import Handles from "./Handles";
import Marks from "./Marks";
import Steps from "./Steps";
import Tracks from "./Tracks";
import SliderContext from "./context";
import useDrag from "./hooks/useDrag";
import useOffset from "./hooks/useOffset";
import useRange from "./hooks/useRange";
/**
* New:
* - click mark to update range value
* - handleRender
* - Fix handle with count not correct
* - Fix pushable not work in some case
* - No more FindDOMNode
* - Move all position related style into inline style
* - Key: up is plus, down is minus
* - fix Key with step = null not align with marks
* - Change range should not trigger onChange
* - keyboard support pushable
*/
var Slider = /*#__PURE__*/React.forwardRef(function (props, ref) {
var _props$prefixCls = props.prefixCls,
prefixCls = _props$prefixCls === void 0 ? 'rc-slider' : _props$prefixCls,
className = props.className,
style = props.style,
classNames = props.classNames,
styles = props.styles,
id = props.id,
_props$disabled = props.disabled,
disabled = _props$disabled === void 0 ? false : _props$disabled,
_props$keyboard = props.keyboard,
keyboard = _props$keyboard === void 0 ? true : _props$keyboard,
autoFocus = props.autoFocus,
onFocus = props.onFocus,
onBlur = props.onBlur,
_props$min = props.min,
min = _props$min === void 0 ? 0 : _props$min,
_props$max = props.max,
max = _props$max === void 0 ? 100 : _props$max,
_props$step = props.step,
step = _props$step === void 0 ? 1 : _props$step,
value = props.value,
defaultValue = props.defaultValue,
range = props.range,
count = props.count,
onChange = props.onChange,
onBeforeChange = props.onBeforeChange,
onAfterChange = props.onAfterChange,
onChangeComplete = props.onChangeComplete,
_props$allowCross = props.allowCross,
allowCross = _props$allowCross === void 0 ? true : _props$allowCross,
_props$pushable = props.pushable,
pushable = _props$pushable === void 0 ? false : _props$pushable,
reverse = props.reverse,
vertical = props.vertical,
_props$included = props.included,
included = _props$included === void 0 ? true : _props$included,
startPoint = props.startPoint,
trackStyle = props.trackStyle,
handleStyle = props.handleStyle,
railStyle = props.railStyle,
dotStyle = props.dotStyle,
activeDotStyle = props.activeDotStyle,
marks = props.marks,
dots = props.dots,
handleRender = props.handleRender,
activeHandleRender = props.activeHandleRender,
track = props.track,
_props$tabIndex = props.tabIndex,
tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,
ariaLabelForHandle = props.ariaLabelForHandle,
ariaLabelledByForHandle = props.ariaLabelledByForHandle,
ariaRequired = props.ariaRequired,
ariaValueTextFormatterForHandle = props.ariaValueTextFormatterForHandle;
var handlesRef = React.useRef(null);
var containerRef = React.useRef(null);
var direction = React.useMemo(function () {
if (vertical) {
return reverse ? 'ttb' : 'btt';
}
return reverse ? 'rtl' : 'ltr';
}, [reverse, vertical]);
// ============================ Range =============================
var _useRange = useRange(range),
_useRange2 = _slicedToArray(_useRange, 5),
rangeEnabled = _useRange2[0],
rangeEditable = _useRange2[1],
rangeDraggableTrack = _useRange2[2],
minCount = _useRange2[3],
maxCount = _useRange2[4];
var mergedMin = React.useMemo(function () {
return isFinite(min) ? min : 0;
}, [min]);
var mergedMax = React.useMemo(function () {
return isFinite(max) ? max : 100;
}, [max]);
// ============================= Step =============================
var mergedStep = React.useMemo(function () {
return step !== null && step <= 0 ? 1 : step;
}, [step]);
// ============================= Push =============================
var mergedPush = React.useMemo(function () {
if (typeof pushable === 'boolean') {
return pushable ? mergedStep : false;
}
return pushable >= 0 ? pushable : false;
}, [pushable, mergedStep]);
// ============================ Marks =============================
var markList = React.useMemo(function () {
return Object.keys(marks || {}).map(function (key) {
var mark = marks[key];
var markObj = {
value: Number(key)
};
if (mark && _typeof(mark) === 'object' && ! /*#__PURE__*/React.isValidElement(mark) && ('label' in mark || 'style' in mark)) {
markObj.style = mark.style;
markObj.label = mark.label;
} else {
markObj.label = mark;
}
return markObj;
}).filter(function (_ref) {
var label = _ref.label;
return label || typeof label === 'number';
}).sort(function (a, b) {
return a.value - b.value;
});
}, [marks]);
// ============================ Format ============================
var _useOffset = useOffset(mergedMin, mergedMax, mergedStep, markList, allowCross, mergedPush),
_useOffset2 = _slicedToArray(_useOffset, 2),
formatValue = _useOffset2[0],
offsetValues = _useOffset2[1];
// ============================ Values ============================
var _useMergedState = useMergedState(defaultValue, {
value: value
}),
_useMergedState2 = _slicedToArray(_useMergedState, 2),
mergedValue = _useMergedState2[0],
setValue = _useMergedState2[1];
var rawValues = React.useMemo(function () {
var valueList = mergedValue === null || mergedValue === undefined ? [] : Array.isArray(mergedValue) ? mergedValue : [mergedValue];
var _valueList = _slicedToArray(valueList, 1),
_valueList$ = _valueList[0],
val0 = _valueList$ === void 0 ? mergedMin : _valueList$;
var returnValues = mergedValue === null ? [] : [val0];
// Format as range
if (rangeEnabled) {
returnValues = _toConsumableArray(valueList);
// When count provided or value is `undefined`, we fill values
if (count || mergedValue === undefined) {
var pointCount = count >= 0 ? count + 1 : 2;
returnValues = returnValues.slice(0, pointCount);
// Fill with count
while (returnValues.length < pointCount) {
var _returnValues;
returnValues.push((_returnValues = returnValues[returnValues.length - 1]) !== null && _returnValues !== void 0 ? _returnValues : mergedMin);
}
}
returnValues.sort(function (a, b) {
return a - b;
});
}
// Align in range
returnValues.forEach(function (val, index) {
returnValues[index] = formatValue(val);
});
return returnValues;
}, [mergedValue, rangeEnabled, mergedMin, count, formatValue]);
// =========================== onChange ===========================
var getTriggerValue = function getTriggerValue(triggerValues) {
return rangeEnabled ? triggerValues : triggerValues[0];
};
var triggerChange = useEvent(function (nextValues) {
// Order first
var cloneNextValues = _toConsumableArray(nextValues).sort(function (a, b) {
return a - b;
});
// Trigger event if needed
if (onChange && !isEqual(cloneNextValues, rawValues, true)) {
onChange(getTriggerValue(cloneNextValues));
}
// We set this later since it will re-render component immediately
setValue(cloneNextValues);
});
var finishChange = useEvent(function (draggingDelete) {
// Trigger from `useDrag` will tell if it's a delete action
if (draggingDelete) {
handlesRef.current.hideHelp();
}
var finishValue = getTriggerValue(rawValues);
onAfterChange === null || onAfterChange === void 0 || onAfterChange(finishValue);
warning(!onAfterChange, '[rc-slider] `onAfterChange` is deprecated. Please use `onChangeComplete` instead.');
onChangeComplete === null || onChangeComplete === void 0 || onChangeComplete(finishValue);
});
var onDelete = function onDelete(index) {
if (disabled || !rangeEditable || rawValues.length <= minCount) {
return;
}
var cloneNextValues = _toConsumableArray(rawValues);
cloneNextValues.splice(index, 1);
onBeforeChange === null || onBeforeChange === void 0 || onBeforeChange(getTriggerValue(cloneNextValues));
triggerChange(cloneNextValues);
var nextFocusIndex = Math.max(0, index - 1);
handlesRef.current.hideHelp();
handlesRef.current.focus(nextFocusIndex);
};
var _useDrag = useDrag(containerRef, direction, rawValues, mergedMin, mergedMax, formatValue, triggerChange, finishChange, offsetValues, rangeEditable, minCount),
_useDrag2 = _slicedToArray(_useDrag, 5),
draggingIndex = _useDrag2[0],
draggingValue = _useDrag2[1],
draggingDelete = _useDrag2[2],
cacheValues = _useDrag2[3],
onStartDrag = _useDrag2[4];
/**
* When `rangeEditable` will insert a new value in the values array.
* Else it will replace the value in the values array.
*/
var changeToCloseValue = function changeToCloseValue(newValue, e) {
if (!disabled) {
// Create new values
var cloneNextValues = _toConsumableArray(rawValues);
var valueIndex = 0;
var valueBeforeIndex = 0; // Record the index which value < newValue
var valueDist = mergedMax - mergedMin;
rawValues.forEach(function (val, index) {
var dist = Math.abs(newValue - val);
if (dist <= valueDist) {
valueDist = dist;
valueIndex = index;
}
if (val < newValue) {
valueBeforeIndex = index;
}
});
var focusIndex = valueIndex;
if (rangeEditable && valueDist !== 0 && (!maxCount || rawValues.length < maxCount)) {
cloneNextValues.splice(valueBeforeIndex + 1, 0, newValue);
focusIndex = valueBeforeIndex + 1;
} else {
cloneNextValues[valueIndex] = newValue;
}
// Fill value to match default 2 (only when `rawValues` is empty)
if (rangeEnabled && !rawValues.length && count === undefined) {
cloneNextValues.push(newValue);
}
var nextValue = getTriggerValue(cloneNextValues);
onBeforeChange === null || onBeforeChange === void 0 || onBeforeChange(nextValue);
triggerChange(cloneNextValues);
if (e) {
var _document$activeEleme, _document$activeEleme2;
(_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 || (_document$activeEleme2 = _document$activeEleme.blur) === null || _document$activeEleme2 === void 0 || _document$activeEleme2.call(_document$activeEleme);
handlesRef.current.focus(focusIndex);
onStartDrag(e, focusIndex, cloneNextValues);
} else {
// https://github.com/ant-design/ant-design/issues/49997
onAfterChange === null || onAfterChange === void 0 || onAfterChange(nextValue);
warning(!onAfterChange, '[rc-slider] `onAfterChange` is deprecated. Please use `onChangeComplete` instead.');
onChangeComplete === null || onChangeComplete === void 0 || onChangeComplete(nextValue);
}
}
};
// ============================ Click =============================
var onSliderMouseDown = function onSliderMouseDown(e) {
e.preventDefault();
var _containerRef$current = containerRef.current.getBoundingClientRect(),
width = _containerRef$current.width,
height = _containerRef$current.height,
left = _containerRef$current.left,
top = _containerRef$current.top,
bottom = _containerRef$current.bottom,
right = _containerRef$current.right;
var clientX = e.clientX,
clientY = e.clientY;
var percent;
switch (direction) {
case 'btt':
percent = (bottom - clientY) / height;
break;
case 'ttb':
percent = (clientY - top) / height;
break;
case 'rtl':
percent = (right - clientX) / width;
break;
default:
percent = (clientX - left) / width;
}
var nextValue = mergedMin + percent * (mergedMax - mergedMin);
changeToCloseValue(formatValue(nextValue), e);
};
// =========================== Keyboard ===========================
var _React$useState = React.useState(null),
_React$useState2 = _slicedToArray(_React$useState, 2),
keyboardValue = _React$useState2[0],
setKeyboardValue = _React$useState2[1];
var onHandleOffsetChange = function onHandleOffsetChange(offset, valueIndex) {
if (!disabled) {
var next = offsetValues(rawValues, offset, valueIndex);
onBeforeChange === null || onBeforeChange === void 0 || onBeforeChange(getTriggerValue(rawValues));
triggerChange(next.values);
setKeyboardValue(next.value);
}
};
React.useEffect(function () {
if (keyboardValue !== null) {
var valueIndex = rawValues.indexOf(keyboardValue);
if (valueIndex >= 0) {
handlesRef.current.focus(valueIndex);
}
}
setKeyboardValue(null);
}, [keyboardValue]);
// ============================= Drag =============================
var mergedDraggableTrack = React.useMemo(function () {
if (rangeDraggableTrack && mergedStep === null) {
if (process.env.NODE_ENV !== 'production') {
warning(false, '`draggableTrack` is not supported when `step` is `null`.');
}
return false;
}
return rangeDraggableTrack;
}, [rangeDraggableTrack, mergedStep]);
var onStartMove = useEvent(function (e, valueIndex) {
onStartDrag(e, valueIndex);
onBeforeChange === null || onBeforeChange === void 0 || onBeforeChange(getTriggerValue(rawValues));
});
// Auto focus for updated handle
var dragging = draggingIndex !== -1;
React.useEffect(function () {
if (!dragging) {
var valueIndex = rawValues.lastIndexOf(draggingValue);
handlesRef.current.focus(valueIndex);
}
}, [dragging]);
// =========================== Included ===========================
var sortedCacheValues = React.useMemo(function () {
return _toConsumableArray(cacheValues).sort(function (a, b) {
return a - b;
});
}, [cacheValues]);
// Provide a range values with included [min, max]
// Used for Track, Mark & Dot
var _React$useMemo = React.useMemo(function () {
if (!rangeEnabled) {
return [mergedMin, sortedCacheValues[0]];
}
return [sortedCacheValues[0], sortedCacheValues[sortedCacheValues.length - 1]];
}, [sortedCacheValues, rangeEnabled, mergedMin]),
_React$useMemo2 = _slicedToArray(_React$useMemo, 2),
includedStart = _React$useMemo2[0],
includedEnd = _React$useMemo2[1];
// ============================= Refs =============================
React.useImperativeHandle(ref, function () {
return {
focus: function focus() {
handlesRef.current.focus(0);
},
blur: function blur() {
var _containerRef$current2;
var _document = document,
activeElement = _document.activeElement;
if ((_containerRef$current2 = containerRef.current) !== null && _containerRef$current2 !== void 0 && _containerRef$current2.contains(activeElement)) {
activeElement === null || activeElement === void 0 || activeElement.blur();
}
}
};
});
// ========================== Auto Focus ==========================
React.useEffect(function () {
if (autoFocus) {
handlesRef.current.focus(0);
}
}, []);
// =========================== Context ============================
var context = React.useMemo(function () {
return {
min: mergedMin,
max: mergedMax,
direction: direction,
disabled: disabled,
keyboard: keyboard,
step: mergedStep,
included: included,
includedStart: includedStart,
includedEnd: includedEnd,
range: rangeEnabled,
tabIndex: tabIndex,
ariaLabelForHandle: ariaLabelForHandle,
ariaLabelledByForHandle: ariaLabelledByForHandle,
ariaRequired: ariaRequired,
ariaValueTextFormatterForHandle: ariaValueTextFormatterForHandle,
styles: styles || {},
classNames: classNames || {}
};
}, [mergedMin, mergedMax, direction, disabled, keyboard, mergedStep, included, includedStart, includedEnd, rangeEnabled, tabIndex, ariaLabelForHandle, ariaLabelledByForHandle, ariaRequired, ariaValueTextFormatterForHandle, styles, classNames]);
// ============================ Render ============================
return /*#__PURE__*/React.createElement(SliderContext.Provider, {
value: context
}, /*#__PURE__*/React.createElement("div", {
ref: containerRef,
className: cls(prefixCls, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-disabled"), disabled), "".concat(prefixCls, "-vertical"), vertical), "".concat(prefixCls, "-horizontal"), !vertical), "".concat(prefixCls, "-with-marks"), markList.length)),
style: style,
onMouseDown: onSliderMouseDown,
id: id
}, /*#__PURE__*/React.createElement("div", {
className: cls("".concat(prefixCls, "-rail"), classNames === null || classNames === void 0 ? void 0 : classNames.rail),
style: _objectSpread(_objectSpread({}, railStyle), styles === null || styles === void 0 ? void 0 : styles.rail)
}), track !== false && /*#__PURE__*/React.createElement(Tracks, {
prefixCls: prefixCls,
style: trackStyle,
values: rawValues,
startPoint: startPoint,
onStartMove: mergedDraggableTrack ? onStartMove : undefined
}), /*#__PURE__*/React.createElement(Steps, {
prefixCls: prefixCls,
marks: markList,
dots: dots,
style: dotStyle,
activeStyle: activeDotStyle
}), /*#__PURE__*/React.createElement(Handles, {
ref: handlesRef,
prefixCls: prefixCls,
style: handleStyle,
values: cacheValues,
draggingIndex: draggingIndex,
draggingDelete: draggingDelete,
onStartMove: onStartMove,
onOffsetChange: onHandleOffsetChange,
onFocus: onFocus,
onBlur: onBlur,
handleRender: handleRender,
activeHandleRender: activeHandleRender,
onChangeComplete: finishChange,
onDelete: rangeEditable ? onDelete : undefined
}), /*#__PURE__*/React.createElement(Marks, {
prefixCls: prefixCls,
marks: markList,
onClick: changeToCloseValue
})));
});
if (process.env.NODE_ENV !== 'production') {
Slider.displayName = 'Slider';
}
export default Slider;

9
node_modules/rc-slider/es/Steps/Dot.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import * as React from 'react';
export interface DotProps {
prefixCls: string;
value: number;
style?: React.CSSProperties | ((dotValue: number) => React.CSSProperties);
activeStyle?: React.CSSProperties | ((dotValue: number) => React.CSSProperties);
}
declare const Dot: React.FC<DotProps>;
export default Dot;

32
node_modules/rc-slider/es/Steps/Dot.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import classNames from 'classnames';
import * as React from 'react';
import SliderContext from "../context";
import { getDirectionStyle } from "../util";
var Dot = function Dot(props) {
var prefixCls = props.prefixCls,
value = props.value,
style = props.style,
activeStyle = props.activeStyle;
var _React$useContext = React.useContext(SliderContext),
min = _React$useContext.min,
max = _React$useContext.max,
direction = _React$useContext.direction,
included = _React$useContext.included,
includedStart = _React$useContext.includedStart,
includedEnd = _React$useContext.includedEnd;
var dotClassName = "".concat(prefixCls, "-dot");
var active = included && includedStart <= value && value <= includedEnd;
// ============================ Offset ============================
var mergedStyle = _objectSpread(_objectSpread({}, getDirectionStyle(direction, value, min, max)), typeof style === 'function' ? style(value) : style);
if (active) {
mergedStyle = _objectSpread(_objectSpread({}, mergedStyle), typeof activeStyle === 'function' ? activeStyle(value) : activeStyle);
}
return /*#__PURE__*/React.createElement("span", {
className: classNames(dotClassName, _defineProperty({}, "".concat(dotClassName, "-active"), active)),
style: mergedStyle
});
};
export default Dot;

11
node_modules/rc-slider/es/Steps/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import type { InternalMarkObj } from '../Marks';
export interface StepsProps {
prefixCls: string;
marks: InternalMarkObj[];
dots?: boolean;
style?: React.CSSProperties | ((dotValue: number) => React.CSSProperties);
activeStyle?: React.CSSProperties | ((dotValue: number) => React.CSSProperties);
}
declare const Steps: React.FC<StepsProps>;
export default Steps;

44
node_modules/rc-slider/es/Steps/index.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
import * as React from 'react';
import SliderContext from "../context";
import Dot from "./Dot";
var Steps = function Steps(props) {
var prefixCls = props.prefixCls,
marks = props.marks,
dots = props.dots,
style = props.style,
activeStyle = props.activeStyle;
var _React$useContext = React.useContext(SliderContext),
min = _React$useContext.min,
max = _React$useContext.max,
step = _React$useContext.step;
var stepDots = React.useMemo(function () {
var dotSet = new Set();
// Add marks
marks.forEach(function (mark) {
dotSet.add(mark.value);
});
// Fill dots
if (dots && step !== null) {
var current = min;
while (current <= max) {
dotSet.add(current);
current += step;
}
}
return Array.from(dotSet);
}, [min, max, step, dots, marks]);
return /*#__PURE__*/React.createElement("div", {
className: "".concat(prefixCls, "-step")
}, stepDots.map(function (dotValue) {
return /*#__PURE__*/React.createElement(Dot, {
prefixCls: prefixCls,
key: dotValue,
value: dotValue,
style: style,
activeStyle: activeStyle
});
}));
};
export default Steps;

14
node_modules/rc-slider/es/Tracks/Track.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import * as React from 'react';
import type { OnStartMove } from '../interface';
export interface TrackProps {
prefixCls: string;
style?: React.CSSProperties;
/** Replace with origin prefix concat className */
replaceCls?: string;
start: number;
end: number;
index: number;
onStartMove?: OnStartMove;
}
declare const Track: React.FC<TrackProps>;
export default Track;

60
node_modules/rc-slider/es/Tracks/Track.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import cls from 'classnames';
import * as React from 'react';
import SliderContext from "../context";
import { getOffset } from "../util";
var Track = function Track(props) {
var prefixCls = props.prefixCls,
style = props.style,
start = props.start,
end = props.end,
index = props.index,
onStartMove = props.onStartMove,
replaceCls = props.replaceCls;
var _React$useContext = React.useContext(SliderContext),
direction = _React$useContext.direction,
min = _React$useContext.min,
max = _React$useContext.max,
disabled = _React$useContext.disabled,
range = _React$useContext.range,
classNames = _React$useContext.classNames;
var trackPrefixCls = "".concat(prefixCls, "-track");
var offsetStart = getOffset(start, min, max);
var offsetEnd = getOffset(end, min, max);
// ============================ Events ============================
var onInternalStartMove = function onInternalStartMove(e) {
if (!disabled && onStartMove) {
onStartMove(e, -1);
}
};
// ============================ Render ============================
var positionStyle = {};
switch (direction) {
case 'rtl':
positionStyle.right = "".concat(offsetStart * 100, "%");
positionStyle.width = "".concat(offsetEnd * 100 - offsetStart * 100, "%");
break;
case 'btt':
positionStyle.bottom = "".concat(offsetStart * 100, "%");
positionStyle.height = "".concat(offsetEnd * 100 - offsetStart * 100, "%");
break;
case 'ttb':
positionStyle.top = "".concat(offsetStart * 100, "%");
positionStyle.height = "".concat(offsetEnd * 100 - offsetStart * 100, "%");
break;
default:
positionStyle.left = "".concat(offsetStart * 100, "%");
positionStyle.width = "".concat(offsetEnd * 100 - offsetStart * 100, "%");
}
var className = replaceCls || cls(trackPrefixCls, _defineProperty(_defineProperty({}, "".concat(trackPrefixCls, "-").concat(index + 1), index !== null && range), "".concat(prefixCls, "-track-draggable"), onStartMove), classNames.track);
return /*#__PURE__*/React.createElement("div", {
className: className,
style: _objectSpread(_objectSpread({}, positionStyle), style),
onMouseDown: onInternalStartMove,
onTouchStart: onInternalStartMove
});
};
export default Track;

11
node_modules/rc-slider/es/Tracks/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import type { OnStartMove } from '../interface';
export interface TrackProps {
prefixCls: string;
style?: React.CSSProperties | React.CSSProperties[];
values: number[];
onStartMove?: OnStartMove;
startPoint?: number;
}
declare const Tracks: React.FC<TrackProps>;
export default Tracks;

72
node_modules/rc-slider/es/Tracks/index.js generated vendored Normal file
View File

@@ -0,0 +1,72 @@
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import cls from 'classnames';
import * as React from 'react';
import SliderContext from "../context";
import { getIndex } from "../util";
import Track from "./Track";
var Tracks = function Tracks(props) {
var prefixCls = props.prefixCls,
style = props.style,
values = props.values,
startPoint = props.startPoint,
onStartMove = props.onStartMove;
var _React$useContext = React.useContext(SliderContext),
included = _React$useContext.included,
range = _React$useContext.range,
min = _React$useContext.min,
styles = _React$useContext.styles,
classNames = _React$useContext.classNames;
// =========================== List ===========================
var trackList = React.useMemo(function () {
if (!range) {
// null value do not have track
if (values.length === 0) {
return [];
}
var startValue = startPoint !== null && startPoint !== void 0 ? startPoint : min;
var endValue = values[0];
return [{
start: Math.min(startValue, endValue),
end: Math.max(startValue, endValue)
}];
}
// Multiple
var list = [];
for (var i = 0; i < values.length - 1; i += 1) {
list.push({
start: values[i],
end: values[i + 1]
});
}
return list;
}, [values, range, startPoint, min]);
if (!included) {
return null;
}
// ========================== Render ==========================
var tracksNode = trackList !== null && trackList !== void 0 && trackList.length && (classNames.tracks || styles.tracks) ? /*#__PURE__*/React.createElement(Track, {
index: null,
prefixCls: prefixCls,
start: trackList[0].start,
end: trackList[trackList.length - 1].end,
replaceCls: cls(classNames.tracks, "".concat(prefixCls, "-tracks")),
style: styles.tracks
}) : null;
return /*#__PURE__*/React.createElement(React.Fragment, null, tracksNode, trackList.map(function (_ref, index) {
var start = _ref.start,
end = _ref.end;
return /*#__PURE__*/React.createElement(Track, {
index: index,
prefixCls: prefixCls,
style: _objectSpread(_objectSpread({}, getIndex(style, index)), styles.track),
start: start,
end: end,
key: index,
onStartMove: onStartMove
});
}));
};
export default Tracks;

38
node_modules/rc-slider/es/context.d.ts generated vendored Normal file
View File

@@ -0,0 +1,38 @@
import * as React from 'react';
import type { AriaValueFormat, Direction, SliderClassNames, SliderStyles } from './interface';
export interface SliderContextProps {
min: number;
max: number;
includedStart: number;
includedEnd: number;
direction: Direction;
disabled?: boolean;
keyboard?: boolean;
included?: boolean;
step: number | null;
range?: boolean;
tabIndex: number | number[];
ariaLabelForHandle?: string | string[];
ariaLabelledByForHandle?: string | string[];
ariaRequired?: boolean;
ariaValueTextFormatterForHandle?: AriaValueFormat | AriaValueFormat[];
classNames: SliderClassNames;
styles: SliderStyles;
}
declare const SliderContext: React.Context<SliderContextProps>;
export default SliderContext;
export interface UnstableContextProps {
onDragStart?: (info: {
rawValues: number[];
draggingIndex: number;
draggingValue: number;
}) => void;
onDragChange?: (info: {
rawValues: number[];
deleteIndex: number;
draggingIndex: number;
draggingValue: number;
}) => void;
}
/** @private NOT PROMISE AVAILABLE. DO NOT USE IN PRODUCTION. */
export declare const UnstableContext: React.Context<UnstableContextProps>;

16
node_modules/rc-slider/es/context.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import * as React from 'react';
var SliderContext = /*#__PURE__*/React.createContext({
min: 0,
max: 0,
direction: 'ltr',
step: 1,
includedStart: 0,
includedEnd: 0,
tabIndex: 0,
keyboard: true,
styles: {},
classNames: {}
});
export default SliderContext;
/** @private NOT PROMISE AVAILABLE. DO NOT USE IN PRODUCTION. */
export var UnstableContext = /*#__PURE__*/React.createContext({});

11
node_modules/rc-slider/es/hooks/useDrag.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import type { Direction, OnStartMove } from '../interface';
import type { OffsetValues } from './useOffset';
declare function useDrag(containerRef: React.RefObject<HTMLDivElement>, direction: Direction, rawValues: number[], min: number, max: number, formatValue: (value: number) => number, triggerChange: (values: number[]) => void, finishChange: (draggingDelete: boolean) => void, offsetValues: OffsetValues, editable: boolean, minCount: number): [
draggingIndex: number,
draggingValue: number,
draggingDelete: boolean,
returnValues: number[],
onStartMove: OnStartMove
];
export default useDrag;

225
node_modules/rc-slider/es/hooks/useDrag.js generated vendored Normal file
View File

@@ -0,0 +1,225 @@
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import * as React from 'react';
import useEvent from "rc-util/es/hooks/useEvent";
import useLayoutEffect from "rc-util/es/hooks/useLayoutEffect";
import { UnstableContext } from "../context";
/** Drag to delete offset. It's a user experience number for dragging out */
var REMOVE_DIST = 130;
function getPosition(e) {
var obj = 'targetTouches' in e ? e.targetTouches[0] : e;
return {
pageX: obj.pageX,
pageY: obj.pageY
};
}
function useDrag(containerRef, direction, rawValues, min, max, formatValue, triggerChange, finishChange, offsetValues, editable, minCount) {
var _React$useState = React.useState(null),
_React$useState2 = _slicedToArray(_React$useState, 2),
draggingValue = _React$useState2[0],
setDraggingValue = _React$useState2[1];
var _React$useState3 = React.useState(-1),
_React$useState4 = _slicedToArray(_React$useState3, 2),
draggingIndex = _React$useState4[0],
setDraggingIndex = _React$useState4[1];
var _React$useState5 = React.useState(false),
_React$useState6 = _slicedToArray(_React$useState5, 2),
draggingDelete = _React$useState6[0],
setDraggingDelete = _React$useState6[1];
var _React$useState7 = React.useState(rawValues),
_React$useState8 = _slicedToArray(_React$useState7, 2),
cacheValues = _React$useState8[0],
setCacheValues = _React$useState8[1];
var _React$useState9 = React.useState(rawValues),
_React$useState10 = _slicedToArray(_React$useState9, 2),
originValues = _React$useState10[0],
setOriginValues = _React$useState10[1];
var mouseMoveEventRef = React.useRef(null);
var mouseUpEventRef = React.useRef(null);
var touchEventTargetRef = React.useRef(null);
var _React$useContext = React.useContext(UnstableContext),
onDragStart = _React$useContext.onDragStart,
onDragChange = _React$useContext.onDragChange;
useLayoutEffect(function () {
if (draggingIndex === -1) {
setCacheValues(rawValues);
}
}, [rawValues, draggingIndex]);
// Clean up event
React.useEffect(function () {
return function () {
document.removeEventListener('mousemove', mouseMoveEventRef.current);
document.removeEventListener('mouseup', mouseUpEventRef.current);
if (touchEventTargetRef.current) {
touchEventTargetRef.current.removeEventListener('touchmove', mouseMoveEventRef.current);
touchEventTargetRef.current.removeEventListener('touchend', mouseUpEventRef.current);
}
};
}, []);
var flushValues = function flushValues(nextValues, nextValue, deleteMark) {
// Perf: Only update state when value changed
if (nextValue !== undefined) {
setDraggingValue(nextValue);
}
setCacheValues(nextValues);
var changeValues = nextValues;
if (deleteMark) {
changeValues = nextValues.filter(function (_, i) {
return i !== draggingIndex;
});
}
triggerChange(changeValues);
if (onDragChange) {
onDragChange({
rawValues: nextValues,
deleteIndex: deleteMark ? draggingIndex : -1,
draggingIndex: draggingIndex,
draggingValue: nextValue
});
}
};
var updateCacheValue = useEvent(function (valueIndex, offsetPercent, deleteMark) {
if (valueIndex === -1) {
// >>>> Dragging on the track
var startValue = originValues[0];
var endValue = originValues[originValues.length - 1];
var maxStartOffset = min - startValue;
var maxEndOffset = max - endValue;
// Get valid offset
var offset = offsetPercent * (max - min);
offset = Math.max(offset, maxStartOffset);
offset = Math.min(offset, maxEndOffset);
// Use first value to revert back of valid offset (like steps marks)
var formatStartValue = formatValue(startValue + offset);
offset = formatStartValue - startValue;
var cloneCacheValues = originValues.map(function (val) {
return val + offset;
});
flushValues(cloneCacheValues);
} else {
// >>>> Dragging on the handle
var offsetDist = (max - min) * offsetPercent;
// Always start with the valueIndex origin value
var cloneValues = _toConsumableArray(cacheValues);
cloneValues[valueIndex] = originValues[valueIndex];
var next = offsetValues(cloneValues, offsetDist, valueIndex, 'dist');
flushValues(next.values, next.value, deleteMark);
}
});
var onStartMove = function onStartMove(e, valueIndex, startValues) {
e.stopPropagation();
// 如果是点击 track 触发的,需要传入变化后的初始值,而不能直接用 rawValues
var initialValues = startValues || rawValues;
var originValue = initialValues[valueIndex];
setDraggingIndex(valueIndex);
setDraggingValue(originValue);
setOriginValues(initialValues);
setCacheValues(initialValues);
setDraggingDelete(false);
var _getPosition = getPosition(e),
startX = _getPosition.pageX,
startY = _getPosition.pageY;
// We declare it here since closure can't get outer latest value
var deleteMark = false;
// Internal trigger event
if (onDragStart) {
onDragStart({
rawValues: initialValues,
draggingIndex: valueIndex,
draggingValue: originValue
});
}
// Moving
var onMouseMove = function onMouseMove(event) {
event.preventDefault();
var _getPosition2 = getPosition(event),
moveX = _getPosition2.pageX,
moveY = _getPosition2.pageY;
var offsetX = moveX - startX;
var offsetY = moveY - startY;
var _containerRef$current = containerRef.current.getBoundingClientRect(),
width = _containerRef$current.width,
height = _containerRef$current.height;
var offSetPercent;
var removeDist;
switch (direction) {
case 'btt':
offSetPercent = -offsetY / height;
removeDist = offsetX;
break;
case 'ttb':
offSetPercent = offsetY / height;
removeDist = offsetX;
break;
case 'rtl':
offSetPercent = -offsetX / width;
removeDist = offsetY;
break;
default:
offSetPercent = offsetX / width;
removeDist = offsetY;
}
// Check if need mark remove
deleteMark = editable ? Math.abs(removeDist) > REMOVE_DIST && minCount < cacheValues.length : false;
setDraggingDelete(deleteMark);
updateCacheValue(valueIndex, offSetPercent, deleteMark);
};
// End
var onMouseUp = function onMouseUp(event) {
event.preventDefault();
document.removeEventListener('mouseup', onMouseUp);
document.removeEventListener('mousemove', onMouseMove);
if (touchEventTargetRef.current) {
touchEventTargetRef.current.removeEventListener('touchmove', mouseMoveEventRef.current);
touchEventTargetRef.current.removeEventListener('touchend', mouseUpEventRef.current);
}
mouseMoveEventRef.current = null;
mouseUpEventRef.current = null;
touchEventTargetRef.current = null;
finishChange(deleteMark);
setDraggingIndex(-1);
setDraggingDelete(false);
};
document.addEventListener('mouseup', onMouseUp);
document.addEventListener('mousemove', onMouseMove);
e.currentTarget.addEventListener('touchend', onMouseUp);
e.currentTarget.addEventListener('touchmove', onMouseMove);
mouseMoveEventRef.current = onMouseMove;
mouseUpEventRef.current = onMouseUp;
touchEventTargetRef.current = e.currentTarget;
};
// Only return cache value when it mapping with rawValues
var returnValues = React.useMemo(function () {
var sourceValues = _toConsumableArray(rawValues).sort(function (a, b) {
return a - b;
});
var targetValues = _toConsumableArray(cacheValues).sort(function (a, b) {
return a - b;
});
var counts = {};
targetValues.forEach(function (val) {
counts[val] = (counts[val] || 0) + 1;
});
sourceValues.forEach(function (val) {
counts[val] = (counts[val] || 0) - 1;
});
var maxDiffCount = editable ? 1 : 0;
var diffCount = Object.values(counts).reduce(function (prev, next) {
return prev + Math.abs(next);
}, 0);
return diffCount <= maxDiffCount ? cacheValues : rawValues;
}, [rawValues, cacheValues, editable]);
return [draggingIndex, draggingValue, draggingDelete, returnValues, onStartMove];
}
export default useDrag;

10
node_modules/rc-slider/es/hooks/useOffset.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import type { InternalMarkObj } from '../Marks';
/** Format value align with step & marks */
type FormatValue = (value: number) => number;
type OffsetMode = 'unit' | 'dist';
export type OffsetValues = (values: number[], offset: number | 'min' | 'max', valueIndex: number, mode?: OffsetMode) => {
value: number;
values: number[];
};
export default function useOffset(min: number, max: number, step: number, markList: InternalMarkObj[], allowCross: boolean, pushable: false | number): [FormatValue, OffsetValues];
export {};

219
node_modules/rc-slider/es/hooks/useOffset.js generated vendored Normal file
View File

@@ -0,0 +1,219 @@
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import * as React from 'react';
/** Format the value in the range of [min, max] */
/** Format value align with step */
/** Format value align with step & marks */
export default function useOffset(min, max, step, markList, allowCross, pushable) {
var formatRangeValue = React.useCallback(function (val) {
return Math.max(min, Math.min(max, val));
}, [min, max]);
var formatStepValue = React.useCallback(function (val) {
if (step !== null) {
var stepValue = min + Math.round((formatRangeValue(val) - min) / step) * step;
// Cut number in case to be like 0.30000000000000004
var getDecimal = function getDecimal(num) {
return (String(num).split('.')[1] || '').length;
};
var maxDecimal = Math.max(getDecimal(step), getDecimal(max), getDecimal(min));
var fixedValue = Number(stepValue.toFixed(maxDecimal));
return min <= fixedValue && fixedValue <= max ? fixedValue : null;
}
return null;
}, [step, min, max, formatRangeValue]);
var formatValue = React.useCallback(function (val) {
var formatNextValue = formatRangeValue(val);
// List align values
var alignValues = markList.map(function (mark) {
return mark.value;
});
if (step !== null) {
alignValues.push(formatStepValue(val));
}
// min & max
alignValues.push(min, max);
// Align with marks
var closeValue = alignValues[0];
var closeDist = max - min;
alignValues.forEach(function (alignValue) {
var dist = Math.abs(formatNextValue - alignValue);
if (dist <= closeDist) {
closeValue = alignValue;
closeDist = dist;
}
});
return closeValue;
}, [min, max, markList, step, formatRangeValue, formatStepValue]);
// ========================== Offset ==========================
// Single Value
var offsetValue = function offsetValue(values, offset, valueIndex) {
var mode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'unit';
if (typeof offset === 'number') {
var nextValue;
var originValue = values[valueIndex];
// Only used for `dist` mode
var targetDistValue = originValue + offset;
// Compare next step value & mark value which is best match
var potentialValues = [];
markList.forEach(function (mark) {
potentialValues.push(mark.value);
});
// Min & Max
potentialValues.push(min, max);
// In case origin value is align with mark but not with step
potentialValues.push(formatStepValue(originValue));
// Put offset step value also
var sign = offset > 0 ? 1 : -1;
if (mode === 'unit') {
potentialValues.push(formatStepValue(originValue + sign * step));
} else {
potentialValues.push(formatStepValue(targetDistValue));
}
// Find close one
potentialValues = potentialValues.filter(function (val) {
return val !== null;
})
// Remove reverse value
.filter(function (val) {
return offset < 0 ? val <= originValue : val >= originValue;
});
if (mode === 'unit') {
// `unit` mode can not contain itself
potentialValues = potentialValues.filter(function (val) {
return val !== originValue;
});
}
var compareValue = mode === 'unit' ? originValue : targetDistValue;
nextValue = potentialValues[0];
var valueDist = Math.abs(nextValue - compareValue);
potentialValues.forEach(function (potentialValue) {
var dist = Math.abs(potentialValue - compareValue);
if (dist < valueDist) {
nextValue = potentialValue;
valueDist = dist;
}
});
// Out of range will back to range
if (nextValue === undefined) {
return offset < 0 ? min : max;
}
// `dist` mode
if (mode === 'dist') {
return nextValue;
}
// `unit` mode may need another round
if (Math.abs(offset) > 1) {
var cloneValues = _toConsumableArray(values);
cloneValues[valueIndex] = nextValue;
return offsetValue(cloneValues, offset - sign, valueIndex, mode);
}
return nextValue;
} else if (offset === 'min') {
return min;
} else if (offset === 'max') {
return max;
}
};
/** Same as `offsetValue` but return `changed` mark to tell value changed */
var offsetChangedValue = function offsetChangedValue(values, offset, valueIndex) {
var mode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'unit';
var originValue = values[valueIndex];
var nextValue = offsetValue(values, offset, valueIndex, mode);
return {
value: nextValue,
changed: nextValue !== originValue
};
};
var needPush = function needPush(dist) {
return pushable === null && dist === 0 || typeof pushable === 'number' && dist < pushable;
};
// Values
var offsetValues = function offsetValues(values, offset, valueIndex) {
var mode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'unit';
var nextValues = values.map(formatValue);
var originValue = nextValues[valueIndex];
var nextValue = offsetValue(nextValues, offset, valueIndex, mode);
nextValues[valueIndex] = nextValue;
if (allowCross === false) {
// >>>>> Allow Cross
var pushNum = pushable || 0;
// ============ AllowCross ===============
if (valueIndex > 0 && nextValues[valueIndex - 1] !== originValue) {
nextValues[valueIndex] = Math.max(nextValues[valueIndex], nextValues[valueIndex - 1] + pushNum);
}
if (valueIndex < nextValues.length - 1 && nextValues[valueIndex + 1] !== originValue) {
nextValues[valueIndex] = Math.min(nextValues[valueIndex], nextValues[valueIndex + 1] - pushNum);
}
} else if (typeof pushable === 'number' || pushable === null) {
// >>>>> Pushable
// =============== Push ==================
// >>>>>> Basic push
// End values
for (var i = valueIndex + 1; i < nextValues.length; i += 1) {
var changed = true;
while (needPush(nextValues[i] - nextValues[i - 1]) && changed) {
var _offsetChangedValue = offsetChangedValue(nextValues, 1, i);
nextValues[i] = _offsetChangedValue.value;
changed = _offsetChangedValue.changed;
}
}
// Start values
for (var _i = valueIndex; _i > 0; _i -= 1) {
var _changed = true;
while (needPush(nextValues[_i] - nextValues[_i - 1]) && _changed) {
var _offsetChangedValue2 = offsetChangedValue(nextValues, -1, _i - 1);
nextValues[_i - 1] = _offsetChangedValue2.value;
_changed = _offsetChangedValue2.changed;
}
}
// >>>>> Revert back to safe push range
// End to Start
for (var _i2 = nextValues.length - 1; _i2 > 0; _i2 -= 1) {
var _changed2 = true;
while (needPush(nextValues[_i2] - nextValues[_i2 - 1]) && _changed2) {
var _offsetChangedValue3 = offsetChangedValue(nextValues, -1, _i2 - 1);
nextValues[_i2 - 1] = _offsetChangedValue3.value;
_changed2 = _offsetChangedValue3.changed;
}
}
// Start to End
for (var _i3 = 0; _i3 < nextValues.length - 1; _i3 += 1) {
var _changed3 = true;
while (needPush(nextValues[_i3 + 1] - nextValues[_i3]) && _changed3) {
var _offsetChangedValue4 = offsetChangedValue(nextValues, 1, _i3 + 1);
nextValues[_i3 + 1] = _offsetChangedValue4.value;
_changed3 = _offsetChangedValue4.changed;
}
}
}
return {
value: nextValues[valueIndex],
values: nextValues
};
};
return [formatValue, offsetValues];
}

8
node_modules/rc-slider/es/hooks/useRange.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import type { SliderProps } from '../Slider';
export default function useRange(range?: SliderProps['range']): [
range: boolean,
rangeEditable: boolean,
rangeDraggableTrack: boolean,
minCount: number,
maxCount?: number
];

17
node_modules/rc-slider/es/hooks/useRange.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import { warning } from "rc-util/es/warning";
import { useMemo } from 'react';
export default function useRange(range) {
return useMemo(function () {
if (range === true || !range) {
return [!!range, false, false, 0];
}
var editable = range.editable,
draggableTrack = range.draggableTrack,
minCount = range.minCount,
maxCount = range.maxCount;
if (process.env.NODE_ENV !== 'production') {
warning(!editable || !draggableTrack, '`editable` can not work with `draggableTrack`.');
}
return [true, editable, !editable && draggableTrack, minCount || 0, maxCount];
}, [range]);
}

5
node_modules/rc-slider/es/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import type { SliderProps, SliderRef } from './Slider';
import Slider from './Slider';
export { UnstableContext } from './context';
export type { SliderProps, SliderRef };
export default Slider;

3
node_modules/rc-slider/es/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import Slider from "./Slider";
export { UnstableContext } from "./context";
export default Slider;

7
node_modules/rc-slider/es/interface.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import type React from 'react';
export type Direction = 'rtl' | 'ltr' | 'ttb' | 'btt';
export type OnStartMove = (e: React.MouseEvent | React.TouchEvent, valueIndex: number, startValues?: number[]) => void;
export type AriaValueFormat = (value: number) => string;
export type SemanticName = 'tracks' | 'track' | 'rail' | 'handle';
export type SliderClassNames = Partial<Record<SemanticName, string>>;
export type SliderStyles = Partial<Record<SemanticName, React.CSSProperties>>;

1
node_modules/rc-slider/es/interface.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

6
node_modules/rc-slider/es/util.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
/// <reference types="react" />
import type { Direction } from './interface';
export declare function getOffset(value: number, min: number, max: number): number;
export declare function getDirectionStyle(direction: Direction, value: number, min: number, max: number): import("react").CSSProperties;
/** Return index value if is list or return value directly */
export declare function getIndex<T>(value: T | T[], index: number): T;

31
node_modules/rc-slider/es/util.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
export function getOffset(value, min, max) {
return (value - min) / (max - min);
}
export function getDirectionStyle(direction, value, min, max) {
var offset = getOffset(value, min, max);
var positionStyle = {};
switch (direction) {
case 'rtl':
positionStyle.right = "".concat(offset * 100, "%");
positionStyle.transform = 'translateX(50%)';
break;
case 'btt':
positionStyle.bottom = "".concat(offset * 100, "%");
positionStyle.transform = 'translateY(50%)';
break;
case 'ttb':
positionStyle.top = "".concat(offset * 100, "%");
positionStyle.transform = 'translateY(-50%)';
break;
default:
positionStyle.left = "".concat(offset * 100, "%");
positionStyle.transform = 'translateX(-50%)';
break;
}
return positionStyle;
}
/** Return index value if is list or return value directly */
export function getIndex(value, index) {
return Array.isArray(value) ? value[index] : value;
}