first commit
This commit is contained in:
43
frontend/node_modules/antd/lib/checkbox/Checkbox.d.ts
generated
vendored
Normal file
43
frontend/node_modules/antd/lib/checkbox/Checkbox.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import * as React from 'react';
|
||||
import type { CheckboxRef } from 'rc-checkbox';
|
||||
export interface AbstractCheckboxProps<T> {
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
rootClassName?: string;
|
||||
defaultChecked?: boolean;
|
||||
checked?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
disabled?: boolean;
|
||||
title?: string;
|
||||
onChange?: (e: T) => void;
|
||||
onClick?: React.MouseEventHandler<HTMLElement>;
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLElement>;
|
||||
onMouseLeave?: React.MouseEventHandler<HTMLElement>;
|
||||
onKeyPress?: React.KeyboardEventHandler<HTMLElement>;
|
||||
onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
|
||||
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
||||
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
||||
value?: any;
|
||||
tabIndex?: number;
|
||||
name?: string;
|
||||
children?: React.ReactNode;
|
||||
id?: string;
|
||||
autoFocus?: boolean;
|
||||
type?: string;
|
||||
skipGroup?: boolean;
|
||||
required?: boolean;
|
||||
}
|
||||
export interface CheckboxChangeEventTarget extends CheckboxProps {
|
||||
checked: boolean;
|
||||
}
|
||||
export interface CheckboxChangeEvent {
|
||||
target: CheckboxChangeEventTarget;
|
||||
stopPropagation: () => void;
|
||||
preventDefault: () => void;
|
||||
nativeEvent: MouseEvent;
|
||||
}
|
||||
export interface CheckboxProps extends AbstractCheckboxProps<CheckboxChangeEvent> {
|
||||
indeterminate?: boolean;
|
||||
}
|
||||
declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<CheckboxRef>>;
|
||||
export default Checkbox;
|
||||
139
frontend/node_modules/antd/lib/checkbox/Checkbox.js
generated
vendored
Normal file
139
frontend/node_modules/antd/lib/checkbox/Checkbox.js
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
var _rcCheckbox = _interopRequireDefault(require("rc-checkbox"));
|
||||
var _ref = require("rc-util/lib/ref");
|
||||
var _warning = require("../_util/warning");
|
||||
var _wave = _interopRequireDefault(require("../_util/wave"));
|
||||
var _interface = require("../_util/wave/interface");
|
||||
var _configProvider = require("../config-provider");
|
||||
var _DisabledContext = _interopRequireDefault(require("../config-provider/DisabledContext"));
|
||||
var _useCSSVarCls = _interopRequireDefault(require("../config-provider/hooks/useCSSVarCls"));
|
||||
var _context = require("../form/context");
|
||||
var _GroupContext = _interopRequireDefault(require("./GroupContext"));
|
||||
var _style = _interopRequireDefault(require("./style"));
|
||||
var _useBubbleLock = _interopRequireDefault(require("./useBubbleLock"));
|
||||
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
const InternalCheckbox = (props, ref) => {
|
||||
var _a;
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
className,
|
||||
rootClassName,
|
||||
children,
|
||||
indeterminate = false,
|
||||
style,
|
||||
onMouseEnter,
|
||||
onMouseLeave,
|
||||
skipGroup = false,
|
||||
disabled
|
||||
} = props,
|
||||
restProps = __rest(props, ["prefixCls", "className", "rootClassName", "children", "indeterminate", "style", "onMouseEnter", "onMouseLeave", "skipGroup", "disabled"]);
|
||||
const {
|
||||
getPrefixCls,
|
||||
direction,
|
||||
checkbox
|
||||
} = React.useContext(_configProvider.ConfigContext);
|
||||
const checkboxGroup = React.useContext(_GroupContext.default);
|
||||
const {
|
||||
isFormItemInput
|
||||
} = React.useContext(_context.FormItemInputContext);
|
||||
const contextDisabled = React.useContext(_DisabledContext.default);
|
||||
const mergedDisabled = (_a = (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.disabled) || disabled) !== null && _a !== void 0 ? _a : contextDisabled;
|
||||
const prevValue = React.useRef(restProps.value);
|
||||
const checkboxRef = React.useRef(null);
|
||||
const mergedRef = (0, _ref.composeRef)(ref, checkboxRef);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const warning = (0, _warning.devUseWarning)('Checkbox');
|
||||
process.env.NODE_ENV !== "production" ? warning('checked' in restProps || !!checkboxGroup || !('value' in restProps), 'usage', '`value` is not a valid prop, do you mean `checked`?') : void 0;
|
||||
}
|
||||
React.useEffect(() => {
|
||||
checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.registerValue(restProps.value);
|
||||
}, []);
|
||||
React.useEffect(() => {
|
||||
if (skipGroup) {
|
||||
return;
|
||||
}
|
||||
if (restProps.value !== prevValue.current) {
|
||||
checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.cancelValue(prevValue.current);
|
||||
checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.registerValue(restProps.value);
|
||||
prevValue.current = restProps.value;
|
||||
}
|
||||
return () => checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.cancelValue(restProps.value);
|
||||
}, [restProps.value]);
|
||||
React.useEffect(() => {
|
||||
var _a;
|
||||
if ((_a = checkboxRef.current) === null || _a === void 0 ? void 0 : _a.input) {
|
||||
checkboxRef.current.input.indeterminate = indeterminate;
|
||||
}
|
||||
}, [indeterminate]);
|
||||
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
|
||||
const rootCls = (0, _useCSSVarCls.default)(prefixCls);
|
||||
const [wrapCSSVar, hashId, cssVarCls] = (0, _style.default)(prefixCls, rootCls);
|
||||
const checkboxProps = Object.assign({}, restProps);
|
||||
if (checkboxGroup && !skipGroup) {
|
||||
checkboxProps.onChange = (...args) => {
|
||||
if (restProps.onChange) {
|
||||
restProps.onChange.apply(restProps, args);
|
||||
}
|
||||
if (checkboxGroup.toggleOption) {
|
||||
checkboxGroup.toggleOption({
|
||||
label: children,
|
||||
value: restProps.value
|
||||
});
|
||||
}
|
||||
};
|
||||
checkboxProps.name = checkboxGroup.name;
|
||||
checkboxProps.checked = checkboxGroup.value.includes(restProps.value);
|
||||
}
|
||||
const classString = (0, _classnames.default)(`${prefixCls}-wrapper`, {
|
||||
[`${prefixCls}-rtl`]: direction === 'rtl',
|
||||
[`${prefixCls}-wrapper-checked`]: checkboxProps.checked,
|
||||
[`${prefixCls}-wrapper-disabled`]: mergedDisabled,
|
||||
[`${prefixCls}-wrapper-in-form-item`]: isFormItemInput
|
||||
}, checkbox === null || checkbox === void 0 ? void 0 : checkbox.className, className, rootClassName, cssVarCls, rootCls, hashId);
|
||||
const checkboxClass = (0, _classnames.default)({
|
||||
[`${prefixCls}-indeterminate`]: indeterminate
|
||||
}, _interface.TARGET_CLS, hashId);
|
||||
// ============================ Event Lock ============================
|
||||
const [onLabelClick, onInputClick] = (0, _useBubbleLock.default)(checkboxProps.onClick);
|
||||
// ============================== Render ==============================
|
||||
return wrapCSSVar(/*#__PURE__*/React.createElement(_wave.default, {
|
||||
component: "Checkbox",
|
||||
disabled: mergedDisabled
|
||||
}, /*#__PURE__*/React.createElement("label", {
|
||||
className: classString,
|
||||
style: Object.assign(Object.assign({}, checkbox === null || checkbox === void 0 ? void 0 : checkbox.style), style),
|
||||
onMouseEnter: onMouseEnter,
|
||||
onMouseLeave: onMouseLeave,
|
||||
onClick: onLabelClick
|
||||
}, /*#__PURE__*/React.createElement(_rcCheckbox.default, Object.assign({}, checkboxProps, {
|
||||
onClick: onInputClick,
|
||||
prefixCls: prefixCls,
|
||||
className: checkboxClass,
|
||||
disabled: mergedDisabled,
|
||||
ref: mergedRef
|
||||
})), children !== undefined && children !== null && (/*#__PURE__*/React.createElement("span", {
|
||||
className: `${prefixCls}-label`
|
||||
}, children)))));
|
||||
};
|
||||
const Checkbox = /*#__PURE__*/React.forwardRef(InternalCheckbox);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Checkbox.displayName = 'Checkbox';
|
||||
}
|
||||
var _default = exports.default = Checkbox;
|
||||
33
frontend/node_modules/antd/lib/checkbox/Group.d.ts
generated
vendored
Normal file
33
frontend/node_modules/antd/lib/checkbox/Group.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import * as React from 'react';
|
||||
import type { CheckboxChangeEvent } from './Checkbox';
|
||||
import GroupContext from './GroupContext';
|
||||
export interface CheckboxOptionType<T = any> {
|
||||
label: React.ReactNode;
|
||||
value: T;
|
||||
style?: React.CSSProperties;
|
||||
className?: string;
|
||||
disabled?: boolean;
|
||||
title?: string;
|
||||
id?: string;
|
||||
onChange?: (e: CheckboxChangeEvent) => void;
|
||||
required?: boolean;
|
||||
}
|
||||
export interface AbstractCheckboxGroupProps<T = any> {
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
rootClassName?: string;
|
||||
options?: (CheckboxOptionType<T> | string | number)[];
|
||||
disabled?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export interface CheckboxGroupProps<T = any> extends AbstractCheckboxGroupProps<T> {
|
||||
name?: string;
|
||||
defaultValue?: T[];
|
||||
value?: T[];
|
||||
onChange?: (checkedValue: T[]) => void;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
export type { CheckboxGroupContext } from './GroupContext';
|
||||
export { GroupContext };
|
||||
declare const _default: <T = any>(props: CheckboxGroupProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement;
|
||||
export default _default;
|
||||
127
frontend/node_modules/antd/lib/checkbox/Group.js
generated
vendored
Normal file
127
frontend/node_modules/antd/lib/checkbox/Group.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "GroupContext", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _GroupContext.default;
|
||||
}
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
var _omit = _interopRequireDefault(require("rc-util/lib/omit"));
|
||||
var _configProvider = require("../config-provider");
|
||||
var _useCSSVarCls = _interopRequireDefault(require("../config-provider/hooks/useCSSVarCls"));
|
||||
var _Checkbox = _interopRequireDefault(require("./Checkbox"));
|
||||
var _GroupContext = _interopRequireDefault(require("./GroupContext"));
|
||||
var _style = _interopRequireDefault(require("./style"));
|
||||
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
const CheckboxGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
||||
const {
|
||||
defaultValue,
|
||||
children,
|
||||
options = [],
|
||||
prefixCls: customizePrefixCls,
|
||||
className,
|
||||
rootClassName,
|
||||
style,
|
||||
onChange
|
||||
} = props,
|
||||
restProps = __rest(props, ["defaultValue", "children", "options", "prefixCls", "className", "rootClassName", "style", "onChange"]);
|
||||
const {
|
||||
getPrefixCls,
|
||||
direction
|
||||
} = React.useContext(_configProvider.ConfigContext);
|
||||
const [value, setValue] = React.useState(restProps.value || defaultValue || []);
|
||||
const [registeredValues, setRegisteredValues] = React.useState([]);
|
||||
React.useEffect(() => {
|
||||
if ('value' in restProps) {
|
||||
setValue(restProps.value || []);
|
||||
}
|
||||
}, [restProps.value]);
|
||||
const memoizedOptions = React.useMemo(() => options.map(option => {
|
||||
if (typeof option === 'string' || typeof option === 'number') {
|
||||
return {
|
||||
label: option,
|
||||
value: option
|
||||
};
|
||||
}
|
||||
return option;
|
||||
}), [options]);
|
||||
const cancelValue = val => {
|
||||
setRegisteredValues(prevValues => prevValues.filter(v => v !== val));
|
||||
};
|
||||
const registerValue = val => {
|
||||
setRegisteredValues(prevValues => [].concat((0, _toConsumableArray2.default)(prevValues), [val]));
|
||||
};
|
||||
const toggleOption = option => {
|
||||
const optionIndex = value.indexOf(option.value);
|
||||
const newValue = (0, _toConsumableArray2.default)(value);
|
||||
if (optionIndex === -1) {
|
||||
newValue.push(option.value);
|
||||
} else {
|
||||
newValue.splice(optionIndex, 1);
|
||||
}
|
||||
if (!('value' in restProps)) {
|
||||
setValue(newValue);
|
||||
}
|
||||
onChange === null || onChange === void 0 ? void 0 : onChange(newValue.filter(val => registeredValues.includes(val)).sort((a, b) => {
|
||||
const indexA = memoizedOptions.findIndex(opt => opt.value === a);
|
||||
const indexB = memoizedOptions.findIndex(opt => opt.value === b);
|
||||
return indexA - indexB;
|
||||
}));
|
||||
};
|
||||
const prefixCls = getPrefixCls('checkbox', customizePrefixCls);
|
||||
const groupPrefixCls = `${prefixCls}-group`;
|
||||
const rootCls = (0, _useCSSVarCls.default)(prefixCls);
|
||||
const [wrapCSSVar, hashId, cssVarCls] = (0, _style.default)(prefixCls, rootCls);
|
||||
const domProps = (0, _omit.default)(restProps, ['value', 'disabled']);
|
||||
const childrenNode = options.length ? memoizedOptions.map(option => (/*#__PURE__*/React.createElement(_Checkbox.default, {
|
||||
prefixCls: prefixCls,
|
||||
key: option.value.toString(),
|
||||
disabled: 'disabled' in option ? option.disabled : restProps.disabled,
|
||||
value: option.value,
|
||||
checked: value.includes(option.value),
|
||||
onChange: option.onChange,
|
||||
className: (0, _classnames.default)(`${groupPrefixCls}-item`, option.className),
|
||||
style: option.style,
|
||||
title: option.title,
|
||||
id: option.id,
|
||||
required: option.required
|
||||
}, option.label))) : children;
|
||||
const memoizedContext = React.useMemo(() => ({
|
||||
toggleOption,
|
||||
value,
|
||||
disabled: restProps.disabled,
|
||||
name: restProps.name,
|
||||
// https://github.com/ant-design/ant-design/issues/16376
|
||||
registerValue,
|
||||
cancelValue
|
||||
}), [toggleOption, value, restProps.disabled, restProps.name, registerValue, cancelValue]);
|
||||
const classString = (0, _classnames.default)(groupPrefixCls, {
|
||||
[`${groupPrefixCls}-rtl`]: direction === 'rtl'
|
||||
}, className, rootClassName, cssVarCls, rootCls, hashId);
|
||||
return wrapCSSVar(/*#__PURE__*/React.createElement("div", Object.assign({
|
||||
className: classString,
|
||||
style: style
|
||||
}, domProps, {
|
||||
ref: ref
|
||||
}), /*#__PURE__*/React.createElement(_GroupContext.default.Provider, {
|
||||
value: memoizedContext
|
||||
}, childrenNode)));
|
||||
});
|
||||
var _default = exports.default = CheckboxGroup;
|
||||
12
frontend/node_modules/antd/lib/checkbox/GroupContext.d.ts
generated
vendored
Normal file
12
frontend/node_modules/antd/lib/checkbox/GroupContext.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import React from 'react';
|
||||
import type { CheckboxOptionType } from './Group';
|
||||
export interface CheckboxGroupContext<T = any> {
|
||||
name?: string;
|
||||
toggleOption?: (option: CheckboxOptionType<T>) => void;
|
||||
value?: any;
|
||||
disabled?: boolean;
|
||||
registerValue: (val: T) => void;
|
||||
cancelValue: (val: T) => void;
|
||||
}
|
||||
declare const GroupContext: React.Context<CheckboxGroupContext<any> | null>;
|
||||
export default GroupContext;
|
||||
10
frontend/node_modules/antd/lib/checkbox/GroupContext.js
generated
vendored
Normal file
10
frontend/node_modules/antd/lib/checkbox/GroupContext.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
const GroupContext = /*#__PURE__*/_react.default.createContext(null);
|
||||
var _default = exports.default = GroupContext;
|
||||
11
frontend/node_modules/antd/lib/checkbox/index.d.ts
generated
vendored
Normal file
11
frontend/node_modules/antd/lib/checkbox/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { CheckboxRef } from 'rc-checkbox';
|
||||
import InternalCheckbox from './Checkbox';
|
||||
import Group from './Group';
|
||||
export type { CheckboxChangeEvent, CheckboxProps } from './Checkbox';
|
||||
export type { CheckboxGroupProps, CheckboxOptionType } from './Group';
|
||||
export type { CheckboxRef };
|
||||
type CompoundedComponent = typeof InternalCheckbox & {
|
||||
Group: typeof Group;
|
||||
};
|
||||
declare const Checkbox: CompoundedComponent;
|
||||
export default Checkbox;
|
||||
17
frontend/node_modules/antd/lib/checkbox/index.js
generated
vendored
Normal file
17
frontend/node_modules/antd/lib/checkbox/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
"use client";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _Checkbox = _interopRequireDefault(require("./Checkbox"));
|
||||
var _Group = _interopRequireDefault(require("./Group"));
|
||||
const Checkbox = _Checkbox.default;
|
||||
Checkbox.Group = _Group.default;
|
||||
Checkbox.__ANT_CHECKBOX = true;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Checkbox.displayName = 'Checkbox';
|
||||
}
|
||||
var _default = exports.default = Checkbox;
|
||||
23
frontend/node_modules/antd/lib/checkbox/style/index.d.ts
generated
vendored
Normal file
23
frontend/node_modules/antd/lib/checkbox/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
||||
export interface ComponentToken {
|
||||
}
|
||||
/**
|
||||
* @desc Checkbox 组件的 Token
|
||||
* @descEN Token for Checkbox component
|
||||
*/
|
||||
interface CheckboxToken extends FullToken<'Checkbox'> {
|
||||
/**
|
||||
* @desc Checkbox 类名
|
||||
* @descEN Checkbox class name
|
||||
*/
|
||||
checkboxCls: string;
|
||||
/**
|
||||
* @desc Checkbox 尺寸
|
||||
* @descEN Size of Checkbox
|
||||
*/
|
||||
checkboxSize: number;
|
||||
}
|
||||
export declare const genCheckboxStyle: GenerateStyle<CheckboxToken>;
|
||||
export declare function getStyle(prefixCls: string, token: FullToken<'Checkbox'>): import("@ant-design/cssinjs").CSSInterpolation;
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
|
||||
export default _default;
|
||||
234
frontend/node_modules/antd/lib/checkbox/style/index.js
generated
vendored
Normal file
234
frontend/node_modules/antd/lib/checkbox/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.genCheckboxStyle = exports.default = void 0;
|
||||
exports.getStyle = getStyle;
|
||||
var _cssinjs = require("@ant-design/cssinjs");
|
||||
var _style = require("../../style");
|
||||
var _internal = require("../../theme/internal");
|
||||
// ============================== Styles ==============================
|
||||
const genCheckboxStyle = token => {
|
||||
const {
|
||||
checkboxCls
|
||||
} = token;
|
||||
const wrapperCls = `${checkboxCls}-wrapper`;
|
||||
return [
|
||||
// ===================== Basic =====================
|
||||
{
|
||||
// Group
|
||||
[`${checkboxCls}-group`]: Object.assign(Object.assign({}, (0, _style.resetComponent)(token)), {
|
||||
display: 'inline-flex',
|
||||
flexWrap: 'wrap',
|
||||
columnGap: token.marginXS,
|
||||
// Group > Grid
|
||||
[`> ${token.antCls}-row`]: {
|
||||
flex: 1
|
||||
}
|
||||
}),
|
||||
// Wrapper
|
||||
[wrapperCls]: Object.assign(Object.assign({}, (0, _style.resetComponent)(token)), {
|
||||
display: 'inline-flex',
|
||||
alignItems: 'baseline',
|
||||
cursor: 'pointer',
|
||||
// Fix checkbox & radio in flex align #30260
|
||||
'&:after': {
|
||||
display: 'inline-block',
|
||||
width: 0,
|
||||
overflow: 'hidden',
|
||||
content: "'\\a0'"
|
||||
},
|
||||
// Checkbox near checkbox
|
||||
[`& + ${wrapperCls}`]: {
|
||||
marginInlineStart: 0
|
||||
},
|
||||
[`&${wrapperCls}-in-form-item`]: {
|
||||
'input[type="checkbox"]': {
|
||||
width: 14,
|
||||
// FIXME: magic
|
||||
height: 14 // FIXME: magic
|
||||
}
|
||||
}
|
||||
}),
|
||||
// Wrapper > Checkbox
|
||||
[checkboxCls]: Object.assign(Object.assign({}, (0, _style.resetComponent)(token)), {
|
||||
position: 'relative',
|
||||
whiteSpace: 'nowrap',
|
||||
lineHeight: 1,
|
||||
cursor: 'pointer',
|
||||
borderRadius: token.borderRadiusSM,
|
||||
// To make alignment right when `controlHeight` is changed
|
||||
// Ref: https://github.com/ant-design/ant-design/issues/41564
|
||||
alignSelf: 'center',
|
||||
// Wrapper > Checkbox > input
|
||||
[`${checkboxCls}-input`]: {
|
||||
position: 'absolute',
|
||||
// Since baseline align will get additional space offset,
|
||||
// we need to move input to top to make it align with text.
|
||||
// Ref: https://github.com/ant-design/ant-design/issues/38926#issuecomment-1486137799
|
||||
inset: 0,
|
||||
zIndex: 1,
|
||||
cursor: 'pointer',
|
||||
opacity: 0,
|
||||
margin: 0,
|
||||
[`&:focus-visible + ${checkboxCls}-inner`]: (0, _style.genFocusOutline)(token)
|
||||
},
|
||||
// Wrapper > Checkbox > inner
|
||||
[`${checkboxCls}-inner`]: {
|
||||
boxSizing: 'border-box',
|
||||
display: 'block',
|
||||
width: token.checkboxSize,
|
||||
height: token.checkboxSize,
|
||||
direction: 'ltr',
|
||||
backgroundColor: token.colorBgContainer,
|
||||
border: `${(0, _cssinjs.unit)(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
|
||||
borderRadius: token.borderRadiusSM,
|
||||
borderCollapse: 'separate',
|
||||
transition: `all ${token.motionDurationSlow}`,
|
||||
'&:after': {
|
||||
boxSizing: 'border-box',
|
||||
position: 'absolute',
|
||||
top: '50%',
|
||||
insetInlineStart: '25%',
|
||||
display: 'table',
|
||||
width: token.calc(token.checkboxSize).div(14).mul(5).equal(),
|
||||
height: token.calc(token.checkboxSize).div(14).mul(8).equal(),
|
||||
border: `${(0, _cssinjs.unit)(token.lineWidthBold)} solid ${token.colorWhite}`,
|
||||
borderTop: 0,
|
||||
borderInlineStart: 0,
|
||||
transform: 'rotate(45deg) scale(0) translate(-50%,-50%)',
|
||||
opacity: 0,
|
||||
content: '""',
|
||||
transition: `all ${token.motionDurationFast} ${token.motionEaseInBack}, opacity ${token.motionDurationFast}`
|
||||
}
|
||||
},
|
||||
// Wrapper > Checkbox + Text
|
||||
'& + span': {
|
||||
paddingInlineStart: token.paddingXS,
|
||||
paddingInlineEnd: token.paddingXS
|
||||
}
|
||||
})
|
||||
},
|
||||
// ===================== Hover =====================
|
||||
{
|
||||
// Wrapper & Wrapper > Checkbox
|
||||
[`
|
||||
${wrapperCls}:not(${wrapperCls}-disabled),
|
||||
${checkboxCls}:not(${checkboxCls}-disabled)
|
||||
`]: {
|
||||
[`&:hover ${checkboxCls}-inner`]: {
|
||||
borderColor: token.colorPrimary
|
||||
}
|
||||
},
|
||||
[`${wrapperCls}:not(${wrapperCls}-disabled)`]: {
|
||||
[`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled) ${checkboxCls}-inner`]: {
|
||||
backgroundColor: token.colorPrimaryHover,
|
||||
borderColor: 'transparent'
|
||||
},
|
||||
[`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled):after`]: {
|
||||
borderColor: token.colorPrimaryHover
|
||||
}
|
||||
}
|
||||
},
|
||||
// ==================== Checked ====================
|
||||
{
|
||||
// Wrapper > Checkbox
|
||||
[`${checkboxCls}-checked`]: {
|
||||
[`${checkboxCls}-inner`]: {
|
||||
backgroundColor: token.colorPrimary,
|
||||
borderColor: token.colorPrimary,
|
||||
'&:after': {
|
||||
opacity: 1,
|
||||
transform: 'rotate(45deg) scale(1) translate(-50%,-50%)',
|
||||
transition: `all ${token.motionDurationMid} ${token.motionEaseOutBack} ${token.motionDurationFast}`
|
||||
}
|
||||
}
|
||||
},
|
||||
[`
|
||||
${wrapperCls}-checked:not(${wrapperCls}-disabled),
|
||||
${checkboxCls}-checked:not(${checkboxCls}-disabled)
|
||||
`]: {
|
||||
[`&:hover ${checkboxCls}-inner`]: {
|
||||
backgroundColor: token.colorPrimaryHover,
|
||||
borderColor: 'transparent'
|
||||
}
|
||||
}
|
||||
},
|
||||
// ================= Indeterminate =================
|
||||
{
|
||||
[checkboxCls]: {
|
||||
'&-indeterminate': {
|
||||
'&': {
|
||||
// Wrapper > Checkbox > inner
|
||||
[`${checkboxCls}-inner`]: {
|
||||
backgroundColor: `${token.colorBgContainer}`,
|
||||
borderColor: `${token.colorBorder}`,
|
||||
'&:after': {
|
||||
top: '50%',
|
||||
insetInlineStart: '50%',
|
||||
width: token.calc(token.fontSizeLG).div(2).equal(),
|
||||
height: token.calc(token.fontSizeLG).div(2).equal(),
|
||||
backgroundColor: token.colorPrimary,
|
||||
border: 0,
|
||||
transform: 'translate(-50%, -50%) scale(1)',
|
||||
opacity: 1,
|
||||
content: '""'
|
||||
}
|
||||
},
|
||||
// https://github.com/ant-design/ant-design/issues/50074
|
||||
[`&:hover ${checkboxCls}-inner`]: {
|
||||
backgroundColor: `${token.colorBgContainer}`,
|
||||
borderColor: `${token.colorPrimary}`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// ==================== Disable ====================
|
||||
{
|
||||
// Wrapper
|
||||
[`${wrapperCls}-disabled`]: {
|
||||
cursor: 'not-allowed'
|
||||
},
|
||||
// Wrapper > Checkbox
|
||||
[`${checkboxCls}-disabled`]: {
|
||||
// Wrapper > Checkbox > input
|
||||
[`&, ${checkboxCls}-input`]: {
|
||||
cursor: 'not-allowed',
|
||||
// Disabled for native input to enable Tooltip event handler
|
||||
// ref: https://github.com/ant-design/ant-design/issues/39822#issuecomment-1365075901
|
||||
pointerEvents: 'none'
|
||||
},
|
||||
// Wrapper > Checkbox > inner
|
||||
[`${checkboxCls}-inner`]: {
|
||||
background: token.colorBgContainerDisabled,
|
||||
borderColor: token.colorBorder,
|
||||
'&:after': {
|
||||
borderColor: token.colorTextDisabled
|
||||
}
|
||||
},
|
||||
'&:after': {
|
||||
display: 'none'
|
||||
},
|
||||
'& + span': {
|
||||
color: token.colorTextDisabled
|
||||
},
|
||||
[`&${checkboxCls}-indeterminate ${checkboxCls}-inner::after`]: {
|
||||
background: token.colorTextDisabled
|
||||
}
|
||||
}
|
||||
}];
|
||||
};
|
||||
// ============================== Export ==============================
|
||||
exports.genCheckboxStyle = genCheckboxStyle;
|
||||
function getStyle(prefixCls, token) {
|
||||
const checkboxToken = (0, _internal.mergeToken)(token, {
|
||||
checkboxCls: `.${prefixCls}`,
|
||||
checkboxSize: token.controlInteractiveSize
|
||||
});
|
||||
return genCheckboxStyle(checkboxToken);
|
||||
}
|
||||
var _default = exports.default = (0, _internal.genStyleHooks)('Checkbox', (token, {
|
||||
prefixCls
|
||||
}) => [getStyle(prefixCls, token)]);
|
||||
7
frontend/node_modules/antd/lib/checkbox/useBubbleLock.d.ts
generated
vendored
Normal file
7
frontend/node_modules/antd/lib/checkbox/useBubbleLock.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import React from 'react';
|
||||
/**
|
||||
* When click on the label,
|
||||
* the event will be stopped to prevent the label from being clicked twice.
|
||||
* label click -> input click -> label click again
|
||||
*/
|
||||
export default function useBubbleLock(onOriginInputClick?: React.MouseEventHandler<HTMLInputElement>): readonly [React.MouseEventHandler<HTMLLabelElement>, React.MouseEventHandler<HTMLInputElement>];
|
||||
35
frontend/node_modules/antd/lib/checkbox/useBubbleLock.js
generated
vendored
Normal file
35
frontend/node_modules/antd/lib/checkbox/useBubbleLock.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = useBubbleLock;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _raf = _interopRequireDefault(require("rc-util/lib/raf"));
|
||||
/**
|
||||
* When click on the label,
|
||||
* the event will be stopped to prevent the label from being clicked twice.
|
||||
* label click -> input click -> label click again
|
||||
*/
|
||||
function useBubbleLock(onOriginInputClick) {
|
||||
const labelClickLockRef = _react.default.useRef(null);
|
||||
const clearLock = () => {
|
||||
_raf.default.cancel(labelClickLockRef.current);
|
||||
labelClickLockRef.current = null;
|
||||
};
|
||||
const onLabelClick = () => {
|
||||
clearLock();
|
||||
labelClickLockRef.current = (0, _raf.default)(() => {
|
||||
labelClickLockRef.current = null;
|
||||
});
|
||||
};
|
||||
const onInputClick = e => {
|
||||
if (labelClickLockRef.current) {
|
||||
e.stopPropagation();
|
||||
clearLock();
|
||||
}
|
||||
onOriginInputClick === null || onOriginInputClick === void 0 ? void 0 : onOriginInputClick(e);
|
||||
};
|
||||
return [onLabelClick, onInputClick];
|
||||
}
|
||||
Reference in New Issue
Block a user