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.
@@ -35021,7 +35021,7 @@ var useStyles$2 = createStyles(function (_ref) {
35021
35021
  var css = _ref.css,
35022
35022
  token = _ref.token;
35023
35023
  return {
35024
- toolbarGrid: css(_templateObject$r || (_templateObject$r = _taggedTemplateLiteralLoose(["\n & .toolbar-primary-button {\n margin-left: ", "px;\n }\n\n & .toolbar-dropdown-container {\n margin-left: ", "px;\n }\n "])), token.margin, token.marginXXS)
35024
+ 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)
35025
35025
  };
35026
35026
  });
35027
35027
 
@@ -35031,79 +35031,94 @@ var useOnToolbarButtonHandler = function useOnToolbarButtonHandler(_ref) {
35031
35031
  callback = _ref.callback;
35032
35032
  var _useStyles = useStyles$2(),
35033
35033
  styles = _useStyles.styles;
35034
- var onToolbarPreparing = useMemo(function () {
35035
- return function (e) {
35036
- if ((toolbarButtonGroup === null || toolbarButtonGroup === void 0 ? void 0 : toolbarButtonGroup.length) > 0) {
35037
- var primaryButtons = toolbarButtonGroup.slice(0, 3);
35038
- var additionalButtons = toolbarButtonGroup.length > 3 ? toolbarButtonGroup.slice(3) : [];
35039
- primaryButtons.forEach(function (button, index) {
35040
- var buttonContainer = document.createElement('div');
35041
- var rootButton = client_1(buttonContainer);
35042
- rootButton.render(React.createElement(React.Fragment, null, React.createElement(OdsButton, Object.assign({
35043
- key: index,
35044
- className: "toolbar-primary-button",
35045
- type: button.type
35046
- }, button.onclick && {
35047
- onClick: button.onclick
35048
- }, {
35049
- disabled: button.disabled
35050
- }), button.label)));
35051
- e.toolbarOptions.items.push({
35052
- location: 'before',
35053
- widget: 'dxTemplate',
35054
- template: function template(_, __, container) {
35055
- container.classList.add(styles.toolbarGrid);
35056
- container.appendChild(buttonContainer);
35057
- }
35058
- });
35034
+ var initialPropsRef = useRef({
35035
+ pageTitle: pageTitle,
35036
+ toolbarButtonGroup: toolbarButtonGroup,
35037
+ callback: callback
35038
+ });
35039
+ if (!initialPropsRef.current) {
35040
+ initialPropsRef.current = {
35041
+ pageTitle: pageTitle,
35042
+ toolbarButtonGroup: toolbarButtonGroup,
35043
+ callback: callback
35044
+ };
35045
+ }
35046
+ var onToolbarPreparing = useRef(function (e) {
35047
+ var _initialPropsRef$curr = initialPropsRef.current,
35048
+ pageTitle = _initialPropsRef$curr.pageTitle,
35049
+ toolbarButtonGroup = _initialPropsRef$curr.toolbarButtonGroup,
35050
+ callback = _initialPropsRef$curr.callback;
35051
+ if ((toolbarButtonGroup === null || toolbarButtonGroup === void 0 ? void 0 : toolbarButtonGroup.length) > 0) {
35052
+ var primaryButtons = toolbarButtonGroup.slice(0, 3);
35053
+ var additionalButtons = toolbarButtonGroup.length > 3 ? toolbarButtonGroup.slice(3) : [];
35054
+ primaryButtons.forEach(function (button, index) {
35055
+ var buttonContainer = document.createElement('div');
35056
+ var rootButton = client_1(buttonContainer);
35057
+ rootButton.render(React.createElement(OdsButton, Object.assign({
35058
+ key: index,
35059
+ className: "toolbar-primary-button",
35060
+ type: button.type
35061
+ }, button.onclick && {
35062
+ onClick: button.onclick
35063
+ }, {
35064
+ disabled: button.disabled
35065
+ }), button.label));
35066
+ e.toolbarOptions.items.push({
35067
+ location: 'before',
35068
+ widget: 'dxTemplate',
35069
+ template: function template(_, __, container) {
35070
+ container.classList.add(styles.toolbarGrid);
35071
+ container.appendChild(buttonContainer);
35072
+ }
35059
35073
  });
35060
- if (additionalButtons.length > 0) {
35061
- var dropdownContainer = document.createElement('div');
35062
- dropdownContainer.classList.add('toolbar-dropdown-container');
35063
- var rootDropdown = client_1(dropdownContainer);
35064
- rootDropdown.render(React.createElement(React.Fragment, null, React.createElement(OdsDropdown, {
35065
- key: "dropdown-custom-toolbar",
35066
- menuItems: additionalButtons.map(function (button) {
35067
- return {
35068
- label: button.label,
35069
- onClick: button.onclick
35070
- };
35071
- })
35072
- }, React.createElement(OdsButton, {
35073
- type: "text",
35074
- icon: React.createElement(DynamicIcon, {
35075
- iconName: "kebabMenu"
35076
- })
35077
- }))));
35078
- e.toolbarOptions.items.push({
35079
- location: 'before',
35080
- widget: 'dxTemplate',
35081
- template: function template(_, __, container) {
35082
- container.classList.add(styles.toolbarGrid);
35083
- container.appendChild(dropdownContainer);
35084
- }
35085
- });
35086
- }
35087
- }
35088
- if (pageTitle) {
35089
- var titleContainer = document.createElement('div');
35090
- var rootTitle = client_1(titleContainer);
35091
- rootTitle.render(React.createElement(React.Fragment, null, React.createElement(OdsTitle, {
35092
- level: 5
35093
- }, pageTitle)));
35094
- e.toolbarOptions.items.unshift({
35074
+ });
35075
+ if (additionalButtons.length > 0) {
35076
+ var dropdownContainer = document.createElement('div');
35077
+ var rootDropdown = client_1(dropdownContainer);
35078
+ rootDropdown.render(React.createElement(OdsDropdown, {
35079
+ key: "dropdown-custom-toolbar",
35080
+ menuItems: additionalButtons.map(function (button) {
35081
+ return {
35082
+ label: button.label,
35083
+ onClick: button.onclick
35084
+ };
35085
+ })
35086
+ }, React.createElement(OdsButton, {
35087
+ type: "text",
35088
+ icon: React.createElement(DynamicIcon, {
35089
+ iconName: "kebabMenu"
35090
+ })
35091
+ })));
35092
+ e.toolbarOptions.items.push({
35095
35093
  location: 'before',
35096
- cssClass: 'toolbarTitleItem',
35094
+ widget: 'dxTemplate',
35097
35095
  template: function template(_, __, container) {
35098
- container.appendChild(titleContainer);
35096
+ container.classList.add(styles.toolbarGrid);
35097
+ container.appendChild(dropdownContainer);
35099
35098
  }
35100
35099
  });
35101
35100
  }
35102
- if (callback) {
35103
- callback(e);
35104
- }
35105
- };
35106
- }, [pageTitle, toolbarButtonGroup]);
35101
+ }
35102
+ if (pageTitle) {
35103
+ var titleContainer = document.createElement('div');
35104
+ var rootTitle = client_1(titleContainer);
35105
+ rootTitle.render(React.createElement(OdsTitle, {
35106
+ level: 5,
35107
+ className: "title-container"
35108
+ }, pageTitle));
35109
+ e.toolbarOptions.items.unshift({
35110
+ location: 'before',
35111
+ widget: 'dxTemplate',
35112
+ template: function template(_, __, container) {
35113
+ container.classList.add(styles.toolbarGrid);
35114
+ container.appendChild(titleContainer);
35115
+ }
35116
+ });
35117
+ }
35118
+ if (callback) {
35119
+ callback(e);
35120
+ }
35121
+ }).current;
35107
35122
  return onToolbarPreparing;
35108
35123
  };
35109
35124