@stella-source/stellasource-dsl 5.1.1 → 5.3.0
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/README.md +13 -0
- package/dist/cjs/index.js +72 -25
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/Table/types.d.ts +0 -1
- package/dist/cjs/types/components/Table/useTableState.d.ts +2 -1
- package/dist/cjs/types/components/TextField/NumberInput/NumberInput.d.ts +1 -1
- package/dist/cjs/types/components/TextField/NumberInput/types.d.ts +1 -0
- package/dist/cjs/types/components/TextField/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/cjs/types/components/TextField/PasswordInput/types.d.ts +1 -0
- package/dist/cjs/types/components/TextField/TextFieldContainer.d.ts +1 -1
- package/dist/cjs/types/components/TextField/TextInput/TextInput.d.ts +1 -1
- package/dist/cjs/types/components/TextField/TextInput/types.d.ts +1 -0
- package/dist/cjs/types/components/TextField/styles.d.ts +8 -2
- package/dist/cjs/types/components/TextField/types.d.ts +1 -0
- package/dist/esm/index.esm.js +72 -25
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/types/components/Table/types.d.ts +0 -1
- package/dist/esm/types/components/Table/useTableState.d.ts +2 -1
- package/dist/esm/types/components/TextField/NumberInput/NumberInput.d.ts +1 -1
- package/dist/esm/types/components/TextField/NumberInput/types.d.ts +1 -0
- package/dist/esm/types/components/TextField/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/esm/types/components/TextField/PasswordInput/types.d.ts +1 -0
- package/dist/esm/types/components/TextField/TextFieldContainer.d.ts +1 -1
- package/dist/esm/types/components/TextField/TextInput/TextInput.d.ts +1 -1
- package/dist/esm/types/components/TextField/TextInput/types.d.ts +1 -0
- package/dist/esm/types/components/TextField/styles.d.ts +8 -2
- package/dist/esm/types/components/TextField/types.d.ts +1 -0
- package/dist/index.d.ts +6 -4
- package/package.json +2 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ColumnSizingState, SortingState, VisibilityState } from "@tanstack/react-table";
|
|
1
|
+
import { ColumnFiltersState, ColumnSizingState, SortingState, VisibilityState } from "@tanstack/react-table";
|
|
2
2
|
type PersistedTableState = {
|
|
3
3
|
columnVisibility: VisibilityState;
|
|
4
4
|
columnSizing: ColumnSizingState;
|
|
5
5
|
sorting: SortingState;
|
|
6
|
+
columnFilters: ColumnFiltersState;
|
|
6
7
|
};
|
|
7
8
|
export declare function loadTableState(tableId: string): Partial<PersistedTableState>;
|
|
8
9
|
export declare function usePersistTableState(tableId: string, state: Partial<PersistedTableState>, sizingDebounceMs?: number): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { NumberInputProps } from "./types";
|
|
3
|
-
declare const NumberInput: ({ id, className, htmlProps, leftCategory, rightCategory, label, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, endIcon, placeholder, textAlign, isTruncated, helperTextAffectLayout, hideLabel, disabled, isLoading, hasError, thousandSeparator, decimalPlaces, allowNegativeNumbers, ariaDescribedBy, enableAutocomplete, isDegrees, }: NumberInputProps) => React.JSX.Element;
|
|
3
|
+
declare const NumberInput: ({ id, className, htmlProps, leftCategory, rightCategory, label, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, endIcon, placeholder, textAlign, isTruncated, helperTextAffectLayout, hideLabel, disabled, isLoading, hasError, thousandSeparator, decimalPlaces, allowNegativeNumbers, ariaDescribedBy, enableAutocomplete, isDegrees, labelPosition, }: NumberInputProps) => React.JSX.Element;
|
|
4
4
|
export default NumberInput;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PasswordInputProps } from "./types";
|
|
3
|
-
declare const PasswordInput: ({ id, className, htmlProps, label, placeholder, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, textAlign, isHidden, helperTextAffectLayout, hideLabel, disabled, hasError, ariaDescribedBy, enableAutocomplete, }: PasswordInputProps) => React.JSX.Element;
|
|
3
|
+
declare const PasswordInput: ({ id, className, htmlProps, label, placeholder, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, textAlign, isHidden, helperTextAffectLayout, hideLabel, disabled, hasError, ariaDescribedBy, enableAutocomplete, labelPosition, }: PasswordInputProps) => React.JSX.Element;
|
|
4
4
|
export default PasswordInput;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TextFieldContainerProps } from "./types";
|
|
3
|
-
declare const TextFieldContainer: ({ id, label, children, tooltipText, endIcon, className, rightCategory, leftCategory, helperText, dataTestId, helperTextAffectLayout, disabled, hideLabel, isLoading, hasError, isRequired, }: TextFieldContainerProps) => React.JSX.Element;
|
|
3
|
+
declare const TextFieldContainer: ({ id, label, children, tooltipText, endIcon, className, rightCategory, leftCategory, helperText, dataTestId, helperTextAffectLayout, disabled, hideLabel, isLoading, hasError, isRequired, labelPosition, }: TextFieldContainerProps) => React.JSX.Element;
|
|
4
4
|
export default TextFieldContainer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TextInputProps } from "./types";
|
|
3
|
-
declare const TextInput: ({ id, className, htmlProps, label, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, endIcon, placeholder, textAlign, helperTextAffectLayout, hideLabel, disabled, hasError, isLoading, ariaDescribedBy, enableAutocomplete, }: TextInputProps) => React.JSX.Element;
|
|
3
|
+
declare const TextInput: ({ id, className, htmlProps, label, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, endIcon, placeholder, textAlign, helperTextAffectLayout, hideLabel, disabled, hasError, isLoading, ariaDescribedBy, enableAutocomplete, labelPosition, }: TextInputProps) => React.JSX.Element;
|
|
4
4
|
export default TextInput;
|
|
@@ -4,14 +4,20 @@ interface TextFieldInputProps {
|
|
|
4
4
|
$isDisabled?: boolean;
|
|
5
5
|
$isLoading?: boolean;
|
|
6
6
|
}
|
|
7
|
+
interface WrapperProps {
|
|
8
|
+
$labelPosition?: "top" | "left";
|
|
9
|
+
}
|
|
7
10
|
interface TextFieldWrapperProps {
|
|
8
11
|
$isDisabled?: boolean;
|
|
9
12
|
$hasError?: boolean;
|
|
10
13
|
$isLoading?: boolean;
|
|
14
|
+
$labelPosition?: "top" | "left";
|
|
11
15
|
}
|
|
12
|
-
declare const Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
16
|
+
declare const Wrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$labelPosition"> & WrapperProps, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$labelPosition"> & WrapperProps, never>>> & string;
|
|
17
|
+
declare const InputColumn: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
18
|
+
declare const LabelAligner: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
13
19
|
declare const TextFieldWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>> & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, keyof TextFieldWrapperProps> & TextFieldWrapperProps, "className"> & Partial<Pick<import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>> & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, keyof TextFieldWrapperProps> & TextFieldWrapperProps, "className">>> & string;
|
|
14
20
|
declare const TextFieldInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, keyof TextFieldInputProps> & TextFieldInputProps, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, keyof TextFieldInputProps> & TextFieldInputProps, never>>> & string;
|
|
15
21
|
declare const Category: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
16
22
|
declare const IconContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
17
|
-
export { Wrapper, TextFieldWrapper, TextFieldInput, Category, IconContainer };
|
|
23
|
+
export { Wrapper, InputColumn, LabelAligner, TextFieldWrapper, TextFieldInput, Category, IconContainer, };
|
package/dist/esm/index.esm.js
CHANGED
|
@@ -18157,12 +18157,24 @@ const IconButton = forwardRef(({ iconName, onClick, disabled, variant = "primary
|
|
|
18157
18157
|
|
|
18158
18158
|
const Wrapper = styled.div `
|
|
18159
18159
|
display: flex;
|
|
18160
|
-
flex-direction: column;
|
|
18160
|
+
flex-direction: ${({ $labelPosition }) => $labelPosition === "left" ? "row" : "column"};
|
|
18161
|
+
align-items: ${({ $labelPosition }) => $labelPosition === "left" ? "flex-start" : "stretch"};
|
|
18162
|
+
gap: ${({ $labelPosition }) => ($labelPosition === "left" ? "10px" : "0")};
|
|
18161
18163
|
min-width: 60px;
|
|
18162
18164
|
max-width: 400px;
|
|
18163
18165
|
position: relative;
|
|
18164
18166
|
width: 100%;
|
|
18165
18167
|
`;
|
|
18168
|
+
const InputColumn = styled.div `
|
|
18169
|
+
display: flex;
|
|
18170
|
+
flex-direction: column;
|
|
18171
|
+
flex: 1;
|
|
18172
|
+
`;
|
|
18173
|
+
const LabelAligner = styled.div `
|
|
18174
|
+
height: 32px;
|
|
18175
|
+
display: flex;
|
|
18176
|
+
align-items: center;
|
|
18177
|
+
`;
|
|
18166
18178
|
const TextFieldWrapper = styled.div.attrs({
|
|
18167
18179
|
className: "DSL-stella-textfield",
|
|
18168
18180
|
}) `
|
|
@@ -18174,7 +18186,7 @@ const TextFieldWrapper = styled.div.attrs({
|
|
|
18174
18186
|
border: 1px solid ${Styles.color.grey.medium};
|
|
18175
18187
|
border-radius: 6px;
|
|
18176
18188
|
overflow: hidden;
|
|
18177
|
-
margin-top: 3px;
|
|
18189
|
+
margin-top: ${({ $labelPosition }) => $labelPosition === "left" ? "0" : "3px"};
|
|
18178
18190
|
background-color: ${({ $isDisabled }) => $isDisabled ? Styles.color.grey.pale : "white"};
|
|
18179
18191
|
outline: ${({ $hasError }) => $hasError && `${Styles.color.states.error} auto 1px`};
|
|
18180
18192
|
cursor: ${({ $isDisabled, $isLoading }) => {
|
|
@@ -18233,10 +18245,9 @@ const IconContainer = styled.div `
|
|
|
18233
18245
|
margin-right: 5px;
|
|
18234
18246
|
`;
|
|
18235
18247
|
|
|
18236
|
-
const TextFieldContainer = ({ id, label, children, tooltipText, endIcon, className, rightCategory, leftCategory, helperText, dataTestId, helperTextAffectLayout = true, disabled = false, hideLabel = false, isLoading = false, hasError = false, isRequired = false, }) => {
|
|
18237
|
-
|
|
18238
|
-
a__default.createElement(
|
|
18239
|
-
a__default.createElement(TextFieldWrapper, { id: id, "$hasError": hasError, "$isDisabled": disabled, "$isLoading": isLoading, "data-testid": "text-input-wrapper" },
|
|
18248
|
+
const TextFieldContainer = ({ id, label, children, tooltipText, endIcon, className, rightCategory, leftCategory, helperText, dataTestId, helperTextAffectLayout = true, disabled = false, hideLabel = false, isLoading = false, hasError = false, isRequired = false, labelPosition = "top", }) => {
|
|
18249
|
+
const inputAndHelper = (a__default.createElement(a__default.Fragment, null,
|
|
18250
|
+
a__default.createElement(TextFieldWrapper, { id: id, "$hasError": hasError, "$isDisabled": disabled, "$isLoading": isLoading, "$labelPosition": labelPosition, "data-testid": "text-input-wrapper" },
|
|
18240
18251
|
leftCategory && a__default.createElement(Category, null, leftCategory),
|
|
18241
18252
|
children,
|
|
18242
18253
|
isLoading && (a__default.createElement(IconContainer, null,
|
|
@@ -18245,9 +18256,13 @@ const TextFieldContainer = ({ id, label, children, tooltipText, endIcon, classNa
|
|
|
18245
18256
|
a__default.createElement(StellaIcon, { dataTestId: "end-icon", iconName: endIcon }))),
|
|
18246
18257
|
rightCategory && a__default.createElement(Category, null, rightCategory)),
|
|
18247
18258
|
helperText && (a__default.createElement(HelperText, { id: `${id}-helper-text`, text: helperText, affectLayout: helperTextAffectLayout, type: hasError ? "error" : "info" }))));
|
|
18259
|
+
return (a__default.createElement(Wrapper, { "data-testid": dataTestId, className: className, "$labelPosition": labelPosition },
|
|
18260
|
+
labelPosition === "left" ? (a__default.createElement(LabelAligner, null,
|
|
18261
|
+
a__default.createElement(Label, { tooltipText: tooltipText, required: isRequired, labelValue: label, hideLabel: hideLabel, id: `${id}-label`, htmlFor: `${id}-text-field` }))) : (a__default.createElement(Label, { tooltipText: tooltipText, required: isRequired, labelValue: label, hideLabel: hideLabel, id: `${id}-label`, htmlFor: `${id}-text-field` })),
|
|
18262
|
+
labelPosition === "left" ? (a__default.createElement(InputColumn, null, inputAndHelper)) : (inputAndHelper)));
|
|
18248
18263
|
};
|
|
18249
18264
|
|
|
18250
|
-
const TextInput = ({ id, className, htmlProps, label, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, endIcon, placeholder = "", textAlign = "left", helperTextAffectLayout = true, hideLabel = false, disabled = false, hasError = false, isLoading = false, ariaDescribedBy, enableAutocomplete = false, }) => {
|
|
18265
|
+
const TextInput = ({ id, className, htmlProps, label, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, endIcon, placeholder = "", textAlign = "left", helperTextAffectLayout = true, hideLabel = false, disabled = false, hasError = false, isLoading = false, ariaDescribedBy, enableAutocomplete = false, labelPosition, }) => {
|
|
18251
18266
|
const containerProps = {
|
|
18252
18267
|
id,
|
|
18253
18268
|
label,
|
|
@@ -18263,6 +18278,7 @@ const TextInput = ({ id, className, htmlProps, label, onChange, onBlur, onFocus,
|
|
|
18263
18278
|
endIcon,
|
|
18264
18279
|
disabled,
|
|
18265
18280
|
isLoading,
|
|
18281
|
+
labelPosition,
|
|
18266
18282
|
};
|
|
18267
18283
|
const [inputValue, setInputValue] = useState("");
|
|
18268
18284
|
const valueToUse = value ?? inputValue;
|
|
@@ -18279,7 +18295,7 @@ const CustomIconButton$2 = styled(IconButton) `
|
|
|
18279
18295
|
margin-right: 2px;
|
|
18280
18296
|
`;
|
|
18281
18297
|
|
|
18282
|
-
const PasswordInput = ({ id, className, htmlProps, label, placeholder = "Enter Password", onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, textAlign = "left", isHidden = true, helperTextAffectLayout = true, hideLabel = false, disabled = false, hasError = false, ariaDescribedBy, enableAutocomplete = false, }) => {
|
|
18298
|
+
const PasswordInput = ({ id, className, htmlProps, label, placeholder = "Enter Password", onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, textAlign = "left", isHidden = true, helperTextAffectLayout = true, hideLabel = false, disabled = false, hasError = false, ariaDescribedBy, enableAutocomplete = false, labelPosition, }) => {
|
|
18283
18299
|
const containerProps = {
|
|
18284
18300
|
id,
|
|
18285
18301
|
label,
|
|
@@ -18293,6 +18309,7 @@ const PasswordInput = ({ id, className, htmlProps, label, placeholder = "Enter P
|
|
|
18293
18309
|
leftCategory: undefined,
|
|
18294
18310
|
hideLabel,
|
|
18295
18311
|
disabled,
|
|
18312
|
+
labelPosition,
|
|
18296
18313
|
};
|
|
18297
18314
|
const [inputValue, setInputValue] = useState("");
|
|
18298
18315
|
const [show, setShow] = useState(!isHidden);
|
|
@@ -18331,7 +18348,7 @@ const formatDynamicNumbersWithCommas = (num, decimalPlaces, isDegrees) => {
|
|
|
18331
18348
|
: "";
|
|
18332
18349
|
};
|
|
18333
18350
|
|
|
18334
|
-
const NumberInput = ({ id, className, htmlProps, leftCategory, rightCategory, label, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, endIcon, placeholder = "0", textAlign = "left", isTruncated = false, helperTextAffectLayout = true, hideLabel = false, disabled = false, isLoading = false, hasError = false, thousandSeparator = true, decimalPlaces = 0, allowNegativeNumbers = false, ariaDescribedBy, enableAutocomplete = false, isDegrees = false, }) => {
|
|
18351
|
+
const NumberInput = ({ id, className, htmlProps, leftCategory, rightCategory, label, onChange, onBlur, onFocus, value, isRequired, maxLength, tooltipText, helperText, endIcon, placeholder = "0", textAlign = "left", isTruncated = false, helperTextAffectLayout = true, hideLabel = false, disabled = false, isLoading = false, hasError = false, thousandSeparator = true, decimalPlaces = 0, allowNegativeNumbers = false, ariaDescribedBy, enableAutocomplete = false, isDegrees = false, labelPosition, }) => {
|
|
18335
18352
|
const containerProps = {
|
|
18336
18353
|
id,
|
|
18337
18354
|
label,
|
|
@@ -18347,6 +18364,7 @@ const NumberInput = ({ id, className, htmlProps, leftCategory, rightCategory, la
|
|
|
18347
18364
|
leftCategory,
|
|
18348
18365
|
hideLabel,
|
|
18349
18366
|
disabled,
|
|
18367
|
+
labelPosition,
|
|
18350
18368
|
};
|
|
18351
18369
|
const [inputValue, setInputValue] = useState("");
|
|
18352
18370
|
const [placeholderText, setPlaceholderText] = useState(placeholder);
|
|
@@ -21823,14 +21841,15 @@ function usePersistTableState(tableId, state, sizingDebounceMs = 300) {
|
|
|
21823
21841
|
useEffect(() => {
|
|
21824
21842
|
latestSizing.current = state.columnSizing;
|
|
21825
21843
|
}, [state.columnSizing]);
|
|
21826
|
-
// Persist visibility and
|
|
21844
|
+
// Persist visibility, sorting, and filters immediately
|
|
21827
21845
|
useEffect(() => {
|
|
21828
21846
|
saveTableState(tableId, {
|
|
21829
21847
|
columnVisibility: state.columnVisibility,
|
|
21830
21848
|
columnSizing: latestSizing.current,
|
|
21831
21849
|
sorting: state.sorting,
|
|
21850
|
+
columnFilters: state.columnFilters,
|
|
21832
21851
|
});
|
|
21833
|
-
}, [tableId, state.columnVisibility, state.sorting]);
|
|
21852
|
+
}, [tableId, state.columnVisibility, state.sorting, state.columnFilters]);
|
|
21834
21853
|
// Persist sizing debounced
|
|
21835
21854
|
useEffect(() => {
|
|
21836
21855
|
if (debounceTimer.current)
|
|
@@ -21840,6 +21859,7 @@ function usePersistTableState(tableId, state, sizingDebounceMs = 300) {
|
|
|
21840
21859
|
columnVisibility: state.columnVisibility,
|
|
21841
21860
|
columnSizing: latestSizing.current,
|
|
21842
21861
|
sorting: state.sorting,
|
|
21862
|
+
columnFilters: state.columnFilters,
|
|
21843
21863
|
});
|
|
21844
21864
|
}, sizingDebounceMs);
|
|
21845
21865
|
return () => {
|
|
@@ -22503,7 +22523,9 @@ const TableHeaderCell = ({ header, serverSide, filters, sorting, scrollPosition,
|
|
|
22503
22523
|
}, 300);
|
|
22504
22524
|
const displayOptions = serverSide
|
|
22505
22525
|
? filterOptions
|
|
22506
|
-
:
|
|
22526
|
+
: header.column.getCanFilter()
|
|
22527
|
+
? normalizeOptions(Array.from(header.column.getFacetedUniqueValues().keys()))
|
|
22528
|
+
: [];
|
|
22507
22529
|
useEffect(() => {
|
|
22508
22530
|
setFilterOptions(normalizeOptions(meta?.filterOptions || []));
|
|
22509
22531
|
}, [meta]);
|
|
@@ -22639,7 +22661,6 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22639
22661
|
const [localColumns, setLocalColumns] = useState(columns);
|
|
22640
22662
|
const [totalData, setTotalData] = useState(paginationDetails?.totalRows);
|
|
22641
22663
|
const [sorting, setSorting] = useState(() => loadTableState(id).sorting ?? []);
|
|
22642
|
-
const [filters, setFilters] = useState({});
|
|
22643
22664
|
const [rowState, setRowState] = useState({});
|
|
22644
22665
|
const [columnVisibility, setColumnVisibility] = useState(() => {
|
|
22645
22666
|
const persisted = loadTableState(id);
|
|
@@ -22653,7 +22674,8 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22653
22674
|
]));
|
|
22654
22675
|
});
|
|
22655
22676
|
const [columnFilters, setColumnFilters] = useState(() => {
|
|
22656
|
-
const
|
|
22677
|
+
const persisted = loadTableState(id);
|
|
22678
|
+
const base = persisted.columnFilters ?? defaultFilters ?? [];
|
|
22657
22679
|
if (!staticFilters?.length)
|
|
22658
22680
|
return base;
|
|
22659
22681
|
const merged = [...base];
|
|
@@ -22672,6 +22694,11 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22672
22694
|
});
|
|
22673
22695
|
return merged;
|
|
22674
22696
|
});
|
|
22697
|
+
const filters = useMemo$1(() => {
|
|
22698
|
+
const map = {};
|
|
22699
|
+
columnFilters.forEach((f) => (map[f.id] = f.value));
|
|
22700
|
+
return map;
|
|
22701
|
+
}, [columnFilters]);
|
|
22675
22702
|
const [columnPinning, setColumnPinning] = useState({ left: ["select"], right: ["options"] });
|
|
22676
22703
|
const scrollRef = useRef(null);
|
|
22677
22704
|
const visibilityButtonRef = useRef(null);
|
|
@@ -22708,7 +22735,13 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22708
22735
|
setLocalData(data);
|
|
22709
22736
|
if (paginationDetails && paginationDetails.startingPage !== pageIndex)
|
|
22710
22737
|
setPageIndex(paginationDetails?.startingPage);
|
|
22711
|
-
}, [
|
|
22738
|
+
}, [
|
|
22739
|
+
paginationDetails?.totalRows,
|
|
22740
|
+
paginationDetails?.startingPage,
|
|
22741
|
+
paginationDetails?.rowsPerPage,
|
|
22742
|
+
data,
|
|
22743
|
+
columns,
|
|
22744
|
+
]);
|
|
22712
22745
|
useEffect(() => {
|
|
22713
22746
|
if (!showVisibilityMenu)
|
|
22714
22747
|
return;
|
|
@@ -22788,7 +22821,7 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22788
22821
|
!table.getIsAllPageRowsSelected();
|
|
22789
22822
|
return (a__default.createElement(IndeterminateCheckbox, { isIndeterminate: isIndeterminate, isChecked: table.getIsAllPageRowsSelected(), onChange: table.getToggleAllPageRowsSelectedHandler() }));
|
|
22790
22823
|
},
|
|
22791
|
-
cell: ({ row }) => (a__default.createElement(Checkbox, { checked: row.getIsSelected(), onChange: row.getToggleSelectedHandler() })),
|
|
22824
|
+
cell: ({ row }) => (a__default.createElement(Checkbox, { checked: row.getIsSelected(), onChange: row.getToggleSelectedHandler(), onClick: (e) => e.stopPropagation() })),
|
|
22792
22825
|
size: 20,
|
|
22793
22826
|
});
|
|
22794
22827
|
}
|
|
@@ -22874,9 +22907,6 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22874
22907
|
});
|
|
22875
22908
|
}
|
|
22876
22909
|
setColumnFilters(next);
|
|
22877
|
-
const map = {};
|
|
22878
|
-
next.forEach((f) => (map[f.id] = f.value));
|
|
22879
|
-
setFilters(map);
|
|
22880
22910
|
onFilterChange?.(next);
|
|
22881
22911
|
},
|
|
22882
22912
|
filterFns: {
|
|
@@ -22887,7 +22917,7 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22887
22917
|
},
|
|
22888
22918
|
},
|
|
22889
22919
|
});
|
|
22890
|
-
usePersistTableState(id, { columnVisibility, sorting });
|
|
22920
|
+
usePersistTableState(id, { columnVisibility, sorting, columnFilters });
|
|
22891
22921
|
useEffect(() => {
|
|
22892
22922
|
if (onRowSelect) {
|
|
22893
22923
|
const selectedData = table
|
|
@@ -22896,6 +22926,12 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22896
22926
|
onRowSelect?.(selectedData);
|
|
22897
22927
|
}
|
|
22898
22928
|
}, [rowSelection]);
|
|
22929
|
+
const initialColumnFilters = useRef(columnFilters);
|
|
22930
|
+
useEffect(() => {
|
|
22931
|
+
if (initialColumnFilters.current.length > 0) {
|
|
22932
|
+
onFilterChange?.(initialColumnFilters.current);
|
|
22933
|
+
}
|
|
22934
|
+
}, []);
|
|
22899
22935
|
const isMounted = useRef(false);
|
|
22900
22936
|
useEffect(() => {
|
|
22901
22937
|
if (!isMounted.current) {
|
|
@@ -22905,8 +22941,9 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22905
22941
|
resetTable();
|
|
22906
22942
|
}, [resetTrigger]);
|
|
22907
22943
|
const resetTable = () => {
|
|
22908
|
-
|
|
22909
|
-
|
|
22944
|
+
const resetFilters = staticFilters ?? [];
|
|
22945
|
+
setColumnFilters(resetFilters);
|
|
22946
|
+
onFilterChange?.(resetFilters);
|
|
22910
22947
|
setSorting([]);
|
|
22911
22948
|
setPageIndex(1);
|
|
22912
22949
|
setPagination({
|
|
@@ -22915,6 +22952,8 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22915
22952
|
});
|
|
22916
22953
|
table.toggleAllRowsSelected(false);
|
|
22917
22954
|
};
|
|
22955
|
+
const hasActiveFilters = Object.keys(filters).length > (staticFilters?.length ?? 0) &&
|
|
22956
|
+
Object.values(filters).some((v) => v?.length);
|
|
22918
22957
|
return (a__default.createElement(a__default.Fragment, null,
|
|
22919
22958
|
!isLoading && (a__default.createElement(ActionBar, null,
|
|
22920
22959
|
a__default.createElement(GlobalActionWrapper, null, globalActions?.(table)),
|
|
@@ -22979,7 +23018,8 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22979
23018
|
}, key: index + "loading-row" }, Array.from({
|
|
22980
23019
|
length: 10,
|
|
22981
23020
|
}).map((_, i) => (a__default.createElement(LoadingShimmer, { key: `${i}-loading`, "$width": "110px", "$height": "25px" }))))))))) : (a__default.createElement(StyledTable, { id: `${id}-table`, ...htmlProps },
|
|
22982
|
-
a__default.createElement("thead", null, table.getHeaderGroups().map((headerGroup) => (a__default.createElement(HeaderRow, { key: headerGroup.id, "$isEmpty": table.
|
|
23021
|
+
a__default.createElement("thead", null, table.getHeaderGroups().map((headerGroup) => (a__default.createElement(HeaderRow, { key: headerGroup.id, "$isEmpty": table.getCoreRowModel().rows.length === 0 &&
|
|
23022
|
+
!hasActiveFilters }, headerGroup.headers.map((header, i) => {
|
|
22983
23023
|
return (a__default.createElement(TableHeaderCell, { key: header.id, serverSide: serverSide, header: header, filters: filters, sorting: sorting, scrollPosition: scrollState, onFilterMenuInteraction: (id, active) => {
|
|
22984
23024
|
setFilterMenuOpen((prev) => ({
|
|
22985
23025
|
...prev,
|
|
@@ -22994,14 +23034,21 @@ function Table({ columns, data, isLoading, serverSide = false, onPageChange, onS
|
|
|
22994
23034
|
} }));
|
|
22995
23035
|
}))))),
|
|
22996
23036
|
a__default.createElement("tbody", null,
|
|
22997
|
-
table.getRowModel().rows.length === 0 && (a__default.createElement(EmptyTableState, { header:
|
|
23037
|
+
table.getRowModel().rows.length === 0 && (a__default.createElement(EmptyTableState, { header: hasActiveFilters
|
|
23038
|
+
? "No results found."
|
|
23039
|
+
: emptyTableState?.header || "No data available.", subHeader: !hasActiveFilters ? emptyTableState?.subHeader : undefined, showClearFilterButton: hasActiveFilters, onClearFilters: () => {
|
|
23040
|
+
resetTable();
|
|
23041
|
+
emptyTableState?.onClearFilters?.();
|
|
23042
|
+
}, colSpan: table.getVisibleLeafColumns().length, size: "large" })),
|
|
22998
23043
|
table.getRowModel().rows.map((row) => (a__default.createElement(a__default.Fragment, { key: row.id },
|
|
22999
23044
|
a__default.createElement(CellRow, { onClick: () => {
|
|
23045
|
+
if (showSelection)
|
|
23046
|
+
row.toggleSelected();
|
|
23000
23047
|
if (!showExpandedRowToggle &&
|
|
23001
23048
|
!!renderExpandedRow?.(row))
|
|
23002
23049
|
toggleRowExpanded(row.id);
|
|
23003
23050
|
onRowClick?.(row.original);
|
|
23004
|
-
}, "$isClickable": !!onRowClick }, row.getVisibleCells().map((cell) => {
|
|
23051
|
+
}, "$isClickable": !!onRowClick || showSelection }, row.getVisibleCells().map((cell) => {
|
|
23005
23052
|
const value = flexRender(cell.column.columnDef.cell, {
|
|
23006
23053
|
...cell.getContext(),
|
|
23007
23054
|
localValue: rowState[row.id]?.[cell.column.id],
|