@hitachivantara/uikit-react-core 5.39.2 → 5.39.3
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/cjs/components/Button/Button.cjs +0 -1
- package/dist/cjs/components/Button/Button.cjs.map +1 -1
- package/dist/cjs/components/Table/hooks/useBulkActions.cjs +12 -14
- package/dist/cjs/components/Table/hooks/useBulkActions.cjs.map +1 -1
- package/dist/esm/components/Button/Button.js +0 -1
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/Table/hooks/useBulkActions.js +12 -14
- package/dist/esm/components/Table/hooks/useBulkActions.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.cjs","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement } from \"react\";\n\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { PolymorphicComponentRef, PolymorphicRef } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport {\n staticClasses as buttonClasses,\n getOverrideColors,\n getRadiusStyles,\n getSizeStyles,\n useClasses,\n} from \"./Button.styles\";\nimport { HvButtonRadius, HvButtonSize, HvButtonVariant } from \"./types\";\n\nexport { buttonClasses };\n\nexport type HvButtonClasses = ExtractNames<typeof useClasses>;\n\nexport type HvButtonProps<C extends React.ElementType = \"button\"> =\n PolymorphicComponentRef<\n C,\n {\n /** Use the variant prop to change the visual style of the Button. */\n variant?: HvButtonVariant;\n /** Whether the Button is an icon-only button. */\n icon?: boolean;\n /** Whether the Button is disabled or not. */\n disabled?: boolean;\n /** Class names to be applied. */\n className?: string;\n /** Element placed before the children. */\n startIcon?: ReactElement;\n /** Element placed after the children. */\n endIcon?: ReactElement;\n /** Button size. */\n size?: HvButtonSize;\n /** Button border radius. */\n radius?: HvButtonRadius;\n /** Defines the default colors of the button are forced into the icon. */\n overrideIconColors?: boolean;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvButtonClasses;\n /** Whether the Button is selected or not. */\n selected?: boolean;\n }\n >;\n\n/**\n * Normalize the button variant. It's meant to give us some retro-compatibility with\n * the DS 3.6 API.\n * @returns the normalized variant in DS 5 API\n */\nconst mapVariant = (\n variant: HvButtonVariant,\n theme?: string\n): HvButtonVariant => {\n if (theme === \"ds3\") return variant;\n\n const deprecatedVariantMap: Record<string, HvButtonVariant> = {\n secondary: \"secondarySubtle\",\n ghost: \"primaryGhost\",\n };\n\n const mappedVariant = deprecatedVariantMap[variant];\n\n if (import.meta.env.DEV && mappedVariant) {\n // eslint-disable-next-line no-console\n console.warn(\n `Button variant '${variant}' is deprecated. Please use '${mappedVariant}'.`\n );\n }\n\n return mappedVariant || variant;\n};\n\n/**\n * Button component is used to trigger an action or event.\n */\nexport const HvButton: <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>\n) => React.ReactElement | null = forwardRef(\n <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>,\n ref: PolymorphicRef<C>\n ) => {\n const {\n
|
|
1
|
+
{"version":3,"file":"Button.cjs","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement } from \"react\";\n\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { PolymorphicComponentRef, PolymorphicRef } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport {\n staticClasses as buttonClasses,\n getOverrideColors,\n getRadiusStyles,\n getSizeStyles,\n useClasses,\n} from \"./Button.styles\";\nimport { HvButtonRadius, HvButtonSize, HvButtonVariant } from \"./types\";\n\nexport { buttonClasses };\n\nexport type HvButtonClasses = ExtractNames<typeof useClasses>;\n\nexport type HvButtonProps<C extends React.ElementType = \"button\"> =\n PolymorphicComponentRef<\n C,\n {\n /** Use the variant prop to change the visual style of the Button. */\n variant?: HvButtonVariant;\n /** Whether the Button is an icon-only button. */\n icon?: boolean;\n /** Whether the Button is disabled or not. */\n disabled?: boolean;\n /** Class names to be applied. */\n className?: string;\n /** Element placed before the children. */\n startIcon?: ReactElement;\n /** Element placed after the children. */\n endIcon?: ReactElement;\n /** Button size. */\n size?: HvButtonSize;\n /** Button border radius. */\n radius?: HvButtonRadius;\n /** Defines the default colors of the button are forced into the icon. */\n overrideIconColors?: boolean;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvButtonClasses;\n /** Whether the Button is selected or not. */\n selected?: boolean;\n }\n >;\n\n/**\n * Normalize the button variant. It's meant to give us some retro-compatibility with\n * the DS 3.6 API.\n * @returns the normalized variant in DS 5 API\n */\nconst mapVariant = (\n variant: HvButtonVariant,\n theme?: string\n): HvButtonVariant => {\n if (theme === \"ds3\") return variant;\n\n const deprecatedVariantMap: Record<string, HvButtonVariant> = {\n secondary: \"secondarySubtle\",\n ghost: \"primaryGhost\",\n };\n\n const mappedVariant = deprecatedVariantMap[variant];\n\n if (import.meta.env.DEV && mappedVariant) {\n // eslint-disable-next-line no-console\n console.warn(\n `Button variant '${variant}' is deprecated. Please use '${mappedVariant}'.`\n );\n }\n\n return mappedVariant || variant;\n};\n\n/**\n * Button component is used to trigger an action or event.\n */\nexport const HvButton: <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>\n) => React.ReactElement | null = forwardRef(\n <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>,\n ref: PolymorphicRef<C>\n ) => {\n const {\n classes: classesProp,\n children,\n variant: variantProp,\n disabled = false,\n className,\n startIcon,\n endIcon,\n icon = false,\n size,\n radius,\n overrideIconColors = true,\n component: Component = \"button\",\n ...others\n } = useDefaultProps(\"HvButton\", props);\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n const variant = mapVariant(\n variantProp ?? (icon ? \"secondaryGhost\" : \"primary\"),\n activeTheme?.name\n );\n\n return (\n <Component\n ref={ref}\n className={cx(\n classes.root,\n classes[variant],\n size && css(getSizeStyles(size)),\n radius && css(getRadiusStyles(radius)),\n overrideIconColors && css(getOverrideColors()),\n {\n [classes.icon]: icon,\n [classes.disabled]: disabled,\n },\n className\n )}\n {...(Component === \"button\" && { type: \"button\" })}\n {...(disabled && {\n disabled: true,\n tabIndex: -1,\n \"aria-disabled\": true,\n })}\n {...others}\n >\n {startIcon && <span className={classes.startIcon}>{startIcon}</span>}\n {children}\n {endIcon && <span className={classes.endIcon}>{endIcon}</span>}\n </Component>\n );\n }\n);\n"],"names":["forwardRef","useDefaultProps","useClasses","useTheme","jsxs","getSizeStyles","getRadiusStyles","getOverrideColors","jsx"],"mappings":";;;;;;;AAsDA,MAAM,aAAa,CACjB,SACA,UACoB;AACpB,MAAI,UAAU;AAAc,WAAA;AAE5B,QAAM,uBAAwD;AAAA,IAC5D,WAAW;AAAA,IACX,OAAO;AAAA,EAAA;AAGH,QAAA,gBAAgB,qBAAqB,OAAO;AASlD,SAAO,iBAAiB;AAC1B;AAKO,MAAM,WAEoBA,MAAA;AAAA,EAC/B,CACE,OACA,QACG;AACG,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA,SAAS;AAAA,MACT,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA,qBAAqB;AAAA,MACrB,WAAW,YAAY;AAAA,MACvB,GAAG;AAAA,IAAA,IACDC,gBAAgB,gBAAA,YAAY,KAAK;AACrC,UAAM,EAAE,SAAS,KAAK,GAAG,IAAIC,cAAAA,WAAW,WAAW;AAC7C,UAAA,EAAE,gBAAgBC,SAAAA;AACxB,UAAM,UAAU;AAAA,MACd,gBAAgB,OAAO,mBAAmB;AAAA,MAC1C,aAAa;AAAA,IAAA;AAIb,WAAAC,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT,QAAQ;AAAA,UACR,QAAQ,OAAO;AAAA,UACf,QAAQ,IAAIC,4BAAc,IAAI,CAAC;AAAA,UAC/B,UAAU,IAAIC,8BAAgB,MAAM,CAAC;AAAA,UACrC,sBAAsB,IAAIC,cAAAA,mBAAmB;AAAA,UAC7C;AAAA,YACE,CAAC,QAAQ,IAAI,GAAG;AAAA,YAChB,CAAC,QAAQ,QAAQ,GAAG;AAAA,UACtB;AAAA,UACA;AAAA,QACF;AAAA,QACC,GAAI,cAAc,YAAY,EAAE,MAAM,SAAS;AAAA,QAC/C,GAAI,YAAY;AAAA,UACf,UAAU;AAAA,UACV,UAAU;AAAA,UACV,iBAAiB;AAAA,QACnB;AAAA,QACC,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA,aAAcC,2BAAAA,IAAA,QAAA,EAAK,WAAW,QAAQ,WAAY,UAAU,WAAA;AAAA,UAC5D;AAAA,UACA,WAAYA,2BAAAA,IAAA,QAAA,EAAK,WAAW,QAAQ,SAAU,UAAQ,SAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG7D;AACF;;;"}
|
|
@@ -17,31 +17,31 @@ const useInstanceHook = (instance) => {
|
|
|
17
17
|
if (!isPaginated)
|
|
18
18
|
return toggleAllRowsSelected();
|
|
19
19
|
const {
|
|
20
|
-
aditivePageBulkSelection,
|
|
20
|
+
aditivePageBulkSelection: additivePageBulkSelection,
|
|
21
21
|
subtractivePageBulkDeselection,
|
|
22
22
|
isNoRowsSelected,
|
|
23
23
|
isNoPageRowsSelected,
|
|
24
24
|
isAllSelectablePageRowsSelected,
|
|
25
25
|
isAllSelectablePageRowsUnselected
|
|
26
26
|
} = getInstance();
|
|
27
|
-
if (
|
|
27
|
+
if (additivePageBulkSelection && subtractivePageBulkDeselection) {
|
|
28
28
|
return toggleAllPageRowsSelected(!isAllSelectablePageRowsSelected);
|
|
29
29
|
}
|
|
30
|
-
if (
|
|
30
|
+
if (additivePageBulkSelection && !subtractivePageBulkDeselection) {
|
|
31
31
|
if (!isAllSelectablePageRowsSelected) {
|
|
32
|
-
return toggleAllPageRowsSelected();
|
|
32
|
+
return toggleAllPageRowsSelected(true);
|
|
33
33
|
}
|
|
34
34
|
return toggleAllRowsSelected(false);
|
|
35
35
|
}
|
|
36
|
-
if (!
|
|
36
|
+
if (!additivePageBulkSelection && !subtractivePageBulkDeselection) {
|
|
37
37
|
if (isNoRowsSelected) {
|
|
38
|
-
return toggleAllPageRowsSelected();
|
|
38
|
+
return toggleAllPageRowsSelected(true);
|
|
39
39
|
}
|
|
40
40
|
return toggleAllRowsSelected(false);
|
|
41
41
|
}
|
|
42
|
-
if (!
|
|
42
|
+
if (!additivePageBulkSelection && subtractivePageBulkDeselection) {
|
|
43
43
|
if (isNoRowsSelected) {
|
|
44
|
-
return toggleAllPageRowsSelected();
|
|
44
|
+
return toggleAllPageRowsSelected(true);
|
|
45
45
|
}
|
|
46
46
|
if (!isAllSelectablePageRowsUnselected) {
|
|
47
47
|
return toggleAllPageRowsSelected(false);
|
|
@@ -58,13 +58,11 @@ const useInstanceHook = (instance) => {
|
|
|
58
58
|
toggleAllPageRowsSelected,
|
|
59
59
|
toggleAllRowsSelected
|
|
60
60
|
]);
|
|
61
|
-
const aditive = instance.aditivePageBulkSelection === true;
|
|
62
|
-
const subtractive = instance.subtractivePageBulkDeselection === true;
|
|
63
61
|
Object.assign(instance, {
|
|
64
62
|
getHvBulkActionsProps,
|
|
65
63
|
invertedToggleAllRowsSelected,
|
|
66
|
-
aditivePageBulkSelection:
|
|
67
|
-
subtractivePageBulkDeselection:
|
|
64
|
+
aditivePageBulkSelection: !!instance.aditivePageBulkSelection,
|
|
65
|
+
subtractivePageBulkDeselection: !!instance.subtractivePageBulkDeselection
|
|
68
66
|
});
|
|
69
67
|
};
|
|
70
68
|
const defaultgetHvBulkActionsProps = (props, { instance }) => {
|
|
@@ -81,8 +79,8 @@ const defaultgetHvBulkActionsProps = (props, { instance }) => {
|
|
|
81
79
|
} = instance;
|
|
82
80
|
const isPaginated = !!page;
|
|
83
81
|
const nextProps = {
|
|
84
|
-
numTotal: applyToggleAllRowsSelectedToPrefilteredRows
|
|
85
|
-
numSelected: applyToggleAllRowsSelectedToPrefilteredRows
|
|
82
|
+
numTotal: applyToggleAllRowsSelectedToPrefilteredRows ? initialRows.length : rows.length,
|
|
83
|
+
numSelected: applyToggleAllRowsSelectedToPrefilteredRows ? Object.keys(selectedRowIds).length : selectedFlatRows.length,
|
|
86
84
|
showSelectAllPages: showSelectAllPages && isPaginated,
|
|
87
85
|
onSelectAll: invertedToggleAllRowsSelected,
|
|
88
86
|
onSelectAllPages: toggleAllRowsSelected
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBulkActions.cjs","sources":["../../../../../src/components/Table/hooks/useBulkActions.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport {\n Hooks,\n PropGetter,\n TableCommonProps,\n makePropGetter,\n useGetLatest,\n ensurePluginOrder,\n} from \"react-table\";\n\n// #region ##### TYPES #####\n\nexport interface HvTAbleBulkActionsProps extends TableCommonProps {\n numTotal: number;\n numSelected: number;\n showSelectAllPages: boolean;\n onSelectAll: () => void;\n onSelectAllPages: () => void;\n labels?: Record<string, string>;\n}\n\nexport type HvBulkActionsPropGetter<D extends object> = PropGetter<\n D,\n HvTAbleBulkActionsProps\n>;\n\nexport interface UseHvBulkActionsHooks<D extends object> {\n getHvBulkActionsProps: Array<HvBulkActionsPropGetter<D>>;\n}\n\nexport type UseHvBulkActionsTableOptions = {\n aditivePageBulkSelection?: boolean;\n subtractivePageBulkDeselection?: boolean;\n showSelectAllPages?: boolean;\n};\n\nexport interface UseHvBulkActionsTableInstanceProps<D extends object> {\n getHvBulkActionsProps: (\n propGetter?: HvBulkActionsPropGetter<D>\n ) => HvTAbleBulkActionsProps;\n invertedToggleAllRowsSelected: () => void;\n}\n\nexport type UseBulkActionsProps = (<D extends object = Record<string, unknown>>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\nconst useInstanceHook = (instance) => {\n const { plugins, page, toggleAllPageRowsSelected, toggleAllRowsSelected } =\n instance;\n\n ensurePluginOrder(plugins, [\"useHvRowSelection\"], \"useHvBulkActions\");\n\n const getInstance = useGetLatest(instance);\n\n const getHvBulkActionsProps = makePropGetter(\n instance.getHooks().getHvBulkActionsProps,\n {\n instance: getInstance(),\n }\n );\n\n const isPaginated = !!page;\n\n const invertedToggleAllRowsSelected = useCallback(() => {\n if (!isPaginated) return toggleAllRowsSelected();\n\n const {\n aditivePageBulkSelection,\n subtractivePageBulkDeselection,\n isNoRowsSelected,\n isNoPageRowsSelected,\n isAllSelectablePageRowsSelected,\n isAllSelectablePageRowsUnselected,\n } = getInstance();\n\n if (
|
|
1
|
+
{"version":3,"file":"useBulkActions.cjs","sources":["../../../../../src/components/Table/hooks/useBulkActions.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport {\n Hooks,\n PropGetter,\n TableCommonProps,\n makePropGetter,\n useGetLatest,\n ensurePluginOrder,\n} from \"react-table\";\n\n// #region ##### TYPES #####\n\n// TODO: fix typo in v6\nexport interface HvTAbleBulkActionsProps extends TableCommonProps {\n numTotal: number;\n numSelected: number;\n showSelectAllPages: boolean;\n onSelectAll: () => void;\n onSelectAllPages: () => void;\n labels?: Record<string, string>;\n}\n\nexport type HvBulkActionsPropGetter<D extends object> = PropGetter<\n D,\n HvTAbleBulkActionsProps\n>;\n\nexport interface UseHvBulkActionsHooks<D extends object> {\n getHvBulkActionsProps: Array<HvBulkActionsPropGetter<D>>;\n}\n\nexport type UseHvBulkActionsTableOptions = {\n // TODO: fix typo in v6\n /** Controls whether the \"Select all\" should _select_ or _unselect_ the rows, in a partial selection state. */\n aditivePageBulkSelection?: boolean;\n /** Controls whether _only the current page_ or _all pages_ should be unselected */\n subtractivePageBulkDeselection?: boolean;\n showSelectAllPages?: boolean;\n};\n\nexport interface UseHvBulkActionsTableInstanceProps<D extends object> {\n getHvBulkActionsProps: (\n propGetter?: HvBulkActionsPropGetter<D>\n ) => HvTAbleBulkActionsProps;\n invertedToggleAllRowsSelected: () => void;\n}\n\nexport type UseBulkActionsProps = (<D extends object = Record<string, unknown>>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\nconst useInstanceHook = (instance) => {\n const { plugins, page, toggleAllPageRowsSelected, toggleAllRowsSelected } =\n instance;\n\n ensurePluginOrder(plugins, [\"useHvRowSelection\"], \"useHvBulkActions\");\n\n const getInstance = useGetLatest(instance);\n\n const getHvBulkActionsProps = makePropGetter(\n instance.getHooks().getHvBulkActionsProps,\n {\n instance: getInstance(),\n }\n );\n\n const isPaginated = !!page;\n\n const invertedToggleAllRowsSelected = useCallback(() => {\n if (!isPaginated) return toggleAllRowsSelected();\n\n const {\n aditivePageBulkSelection: additivePageBulkSelection,\n subtractivePageBulkDeselection,\n isNoRowsSelected,\n isNoPageRowsSelected,\n isAllSelectablePageRowsSelected,\n isAllSelectablePageRowsUnselected,\n } = getInstance();\n\n if (additivePageBulkSelection && subtractivePageBulkDeselection) {\n return toggleAllPageRowsSelected(!isAllSelectablePageRowsSelected);\n }\n\n if (additivePageBulkSelection && !subtractivePageBulkDeselection) {\n if (!isAllSelectablePageRowsSelected) {\n return toggleAllPageRowsSelected(true);\n }\n\n return toggleAllRowsSelected(false);\n }\n\n if (!additivePageBulkSelection && !subtractivePageBulkDeselection) {\n if (isNoRowsSelected) {\n return toggleAllPageRowsSelected(true);\n }\n\n return toggleAllRowsSelected(false);\n }\n\n if (!additivePageBulkSelection && subtractivePageBulkDeselection) {\n if (isNoRowsSelected) {\n return toggleAllPageRowsSelected(true);\n }\n if (!isAllSelectablePageRowsUnselected) {\n return toggleAllPageRowsSelected(false);\n }\n if (!isNoPageRowsSelected) {\n return toggleAllPageRowsSelected(false);\n }\n\n return toggleAllRowsSelected(false);\n }\n\n return toggleAllPageRowsSelected();\n }, [\n getInstance,\n isPaginated,\n toggleAllPageRowsSelected,\n toggleAllRowsSelected,\n ]);\n\n Object.assign(instance, {\n getHvBulkActionsProps,\n invertedToggleAllRowsSelected,\n aditivePageBulkSelection: !!instance.aditivePageBulkSelection,\n subtractivePageBulkDeselection: !!instance.subtractivePageBulkDeselection,\n });\n};\n\n// TODO: fix typo in v6\nexport const defaultgetHvBulkActionsProps = (props, { instance }) => {\n const {\n rows,\n initialRows,\n selectedFlatRows,\n state: { selectedRowIds = {} } = {},\n page,\n toggleAllRowsSelected,\n invertedToggleAllRowsSelected,\n showSelectAllPages = true,\n applyToggleAllRowsSelectedToPrefilteredRows,\n } = instance;\n\n const isPaginated = !!page;\n\n const nextProps: HvTAbleBulkActionsProps = {\n numTotal: applyToggleAllRowsSelectedToPrefilteredRows\n ? initialRows.length\n : rows.length,\n numSelected: applyToggleAllRowsSelectedToPrefilteredRows\n ? Object.keys(selectedRowIds).length\n : selectedFlatRows.length,\n showSelectAllPages: showSelectAllPages && isPaginated,\n onSelectAll: invertedToggleAllRowsSelected,\n onSelectAllPages: toggleAllRowsSelected,\n };\n\n return [props, nextProps];\n};\n\nconst useBulkActions: UseBulkActionsProps = (hooks) => {\n hooks.getHvBulkActionsProps = [defaultgetHvBulkActionsProps];\n\n hooks.useInstance.push(useInstanceHook);\n};\n\nuseBulkActions.pluginName = \"useHvBulkActions\";\n\nexport default useBulkActions;\n"],"names":["ensurePluginOrder","useGetLatest","makePropGetter","useCallback"],"mappings":";;;;AAqDA,MAAM,kBAAkB,CAAC,aAAa;AACpC,QAAM,EAAE,SAAS,MAAM,2BAA2B,0BAChD;AAEFA,aAAAA,kBAAkB,SAAS,CAAC,mBAAmB,GAAG,kBAAkB;AAE9D,QAAA,cAAcC,wBAAa,QAAQ;AAEzC,QAAM,wBAAwBC,WAAA;AAAA,IAC5B,SAAS,WAAW;AAAA,IACpB;AAAA,MACE,UAAU,YAAY;AAAA,IACxB;AAAA,EAAA;AAGI,QAAA,cAAc,CAAC,CAAC;AAEhB,QAAA,gCAAgCC,MAAAA,YAAY,MAAM;AACtD,QAAI,CAAC;AAAa,aAAO,sBAAsB;AAEzC,UAAA;AAAA,MACJ,0BAA0B;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACE,YAAY;AAEhB,QAAI,6BAA6B,gCAAgC;AACxD,aAAA,0BAA0B,CAAC,+BAA+B;AAAA,IACnE;AAEI,QAAA,6BAA6B,CAAC,gCAAgC;AAChE,UAAI,CAAC,iCAAiC;AACpC,eAAO,0BAA0B,IAAI;AAAA,MACvC;AAEA,aAAO,sBAAsB,KAAK;AAAA,IACpC;AAEI,QAAA,CAAC,6BAA6B,CAAC,gCAAgC;AACjE,UAAI,kBAAkB;AACpB,eAAO,0BAA0B,IAAI;AAAA,MACvC;AAEA,aAAO,sBAAsB,KAAK;AAAA,IACpC;AAEI,QAAA,CAAC,6BAA6B,gCAAgC;AAChE,UAAI,kBAAkB;AACpB,eAAO,0BAA0B,IAAI;AAAA,MACvC;AACA,UAAI,CAAC,mCAAmC;AACtC,eAAO,0BAA0B,KAAK;AAAA,MACxC;AACA,UAAI,CAAC,sBAAsB;AACzB,eAAO,0BAA0B,KAAK;AAAA,MACxC;AAEA,aAAO,sBAAsB,KAAK;AAAA,IACpC;AAEA,WAAO,0BAA0B;AAAA,EAAA,GAChC;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAED,SAAO,OAAO,UAAU;AAAA,IACtB;AAAA,IACA;AAAA,IACA,0BAA0B,CAAC,CAAC,SAAS;AAAA,IACrC,gCAAgC,CAAC,CAAC,SAAS;AAAA,EAAA,CAC5C;AACH;AAGO,MAAM,+BAA+B,CAAC,OAAO,EAAE,eAAe;AAC7D,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,iBAAiB,CAAC,EAAA,IAAM,CAAC;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,IACA,qBAAqB;AAAA,IACrB;AAAA,EACE,IAAA;AAEE,QAAA,cAAc,CAAC,CAAC;AAEtB,QAAM,YAAqC;AAAA,IACzC,UAAU,8CACN,YAAY,SACZ,KAAK;AAAA,IACT,aAAa,8CACT,OAAO,KAAK,cAAc,EAAE,SAC5B,iBAAiB;AAAA,IACrB,oBAAoB,sBAAsB;AAAA,IAC1C,aAAa;AAAA,IACb,kBAAkB;AAAA,EAAA;AAGb,SAAA,CAAC,OAAO,SAAS;AAC1B;AAEA,MAAM,iBAAsC,CAAC,UAAU;AAC/C,QAAA,wBAAwB,CAAC,4BAA4B;AAErD,QAAA,YAAY,KAAK,eAAe;AACxC;AAEA,eAAe,aAAa;AAE5B,MAAA,mBAAe;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement } from \"react\";\n\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { PolymorphicComponentRef, PolymorphicRef } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport {\n staticClasses as buttonClasses,\n getOverrideColors,\n getRadiusStyles,\n getSizeStyles,\n useClasses,\n} from \"./Button.styles\";\nimport { HvButtonRadius, HvButtonSize, HvButtonVariant } from \"./types\";\n\nexport { buttonClasses };\n\nexport type HvButtonClasses = ExtractNames<typeof useClasses>;\n\nexport type HvButtonProps<C extends React.ElementType = \"button\"> =\n PolymorphicComponentRef<\n C,\n {\n /** Use the variant prop to change the visual style of the Button. */\n variant?: HvButtonVariant;\n /** Whether the Button is an icon-only button. */\n icon?: boolean;\n /** Whether the Button is disabled or not. */\n disabled?: boolean;\n /** Class names to be applied. */\n className?: string;\n /** Element placed before the children. */\n startIcon?: ReactElement;\n /** Element placed after the children. */\n endIcon?: ReactElement;\n /** Button size. */\n size?: HvButtonSize;\n /** Button border radius. */\n radius?: HvButtonRadius;\n /** Defines the default colors of the button are forced into the icon. */\n overrideIconColors?: boolean;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvButtonClasses;\n /** Whether the Button is selected or not. */\n selected?: boolean;\n }\n >;\n\n/**\n * Normalize the button variant. It's meant to give us some retro-compatibility with\n * the DS 3.6 API.\n * @returns the normalized variant in DS 5 API\n */\nconst mapVariant = (\n variant: HvButtonVariant,\n theme?: string\n): HvButtonVariant => {\n if (theme === \"ds3\") return variant;\n\n const deprecatedVariantMap: Record<string, HvButtonVariant> = {\n secondary: \"secondarySubtle\",\n ghost: \"primaryGhost\",\n };\n\n const mappedVariant = deprecatedVariantMap[variant];\n\n if (import.meta.env.DEV && mappedVariant) {\n // eslint-disable-next-line no-console\n console.warn(\n `Button variant '${variant}' is deprecated. Please use '${mappedVariant}'.`\n );\n }\n\n return mappedVariant || variant;\n};\n\n/**\n * Button component is used to trigger an action or event.\n */\nexport const HvButton: <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>\n) => React.ReactElement | null = forwardRef(\n <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>,\n ref: PolymorphicRef<C>\n ) => {\n const {\n
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement } from \"react\";\n\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { PolymorphicComponentRef, PolymorphicRef } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport {\n staticClasses as buttonClasses,\n getOverrideColors,\n getRadiusStyles,\n getSizeStyles,\n useClasses,\n} from \"./Button.styles\";\nimport { HvButtonRadius, HvButtonSize, HvButtonVariant } from \"./types\";\n\nexport { buttonClasses };\n\nexport type HvButtonClasses = ExtractNames<typeof useClasses>;\n\nexport type HvButtonProps<C extends React.ElementType = \"button\"> =\n PolymorphicComponentRef<\n C,\n {\n /** Use the variant prop to change the visual style of the Button. */\n variant?: HvButtonVariant;\n /** Whether the Button is an icon-only button. */\n icon?: boolean;\n /** Whether the Button is disabled or not. */\n disabled?: boolean;\n /** Class names to be applied. */\n className?: string;\n /** Element placed before the children. */\n startIcon?: ReactElement;\n /** Element placed after the children. */\n endIcon?: ReactElement;\n /** Button size. */\n size?: HvButtonSize;\n /** Button border radius. */\n radius?: HvButtonRadius;\n /** Defines the default colors of the button are forced into the icon. */\n overrideIconColors?: boolean;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvButtonClasses;\n /** Whether the Button is selected or not. */\n selected?: boolean;\n }\n >;\n\n/**\n * Normalize the button variant. It's meant to give us some retro-compatibility with\n * the DS 3.6 API.\n * @returns the normalized variant in DS 5 API\n */\nconst mapVariant = (\n variant: HvButtonVariant,\n theme?: string\n): HvButtonVariant => {\n if (theme === \"ds3\") return variant;\n\n const deprecatedVariantMap: Record<string, HvButtonVariant> = {\n secondary: \"secondarySubtle\",\n ghost: \"primaryGhost\",\n };\n\n const mappedVariant = deprecatedVariantMap[variant];\n\n if (import.meta.env.DEV && mappedVariant) {\n // eslint-disable-next-line no-console\n console.warn(\n `Button variant '${variant}' is deprecated. Please use '${mappedVariant}'.`\n );\n }\n\n return mappedVariant || variant;\n};\n\n/**\n * Button component is used to trigger an action or event.\n */\nexport const HvButton: <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>\n) => React.ReactElement | null = forwardRef(\n <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>,\n ref: PolymorphicRef<C>\n ) => {\n const {\n classes: classesProp,\n children,\n variant: variantProp,\n disabled = false,\n className,\n startIcon,\n endIcon,\n icon = false,\n size,\n radius,\n overrideIconColors = true,\n component: Component = \"button\",\n ...others\n } = useDefaultProps(\"HvButton\", props);\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n const variant = mapVariant(\n variantProp ?? (icon ? \"secondaryGhost\" : \"primary\"),\n activeTheme?.name\n );\n\n return (\n <Component\n ref={ref}\n className={cx(\n classes.root,\n classes[variant],\n size && css(getSizeStyles(size)),\n radius && css(getRadiusStyles(radius)),\n overrideIconColors && css(getOverrideColors()),\n {\n [classes.icon]: icon,\n [classes.disabled]: disabled,\n },\n className\n )}\n {...(Component === \"button\" && { type: \"button\" })}\n {...(disabled && {\n disabled: true,\n tabIndex: -1,\n \"aria-disabled\": true,\n })}\n {...others}\n >\n {startIcon && <span className={classes.startIcon}>{startIcon}</span>}\n {children}\n {endIcon && <span className={classes.endIcon}>{endIcon}</span>}\n </Component>\n );\n }\n);\n"],"names":[],"mappings":";;;;;;AAsDA,MAAM,aAAa,CACjB,SACA,UACoB;AACpB,MAAI,UAAU;AAAc,WAAA;AAE5B,QAAM,uBAAwD;AAAA,IAC5D,WAAW;AAAA,IACX,OAAO;AAAA,EAAA;AAGH,QAAA,gBAAgB,qBAAqB,OAAO;AASlD,SAAO,iBAAiB;AAC1B;AAKO,MAAM,WAEoB;AAAA,EAC/B,CACE,OACA,QACG;AACG,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA,SAAS;AAAA,MACT,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA,qBAAqB;AAAA,MACrB,WAAW,YAAY;AAAA,MACvB,GAAG;AAAA,IAAA,IACD,gBAAgB,YAAY,KAAK;AACrC,UAAM,EAAE,SAAS,KAAK,GAAG,IAAI,WAAW,WAAW;AAC7C,UAAA,EAAE,gBAAgB;AACxB,UAAM,UAAU;AAAA,MACd,gBAAgB,OAAO,mBAAmB;AAAA,MAC1C,aAAa;AAAA,IAAA;AAIb,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT,QAAQ;AAAA,UACR,QAAQ,OAAO;AAAA,UACf,QAAQ,IAAI,cAAc,IAAI,CAAC;AAAA,UAC/B,UAAU,IAAI,gBAAgB,MAAM,CAAC;AAAA,UACrC,sBAAsB,IAAI,mBAAmB;AAAA,UAC7C;AAAA,YACE,CAAC,QAAQ,IAAI,GAAG;AAAA,YAChB,CAAC,QAAQ,QAAQ,GAAG;AAAA,UACtB;AAAA,UACA;AAAA,QACF;AAAA,QACC,GAAI,cAAc,YAAY,EAAE,MAAM,SAAS;AAAA,QAC/C,GAAI,YAAY;AAAA,UACf,UAAU;AAAA,UACV,UAAU;AAAA,UACV,iBAAiB;AAAA,QACnB;AAAA,QACC,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA,aAAc,oBAAA,QAAA,EAAK,WAAW,QAAQ,WAAY,UAAU,WAAA;AAAA,UAC5D;AAAA,UACA,WAAY,oBAAA,QAAA,EAAK,WAAW,QAAQ,SAAU,UAAQ,SAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG7D;AACF;"}
|
|
@@ -15,31 +15,31 @@ const useInstanceHook = (instance) => {
|
|
|
15
15
|
if (!isPaginated)
|
|
16
16
|
return toggleAllRowsSelected();
|
|
17
17
|
const {
|
|
18
|
-
aditivePageBulkSelection,
|
|
18
|
+
aditivePageBulkSelection: additivePageBulkSelection,
|
|
19
19
|
subtractivePageBulkDeselection,
|
|
20
20
|
isNoRowsSelected,
|
|
21
21
|
isNoPageRowsSelected,
|
|
22
22
|
isAllSelectablePageRowsSelected,
|
|
23
23
|
isAllSelectablePageRowsUnselected
|
|
24
24
|
} = getInstance();
|
|
25
|
-
if (
|
|
25
|
+
if (additivePageBulkSelection && subtractivePageBulkDeselection) {
|
|
26
26
|
return toggleAllPageRowsSelected(!isAllSelectablePageRowsSelected);
|
|
27
27
|
}
|
|
28
|
-
if (
|
|
28
|
+
if (additivePageBulkSelection && !subtractivePageBulkDeselection) {
|
|
29
29
|
if (!isAllSelectablePageRowsSelected) {
|
|
30
|
-
return toggleAllPageRowsSelected();
|
|
30
|
+
return toggleAllPageRowsSelected(true);
|
|
31
31
|
}
|
|
32
32
|
return toggleAllRowsSelected(false);
|
|
33
33
|
}
|
|
34
|
-
if (!
|
|
34
|
+
if (!additivePageBulkSelection && !subtractivePageBulkDeselection) {
|
|
35
35
|
if (isNoRowsSelected) {
|
|
36
|
-
return toggleAllPageRowsSelected();
|
|
36
|
+
return toggleAllPageRowsSelected(true);
|
|
37
37
|
}
|
|
38
38
|
return toggleAllRowsSelected(false);
|
|
39
39
|
}
|
|
40
|
-
if (!
|
|
40
|
+
if (!additivePageBulkSelection && subtractivePageBulkDeselection) {
|
|
41
41
|
if (isNoRowsSelected) {
|
|
42
|
-
return toggleAllPageRowsSelected();
|
|
42
|
+
return toggleAllPageRowsSelected(true);
|
|
43
43
|
}
|
|
44
44
|
if (!isAllSelectablePageRowsUnselected) {
|
|
45
45
|
return toggleAllPageRowsSelected(false);
|
|
@@ -56,13 +56,11 @@ const useInstanceHook = (instance) => {
|
|
|
56
56
|
toggleAllPageRowsSelected,
|
|
57
57
|
toggleAllRowsSelected
|
|
58
58
|
]);
|
|
59
|
-
const aditive = instance.aditivePageBulkSelection === true;
|
|
60
|
-
const subtractive = instance.subtractivePageBulkDeselection === true;
|
|
61
59
|
Object.assign(instance, {
|
|
62
60
|
getHvBulkActionsProps,
|
|
63
61
|
invertedToggleAllRowsSelected,
|
|
64
|
-
aditivePageBulkSelection:
|
|
65
|
-
subtractivePageBulkDeselection:
|
|
62
|
+
aditivePageBulkSelection: !!instance.aditivePageBulkSelection,
|
|
63
|
+
subtractivePageBulkDeselection: !!instance.subtractivePageBulkDeselection
|
|
66
64
|
});
|
|
67
65
|
};
|
|
68
66
|
const defaultgetHvBulkActionsProps = (props, { instance }) => {
|
|
@@ -79,8 +77,8 @@ const defaultgetHvBulkActionsProps = (props, { instance }) => {
|
|
|
79
77
|
} = instance;
|
|
80
78
|
const isPaginated = !!page;
|
|
81
79
|
const nextProps = {
|
|
82
|
-
numTotal: applyToggleAllRowsSelectedToPrefilteredRows
|
|
83
|
-
numSelected: applyToggleAllRowsSelectedToPrefilteredRows
|
|
80
|
+
numTotal: applyToggleAllRowsSelectedToPrefilteredRows ? initialRows.length : rows.length,
|
|
81
|
+
numSelected: applyToggleAllRowsSelectedToPrefilteredRows ? Object.keys(selectedRowIds).length : selectedFlatRows.length,
|
|
84
82
|
showSelectAllPages: showSelectAllPages && isPaginated,
|
|
85
83
|
onSelectAll: invertedToggleAllRowsSelected,
|
|
86
84
|
onSelectAllPages: toggleAllRowsSelected
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBulkActions.js","sources":["../../../../../src/components/Table/hooks/useBulkActions.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport {\n Hooks,\n PropGetter,\n TableCommonProps,\n makePropGetter,\n useGetLatest,\n ensurePluginOrder,\n} from \"react-table\";\n\n// #region ##### TYPES #####\n\nexport interface HvTAbleBulkActionsProps extends TableCommonProps {\n numTotal: number;\n numSelected: number;\n showSelectAllPages: boolean;\n onSelectAll: () => void;\n onSelectAllPages: () => void;\n labels?: Record<string, string>;\n}\n\nexport type HvBulkActionsPropGetter<D extends object> = PropGetter<\n D,\n HvTAbleBulkActionsProps\n>;\n\nexport interface UseHvBulkActionsHooks<D extends object> {\n getHvBulkActionsProps: Array<HvBulkActionsPropGetter<D>>;\n}\n\nexport type UseHvBulkActionsTableOptions = {\n aditivePageBulkSelection?: boolean;\n subtractivePageBulkDeselection?: boolean;\n showSelectAllPages?: boolean;\n};\n\nexport interface UseHvBulkActionsTableInstanceProps<D extends object> {\n getHvBulkActionsProps: (\n propGetter?: HvBulkActionsPropGetter<D>\n ) => HvTAbleBulkActionsProps;\n invertedToggleAllRowsSelected: () => void;\n}\n\nexport type UseBulkActionsProps = (<D extends object = Record<string, unknown>>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\nconst useInstanceHook = (instance) => {\n const { plugins, page, toggleAllPageRowsSelected, toggleAllRowsSelected } =\n instance;\n\n ensurePluginOrder(plugins, [\"useHvRowSelection\"], \"useHvBulkActions\");\n\n const getInstance = useGetLatest(instance);\n\n const getHvBulkActionsProps = makePropGetter(\n instance.getHooks().getHvBulkActionsProps,\n {\n instance: getInstance(),\n }\n );\n\n const isPaginated = !!page;\n\n const invertedToggleAllRowsSelected = useCallback(() => {\n if (!isPaginated) return toggleAllRowsSelected();\n\n const {\n aditivePageBulkSelection,\n subtractivePageBulkDeselection,\n isNoRowsSelected,\n isNoPageRowsSelected,\n isAllSelectablePageRowsSelected,\n isAllSelectablePageRowsUnselected,\n } = getInstance();\n\n if (
|
|
1
|
+
{"version":3,"file":"useBulkActions.js","sources":["../../../../../src/components/Table/hooks/useBulkActions.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport {\n Hooks,\n PropGetter,\n TableCommonProps,\n makePropGetter,\n useGetLatest,\n ensurePluginOrder,\n} from \"react-table\";\n\n// #region ##### TYPES #####\n\n// TODO: fix typo in v6\nexport interface HvTAbleBulkActionsProps extends TableCommonProps {\n numTotal: number;\n numSelected: number;\n showSelectAllPages: boolean;\n onSelectAll: () => void;\n onSelectAllPages: () => void;\n labels?: Record<string, string>;\n}\n\nexport type HvBulkActionsPropGetter<D extends object> = PropGetter<\n D,\n HvTAbleBulkActionsProps\n>;\n\nexport interface UseHvBulkActionsHooks<D extends object> {\n getHvBulkActionsProps: Array<HvBulkActionsPropGetter<D>>;\n}\n\nexport type UseHvBulkActionsTableOptions = {\n // TODO: fix typo in v6\n /** Controls whether the \"Select all\" should _select_ or _unselect_ the rows, in a partial selection state. */\n aditivePageBulkSelection?: boolean;\n /** Controls whether _only the current page_ or _all pages_ should be unselected */\n subtractivePageBulkDeselection?: boolean;\n showSelectAllPages?: boolean;\n};\n\nexport interface UseHvBulkActionsTableInstanceProps<D extends object> {\n getHvBulkActionsProps: (\n propGetter?: HvBulkActionsPropGetter<D>\n ) => HvTAbleBulkActionsProps;\n invertedToggleAllRowsSelected: () => void;\n}\n\nexport type UseBulkActionsProps = (<D extends object = Record<string, unknown>>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\nconst useInstanceHook = (instance) => {\n const { plugins, page, toggleAllPageRowsSelected, toggleAllRowsSelected } =\n instance;\n\n ensurePluginOrder(plugins, [\"useHvRowSelection\"], \"useHvBulkActions\");\n\n const getInstance = useGetLatest(instance);\n\n const getHvBulkActionsProps = makePropGetter(\n instance.getHooks().getHvBulkActionsProps,\n {\n instance: getInstance(),\n }\n );\n\n const isPaginated = !!page;\n\n const invertedToggleAllRowsSelected = useCallback(() => {\n if (!isPaginated) return toggleAllRowsSelected();\n\n const {\n aditivePageBulkSelection: additivePageBulkSelection,\n subtractivePageBulkDeselection,\n isNoRowsSelected,\n isNoPageRowsSelected,\n isAllSelectablePageRowsSelected,\n isAllSelectablePageRowsUnselected,\n } = getInstance();\n\n if (additivePageBulkSelection && subtractivePageBulkDeselection) {\n return toggleAllPageRowsSelected(!isAllSelectablePageRowsSelected);\n }\n\n if (additivePageBulkSelection && !subtractivePageBulkDeselection) {\n if (!isAllSelectablePageRowsSelected) {\n return toggleAllPageRowsSelected(true);\n }\n\n return toggleAllRowsSelected(false);\n }\n\n if (!additivePageBulkSelection && !subtractivePageBulkDeselection) {\n if (isNoRowsSelected) {\n return toggleAllPageRowsSelected(true);\n }\n\n return toggleAllRowsSelected(false);\n }\n\n if (!additivePageBulkSelection && subtractivePageBulkDeselection) {\n if (isNoRowsSelected) {\n return toggleAllPageRowsSelected(true);\n }\n if (!isAllSelectablePageRowsUnselected) {\n return toggleAllPageRowsSelected(false);\n }\n if (!isNoPageRowsSelected) {\n return toggleAllPageRowsSelected(false);\n }\n\n return toggleAllRowsSelected(false);\n }\n\n return toggleAllPageRowsSelected();\n }, [\n getInstance,\n isPaginated,\n toggleAllPageRowsSelected,\n toggleAllRowsSelected,\n ]);\n\n Object.assign(instance, {\n getHvBulkActionsProps,\n invertedToggleAllRowsSelected,\n aditivePageBulkSelection: !!instance.aditivePageBulkSelection,\n subtractivePageBulkDeselection: !!instance.subtractivePageBulkDeselection,\n });\n};\n\n// TODO: fix typo in v6\nexport const defaultgetHvBulkActionsProps = (props, { instance }) => {\n const {\n rows,\n initialRows,\n selectedFlatRows,\n state: { selectedRowIds = {} } = {},\n page,\n toggleAllRowsSelected,\n invertedToggleAllRowsSelected,\n showSelectAllPages = true,\n applyToggleAllRowsSelectedToPrefilteredRows,\n } = instance;\n\n const isPaginated = !!page;\n\n const nextProps: HvTAbleBulkActionsProps = {\n numTotal: applyToggleAllRowsSelectedToPrefilteredRows\n ? initialRows.length\n : rows.length,\n numSelected: applyToggleAllRowsSelectedToPrefilteredRows\n ? Object.keys(selectedRowIds).length\n : selectedFlatRows.length,\n showSelectAllPages: showSelectAllPages && isPaginated,\n onSelectAll: invertedToggleAllRowsSelected,\n onSelectAllPages: toggleAllRowsSelected,\n };\n\n return [props, nextProps];\n};\n\nconst useBulkActions: UseBulkActionsProps = (hooks) => {\n hooks.getHvBulkActionsProps = [defaultgetHvBulkActionsProps];\n\n hooks.useInstance.push(useInstanceHook);\n};\n\nuseBulkActions.pluginName = \"useHvBulkActions\";\n\nexport default useBulkActions;\n"],"names":[],"mappings":";;AAqDA,MAAM,kBAAkB,CAAC,aAAa;AACpC,QAAM,EAAE,SAAS,MAAM,2BAA2B,0BAChD;AAEF,oBAAkB,SAAS,CAAC,mBAAmB,GAAG,kBAAkB;AAE9D,QAAA,cAAc,aAAa,QAAQ;AAEzC,QAAM,wBAAwB;AAAA,IAC5B,SAAS,WAAW;AAAA,IACpB;AAAA,MACE,UAAU,YAAY;AAAA,IACxB;AAAA,EAAA;AAGI,QAAA,cAAc,CAAC,CAAC;AAEhB,QAAA,gCAAgC,YAAY,MAAM;AACtD,QAAI,CAAC;AAAa,aAAO,sBAAsB;AAEzC,UAAA;AAAA,MACJ,0BAA0B;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACE,YAAY;AAEhB,QAAI,6BAA6B,gCAAgC;AACxD,aAAA,0BAA0B,CAAC,+BAA+B;AAAA,IACnE;AAEI,QAAA,6BAA6B,CAAC,gCAAgC;AAChE,UAAI,CAAC,iCAAiC;AACpC,eAAO,0BAA0B,IAAI;AAAA,MACvC;AAEA,aAAO,sBAAsB,KAAK;AAAA,IACpC;AAEI,QAAA,CAAC,6BAA6B,CAAC,gCAAgC;AACjE,UAAI,kBAAkB;AACpB,eAAO,0BAA0B,IAAI;AAAA,MACvC;AAEA,aAAO,sBAAsB,KAAK;AAAA,IACpC;AAEI,QAAA,CAAC,6BAA6B,gCAAgC;AAChE,UAAI,kBAAkB;AACpB,eAAO,0BAA0B,IAAI;AAAA,MACvC;AACA,UAAI,CAAC,mCAAmC;AACtC,eAAO,0BAA0B,KAAK;AAAA,MACxC;AACA,UAAI,CAAC,sBAAsB;AACzB,eAAO,0BAA0B,KAAK;AAAA,MACxC;AAEA,aAAO,sBAAsB,KAAK;AAAA,IACpC;AAEA,WAAO,0BAA0B;AAAA,EAAA,GAChC;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAED,SAAO,OAAO,UAAU;AAAA,IACtB;AAAA,IACA;AAAA,IACA,0BAA0B,CAAC,CAAC,SAAS;AAAA,IACrC,gCAAgC,CAAC,CAAC,SAAS;AAAA,EAAA,CAC5C;AACH;AAGO,MAAM,+BAA+B,CAAC,OAAO,EAAE,eAAe;AAC7D,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,iBAAiB,CAAC,EAAA,IAAM,CAAC;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,IACA,qBAAqB;AAAA,IACrB;AAAA,EACE,IAAA;AAEE,QAAA,cAAc,CAAC,CAAC;AAEtB,QAAM,YAAqC;AAAA,IACzC,UAAU,8CACN,YAAY,SACZ,KAAK;AAAA,IACT,aAAa,8CACT,OAAO,KAAK,cAAc,EAAE,SAC5B,iBAAiB;AAAA,IACrB,oBAAoB,sBAAsB;AAAA,IAC1C,aAAa;AAAA,IACb,kBAAkB;AAAA,EAAA;AAGb,SAAA,CAAC,OAAO,SAAS;AAC1B;AAEA,MAAM,iBAAsC,CAAC,UAAU;AAC/C,QAAA,wBAAwB,CAAC,4BAA4B;AAErD,QAAA,YAAY,KAAK,eAAe;AACxC;AAEA,eAAe,aAAa;AAE5B,MAAA,mBAAe;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10381,7 +10381,9 @@ export declare interface UseHvBulkActionsTableInstanceProps<D extends object> {
|
|
|
10381
10381
|
}
|
|
10382
10382
|
|
|
10383
10383
|
export declare type UseHvBulkActionsTableOptions = {
|
|
10384
|
+
/** Controls whether the "Select all" should _select_ or _unselect_ the rows, in a partial selection state. */
|
|
10384
10385
|
aditivePageBulkSelection?: boolean;
|
|
10386
|
+
/** Controls whether _only the current page_ or _all pages_ should be unselected */
|
|
10385
10387
|
subtractivePageBulkDeselection?: boolean;
|
|
10386
10388
|
showSelectAllPages?: boolean;
|
|
10387
10389
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-core",
|
|
3
|
-
"version": "5.39.
|
|
3
|
+
"version": "5.39.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Hitachi Vantara UI Kit Team",
|
|
6
6
|
"description": "Core React components for the NEXT Design System.",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"access": "public",
|
|
65
65
|
"directory": "package"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "3d083cd58569dbabbbdbe081002246eaf1909ba2",
|
|
68
68
|
"main": "dist/cjs/index.cjs",
|
|
69
69
|
"exports": {
|
|
70
70
|
".": {
|