@addsign/moje-agenda-shared-lib 2.0.44 → 2.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/datatable/DataTableServer.js +262 -242
- package/dist/components/datatable/DataTableServer.js.map +1 -1
- package/dist/components/datatable/DatatableSettings.js +3 -0
- package/dist/components/datatable/DatatableSettings.js.map +1 -1
- package/dist/components/form/InputField.js.map +1 -1
- package/lib/components/datatable/DataTableServer.tsx +15 -3
- package/lib/components/datatable/DatatableSettings.tsx +3 -0
- package/lib/components/form/InputField.tsx +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputField.js","sources":["../../../lib/components/form/InputField.tsx"],"sourcesContent":["import * as React from \"react\";\r\nimport { IFormFieldGlobalProps } from \"../../types\";\r\nimport { MdClose } from \"react-icons/md\";\r\nimport { useClickAway } from \"react-use\";\r\nimport { FaSpinner } from \"react-icons/fa\";\r\nimport SpinnerIcon from \"../SpinnerIcon\";\r\n\r\nexport interface IInputFieldProps extends IFormFieldGlobalProps {\r\n maxLength?: number;\r\n debounceTimeout?: number;\r\n manualRef?: React.RefObject<HTMLInputElement>;\r\n disableAutocomplete?: boolean;\r\n}\r\n\r\nexport default function InputField({\r\n label,\r\n name,\r\n value,\r\n description,\r\n onInputChange,\r\n placeholder,\r\n className,\r\n register,\r\n type,\r\n disabled,\r\n maxLength,\r\n errors = {},\r\n rounded = true,\r\n debounceTimeout,\r\n required,\r\n onFocus = () => {},\r\n onBlur = () => {},\r\n children,\r\n disableAutocomplete,\r\n}: IInputFieldProps) {\r\n const wrapperRef = React.useRef(null);\r\n const [isFocused, setIsFocused] = React.useState(false);\r\n const [inputValue, setInputValue] = React.useState(value || \"\"); // Local state for input value\r\n const debounceTimeoutRef = React.useRef<NodeJS.Timeout | null>(null); // Ref to hold the debounce timeout\r\n const [inputIsChanging, setInputIsChanging] = React.useState(false);\r\n\r\n React.useEffect(() => {\r\n setInputValue(value || \"\");\r\n }, [value]);\r\n const handleClear = (e: any) => {\r\n setInputValue(\"\"); // Clear local state\r\n onInputChange({\r\n ...e,\r\n target: {\r\n value: \"\",\r\n name: name,\r\n },\r\n });\r\n };\r\n const fallbackRef = React.useRef(null);\r\n const {\r\n ref: registeredRef = fallbackRef,\r\n onBlur: formOnBlur = () => {} /* default function */,\r\n ...rest\r\n } = register ? register(name) : {};\r\n\r\n const ref = registeredRef || fallbackRef;\r\n const handleSetFocus = () => {\r\n setIsFocused(true);\r\n ref?.current?.focus();\r\n };\r\n useClickAway(wrapperRef, () => {\r\n if (isFocused) {\r\n setIsFocused(false);\r\n }\r\n });\r\n\r\n const handleDebouncedChange = React.useCallback(\r\n (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\r\n const { value } = e.target;\r\n setInputValue(value); // Update local state\r\n setInputIsChanging(true);\r\n\r\n if (debounceTimeout) {\r\n // Clear any previous debounce timeout\r\n if (debounceTimeoutRef.current)\r\n clearTimeout(debounceTimeoutRef.current);\r\n\r\n // Set a new debounce timeout\r\n debounceTimeoutRef.current = setTimeout(() => {\r\n onInputChange(e);\r\n setInputIsChanging(false);\r\n }, debounceTimeout);\r\n } else {\r\n onInputChange(e);\r\n setInputIsChanging(false);\r\n }\r\n },\r\n [debounceTimeout, debounceTimeoutRef, onInputChange, setInputValue]\r\n );\r\n\r\n const handleBlur = (\r\n e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>\r\n ) => {\r\n formOnBlur(e); // Call React Hook Form's onBlur\r\n setIsFocused(false); // Then call your custom onBlur logic\r\n\r\n if (debounceTimeoutRef.current && inputIsChanging) {\r\n clearTimeout(debounceTimeoutRef.current);\r\n onInputChange(e);\r\n setInputIsChanging(false);\r\n }\r\n };\r\n\r\n const renderInput = () => {\r\n switch (type) {\r\n case \"textarea\":\r\n return (\r\n <textarea\r\n id={name}\r\n name={name}\r\n className=\"grow shrink basis-0 text-muted-foreground text-sm font-normal leading-tight focus:border-none outline-none shadow-none\r\n bg-white \"\r\n disabled={disabled}\r\n value={inputValue}\r\n rows={3}\r\n {...rest} // Spread the rest of register's return value\r\n // ref={ref}\r\n onChange={(e) => handleDebouncedChange(e)}\r\n onFocus={() => {\r\n setIsFocused(true);\r\n onFocus();\r\n }}\r\n onBlur={(e) => {\r\n handleBlur(e);\r\n onBlur();\r\n }}\r\n maxLength={maxLength || 4000}\r\n />\r\n );\r\n default:\r\n return (\r\n <>\r\n <input\r\n className={`text-muted-foreground text-sm font-normal leading-normal outline-none shadow-none \r\n placeholder-muted-foreground\r\n text-ellipsis overflow-hidden w-full disabled:cursor-not-allowed bg-white`}\r\n id={name}\r\n name={name}\r\n disabled={disabled}\r\n type={type}\r\n {...rest}\r\n // ref={ref}\r\n value={inputValue} // Controlled value\r\n placeholder={placeholder}\r\n onChange={(e) => handleDebouncedChange(e)}\r\n onFocus={() => {\r\n setIsFocused(true);\r\n onFocus();\r\n }}\r\n onBlur={(e) => {\r\n handleBlur(e);\r\n onBlur();\r\n }}\r\n autoComplete={disableAutocomplete ? \"off\" : \"on\"}\r\n />\r\n </>\r\n );\r\n }\r\n };\r\n\r\n return (\r\n <>\r\n <div\r\n className={\r\n \"min-h-30 flex-col justify-start items-start gap-1.5 w-full relative \" +\r\n className\r\n }\r\n ref={wrapperRef}\r\n id=\"component\"\r\n >\r\n <div className=\"self-stretch flex-col justify-start items-start gap-1.5 flex\">\r\n {label && (\r\n <div className=\"text-slate-700 text-sm font-medium leading-tight\">\r\n {label} {required ? \"*\" : \"\"}\r\n </div>\r\n )}\r\n <div\r\n className={`self-stretch w-full pl-3 pr-2 py-1 border justify-between items-center gap-0 inline-flex outline-none bg-white\r\n ${isFocused ? \"outline-4 outline-indigo-200 outline-offset-0 border-indigo-300 \" : \"\"}\r\n ${rounded ? \" rounded-lg \" : \" rounded-none \"}\r\n ${disabled ? \" !opacity-80 cursor-not-allowed \" : \"\"}`}\r\n onClick={handleSetFocus}\r\n >\r\n <div className=\"flex-grow basis-0 min-h-[32px] justify-start items-center gap-0 flex whitespace-nowrap w-[calc(100%-40px)] \">\r\n {renderInput()}\r\n </div>\r\n <div className=\"items-center content-center flex-shrink flex\">\r\n {inputIsChanging === true && (\r\n <div className=\"w-6 h-6 relative flex items-center justify-center align-middle\">\r\n <SpinnerIcon icon={<FaSpinner />} />\r\n </div>\r\n )}\r\n {value && !disabled && (\r\n <div\r\n className=\"w-6 h-6 relative flex cursor-pointer items-center justify-center align-middle hover:bg-gray-100 rounded-full text-lg\"\r\n onClick={handleClear}\r\n id={name + \":clear\"}\r\n >\r\n <MdClose />\r\n </div>\r\n )}\r\n {children}\r\n </div>\r\n </div>\r\n </div>\r\n {description && !isFocused && (\r\n <div\r\n className=\"self-stretch text-slate-600 text-sm font-normal leading-tight\"\r\n id={name + \":description\"}\r\n >\r\n {description}\r\n </div>\r\n )}{\" \"}\r\n {errors[name] && (\r\n <div\r\n className=\"HintText self-stretch text-red-600 text-sm font-normal leading-tight mt-1\"\r\n id={name + \":error\"}\r\n >\r\n {errors[name]?.message}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n );\r\n}\r\n"],"names":["_a","value"],"mappings":";;;;;;AAcA,SAAwB,WAAW;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,CAAC;AAAA,EACV,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,UAAU,MAAM;AAAA,EAAC;AAAA,EACjB,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB;AAAA,EACA;AACF,GAAqB;;AACb,QAAA,aAAa,MAAM,OAAO,IAAI;AACpC,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,KAAK;AACtD,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAS,SAAS,EAAE;AACxD,QAAA,qBAAqB,MAAM,OAA8B,IAAI;AACnE,Q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E,WAAW,MAAM;AAAA,UAAA,GAC5B;AAAA,UAEF;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW;AAAA,iBACN,YAAY,qEAAqE,EAAE;AAAA,iBACnF,UAAU,iBAAiB,gBAAgB;AAAA,iBAC3C,WAAW,qCAAqC,EAAE;AAAA,cACvD,SAAS;AAAA,cAET,UAAA;AAAA,gBAAA,oBAAC,OAAI,EAAA,WAAU,gHACZ,UAAA,YAAA,GACH;AAAA,gBACA,qBAAC,OAAI,EAAA,WAAU,gDACZ,UAAA;AAAA,kBAAoB,oBAAA,QAClB,oBAAA,OAAA,EAAI,WAAU,mEACb,UAAC,oBAAA,aAAA,EAAY,MAAM,oBAAC,WAAU,CAAA,CAAA,EAAI,CAAA,GACpC;AAAA,kBAED,SAAS,CAAC,YACT;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,WAAU;AAAA,sBACV,SAAS;AAAA,sBACT,IAAI,OAAO;AAAA,sBAEX,8BAAC,SAAQ,EAAA;AAAA,oBAAA;AAAA,kBACX;AAAA,kBAED;AAAA,gBAAA,GACH;AAAA,cAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA,GACF;AAAA,QACC,eAAe,CAAC,aACf;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAI,OAAO;AAAA,YAEV,UAAA;AAAA,UAAA;AAAA,QACH;AAAA,QACC;AAAA,QACF,OAAO,IAAI,KACV;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAI,OAAO;AAAA,YAEV,WAAA,YAAO,IAAI,MAAX,mBAAc;AAAA,UAAA;AAAA,QACjB;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN,EAAA,CAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"InputField.js","sources":["../../../lib/components/form/InputField.tsx"],"sourcesContent":["import * as React from \"react\";\r\nimport { IFormFieldGlobalProps } from \"../../types\";\r\nimport { MdClose } from \"react-icons/md\";\r\nimport { useClickAway } from \"react-use\";\r\nimport { FaSpinner } from \"react-icons/fa\";\r\nimport SpinnerIcon from \"../SpinnerIcon\";\r\n\r\nexport interface IInputFieldProps extends IFormFieldGlobalProps {\r\n maxLength?: number;\r\n debounceTimeout?: number;\r\n manualRef?: React.RefObject<HTMLInputElement>;\r\n disableAutocomplete?: boolean;\r\n}\r\n\r\nexport default function InputField({\r\n label,\r\n name,\r\n value,\r\n description,\r\n onInputChange,\r\n placeholder,\r\n className,\r\n register,\r\n type,\r\n disabled,\r\n maxLength,\r\n errors = {},\r\n rounded = true,\r\n debounceTimeout,\r\n required,\r\n onFocus = () => {},\r\n onBlur = () => {},\r\n children,\r\n disableAutocomplete,\r\n}: IInputFieldProps) {\r\n const wrapperRef = React.useRef(null);\r\n const [isFocused, setIsFocused] = React.useState(false);\r\n const [inputValue, setInputValue] = React.useState(value || \"\"); // Local state for input value\r\n const debounceTimeoutRef = React.useRef<NodeJS.Timeout | null>(null); // Ref to hold the debounce timeout\r\n const [inputIsChanging, setInputIsChanging] = React.useState(false);\r\n\r\n React.useEffect(() => {\r\n setInputValue(value || \"\");\r\n }, [value]);\r\n const handleClear = (e: any) => {\r\n setInputValue(\"\"); // Clear local state\r\n onInputChange({\r\n ...e,\r\n target: {\r\n value: \"\",\r\n name: name,\r\n },\r\n });\r\n };\r\n const fallbackRef = React.useRef(null);\r\n const {\r\n ref: registeredRef = fallbackRef,\r\n onBlur: formOnBlur = () => {} /* default function */,\r\n ...rest\r\n } = register ? register(name) : {};\r\n\r\n const ref = registeredRef || fallbackRef;\r\n const handleSetFocus = () => {\r\n setIsFocused(true);\r\n ref?.current?.focus();\r\n };\r\n useClickAway(wrapperRef, () => {\r\n if (isFocused) {\r\n setIsFocused(false);\r\n }\r\n });\r\n\r\n const handleDebouncedChange = React.useCallback(\r\n (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\r\n const { value } = e.target;\r\n setInputValue(value); // Update local state\r\n setInputIsChanging(true);\r\n\r\n if (debounceTimeout) {\r\n // Clear any previous debounce timeout\r\n if (debounceTimeoutRef.current)\r\n clearTimeout(debounceTimeoutRef.current);\r\n\r\n // Set a new debounce timeout\r\n debounceTimeoutRef.current = setTimeout(() => {\r\n onInputChange(e);\r\n setInputIsChanging(false);\r\n }, debounceTimeout);\r\n } else {\r\n onInputChange(e);\r\n setInputIsChanging(false);\r\n }\r\n },\r\n [debounceTimeout, debounceTimeoutRef, onInputChange, setInputValue]\r\n );\r\n\r\n const handleBlur = (\r\n e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>\r\n ) => {\r\n formOnBlur(e); // Call React Hook Form's onBlur\r\n setIsFocused(false); // Then call your custom onBlur logic\r\n\r\n if (debounceTimeoutRef.current && inputIsChanging) {\r\n clearTimeout(debounceTimeoutRef.current);\r\n onInputChange(e);\r\n setInputIsChanging(false);\r\n }\r\n };\r\n\r\n const renderInput = () => {\r\n switch (type) {\r\n case \"textarea\":\r\n return (\r\n <textarea\r\n id={name}\r\n name={name}\r\n className=\"grow shrink basis-0 text-muted-foreground text-sm font-normal leading-tight focus:border-none outline-none shadow-none\r\n bg-white \"\r\n disabled={disabled}\r\n value={inputValue}\r\n rows={3}\r\n {...rest} // Spread the rest of register's return value\r\n // ref={ref}\r\n onChange={(e) => handleDebouncedChange(e)}\r\n onFocus={() => {\r\n setIsFocused(true);\r\n onFocus();\r\n }}\r\n onBlur={(e) => {\r\n handleBlur(e);\r\n onBlur();\r\n }}\r\n maxLength={maxLength || 4000}\r\n />\r\n );\r\n default:\r\n return (\r\n <>\r\n <input\r\n className={`text-muted-foreground text-sm font-normal leading-normal outline-none shadow-none \r\n placeholder-muted-foreground\r\n text-ellipsis overflow-hidden w-full disabled:cursor-not-allowed bg-white`}\r\n id={name}\r\n name={name}\r\n disabled={disabled}\r\n type={type}\r\n {...rest}\r\n // ref={ref}\r\n value={inputValue} // Controlled value\r\n placeholder={placeholder}\r\n onChange={(e) => handleDebouncedChange(e)}\r\n onFocus={() => {\r\n setIsFocused(true);\r\n onFocus();\r\n }}\r\n onBlur={(e) => {\r\n handleBlur(e);\r\n onBlur();\r\n }}\r\n autoComplete={disableAutocomplete ? \"off\" : \"on\"}\r\n />\r\n </>\r\n );\r\n }\r\n };\r\n\r\n return (\r\n <>\r\n <div\r\n className={\r\n \"min-h-30 flex-col justify-start items-start gap-1.5 w-full relative \" +\r\n className\r\n }\r\n ref={wrapperRef}\r\n id=\"component\"\r\n \r\n >\r\n <div className=\"self-stretch flex-col justify-start items-start gap-1.5 flex\">\r\n {label && (\r\n <div className=\"text-slate-700 text-sm font-medium leading-tight\">\r\n {label} {required ? \"*\" : \"\"}\r\n </div>\r\n )}\r\n <div\r\n className={`self-stretch w-full pl-3 pr-2 py-1 border justify-between items-center gap-0 inline-flex outline-none bg-white\r\n ${isFocused ? \"outline-4 outline-indigo-200 outline-offset-0 border-indigo-300 \" : \"\"}\r\n ${rounded ? \" rounded-lg \" : \" rounded-none \"}\r\n ${disabled ? \" !opacity-80 cursor-not-allowed \" : \"\"}`}\r\n onClick={handleSetFocus}\r\n >\r\n <div className=\"flex-grow basis-0 min-h-[32px] justify-start items-center gap-0 flex whitespace-nowrap w-[calc(100%-40px)] \">\r\n {renderInput()}\r\n </div>\r\n <div className=\"items-center content-center flex-shrink flex\">\r\n {inputIsChanging === true && (\r\n <div className=\"w-6 h-6 relative flex items-center justify-center align-middle\">\r\n <SpinnerIcon icon={<FaSpinner />} />\r\n </div>\r\n )}\r\n {value && !disabled && (\r\n <div\r\n className=\"w-6 h-6 relative flex cursor-pointer items-center justify-center align-middle hover:bg-gray-100 rounded-full text-lg\"\r\n onClick={handleClear}\r\n id={name + \":clear\"}\r\n >\r\n <MdClose />\r\n </div>\r\n )}\r\n {children}\r\n </div>\r\n </div>\r\n </div>\r\n {description && !isFocused && (\r\n <div\r\n className=\"self-stretch text-slate-600 text-sm font-normal leading-tight\"\r\n id={name + \":description\"}\r\n >\r\n {description}\r\n </div>\r\n )}{\" \"}\r\n {errors[name] && (\r\n <div\r\n className=\"HintText self-stretch text-red-600 text-sm font-normal leading-tight mt-1\"\r\n id={name + \":error\"}\r\n >\r\n {errors[name]?.message}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n );\r\n}\r\n"],"names":["_a","value"],"mappings":";;;;;;AAcA,SAAwB,WAAW;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,CAAC;AAAA,EACV,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,UAAU,MAAM;AAAA,EAAC;AAAA,EACjB,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB;AAAA,EACA;AACF,GAAqB;;AACb,QAAA,aAAa,MAAM,OAAO,IAAI;AACpC,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,KAAK;AACtD,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAS,SAAS,EAAE;AACxD,QAAA,qBAAqB,MAAM,OAA8B,IAAI;AACnE,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,MAAM,SAAS,KAAK;AAElE,QAAM,UAAU,MAAM;AACpB,kBAAc,SAAS,EAAE;AAAA,EAAA,GACxB,CAAC,KAAK,CAAC;AACJ,QAAA,cAAc,CAAC,MAAW;AAC9B,kBAAc,EAAE;AACF,kBAAA;AAAA,MACZ,GAAG;AAAA,MACH,QAAQ;AAAA,QACN,OAAO;AAAA,QACP;AAAA,MACF;AAAA,IAAA,CACD;AAAA,EAAA;AAEG,QAAA,cAAc,MAAM,OAAO,IAAI;AAC/B,QAAA;AAAA,IACJ,KAAK,gBAAgB;AAAA,IACrB,QAAQ,aAAa,MAAM;AAAA,IAAC;AAAA,IAC5B,GAAG;AAAA,EACD,IAAA,WAAW,SAAS,IAAI,IAAI,CAAA;AAEhC,QAAM,MAAM,iBAAiB;AAC7B,QAAM,iBAAiB,MAAM;;AAC3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,sBACV,SAAS;AAAA,sBACT,IAAI,OAAO;AAAA,sBAEX,8BAAC,SAAQ,EAAA;AAAA,oBAAA;AAAA,kBACX;AAAA,kBAED;AAAA,gBAAA,GACH;AAAA,cAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA,GACF;AAAA,QACC,eAAe,CAAC,aACf;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAI,OAAO;AAAA,YAEV,UAAA;AAAA,UAAA;AAAA,QACH;AAAA,QACC;AAAA,QACF,OAAO,IAAI,KACV;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAI,OAAO;AAAA,YAEV,WAAA,YAAO,IAAI,MAAX,mBAAc;AAAA,UAAA;AAAA,QACjB;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN,EAAA,CAAA;AAEJ;"}
|
|
@@ -622,6 +622,7 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
622
622
|
<div
|
|
623
623
|
className="shadow-lg border border-gray-200 rounded-xl"
|
|
624
624
|
style={{ overflowY: "visible" }}
|
|
625
|
+
data-cy={"datatable-container-" + id}
|
|
625
626
|
>
|
|
626
627
|
{showHeader && (
|
|
627
628
|
<div className="p-4 leading-9 flex ">
|
|
@@ -653,6 +654,7 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
653
654
|
: "Filtrovat podle sloupců"
|
|
654
655
|
}
|
|
655
656
|
onClick={handleToggleShowColFilters}
|
|
657
|
+
data-cy="datatable-filter-toggle"
|
|
656
658
|
>
|
|
657
659
|
{!showColFilters && <MdOutlineFilterAlt />}
|
|
658
660
|
{showColFilters && (
|
|
@@ -681,7 +683,11 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
681
683
|
</div>
|
|
682
684
|
)}
|
|
683
685
|
<div className="overflow-auto min-h-[500px]">
|
|
684
|
-
<table
|
|
686
|
+
<table
|
|
687
|
+
className="w-full leading-normal"
|
|
688
|
+
key={tableKey}
|
|
689
|
+
data-cy={"datatable-table-" + id}
|
|
690
|
+
>
|
|
685
691
|
<thead>
|
|
686
692
|
<tr>
|
|
687
693
|
{data && bulkAction && (
|
|
@@ -731,6 +737,7 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
731
737
|
onClick={() =>
|
|
732
738
|
sortParam ? requestSort(sortParam) : undefined
|
|
733
739
|
}
|
|
740
|
+
data-cy={"datatable-header-" + id + "-" + String(key)}
|
|
734
741
|
>
|
|
735
742
|
<span className="inline-flex items-center gap-2 group select-none w-full">
|
|
736
743
|
{header}{" "}
|
|
@@ -914,7 +921,7 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
914
921
|
onClick={
|
|
915
922
|
rowAction ? () => rowAction(item) : undefined
|
|
916
923
|
}
|
|
917
|
-
className={`px-3 py-
|
|
924
|
+
className={`px-3 py-2 text-gray-700 ${rowAction ? "cursor-pointer" : ""} ${
|
|
918
925
|
colIndex === 0 ? "font-medium " : ""
|
|
919
926
|
} ${classes || ""}`}
|
|
920
927
|
>
|
|
@@ -1007,6 +1014,7 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
1007
1014
|
onClick={prevPage}
|
|
1008
1015
|
className="flex items-center"
|
|
1009
1016
|
disabled={data.first || isLoading}
|
|
1017
|
+
data-cy="prev-page"
|
|
1010
1018
|
>
|
|
1011
1019
|
<MdArrowBack className="mr-1.5" /> Předchozí
|
|
1012
1020
|
</Button>
|
|
@@ -1017,6 +1025,7 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
1017
1025
|
onClick={nextPage}
|
|
1018
1026
|
className="flex items-center"
|
|
1019
1027
|
disabled={data.last || isLoading}
|
|
1028
|
+
data-cy="next-page"
|
|
1020
1029
|
>
|
|
1021
1030
|
Následující <MdArrowForward className="ml-2" size={20} />
|
|
1022
1031
|
</Button>
|
|
@@ -1025,7 +1034,10 @@ function DataTableServer<T extends DataTableInternalItems>({
|
|
|
1025
1034
|
<div className="flex items-center justify-center text-gray-800">
|
|
1026
1035
|
{paginationDisplay}
|
|
1027
1036
|
</div>
|
|
1028
|
-
<div
|
|
1037
|
+
<div
|
|
1038
|
+
className="content-center w-auto items-center justify-end flex-row gap-5 flex md:mt-0 mt-5"
|
|
1039
|
+
data-cy="items-per-page"
|
|
1040
|
+
>
|
|
1029
1041
|
<span className=" whitespace-nowrap flex-grow">
|
|
1030
1042
|
Počet řádků na stránku:
|
|
1031
1043
|
</span>
|
|
@@ -26,6 +26,7 @@ export function DatatableSettings({
|
|
|
26
26
|
className=" text-xl h-full cursor-pointer text-gray-600 hover:text-black"
|
|
27
27
|
title="Obnovit Data"
|
|
28
28
|
onClick={onSuccess}
|
|
29
|
+
data-cy="datatable-refresh"
|
|
29
30
|
>
|
|
30
31
|
<MdRefresh />
|
|
31
32
|
</div>
|
|
@@ -33,6 +34,7 @@ export function DatatableSettings({
|
|
|
33
34
|
className=" text-xl h-full cursor-pointer text-gray-600 hover:text-black"
|
|
34
35
|
title="Obnovit výchozí nastavení tabulky"
|
|
35
36
|
onClick={() => refreshTable()}
|
|
37
|
+
data-cy="datatable-refresh-default"
|
|
36
38
|
>
|
|
37
39
|
<TiArrowBackOutline />
|
|
38
40
|
</div>
|
|
@@ -40,6 +42,7 @@ export function DatatableSettings({
|
|
|
40
42
|
className=" text-xl h-full cursor-pointer text-gray-600 hover:text-black"
|
|
41
43
|
title="Stáhnout jako XLS soubor"
|
|
42
44
|
onClick={onExport}
|
|
45
|
+
data-cy="datatable-export"
|
|
43
46
|
>
|
|
44
47
|
<PiFileXlsLight />
|
|
45
48
|
</div>{" "}
|