mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 21:52:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
155
web/node_modules/@material-ui/core/Select/Select.d.ts
generated
vendored
Normal file
155
web/node_modules/@material-ui/core/Select/Select.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,155 @@
|
|||
import * as React from 'react';
|
||||
import { StandardProps } from '..';
|
||||
import { InputProps } from '../Input';
|
||||
import { MenuProps } from '../Menu';
|
||||
import { SelectInputProps } from './SelectInput';
|
||||
|
||||
export interface SelectProps
|
||||
extends StandardProps<InputProps, SelectClassKey, 'value' | 'onChange'>,
|
||||
Pick<SelectInputProps, 'onChange'> {
|
||||
/**
|
||||
* If `true`, the width of the popover will automatically be set according to the items inside the
|
||||
* menu, otherwise it will be at least the width of the select input.
|
||||
*/
|
||||
autoWidth?: boolean;
|
||||
/**
|
||||
* The option elements to populate the select with.
|
||||
* Can be some `MenuItem` when `native` is false and `option` when `native` is true.
|
||||
*
|
||||
* ⚠️The `MenuItem` elements **must** be direct descendants when `native` is false.
|
||||
*/
|
||||
children?: React.ReactNode;
|
||||
/**
|
||||
* The default element value. Use when the component is not controlled.
|
||||
* @document
|
||||
*/
|
||||
defaultValue?: unknown;
|
||||
/**
|
||||
* If `true`, a value is displayed even if no items are selected.
|
||||
*
|
||||
* In order to display a meaningful value, a function should be passed to the `renderValue` prop which returns the value to be displayed when no items are selected.
|
||||
* You can only use it when the `native` prop is `false` (default).
|
||||
*/
|
||||
displayEmpty?: boolean;
|
||||
/**
|
||||
* The icon that displays the arrow.
|
||||
*/
|
||||
IconComponent?: React.ElementType;
|
||||
/**
|
||||
* The `id` of the wrapper element or the `select` element when `native`.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* An `Input` element; does not have to be a material-ui specific `Input`.
|
||||
*/
|
||||
input?: React.ReactElement<any, any>;
|
||||
/**
|
||||
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
||||
* When `native` is `true`, the attributes are applied on the `select` element.
|
||||
*/
|
||||
inputProps?: InputProps['inputProps'];
|
||||
/**
|
||||
* See [OutlinedInput#label](/api/outlined-input/#props)
|
||||
*/
|
||||
label?: React.ReactNode;
|
||||
/**
|
||||
* The ID of an element that acts as an additional label. The Select will
|
||||
* be labelled by the additional label and the selected value.
|
||||
*/
|
||||
labelId?: string;
|
||||
/**
|
||||
* See [OutlinedInput#label](/api/outlined-input/#props)
|
||||
*/
|
||||
labelWidth?: number;
|
||||
/**
|
||||
* Props applied to the [`Menu`](/api/menu/) element.
|
||||
*/
|
||||
MenuProps?: Partial<MenuProps>;
|
||||
/**
|
||||
* If `true`, `value` must be an array and the menu will support multiple selections.
|
||||
*/
|
||||
multiple?: boolean;
|
||||
/**
|
||||
* If `true`, the component will be using a native `select` element.
|
||||
*/
|
||||
native?: boolean;
|
||||
/**
|
||||
* Callback function fired when a menu item is selected.
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
* You can pull out the new value by accessing `event.target.value` (any).
|
||||
* @param {object} [child] The react element that was selected when `native` is `false` (default).
|
||||
* @document
|
||||
*/
|
||||
onChange?: SelectInputProps['onChange'];
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
* Use in controlled mode (see open).
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
*/
|
||||
onClose?: (event: React.ChangeEvent<{}>) => void;
|
||||
/**
|
||||
* Callback fired when the component requests to be opened.
|
||||
* Use in controlled mode (see open).
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
*/
|
||||
onOpen?: (event: React.ChangeEvent<{}>) => void;
|
||||
/**
|
||||
* Control `select` open state.
|
||||
* You can only use it when the `native` prop is `false` (default).
|
||||
*/
|
||||
open?: boolean;
|
||||
/**
|
||||
* Render the selected value.
|
||||
* You can only use it when the `native` prop is `false` (default).
|
||||
*
|
||||
* @param {any} value The `value` provided to the component.
|
||||
* @returns {ReactNode}
|
||||
*/
|
||||
renderValue?: (value: SelectProps['value']) => React.ReactNode;
|
||||
/**
|
||||
* Props applied to the clickable div element.
|
||||
*/
|
||||
SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
|
||||
/**
|
||||
* The input value. Providing an empty string will select no options.
|
||||
* This prop is required when the `native` prop is `false` (default).
|
||||
* Set to an empty string `''` if you don't want any of the available options to be selected.
|
||||
*
|
||||
* If the value is an object it must have reference equality with the option in order to be selected.
|
||||
* If the value is not an object, the string representation must match with the string representation of the option in order to be selected.
|
||||
* @document
|
||||
*/
|
||||
value?: unknown;
|
||||
/**
|
||||
* The variant to use.
|
||||
*/
|
||||
variant?: 'standard' | 'outlined' | 'filled';
|
||||
}
|
||||
|
||||
export type SelectClassKey =
|
||||
| 'root'
|
||||
| 'select'
|
||||
| 'filled'
|
||||
| 'outlined'
|
||||
| 'selectMenu'
|
||||
| 'disabled'
|
||||
| 'icon'
|
||||
| 'iconOpen'
|
||||
| 'iconFilled'
|
||||
| 'iconOutlined';
|
||||
|
||||
/**
|
||||
*
|
||||
* Demos:
|
||||
*
|
||||
* - [Selects](https://material-ui.com/components/selects/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [Select API](https://material-ui.com/api/select/)
|
||||
* - inherits [Input API](https://material-ui.com/api/input/)
|
||||
*/
|
||||
export default function Select(props: SelectProps): JSX.Element;
|
286
web/node_modules/@material-ui/core/Select/Select.js
generated
vendored
Normal file
286
web/node_modules/@material-ui/core/Select/Select.js
generated
vendored
Normal file
|
@ -0,0 +1,286 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.styles = void 0;
|
||||
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
|
||||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
var _styles = require("@material-ui/styles");
|
||||
|
||||
var _SelectInput = _interopRequireDefault(require("./SelectInput"));
|
||||
|
||||
var _formControlState = _interopRequireDefault(require("../FormControl/formControlState"));
|
||||
|
||||
var _useFormControl = _interopRequireDefault(require("../FormControl/useFormControl"));
|
||||
|
||||
var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
||||
|
||||
var _ArrowDropDown = _interopRequireDefault(require("../internal/svg-icons/ArrowDropDown"));
|
||||
|
||||
var _Input = _interopRequireDefault(require("../Input"));
|
||||
|
||||
var _NativeSelect = require("../NativeSelect/NativeSelect");
|
||||
|
||||
var _NativeSelectInput = _interopRequireDefault(require("../NativeSelect/NativeSelectInput"));
|
||||
|
||||
var _FilledInput = _interopRequireDefault(require("../FilledInput"));
|
||||
|
||||
var _OutlinedInput = _interopRequireDefault(require("../OutlinedInput"));
|
||||
|
||||
var styles = _NativeSelect.styles;
|
||||
exports.styles = styles;
|
||||
|
||||
var _ref = /*#__PURE__*/React.createElement(_Input.default, null);
|
||||
|
||||
var _ref2 = /*#__PURE__*/React.createElement(_FilledInput.default, null);
|
||||
|
||||
var Select = /*#__PURE__*/React.forwardRef(function Select(props, ref) {
|
||||
var _props$autoWidth = props.autoWidth,
|
||||
autoWidth = _props$autoWidth === void 0 ? false : _props$autoWidth,
|
||||
children = props.children,
|
||||
classes = props.classes,
|
||||
_props$displayEmpty = props.displayEmpty,
|
||||
displayEmpty = _props$displayEmpty === void 0 ? false : _props$displayEmpty,
|
||||
_props$IconComponent = props.IconComponent,
|
||||
IconComponent = _props$IconComponent === void 0 ? _ArrowDropDown.default : _props$IconComponent,
|
||||
id = props.id,
|
||||
input = props.input,
|
||||
inputProps = props.inputProps,
|
||||
label = props.label,
|
||||
labelId = props.labelId,
|
||||
_props$labelWidth = props.labelWidth,
|
||||
labelWidth = _props$labelWidth === void 0 ? 0 : _props$labelWidth,
|
||||
MenuProps = props.MenuProps,
|
||||
_props$multiple = props.multiple,
|
||||
multiple = _props$multiple === void 0 ? false : _props$multiple,
|
||||
_props$native = props.native,
|
||||
native = _props$native === void 0 ? false : _props$native,
|
||||
onClose = props.onClose,
|
||||
onOpen = props.onOpen,
|
||||
open = props.open,
|
||||
renderValue = props.renderValue,
|
||||
SelectDisplayProps = props.SelectDisplayProps,
|
||||
_props$variant = props.variant,
|
||||
variantProps = _props$variant === void 0 ? 'standard' : _props$variant,
|
||||
other = (0, _objectWithoutProperties2.default)(props, ["autoWidth", "children", "classes", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "labelWidth", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"]);
|
||||
var inputComponent = native ? _NativeSelectInput.default : _SelectInput.default;
|
||||
var muiFormControl = (0, _useFormControl.default)();
|
||||
var fcs = (0, _formControlState.default)({
|
||||
props: props,
|
||||
muiFormControl: muiFormControl,
|
||||
states: ['variant']
|
||||
});
|
||||
var variant = fcs.variant || variantProps;
|
||||
var InputComponent = input || {
|
||||
standard: _ref,
|
||||
outlined: /*#__PURE__*/React.createElement(_OutlinedInput.default, {
|
||||
label: label,
|
||||
labelWidth: labelWidth
|
||||
}),
|
||||
filled: _ref2
|
||||
}[variant];
|
||||
return /*#__PURE__*/React.cloneElement(InputComponent, (0, _extends2.default)({
|
||||
// Most of the logic is implemented in `SelectInput`.
|
||||
// The `Select` component is a simple API wrapper to expose something better to play with.
|
||||
inputComponent: inputComponent,
|
||||
inputProps: (0, _extends2.default)({
|
||||
children: children,
|
||||
IconComponent: IconComponent,
|
||||
variant: variant,
|
||||
type: undefined,
|
||||
// We render a select. We can ignore the type provided by the `Input`.
|
||||
multiple: multiple
|
||||
}, native ? {
|
||||
id: id
|
||||
} : {
|
||||
autoWidth: autoWidth,
|
||||
displayEmpty: displayEmpty,
|
||||
labelId: labelId,
|
||||
MenuProps: MenuProps,
|
||||
onClose: onClose,
|
||||
onOpen: onOpen,
|
||||
open: open,
|
||||
renderValue: renderValue,
|
||||
SelectDisplayProps: (0, _extends2.default)({
|
||||
id: id
|
||||
}, SelectDisplayProps)
|
||||
}, inputProps, {
|
||||
classes: inputProps ? (0, _styles.mergeClasses)({
|
||||
baseClasses: classes,
|
||||
newClasses: inputProps.classes,
|
||||
Component: Select
|
||||
}) : classes
|
||||
}, input ? input.props.inputProps : {}),
|
||||
ref: ref
|
||||
}, other));
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? Select.propTypes = {
|
||||
// ----------------------------- Warning --------------------------------
|
||||
// | These PropTypes are generated from the TypeScript type definitions |
|
||||
// | To update them edit the d.ts file and run "yarn proptypes" |
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* If `true`, the width of the popover will automatically be set according to the items inside the
|
||||
* menu, otherwise it will be at least the width of the select input.
|
||||
*/
|
||||
autoWidth: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* The option elements to populate the select with.
|
||||
* Can be some `MenuItem` when `native` is false and `option` when `native` is true.
|
||||
*
|
||||
* ⚠️The `MenuItem` elements **must** be direct descendants when `native` is false.
|
||||
*/
|
||||
children: _propTypes.default.node,
|
||||
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
* See [CSS API](#css) below for more details.
|
||||
*/
|
||||
classes: _propTypes.default.object,
|
||||
|
||||
/**
|
||||
* The default element value. Use when the component is not controlled.
|
||||
*/
|
||||
defaultValue: _propTypes.default.any,
|
||||
|
||||
/**
|
||||
* If `true`, a value is displayed even if no items are selected.
|
||||
*
|
||||
* In order to display a meaningful value, a function should be passed to the `renderValue` prop which returns the value to be displayed when no items are selected.
|
||||
* You can only use it when the `native` prop is `false` (default).
|
||||
*/
|
||||
displayEmpty: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* The icon that displays the arrow.
|
||||
*/
|
||||
IconComponent: _propTypes.default.elementType,
|
||||
|
||||
/**
|
||||
* The `id` of the wrapper element or the `select` element when `native`.
|
||||
*/
|
||||
id: _propTypes.default.string,
|
||||
|
||||
/**
|
||||
* An `Input` element; does not have to be a material-ui specific `Input`.
|
||||
*/
|
||||
input: _propTypes.default.element,
|
||||
|
||||
/**
|
||||
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
||||
* When `native` is `true`, the attributes are applied on the `select` element.
|
||||
*/
|
||||
inputProps: _propTypes.default.object,
|
||||
|
||||
/**
|
||||
* See [OutlinedInput#label](/api/outlined-input/#props)
|
||||
*/
|
||||
label: _propTypes.default.node,
|
||||
|
||||
/**
|
||||
* The ID of an element that acts as an additional label. The Select will
|
||||
* be labelled by the additional label and the selected value.
|
||||
*/
|
||||
labelId: _propTypes.default.string,
|
||||
|
||||
/**
|
||||
* See [OutlinedInput#label](/api/outlined-input/#props)
|
||||
*/
|
||||
labelWidth: _propTypes.default.number,
|
||||
|
||||
/**
|
||||
* Props applied to the [`Menu`](/api/menu/) element.
|
||||
*/
|
||||
MenuProps: _propTypes.default.object,
|
||||
|
||||
/**
|
||||
* If `true`, `value` must be an array and the menu will support multiple selections.
|
||||
*/
|
||||
multiple: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* If `true`, the component will be using a native `select` element.
|
||||
*/
|
||||
native: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* Callback function fired when a menu item is selected.
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
* You can pull out the new value by accessing `event.target.value` (any).
|
||||
* @param {object} [child] The react element that was selected when `native` is `false` (default).
|
||||
*/
|
||||
onChange: _propTypes.default.func,
|
||||
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
* Use in controlled mode (see open).
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
*/
|
||||
onClose: _propTypes.default.func,
|
||||
|
||||
/**
|
||||
* Callback fired when the component requests to be opened.
|
||||
* Use in controlled mode (see open).
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
*/
|
||||
onOpen: _propTypes.default.func,
|
||||
|
||||
/**
|
||||
* Control `select` open state.
|
||||
* You can only use it when the `native` prop is `false` (default).
|
||||
*/
|
||||
open: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* Render the selected value.
|
||||
* You can only use it when the `native` prop is `false` (default).
|
||||
*
|
||||
* @param {any} value The `value` provided to the component.
|
||||
* @returns {ReactNode}
|
||||
*/
|
||||
renderValue: _propTypes.default.func,
|
||||
|
||||
/**
|
||||
* Props applied to the clickable div element.
|
||||
*/
|
||||
SelectDisplayProps: _propTypes.default.object,
|
||||
|
||||
/**
|
||||
* The input value. Providing an empty string will select no options.
|
||||
* This prop is required when the `native` prop is `false` (default).
|
||||
* Set to an empty string `''` if you don't want any of the available options to be selected.
|
||||
*
|
||||
* If the value is an object it must have reference equality with the option in order to be selected.
|
||||
* If the value is not an object, the string representation must match with the string representation of the option in order to be selected.
|
||||
*/
|
||||
value: _propTypes.default.any,
|
||||
|
||||
/**
|
||||
* The variant to use.
|
||||
*/
|
||||
variant: _propTypes.default.oneOf(['filled', 'outlined', 'standard'])
|
||||
} : void 0;
|
||||
Select.muiName = 'Select';
|
||||
|
||||
var _default = (0, _withStyles.default)(styles, {
|
||||
name: 'MuiSelect'
|
||||
})(Select);
|
||||
|
||||
exports.default = _default;
|
35
web/node_modules/@material-ui/core/Select/SelectInput.d.ts
generated
vendored
Normal file
35
web/node_modules/@material-ui/core/Select/SelectInput.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
import * as React from 'react';
|
||||
import { MenuProps } from '../Menu';
|
||||
|
||||
export interface SelectInputProps {
|
||||
autoFocus?: boolean;
|
||||
autoWidth: boolean;
|
||||
disabled?: boolean;
|
||||
IconComponent?: React.ElementType;
|
||||
inputRef?: (
|
||||
ref: HTMLSelectElement | { node: HTMLInputElement; value: SelectInputProps['value'] }
|
||||
) => void;
|
||||
MenuProps?: Partial<MenuProps>;
|
||||
multiple: boolean;
|
||||
name?: string;
|
||||
native: boolean;
|
||||
onBlur?: React.FocusEventHandler<any>;
|
||||
onChange?: (
|
||||
event: React.ChangeEvent<{ name?: string; value: unknown }>,
|
||||
child: React.ReactNode
|
||||
) => void;
|
||||
onClose?: (event: React.ChangeEvent<{}>) => void;
|
||||
onFocus?: React.FocusEventHandler<any>;
|
||||
onOpen?: (event: React.ChangeEvent<{}>) => void;
|
||||
open?: boolean;
|
||||
readOnly?: boolean;
|
||||
renderValue?: (value: SelectInputProps['value']) => React.ReactNode;
|
||||
SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
|
||||
tabIndex?: number;
|
||||
value?: unknown;
|
||||
variant?: 'standard' | 'outlined' | 'filled';
|
||||
}
|
||||
|
||||
declare const SelectInput: React.ComponentType<SelectInputProps>;
|
||||
|
||||
export default SelectInput;
|
609
web/node_modules/@material-ui/core/Select/SelectInput.js
generated
vendored
Normal file
609
web/node_modules/@material-ui/core/Select/SelectInput.js
generated
vendored
Normal file
|
@ -0,0 +1,609 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
|
||||
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
||||
|
||||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
||||
|
||||
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
||||
|
||||
var _utils = require("@material-ui/utils");
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _reactIs = require("react-is");
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
|
||||
var _ownerDocument = _interopRequireDefault(require("../utils/ownerDocument"));
|
||||
|
||||
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
||||
|
||||
var _Menu = _interopRequireDefault(require("../Menu/Menu"));
|
||||
|
||||
var _utils2 = require("../InputBase/utils");
|
||||
|
||||
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
||||
|
||||
var _useControlled3 = _interopRequireDefault(require("../utils/useControlled"));
|
||||
|
||||
function areEqualValues(a, b) {
|
||||
if ((0, _typeof2.default)(b) === 'object' && b !== null) {
|
||||
return a === b;
|
||||
}
|
||||
|
||||
return String(a) === String(b);
|
||||
}
|
||||
|
||||
function isEmpty(display) {
|
||||
return display == null || typeof display === 'string' && !display.trim();
|
||||
}
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
|
||||
|
||||
var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref) {
|
||||
var ariaLabel = props['aria-label'],
|
||||
autoFocus = props.autoFocus,
|
||||
autoWidth = props.autoWidth,
|
||||
children = props.children,
|
||||
classes = props.classes,
|
||||
className = props.className,
|
||||
defaultValue = props.defaultValue,
|
||||
disabled = props.disabled,
|
||||
displayEmpty = props.displayEmpty,
|
||||
IconComponent = props.IconComponent,
|
||||
inputRefProp = props.inputRef,
|
||||
labelId = props.labelId,
|
||||
_props$MenuProps = props.MenuProps,
|
||||
MenuProps = _props$MenuProps === void 0 ? {} : _props$MenuProps,
|
||||
multiple = props.multiple,
|
||||
name = props.name,
|
||||
onBlur = props.onBlur,
|
||||
onChange = props.onChange,
|
||||
onClose = props.onClose,
|
||||
onFocus = props.onFocus,
|
||||
onOpen = props.onOpen,
|
||||
openProp = props.open,
|
||||
readOnly = props.readOnly,
|
||||
renderValue = props.renderValue,
|
||||
_props$SelectDisplayP = props.SelectDisplayProps,
|
||||
SelectDisplayProps = _props$SelectDisplayP === void 0 ? {} : _props$SelectDisplayP,
|
||||
tabIndexProp = props.tabIndex,
|
||||
type = props.type,
|
||||
valueProp = props.value,
|
||||
_props$variant = props.variant,
|
||||
variant = _props$variant === void 0 ? 'standard' : _props$variant,
|
||||
other = (0, _objectWithoutProperties2.default)(props, ["aria-label", "autoFocus", "autoWidth", "children", "classes", "className", "defaultValue", "disabled", "displayEmpty", "IconComponent", "inputRef", "labelId", "MenuProps", "multiple", "name", "onBlur", "onChange", "onClose", "onFocus", "onOpen", "open", "readOnly", "renderValue", "SelectDisplayProps", "tabIndex", "type", "value", "variant"]);
|
||||
|
||||
var _useControlled = (0, _useControlled3.default)({
|
||||
controlled: valueProp,
|
||||
default: defaultValue,
|
||||
name: 'Select'
|
||||
}),
|
||||
_useControlled2 = (0, _slicedToArray2.default)(_useControlled, 2),
|
||||
value = _useControlled2[0],
|
||||
setValue = _useControlled2[1];
|
||||
|
||||
var inputRef = React.useRef(null);
|
||||
|
||||
var _React$useState = React.useState(null),
|
||||
displayNode = _React$useState[0],
|
||||
setDisplayNode = _React$useState[1];
|
||||
|
||||
var _React$useRef = React.useRef(openProp != null),
|
||||
isOpenControlled = _React$useRef.current;
|
||||
|
||||
var _React$useState2 = React.useState(),
|
||||
menuMinWidthState = _React$useState2[0],
|
||||
setMenuMinWidthState = _React$useState2[1];
|
||||
|
||||
var _React$useState3 = React.useState(false),
|
||||
openState = _React$useState3[0],
|
||||
setOpenState = _React$useState3[1];
|
||||
|
||||
var handleRef = (0, _useForkRef.default)(ref, inputRefProp);
|
||||
React.useImperativeHandle(handleRef, function () {
|
||||
return {
|
||||
focus: function focus() {
|
||||
displayNode.focus();
|
||||
},
|
||||
node: inputRef.current,
|
||||
value: value
|
||||
};
|
||||
}, [displayNode, value]);
|
||||
React.useEffect(function () {
|
||||
if (autoFocus && displayNode) {
|
||||
displayNode.focus();
|
||||
}
|
||||
}, [autoFocus, displayNode]);
|
||||
React.useEffect(function () {
|
||||
if (displayNode) {
|
||||
var label = (0, _ownerDocument.default)(displayNode).getElementById(labelId);
|
||||
|
||||
if (label) {
|
||||
var handler = function handler() {
|
||||
if (getSelection().isCollapsed) {
|
||||
displayNode.focus();
|
||||
}
|
||||
};
|
||||
|
||||
label.addEventListener('click', handler);
|
||||
return function () {
|
||||
label.removeEventListener('click', handler);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}, [labelId, displayNode]);
|
||||
|
||||
var update = function update(open, event) {
|
||||
if (open) {
|
||||
if (onOpen) {
|
||||
onOpen(event);
|
||||
}
|
||||
} else if (onClose) {
|
||||
onClose(event);
|
||||
}
|
||||
|
||||
if (!isOpenControlled) {
|
||||
setMenuMinWidthState(autoWidth ? null : displayNode.clientWidth);
|
||||
setOpenState(open);
|
||||
}
|
||||
};
|
||||
|
||||
var handleMouseDown = function handleMouseDown(event) {
|
||||
// Ignore everything but left-click
|
||||
if (event.button !== 0) {
|
||||
return;
|
||||
} // Hijack the default focus behavior.
|
||||
|
||||
|
||||
event.preventDefault();
|
||||
displayNode.focus();
|
||||
update(true, event);
|
||||
};
|
||||
|
||||
var handleClose = function handleClose(event) {
|
||||
update(false, event);
|
||||
};
|
||||
|
||||
var childrenArray = React.Children.toArray(children); // Support autofill.
|
||||
|
||||
var handleChange = function handleChange(event) {
|
||||
var index = childrenArray.map(function (child) {
|
||||
return child.props.value;
|
||||
}).indexOf(event.target.value);
|
||||
|
||||
if (index === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var child = childrenArray[index];
|
||||
setValue(child.props.value);
|
||||
|
||||
if (onChange) {
|
||||
onChange(event, child);
|
||||
}
|
||||
};
|
||||
|
||||
var handleItemClick = function handleItemClick(child) {
|
||||
return function (event) {
|
||||
if (!multiple) {
|
||||
update(false, event);
|
||||
}
|
||||
|
||||
var newValue;
|
||||
|
||||
if (multiple) {
|
||||
newValue = Array.isArray(value) ? value.slice() : [];
|
||||
var itemIndex = value.indexOf(child.props.value);
|
||||
|
||||
if (itemIndex === -1) {
|
||||
newValue.push(child.props.value);
|
||||
} else {
|
||||
newValue.splice(itemIndex, 1);
|
||||
}
|
||||
} else {
|
||||
newValue = child.props.value;
|
||||
}
|
||||
|
||||
if (child.props.onClick) {
|
||||
child.props.onClick(event);
|
||||
}
|
||||
|
||||
if (value === newValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
setValue(newValue);
|
||||
|
||||
if (onChange) {
|
||||
event.persist(); // Preact support, target is read only property on a native event.
|
||||
|
||||
Object.defineProperty(event, 'target', {
|
||||
writable: true,
|
||||
value: {
|
||||
value: newValue,
|
||||
name: name
|
||||
}
|
||||
});
|
||||
onChange(event, child);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var handleKeyDown = function handleKeyDown(event) {
|
||||
if (!readOnly) {
|
||||
var validKeys = [' ', 'ArrowUp', 'ArrowDown', // The native select doesn't respond to enter on MacOS, but it's recommended by
|
||||
// https://www.w3.org/TR/wai-aria-practices/examples/listbox/listbox-collapsible.html
|
||||
'Enter'];
|
||||
|
||||
if (validKeys.indexOf(event.key) !== -1) {
|
||||
event.preventDefault();
|
||||
update(true, event);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var open = displayNode !== null && (isOpenControlled ? openProp : openState);
|
||||
|
||||
var handleBlur = function handleBlur(event) {
|
||||
// if open event.stopImmediatePropagation
|
||||
if (!open && onBlur) {
|
||||
event.persist(); // Preact support, target is read only property on a native event.
|
||||
|
||||
Object.defineProperty(event, 'target', {
|
||||
writable: true,
|
||||
value: {
|
||||
value: value,
|
||||
name: name
|
||||
}
|
||||
});
|
||||
onBlur(event);
|
||||
}
|
||||
};
|
||||
|
||||
delete other['aria-invalid'];
|
||||
var display;
|
||||
var displaySingle;
|
||||
var displayMultiple = [];
|
||||
var computeDisplay = false;
|
||||
var foundMatch = false; // No need to display any value if the field is empty.
|
||||
|
||||
if ((0, _utils2.isFilled)({
|
||||
value: value
|
||||
}) || displayEmpty) {
|
||||
if (renderValue) {
|
||||
display = renderValue(value);
|
||||
} else {
|
||||
computeDisplay = true;
|
||||
}
|
||||
}
|
||||
|
||||
var items = childrenArray.map(function (child) {
|
||||
if (! /*#__PURE__*/React.isValidElement(child)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if ((0, _reactIs.isFragment)(child)) {
|
||||
console.error(["Material-UI: The Select component doesn't accept a Fragment as a child.", 'Consider providing an array instead.'].join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
var selected;
|
||||
|
||||
if (multiple) {
|
||||
if (!Array.isArray(value)) {
|
||||
throw new Error(process.env.NODE_ENV !== "production" ? "Material-UI: The `value` prop must be an array when using the `Select` component with `multiple`." : (0, _utils.formatMuiErrorMessage)(2));
|
||||
}
|
||||
|
||||
selected = value.some(function (v) {
|
||||
return areEqualValues(v, child.props.value);
|
||||
});
|
||||
|
||||
if (selected && computeDisplay) {
|
||||
displayMultiple.push(child.props.children);
|
||||
}
|
||||
} else {
|
||||
selected = areEqualValues(value, child.props.value);
|
||||
|
||||
if (selected && computeDisplay) {
|
||||
displaySingle = child.props.children;
|
||||
}
|
||||
}
|
||||
|
||||
if (selected) {
|
||||
foundMatch = true;
|
||||
}
|
||||
|
||||
return /*#__PURE__*/React.cloneElement(child, {
|
||||
'aria-selected': selected ? 'true' : undefined,
|
||||
onClick: handleItemClick(child),
|
||||
onKeyUp: function onKeyUp(event) {
|
||||
if (event.key === ' ') {
|
||||
// otherwise our MenuItems dispatches a click event
|
||||
// it's not behavior of the native <option> and causes
|
||||
// the select to close immediately since we open on space keydown
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (child.props.onKeyUp) {
|
||||
child.props.onKeyUp(event);
|
||||
}
|
||||
},
|
||||
role: 'option',
|
||||
selected: selected,
|
||||
value: undefined,
|
||||
// The value is most likely not a valid HTML attribute.
|
||||
'data-value': child.props.value // Instead, we provide it as a data attribute.
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
React.useEffect(function () {
|
||||
if (!foundMatch && !multiple && value !== '') {
|
||||
var values = childrenArray.map(function (child) {
|
||||
return child.props.value;
|
||||
});
|
||||
console.warn(["Material-UI: You have provided an out-of-range value `".concat(value, "` for the select ").concat(name ? "(name=\"".concat(name, "\") ") : '', "component."), "Consider providing a value that matches one of the available options or ''.", "The available values are ".concat(values.filter(function (x) {
|
||||
return x != null;
|
||||
}).map(function (x) {
|
||||
return "`".concat(x, "`");
|
||||
}).join(', ') || '""', ".")].join('\n'));
|
||||
}
|
||||
}, [foundMatch, childrenArray, multiple, name, value]);
|
||||
}
|
||||
|
||||
if (computeDisplay) {
|
||||
display = multiple ? displayMultiple.join(', ') : displaySingle;
|
||||
} // Avoid performing a layout computation in the render method.
|
||||
|
||||
|
||||
var menuMinWidth = menuMinWidthState;
|
||||
|
||||
if (!autoWidth && isOpenControlled && displayNode) {
|
||||
menuMinWidth = displayNode.clientWidth;
|
||||
}
|
||||
|
||||
var tabIndex;
|
||||
|
||||
if (typeof tabIndexProp !== 'undefined') {
|
||||
tabIndex = tabIndexProp;
|
||||
} else {
|
||||
tabIndex = disabled ? null : 0;
|
||||
}
|
||||
|
||||
var buttonId = SelectDisplayProps.id || (name ? "mui-component-select-".concat(name) : undefined);
|
||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", (0, _extends2.default)({
|
||||
className: (0, _clsx.default)(classes.root, // TODO v5: merge root and select
|
||||
classes.select, classes.selectMenu, classes[variant], className, disabled && classes.disabled),
|
||||
ref: setDisplayNode,
|
||||
tabIndex: tabIndex,
|
||||
role: "button",
|
||||
"aria-disabled": disabled ? 'true' : undefined,
|
||||
"aria-expanded": open ? 'true' : undefined,
|
||||
"aria-haspopup": "listbox",
|
||||
"aria-label": ariaLabel,
|
||||
"aria-labelledby": [labelId, buttonId].filter(Boolean).join(' ') || undefined,
|
||||
onKeyDown: handleKeyDown,
|
||||
onMouseDown: disabled || readOnly ? null : handleMouseDown,
|
||||
onBlur: handleBlur,
|
||||
onFocus: onFocus
|
||||
}, SelectDisplayProps, {
|
||||
// The id is required for proper a11y
|
||||
id: buttonId
|
||||
}), isEmpty(display) ?
|
||||
/*#__PURE__*/
|
||||
// eslint-disable-next-line react/no-danger
|
||||
React.createElement("span", {
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: '​'
|
||||
}
|
||||
}) : display), /*#__PURE__*/React.createElement("input", (0, _extends2.default)({
|
||||
value: Array.isArray(value) ? value.join(',') : value,
|
||||
name: name,
|
||||
ref: inputRef,
|
||||
"aria-hidden": true,
|
||||
onChange: handleChange,
|
||||
tabIndex: -1,
|
||||
className: classes.nativeInput,
|
||||
autoFocus: autoFocus
|
||||
}, other)), /*#__PURE__*/React.createElement(IconComponent, {
|
||||
className: (0, _clsx.default)(classes.icon, classes["icon".concat((0, _capitalize.default)(variant))], open && classes.iconOpen, disabled && classes.disabled)
|
||||
}), /*#__PURE__*/React.createElement(_Menu.default, (0, _extends2.default)({
|
||||
id: "menu-".concat(name || ''),
|
||||
anchorEl: displayNode,
|
||||
open: open,
|
||||
onClose: handleClose
|
||||
}, MenuProps, {
|
||||
MenuListProps: (0, _extends2.default)({
|
||||
'aria-labelledby': labelId,
|
||||
role: 'listbox',
|
||||
disableListWrap: true
|
||||
}, MenuProps.MenuListProps),
|
||||
PaperProps: (0, _extends2.default)({}, MenuProps.PaperProps, {
|
||||
style: (0, _extends2.default)({
|
||||
minWidth: menuMinWidth
|
||||
}, MenuProps.PaperProps != null ? MenuProps.PaperProps.style : null)
|
||||
})
|
||||
}), items));
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? SelectInput.propTypes = {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
'aria-label': _propTypes.default.string,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
autoFocus: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* If `true`, the width of the popover will automatically be set according to the items inside the
|
||||
* menu, otherwise it will be at least the width of the select input.
|
||||
*/
|
||||
autoWidth: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* The option elements to populate the select with.
|
||||
* Can be some `<MenuItem>` elements.
|
||||
*/
|
||||
children: _propTypes.default.node,
|
||||
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
* See [CSS API](#css) below for more details.
|
||||
*/
|
||||
classes: _propTypes.default.object.isRequired,
|
||||
|
||||
/**
|
||||
* The CSS class name of the select element.
|
||||
*/
|
||||
className: _propTypes.default.string,
|
||||
|
||||
/**
|
||||
* The default element value. Use when the component is not controlled.
|
||||
*/
|
||||
defaultValue: _propTypes.default.any,
|
||||
|
||||
/**
|
||||
* If `true`, the select will be disabled.
|
||||
*/
|
||||
disabled: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* If `true`, the selected item is displayed even if its value is empty.
|
||||
*/
|
||||
displayEmpty: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* The icon that displays the arrow.
|
||||
*/
|
||||
IconComponent: _propTypes.default.elementType.isRequired,
|
||||
|
||||
/**
|
||||
* Imperative handle implementing `{ value: T, node: HTMLElement, focus(): void }`
|
||||
* Equivalent to `ref`
|
||||
*/
|
||||
inputRef: _utils.refType,
|
||||
|
||||
/**
|
||||
* The ID of an element that acts as an additional label. The Select will
|
||||
* be labelled by the additional label and the selected value.
|
||||
*/
|
||||
labelId: _propTypes.default.string,
|
||||
|
||||
/**
|
||||
* Props applied to the [`Menu`](/api/menu/) element.
|
||||
*/
|
||||
MenuProps: _propTypes.default.object,
|
||||
|
||||
/**
|
||||
* If `true`, `value` must be an array and the menu will support multiple selections.
|
||||
*/
|
||||
multiple: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* Name attribute of the `select` or hidden `input` element.
|
||||
*/
|
||||
name: _propTypes.default.string,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onBlur: _propTypes.default.func,
|
||||
|
||||
/**
|
||||
* Callback function fired when a menu item is selected.
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
* You can pull out the new value by accessing `event.target.value` (any).
|
||||
* @param {object} [child] The react element that was selected.
|
||||
*/
|
||||
onChange: _propTypes.default.func,
|
||||
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
* Use in controlled mode (see open).
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
*/
|
||||
onClose: _propTypes.default.func,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onFocus: _propTypes.default.func,
|
||||
|
||||
/**
|
||||
* Callback fired when the component requests to be opened.
|
||||
* Use in controlled mode (see open).
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
*/
|
||||
onOpen: _propTypes.default.func,
|
||||
|
||||
/**
|
||||
* Control `select` open state.
|
||||
*/
|
||||
open: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
readOnly: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* Render the selected value.
|
||||
*
|
||||
* @param {any} value The `value` provided to the component.
|
||||
* @returns {ReactNode}
|
||||
*/
|
||||
renderValue: _propTypes.default.func,
|
||||
|
||||
/**
|
||||
* Props applied to the clickable div element.
|
||||
*/
|
||||
SelectDisplayProps: _propTypes.default.object,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
tabIndex: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
type: _propTypes.default.any,
|
||||
|
||||
/**
|
||||
* The input value.
|
||||
*/
|
||||
value: _propTypes.default.any,
|
||||
|
||||
/**
|
||||
* The variant to use.
|
||||
*/
|
||||
variant: _propTypes.default.oneOf(['standard', 'outlined', 'filled'])
|
||||
} : void 0;
|
||||
var _default = SelectInput;
|
||||
exports.default = _default;
|
2
web/node_modules/@material-ui/core/Select/index.d.ts
generated
vendored
Normal file
2
web/node_modules/@material-ui/core/Select/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export { default } from './Select';
|
||||
export * from './Select';
|
15
web/node_modules/@material-ui/core/Select/index.js
generated
vendored
Normal file
15
web/node_modules/@material-ui/core/Select/index.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Select.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _Select = _interopRequireDefault(require("./Select"));
|
5
web/node_modules/@material-ui/core/Select/package.json
generated
vendored
Normal file
5
web/node_modules/@material-ui/core/Select/package.json
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"sideEffects": false,
|
||||
"module": "../esm/Select/index.js",
|
||||
"typings": "./index.d.ts"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue