ods-component-lib 1.18.152 → 1.18.153
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.
|
@@ -3,14 +3,5 @@ interface IOnToolbarPreparingOptions {
|
|
|
3
3
|
toolbarButtonGroup?: any[];
|
|
4
4
|
callback?: (e: any) => void;
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
7
|
-
* Handles the rendering and configuration of the toolbar for ODS DataGrid.
|
|
8
|
-
* This hook prepares the toolbar based on the button configuration provided through props,
|
|
9
|
-
* rendering primary and secondary buttons directly and additional buttons in a dropdown if necessary.
|
|
10
|
-
*
|
|
11
|
-
* @param {Object} props - The properties including configuration for toolbar buttons and the page title.
|
|
12
|
-
* @returns {Function} A memoized function that configures and populates the toolbar with buttons and title.
|
|
13
|
-
* This function is intended to be used as a callback in the toolbar's preparation phase of the DataGrid component.
|
|
14
|
-
*/
|
|
15
6
|
export declare const useOnToolbarButtonHandler: ({ pageTitle, toolbarButtonGroup, callback }: IOnToolbarPreparingOptions) => (e: any) => void;
|
|
16
7
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -35026,7 +35026,7 @@ var useStyles$2 = antdStyle.createStyles(function (_ref) {
|
|
|
35026
35026
|
var css = _ref.css,
|
|
35027
35027
|
token = _ref.token;
|
|
35028
35028
|
return {
|
|
35029
|
-
toolbarGrid: css(_templateObject$r || (_templateObject$r = _taggedTemplateLiteralLoose(["\n
|
|
35029
|
+
toolbarGrid: css(_templateObject$r || (_templateObject$r = _taggedTemplateLiteralLoose(["\n & .toolbar-primary-button {\n margin-left: ", "px;\n }\n & .toolbar-dropdown-container {\n margin-left: ", "px;\n }\n & .title-container { \n display: flex;\n margin: 0;\n }\n "])), token.margin, token.marginXXS)
|
|
35030
35030
|
};
|
|
35031
35031
|
});
|
|
35032
35032
|
|
|
@@ -35036,79 +35036,94 @@ var useOnToolbarButtonHandler = function useOnToolbarButtonHandler(_ref) {
|
|
|
35036
35036
|
callback = _ref.callback;
|
|
35037
35037
|
var _useStyles = useStyles$2(),
|
|
35038
35038
|
styles = _useStyles.styles;
|
|
35039
|
-
var
|
|
35040
|
-
|
|
35041
|
-
|
|
35042
|
-
|
|
35043
|
-
|
|
35044
|
-
|
|
35045
|
-
|
|
35046
|
-
|
|
35047
|
-
|
|
35048
|
-
|
|
35049
|
-
|
|
35050
|
-
|
|
35051
|
-
|
|
35052
|
-
|
|
35053
|
-
|
|
35054
|
-
|
|
35055
|
-
|
|
35056
|
-
|
|
35057
|
-
|
|
35058
|
-
|
|
35059
|
-
|
|
35060
|
-
|
|
35061
|
-
|
|
35062
|
-
|
|
35063
|
-
|
|
35039
|
+
var initialPropsRef = React.useRef({
|
|
35040
|
+
pageTitle: pageTitle,
|
|
35041
|
+
toolbarButtonGroup: toolbarButtonGroup,
|
|
35042
|
+
callback: callback
|
|
35043
|
+
});
|
|
35044
|
+
if (!initialPropsRef.current) {
|
|
35045
|
+
initialPropsRef.current = {
|
|
35046
|
+
pageTitle: pageTitle,
|
|
35047
|
+
toolbarButtonGroup: toolbarButtonGroup,
|
|
35048
|
+
callback: callback
|
|
35049
|
+
};
|
|
35050
|
+
}
|
|
35051
|
+
var onToolbarPreparing = React.useRef(function (e) {
|
|
35052
|
+
var _initialPropsRef$curr = initialPropsRef.current,
|
|
35053
|
+
pageTitle = _initialPropsRef$curr.pageTitle,
|
|
35054
|
+
toolbarButtonGroup = _initialPropsRef$curr.toolbarButtonGroup,
|
|
35055
|
+
callback = _initialPropsRef$curr.callback;
|
|
35056
|
+
if ((toolbarButtonGroup === null || toolbarButtonGroup === void 0 ? void 0 : toolbarButtonGroup.length) > 0) {
|
|
35057
|
+
var primaryButtons = toolbarButtonGroup.slice(0, 3);
|
|
35058
|
+
var additionalButtons = toolbarButtonGroup.length > 3 ? toolbarButtonGroup.slice(3) : [];
|
|
35059
|
+
primaryButtons.forEach(function (button, index) {
|
|
35060
|
+
var buttonContainer = document.createElement('div');
|
|
35061
|
+
var rootButton = client_1(buttonContainer);
|
|
35062
|
+
rootButton.render(React__default.createElement(OdsButton, Object.assign({
|
|
35063
|
+
key: index,
|
|
35064
|
+
className: "toolbar-primary-button",
|
|
35065
|
+
type: button.type
|
|
35066
|
+
}, button.onclick && {
|
|
35067
|
+
onClick: button.onclick
|
|
35068
|
+
}, {
|
|
35069
|
+
disabled: button.disabled
|
|
35070
|
+
}), button.label));
|
|
35071
|
+
e.toolbarOptions.items.push({
|
|
35072
|
+
location: 'before',
|
|
35073
|
+
widget: 'dxTemplate',
|
|
35074
|
+
template: function template(_, __, container) {
|
|
35075
|
+
container.classList.add(styles.toolbarGrid);
|
|
35076
|
+
container.appendChild(buttonContainer);
|
|
35077
|
+
}
|
|
35064
35078
|
});
|
|
35065
|
-
|
|
35066
|
-
|
|
35067
|
-
|
|
35068
|
-
|
|
35069
|
-
|
|
35070
|
-
|
|
35071
|
-
|
|
35072
|
-
|
|
35073
|
-
|
|
35074
|
-
|
|
35075
|
-
|
|
35076
|
-
|
|
35077
|
-
|
|
35078
|
-
|
|
35079
|
-
|
|
35080
|
-
|
|
35081
|
-
|
|
35082
|
-
|
|
35083
|
-
|
|
35084
|
-
location: 'before',
|
|
35085
|
-
widget: 'dxTemplate',
|
|
35086
|
-
template: function template(_, __, container) {
|
|
35087
|
-
container.classList.add(styles.toolbarGrid);
|
|
35088
|
-
container.appendChild(dropdownContainer);
|
|
35089
|
-
}
|
|
35090
|
-
});
|
|
35091
|
-
}
|
|
35092
|
-
}
|
|
35093
|
-
if (pageTitle) {
|
|
35094
|
-
var titleContainer = document.createElement('div');
|
|
35095
|
-
var rootTitle = client_1(titleContainer);
|
|
35096
|
-
rootTitle.render(React__default.createElement(React__default.Fragment, null, React__default.createElement(OdsTitle, {
|
|
35097
|
-
level: 5
|
|
35098
|
-
}, pageTitle)));
|
|
35099
|
-
e.toolbarOptions.items.unshift({
|
|
35079
|
+
});
|
|
35080
|
+
if (additionalButtons.length > 0) {
|
|
35081
|
+
var dropdownContainer = document.createElement('div');
|
|
35082
|
+
var rootDropdown = client_1(dropdownContainer);
|
|
35083
|
+
rootDropdown.render(React__default.createElement(OdsDropdown, {
|
|
35084
|
+
key: "dropdown-custom-toolbar",
|
|
35085
|
+
menuItems: additionalButtons.map(function (button) {
|
|
35086
|
+
return {
|
|
35087
|
+
label: button.label,
|
|
35088
|
+
onClick: button.onclick
|
|
35089
|
+
};
|
|
35090
|
+
})
|
|
35091
|
+
}, React__default.createElement(OdsButton, {
|
|
35092
|
+
type: "text",
|
|
35093
|
+
icon: React__default.createElement(DynamicIcon, {
|
|
35094
|
+
iconName: "kebabMenu"
|
|
35095
|
+
})
|
|
35096
|
+
})));
|
|
35097
|
+
e.toolbarOptions.items.push({
|
|
35100
35098
|
location: 'before',
|
|
35101
|
-
|
|
35099
|
+
widget: 'dxTemplate',
|
|
35102
35100
|
template: function template(_, __, container) {
|
|
35103
|
-
container.
|
|
35101
|
+
container.classList.add(styles.toolbarGrid);
|
|
35102
|
+
container.appendChild(dropdownContainer);
|
|
35104
35103
|
}
|
|
35105
35104
|
});
|
|
35106
35105
|
}
|
|
35107
|
-
|
|
35108
|
-
|
|
35109
|
-
|
|
35110
|
-
|
|
35111
|
-
|
|
35106
|
+
}
|
|
35107
|
+
if (pageTitle) {
|
|
35108
|
+
var titleContainer = document.createElement('div');
|
|
35109
|
+
var rootTitle = client_1(titleContainer);
|
|
35110
|
+
rootTitle.render(React__default.createElement(OdsTitle, {
|
|
35111
|
+
level: 5,
|
|
35112
|
+
className: "title-container"
|
|
35113
|
+
}, pageTitle));
|
|
35114
|
+
e.toolbarOptions.items.unshift({
|
|
35115
|
+
location: 'before',
|
|
35116
|
+
widget: 'dxTemplate',
|
|
35117
|
+
template: function template(_, __, container) {
|
|
35118
|
+
container.classList.add(styles.toolbarGrid);
|
|
35119
|
+
container.appendChild(titleContainer);
|
|
35120
|
+
}
|
|
35121
|
+
});
|
|
35122
|
+
}
|
|
35123
|
+
if (callback) {
|
|
35124
|
+
callback(e);
|
|
35125
|
+
}
|
|
35126
|
+
}).current;
|
|
35112
35127
|
return onToolbarPreparing;
|
|
35113
35128
|
};
|
|
35114
35129
|
|