@m4l/components 9.1.119 → 9.1.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/decorators/WithAppearanceContext/index.d.ts +0 -0
- package/.storybook/utils/getStylesColorsByMode.d.ts +4 -4
- package/components/Chip/Chip.js +8 -5
- package/components/Chip/ChipStyles.js +21 -18
- package/components/Chip/slots/ChipSlots.d.ts +5 -5
- package/components/Chip/types.d.ts +14 -7
- package/components/DataGrid/contexts/DataGridContext/index.js +3 -5
- package/components/DataGrid/contexts/DataGridContext/types.d.ts +1 -3
- package/components/DataGrid/contexts/FilterContext/index.d.ts +1 -1
- package/components/DataGrid/dictionary.d.ts +18 -0
- package/components/DataGrid/dictionary.js +19 -1
- package/components/DataGrid/formatters/ColumnBooleanFormatter/index.d.ts +1 -1
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index.js +1 -1
- package/components/DataGrid/formatters/ColumnDateFormatter/index.d.ts +1 -1
- package/components/DataGrid/formatters/ColumnIconFormatter/index.d.ts +1 -1
- package/components/DataGrid/formatters/ColumnIconFormatter/index.js +1 -2
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.js +1 -3
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/index.d.ts +0 -3
- package/components/DataGrid/hooks/useDataGrid.d.ts +2 -1
- package/components/DataGrid/icons.d.ts +15 -0
- package/components/DataGrid/icons.js +18 -0
- package/components/DataGrid/index.d.ts +5 -1
- package/components/DataGrid/index.js +5 -10
- package/components/DataGrid/slots/DataGridEnum.d.ts +30 -0
- package/components/DataGrid/slots/DataGridEnum.js +44 -0
- package/components/DataGrid/slots/DataGridSlot.d.ts +48 -0
- package/components/DataGrid/slots/DataGridSlot.js +97 -0
- package/components/DataGrid/styles.d.ts +2 -1
- package/components/DataGrid/styles.js +479 -12
- package/components/DataGrid/subcomponents/Actions/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Actions/index.js +7 -7
- package/components/DataGrid/subcomponents/Actions/subcomponents/Density/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Actions/subcomponents/Density/index.js +13 -12
- package/components/DataGrid/subcomponents/Actions/subcomponents/Filter/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Actions/subcomponents/Filter/index.js +5 -6
- package/components/DataGrid/subcomponents/Actions/subcomponents/MobileMenuActions/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Actions/subcomponents/MobileMenuActions/index.js +14 -13
- package/components/DataGrid/subcomponents/Actions/subcomponents/RowsCount/index.js +7 -6
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/index.js +2 -4
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +28 -27
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/types.d.ts +1 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/hooks/useModalSettings/index.js +11 -11
- package/components/DataGrid/subcomponents/Actions/types.d.ts +1 -1
- package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +1 -1
- package/components/DataGrid/subcomponents/Table/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Table/index.js +5 -4
- package/components/DataGrid/subcomponents/Table/subcomponents/ActionsColumn.js +1 -2
- package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +12 -43
- package/components/DataGrid/subcomponents/Table/subcomponents/SelectColumn.js +2 -2
- package/components/DataGrid/subcomponents/Table/subcomponents/SkeletonFormatter/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/SkeletonFormatter/index.js +2 -4
- package/components/DataGrid/subcomponents/editors/TextEditor/index.d.ts +0 -1
- package/components/DataGrid/subcomponents/editors/TextEditor/index.js +3 -28
- package/components/DataGrid/types.d.ts +6 -0
- package/components/Pager/subcomponents/CustomTablePagination/CustomTablePagination.js +10 -4
- package/components/areas/components/AreasAdmin/slots/AreasAdminSlots.js +1 -1
- package/components/gclick/MyDevice/MyDevice.js +1 -1
- package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +1 -1
- package/components/hook-form/RHFPeriod/subcomponents/Period/Period.js +0 -1
- package/components/hook-form/RHFSelect/RHFSelect.d.ts +1 -1
- package/components/hook-form/RHFSelect/RHFSelect.js +21 -3
- package/components/hook-form/RHFSelect/slots/RHFSlots.d.ts +1 -1
- package/components/hook-form/RHFSelect/types.d.ts +1 -1
- package/components/mui_extended/Select/Select.d.ts +1 -1
- package/components/mui_extended/Select/Select.js +195 -145
- package/components/mui_extended/Select/Select.styles.js +69 -81
- package/components/mui_extended/Select/constants.d.ts +1 -1
- package/components/mui_extended/Select/slots/SelectEnum.d.ts +1 -1
- package/components/mui_extended/Select/slots/SelectEnum.js +1 -1
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +19 -11
- package/components/mui_extended/Select/slots/SelectSlots.js +7 -7
- package/components/mui_extended/Select/tests/Select.test.d.ts +1 -0
- package/components/mui_extended/Select/types.d.ts +26 -16
- package/mockServiceWorker.js +1 -1
- package/package.json +1 -1
- package/components/DataGrid/classes/constants.d.ts +0 -1
- package/components/DataGrid/classes/constants.js +0 -4
- package/components/DataGrid/classes/index.d.ts +0 -33
- package/components/DataGrid/classes/index.js +0 -71
- package/components/DataGrid/classes/types.d.ts +0 -30
- package/components/DataGrid/formatters/ColumnDateFormatter/styles.d.ts +0 -1
- package/components/DataGrid/subcomponents/Actions/styles.d.ts +0 -1
- package/components/DataGrid/subcomponents/Actions/subcomponents/Filter/types.d.ts +0 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/RowsCount/types.d.ts +0 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/styles.d.ts +0 -7
- package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/styles.js +0 -50
- package/components/DataGrid/subcomponents/Table/subcomponents/SkeletonFormatter/styles.d.ts +0 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/SkeletonFormatter/styles.js +0 -10
- package/storybook/components/Label/Label.stories.d.ts +0 -16
- package/storybook/components/formatters/CourseFormatter/CourseFormatter.stories.d.ts +0 -25
- package/storybook/components/formatters/CourseFormatter/constants.d.ts +0 -3
- package/storybook/components/formatters/CourseFormatter/types.d.ts +0 -3
- /package/components/DataGrid/subcomponents/Actions/subcomponents/{Settings/types.d.ts → types.d.ts} +0 -0
- /package/components/{mui_extended/Select/test/Select.test.d.ts → DataGrid/tests/DataGrid.test.d.ts} +0 -0
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Maybe } from '@m4l/core';
|
|
2
|
+
import { Theme } from '@mui/material/styles';
|
|
2
3
|
import { Column, RowsChangeData, FormatterProps } from 'react-data-grid';
|
|
3
4
|
import { MenuAction } from '../MenuActions/types';
|
|
4
5
|
import { ActionsProps } from './subcomponents/Actions/types';
|
|
6
|
+
import { ActionsSlots, ColumnsConfigSlots, DataGridSlots, RowsCountSlots, TableSlots, TextEditorSlots } from './slots/DataGridEnum';
|
|
7
|
+
import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
8
|
+
import { DATAGRID_PREFIX_NAME } from './constants';
|
|
5
9
|
export type GridFormatterPropss<T, SR> = FormatterProps<T, SR>;
|
|
6
10
|
export type { ColumnUncertaintyFormatter, ColumnPointsFormatter, ColumnNestedValueFormatter, } from './formatters';
|
|
7
11
|
export declare type ColumnType = 'string' | 'date' | 'number' | 'boolean' | 'custom';
|
|
@@ -69,3 +73,5 @@ export declare interface DataGridProps<TRow, TSummaryRow, TKey extends RowKey =
|
|
|
69
73
|
export interface OwnerState extends WithActionsProps {
|
|
70
74
|
actionsProps: ActionsProps;
|
|
71
75
|
}
|
|
76
|
+
export type DataGridSlotsType = DataGridSlots | TextEditorSlots | ActionsSlots | RowsCountSlots | ColumnsConfigSlots | TableSlots;
|
|
77
|
+
export type DataGridStyles = OverridesStyleRules<DataGridSlotsType, typeof DATAGRID_PREFIX_NAME, Theme>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { P as PagerActions } from "../PagerActions/PagerActions.js";
|
|
3
|
-
import { useState, useMemo, useEffect } from "react";
|
|
3
|
+
import { useState, useMemo, useEffect, useCallback } from "react";
|
|
4
4
|
import { useModuleDictionary } from "@m4l/core";
|
|
5
5
|
import { P as PAGER_DICTIONARY } from "../../dicctionary.js";
|
|
6
6
|
import { T as TotalRowStyled, L as LabelSelectContainerStyled, R as RowsPerPageStyled, A as ActionsContainerStyled, a as PageCounterStyled } from "../../slots/PagerSlots.js";
|
|
@@ -45,7 +45,7 @@ const CustomTablePagination = (props) => {
|
|
|
45
45
|
const displayedPage = currentPage === 1 ? 1 : currentPage + 1;
|
|
46
46
|
return `${memoizedLabelPage} ${displayedPage} ${labelOf} ${totalPages}`;
|
|
47
47
|
}, [currentPage, totalPages, countTotal, labelOf, memoizedLabelPage, memoizedLabelNoRecords]);
|
|
48
|
-
const handleChangeRowsPerPage = (option) => {
|
|
48
|
+
const handleChangeRowsPerPage = useCallback((option) => {
|
|
49
49
|
const selectedValue = Number(option.id);
|
|
50
50
|
const newTotalPages = Math.ceil(countTotal / selectedValue);
|
|
51
51
|
const newPage = Math.min(currentPage, newTotalPages - 1);
|
|
@@ -57,7 +57,13 @@ const CustomTablePagination = (props) => {
|
|
|
57
57
|
if (onPageChange) {
|
|
58
58
|
onPageChange(null, newPage);
|
|
59
59
|
}
|
|
60
|
-
};
|
|
60
|
+
}, [countTotal, currentPage, memoizedLabelRows, onPageChange, onRowsPerPageChange]);
|
|
61
|
+
const onChangeSelect = useCallback((opt) => {
|
|
62
|
+
if (!opt) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
handleChangeRowsPerPage(opt);
|
|
66
|
+
}, [handleChangeRowsPerPage]);
|
|
61
67
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
62
68
|
rowsPerPageOptions?.length > 1 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
63
69
|
/* @__PURE__ */ jsx(TotalRowStyled, { skeletonWidth: 50, size, variant: "body", children: `${labelTotalRows}: ${countTotal}` }),
|
|
@@ -68,7 +74,7 @@ const CustomTablePagination = (props) => {
|
|
|
68
74
|
{
|
|
69
75
|
size,
|
|
70
76
|
value: rowsPerPageOptions.includes(localRowsPerPage) ? localRowsPerPage.toString() : rowsPerPageOptions[0].toString(),
|
|
71
|
-
onChange:
|
|
77
|
+
onChange: onChangeSelect,
|
|
72
78
|
options: rowsPerPageOptions.map((item) => ({
|
|
73
79
|
id: item.toString(),
|
|
74
80
|
value: item.toString(),
|
|
@@ -3,9 +3,9 @@ import { A as AREAS_ADMIN_KEY_COMPONENT } from "../constants.js";
|
|
|
3
3
|
import { a as areasAdminStyles } from "../AreasAdmin.styles.js";
|
|
4
4
|
import { A as AreasAdminSlots } from "./AreasAdminEnum.js";
|
|
5
5
|
import { T as Typography } from "../../../../mui_extended/Typography/Typography.js";
|
|
6
|
-
import { C as Chip } from "../../../../Chip/Chip.js";
|
|
7
6
|
import { I as IconButton } from "../../../../mui_extended/IconButton/IconButton.js";
|
|
8
7
|
import { B as Button } from "../../../../mui_extended/Button/Button.js";
|
|
8
|
+
import { C as Chip } from "../../../../Chip/Chip.js";
|
|
9
9
|
import { M as MenuActions } from "../../../../MenuActions/MenuActions.js";
|
|
10
10
|
const AreasAdminRootStyled = styled("div", {
|
|
11
11
|
name: AREAS_ADMIN_KEY_COMPONENT,
|
|
@@ -10,7 +10,7 @@ const MyDevice = (props) => {
|
|
|
10
10
|
for (const match of matches) {
|
|
11
11
|
const r = getPropertyByString(props.deviceData, match.slice(1, -1));
|
|
12
12
|
if (typeof r === "string" || typeof r === "number" || typeof r === "boolean") {
|
|
13
|
-
label = label.replaceAll(match, r);
|
|
13
|
+
label = label.replaceAll(match, r.toString());
|
|
14
14
|
} else {
|
|
15
15
|
label = label.replaceAll(match, "err");
|
|
16
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const RHFPeriodRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
2
2
|
export declare const PeriodRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
3
3
|
export declare const TextFieldStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../../mui_extended/TextField/types').TextFieldProps, "ref"> & import('react').RefAttributes<HTMLDivElement>, "children" | "value" | "title" | "component" | "size" | "name" | "error" | "select" | "rows" | "id" | "type" | "hidden" | "content" | "style" | "disabled" | "variant" | "margin" | "translate" | "sx" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "slot" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "label" | keyof import('react').RefAttributes<HTMLDivElement> | "autoComplete" | "placeholder" | "required" | "dataTestId" | "fullWidth" | "helperText" | "inputProps" | "inputRef" | "SelectProps" | "multiline" | "maxRows" | "minRows" | "hiddenLabel" | "focused" | "InputProps" | "FormHelperTextProps" | "InputLabelProps"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
|
|
4
|
-
export declare const SelectStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../../mui_extended/Select').SelectProps<
|
|
4
|
+
export declare const SelectStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../../mui_extended/Select').SelectProps<string | number, boolean | undefined>, "ref"> & import('react').RefAttributes<HTMLDivElement>, "children" | "value" | "onClose" | "title" | "size" | "name" | "error" | "input" | "options" | "rows" | "id" | "type" | "components" | "hidden" | "content" | "style" | "open" | "multiple" | "disabled" | "variant" | "margin" | "translate" | "sx" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "slot" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "componentsProps" | "onOpen" | "slotProps" | "slots" | "label" | keyof import('react').RefAttributes<HTMLDivElement> | "autoComplete" | "placeholder" | "readOnly" | "required" | "dataTestId" | "fullWidth" | "inputProps" | "inputRef" | "disableInjectingGlobalStyles" | "endAdornment" | "inputComponent" | "multiline" | "renderSuffix" | "maxRows" | "minRows" | "startAdornment" | "disableUnderline" | "autoWidth" | "defaultOpen" | "displayEmpty" | "IconComponent" | "labelId" | "MenuProps" | "native" | "renderValue" | "SelectDisplayProps"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
|
|
@@ -122,7 +122,6 @@ const Period = (props) => {
|
|
|
122
122
|
type: "number",
|
|
123
123
|
variant: "outlined",
|
|
124
124
|
value: singleValue,
|
|
125
|
-
InputProps: { disableUnderline: true },
|
|
126
125
|
onChange: (e) => {
|
|
127
126
|
onTotalChange(selPeriodTime, e.target.value === "" ? "" : parseInt(e.target.value));
|
|
128
127
|
}
|
|
@@ -20,4 +20,4 @@ import { RHFSelectProps } from './types';
|
|
|
20
20
|
* @param {string} [props.dataTestId] - The data test ID for the select input.
|
|
21
21
|
* @returns {JSX.Element} The rendered RHFSelect component.
|
|
22
22
|
*/
|
|
23
|
-
export declare const RHFSelect: <T>(props: RHFSelectProps<T>) =>
|
|
23
|
+
export declare const RHFSelect: <T extends string | number, Multiple extends boolean | undefined = false>(props: RHFSelectProps<T, Multiple>) => JSX.Element;
|
|
@@ -5,10 +5,13 @@ import { R as RHFSelectEnum } from "./slots/RHFSelectEnum.js";
|
|
|
5
5
|
import { R as RootStyled, L as LabelStyled, S as SelectStyled, H as HelperErrorStyled } from "./slots/RHFSlots.js";
|
|
6
6
|
import { useFormContext, Controller } from "react-hook-form";
|
|
7
7
|
import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
|
|
8
|
+
import { useId } from "react";
|
|
8
9
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
9
10
|
const RHFSelect = (props) => {
|
|
10
11
|
const {
|
|
12
|
+
id,
|
|
11
13
|
name,
|
|
14
|
+
multiple,
|
|
12
15
|
options,
|
|
13
16
|
label,
|
|
14
17
|
labelSkeletonWidth,
|
|
@@ -24,6 +27,8 @@ const RHFSelect = (props) => {
|
|
|
24
27
|
className,
|
|
25
28
|
dataTestId
|
|
26
29
|
} = props;
|
|
30
|
+
const reactId = useId();
|
|
31
|
+
const htmlForId = id || reactId;
|
|
27
32
|
const { currentSize } = useComponentSize(size);
|
|
28
33
|
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
29
34
|
const { control } = useFormContext();
|
|
@@ -33,11 +38,23 @@ const RHFSelect = (props) => {
|
|
|
33
38
|
name,
|
|
34
39
|
control,
|
|
35
40
|
render: ({ field: { value, onChange, ref }, fieldState: { error } }) => {
|
|
41
|
+
const onChangeLocal = (opt) => {
|
|
42
|
+
if (!opt) {
|
|
43
|
+
onChange(null);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (multiple && Array.isArray(opt)) {
|
|
47
|
+
onChange(opt.map((option) => option.id));
|
|
48
|
+
} else if (!Array.isArray(opt)) {
|
|
49
|
+
onChange(opt.id);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
36
52
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
37
53
|
label && /* @__PURE__ */ jsx(
|
|
38
54
|
LabelStyled,
|
|
39
55
|
{
|
|
40
|
-
|
|
56
|
+
id: `${htmlForId}-label`,
|
|
57
|
+
htmlFor: htmlForId,
|
|
41
58
|
label,
|
|
42
59
|
mandatory,
|
|
43
60
|
mandatoryMessage,
|
|
@@ -52,13 +69,14 @@ const RHFSelect = (props) => {
|
|
|
52
69
|
/* @__PURE__ */ jsx(
|
|
53
70
|
SelectStyled,
|
|
54
71
|
{
|
|
72
|
+
labelId: `${htmlForId}-label`,
|
|
55
73
|
ref,
|
|
56
74
|
options,
|
|
57
|
-
|
|
75
|
+
multiple,
|
|
58
76
|
size: adjustedSize,
|
|
59
77
|
variant,
|
|
60
78
|
value,
|
|
61
|
-
onChange:
|
|
79
|
+
onChange: onChangeLocal,
|
|
62
80
|
disabled,
|
|
63
81
|
className: RHFSELECT_CLASSES.select,
|
|
64
82
|
error: Boolean(error),
|
|
@@ -12,7 +12,7 @@ export declare const LabelStyled: import('@emotion/styled').StyledComponent<Pick
|
|
|
12
12
|
* Elemento HelperError construido a través de styled,
|
|
13
13
|
* sirve para mostrar el mensaje de error del componente `RHFSelect`
|
|
14
14
|
*/
|
|
15
|
-
export declare const SelectStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../../mui_extended/Select').SelectProps<
|
|
15
|
+
export declare const SelectStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../../mui_extended/Select').SelectProps<string | number, boolean | undefined>, "ref"> & import('react').RefAttributes<HTMLDivElement>, "children" | "value" | "onClose" | "title" | "size" | "name" | "error" | "input" | "options" | "rows" | "id" | "type" | "components" | "hidden" | "content" | "style" | "open" | "multiple" | "disabled" | "variant" | "margin" | "translate" | "sx" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "slot" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "componentsProps" | "onOpen" | "slotProps" | "slots" | "label" | keyof import('react').RefAttributes<HTMLDivElement> | "autoComplete" | "placeholder" | "readOnly" | "required" | "dataTestId" | "fullWidth" | "inputProps" | "inputRef" | "disableInjectingGlobalStyles" | "endAdornment" | "inputComponent" | "multiline" | "renderSuffix" | "maxRows" | "minRows" | "startAdornment" | "disableUnderline" | "autoWidth" | "defaultOpen" | "displayEmpty" | "IconComponent" | "labelId" | "MenuProps" | "native" | "renderValue" | "SelectDisplayProps"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, {}, {}>;
|
|
16
16
|
/**
|
|
17
17
|
* Elemento HelperError construido a través de styled,
|
|
18
18
|
* sirve para mostrar el mensaje de error del componente `RHFSelect`
|
|
@@ -10,7 +10,7 @@ import { Theme } from '@mui/material';
|
|
|
10
10
|
* Props para el componente RHFSelect, incluye las propedades esceciales del Select, Label,
|
|
11
11
|
* así como las propiedades requeridas por react hook form.
|
|
12
12
|
*/
|
|
13
|
-
export interface RHFSelectProps<T> extends Pick<SelectProps<T>, 'options' | 'placeholder' | 'variant'>, Omit<LabelProps, 'dataTestId' | 'error' | 'children' | '
|
|
13
|
+
export interface RHFSelectProps<T extends string | number, Multiple extends boolean | undefined = false> extends Pick<SelectProps<T, Multiple>, 'options' | 'placeholder' | 'variant' | 'multiple'>, Omit<LabelProps, 'dataTestId' | 'error' | 'children' | 'className' | 'disabled' | 'size' | 'skeletonWidth'> {
|
|
14
14
|
/**
|
|
15
15
|
* Identificador para el manejo de campos en react hook form.
|
|
16
16
|
*/
|
|
@@ -4,4 +4,4 @@ import { SelectProps } from './types';
|
|
|
4
4
|
* @param {SelectProps} props - The properties for the Select component.
|
|
5
5
|
* @returns {JSX.Element} The rendered Select component.
|
|
6
6
|
*/
|
|
7
|
-
export declare const Select: import('react').ForwardRefExoticComponent<Omit<SelectProps<
|
|
7
|
+
export declare const Select: import('react').ForwardRefExoticComponent<Omit<SelectProps<string | number, boolean | undefined>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|