ods-component-lib 1.18.150 → 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.
@@ -28,7 +28,7 @@ interface IExportProps {
28
28
  interface IToolbarButton {
29
29
  type: string;
30
30
  label: string;
31
- onClick: () => void;
31
+ onclick: () => void;
32
32
  disabled?: boolean;
33
33
  }
34
34
  interface IEditingoptions extends IEditingProps {
@@ -1,10 +1,7 @@
1
- /**
2
- * Handles the rendering and configuration of the toolbar for ODS DataGrid.
3
- * This hook prepares the toolbar based on the button configuration provided through props,
4
- * rendering primary and secondary buttons directly and additional buttons in a dropdown if necessary.
5
- *
6
- * @param {Object} props - The properties including configuration for toolbar buttons and the page title.
7
- * @returns {Function} A memoized function that configures and populates the toolbar with buttons and title.
8
- * This function is intended to be used as a callback in the toolbar's preparation phase of the DataGrid component.
9
- */
10
- export declare const useOnToolbarButtonHandler: (props: any) => (e: any) => void;
1
+ interface IOnToolbarPreparingOptions {
2
+ pageTitle?: string;
3
+ toolbarButtonGroup?: any[];
4
+ callback?: (e: any) => void;
5
+ }
6
+ export declare const useOnToolbarButtonHandler: ({ pageTitle, toolbarButtonGroup, callback }: IOnToolbarPreparingOptions) => (e: any) => void;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ toolbarGrid: import("antd-style").SerializedStyles;
3
+ }>;
package/dist/index.js CHANGED
@@ -34993,6 +34993,140 @@ var DynamicIcon = function DynamicIcon(_ref) {
34993
34993
  return React__default.createElement(IconComponent, null);
34994
34994
  };
34995
34995
 
34996
+ var client = createCommonjsModule(function (module, exports) {
34997
+
34998
+
34999
+ if (process.env.NODE_ENV === 'production') {
35000
+ exports.createRoot = reactDom.createRoot;
35001
+ exports.hydrateRoot = reactDom.hydrateRoot;
35002
+ } else {
35003
+ var i = reactDom.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
35004
+ exports.createRoot = function(c, o) {
35005
+ i.usingClientEntryPoint = true;
35006
+ try {
35007
+ return reactDom.createRoot(c, o);
35008
+ } finally {
35009
+ i.usingClientEntryPoint = false;
35010
+ }
35011
+ };
35012
+ exports.hydrateRoot = function(c, h, o) {
35013
+ i.usingClientEntryPoint = true;
35014
+ try {
35015
+ return reactDom.hydrateRoot(c, h, o);
35016
+ } finally {
35017
+ i.usingClientEntryPoint = false;
35018
+ }
35019
+ };
35020
+ }
35021
+ });
35022
+ var client_1 = client.createRoot;
35023
+
35024
+ var _templateObject$r;
35025
+ var useStyles$2 = antdStyle.createStyles(function (_ref) {
35026
+ var css = _ref.css,
35027
+ token = _ref.token;
35028
+ return {
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
+ };
35031
+ });
35032
+
35033
+ var useOnToolbarButtonHandler = function useOnToolbarButtonHandler(_ref) {
35034
+ var pageTitle = _ref.pageTitle,
35035
+ toolbarButtonGroup = _ref.toolbarButtonGroup,
35036
+ callback = _ref.callback;
35037
+ var _useStyles = useStyles$2(),
35038
+ styles = _useStyles.styles;
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
+ }
35078
+ });
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({
35098
+ location: 'before',
35099
+ widget: 'dxTemplate',
35100
+ template: function template(_, __, container) {
35101
+ container.classList.add(styles.toolbarGrid);
35102
+ container.appendChild(dropdownContainer);
35103
+ }
35104
+ });
35105
+ }
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;
35127
+ return onToolbarPreparing;
35128
+ };
35129
+
34996
35130
  var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
34997
35131
  var _props$columnResizing, _props$pagerProps$vis, _props$pagerProps, _props$pagerProps$sho, _props$pagerProps2, _props$pagerProps$sho2, _props$pagerProps3, _props$pagerProps$dis, _props$pagerProps4, _props$pagerProps$inf, _props$pagerProps5, _props$exportProps;
34998
35132
  var rowCount = React.useRef(0);
@@ -35115,6 +35249,11 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
35115
35249
  props.sortingProps.onOptionChanged(e);
35116
35250
  }
35117
35251
  }, [props.dataGridRef]);
35252
+ var handleOnToolbarPreparing = useOnToolbarButtonHandler({
35253
+ pageTitle: props.pageTitle,
35254
+ toolbarButtonGroup: props.toolbarButtonGroup,
35255
+ callback: props.onToolbarPreparing
35256
+ });
35118
35257
  React.useEffect(function () {}, [updateTrigger]);
35119
35258
  React.useEffect(function () {
35120
35259
  var loadFilterData = function loadFilterData() {
@@ -35273,29 +35412,7 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
35273
35412
  }
35274
35413
  return React__default.createElement(React__default.Fragment, null, buttonElements);
35275
35414
  }
35276
- return React__default.createElement("div", null, props.pageTitle && React__default.createElement("div", {
35277
- style: {
35278
- display: "flex",
35279
- justifyContent: "space-between",
35280
- alignItems: "center",
35281
- marginBottom: "10px"
35282
- }
35283
- }, React__default.createElement("h2", null, props.pageTitle), props.toolbarButtonGroup && React__default.createElement("div", {
35284
- style: {
35285
- display: "flex",
35286
- alignItems: "center"
35287
- }
35288
- }, props.toolbarButtonGroup.map(function (button, index) {
35289
- return React__default.createElement(OdsButton, {
35290
- key: index,
35291
- type: button.type,
35292
- onClick: button.onClick,
35293
- disabled: button.disabled,
35294
- style: {
35295
- marginLeft: index > 0 ? "10px" : undefined
35296
- }
35297
- }, button.label);
35298
- }))), React__default.createElement(devextremeReact.DataGrid, Object.assign({
35415
+ return React__default.createElement("div", null, React__default.createElement(devextremeReact.DataGrid, Object.assign({
35299
35416
  dataSource: props.dataSource,
35300
35417
  showBorders: true,
35301
35418
  repaintChangesOnly: true,
@@ -35343,7 +35460,7 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
35343
35460
  onOptionChanged: handleOptionChanged,
35344
35461
  width: "100%",
35345
35462
  language: props.language,
35346
- onToolbarPreparing: props.onToolbarPreparing,
35463
+ onToolbarPreparing: handleOnToolbarPreparing,
35347
35464
  ref: props.dataGridRef
35348
35465
  }), React__default.createElement(DataGrid.Scrolling, {
35349
35466
  mode: "infinite",
@@ -35432,11 +35549,11 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
35432
35549
  }, React__default.createElement("p", null, renderTotal())));
35433
35550
  };
35434
35551
 
35435
- var _templateObject$r, _templateObject2$3, _templateObject3$1, _templateObject4, _templateObject5;
35436
- var useStyles$2 = antdStyle.createStyles(function (_ref) {
35552
+ var _templateObject$s, _templateObject2$3, _templateObject3$1, _templateObject4, _templateObject5;
35553
+ var useStyles$3 = antdStyle.createStyles(function (_ref) {
35437
35554
  var css = _ref.css;
35438
35555
  return {
35439
- grid: css(_templateObject$r || (_templateObject$r = _taggedTemplateLiteralLoose(["\n & .grid-cell-selected {\n background-color: lightgreen;\n }\n & .grid-cell-disable-text-selection {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n & .grid-cell-disable-colored {\n background-color: lightgray;\n }\n & .grid-summary-row-label {\n font-weight: 900;\n }\n\n & .grid-toolbar-button-item {\n padding: 0 !important;\n }\n\n & .dx-datagrid.dx-gridbase-container.dx-datagrid-borders {\n border: none !important;\n border-radius: 16px 16px 0 0;\n }\n & .dx-datagrid-borders > .dx-datagrid-filter-panel,\n & .dx-datagrid-borders > .dx-datagrid-headers {\n border: 0 !important;\n }\n & .dx-datagrid-search-panel {\n margin-left: 0;\n }\n & .dx-toolbar-after .dx-toolbar-item,\n & .dx-toolbar-after .dx-toolbar-item:last-child {\n padding: 0;\n }\n & .dx-toolbar .dx-toolbar-after {\n display: inline-flex;\n gap: 5px;\n }\n .dx-datagrid-borders > .dx-datagrid-headers,\n .dx-datagrid-borders > .dx-datagrid-rowsview,\n .dx-datagrid-borders > .dx-datagrid-total-footer {\n border-radius: 0;\n }\n\n .dx-datagrid-headers .dx-datagrid-table .dx-row > td {\n text-align: start !important;\n }\n\n & .dx-column-indicators {\n float: right !important;\n }\n\n .dx-header-row .dx-header-filter-indicator.dx-text-content-alignment-right, .dx-header-row .dx-sort-indicator.dx-text-content-alignment-right {\n margin-right: 3px;\n margin-left: unset;\n }\n "]))),
35556
+ grid: css(_templateObject$s || (_templateObject$s = _taggedTemplateLiteralLoose(["\n & .grid-cell-selected {\n background-color: lightgreen;\n }\n & .grid-cell-disable-text-selection {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n & .grid-cell-disable-colored {\n background-color: lightgray;\n }\n & .grid-summary-row-label {\n font-weight: 900;\n }\n\n & .grid-toolbar-button-item {\n padding: 0 !important;\n }\n\n & .dx-datagrid.dx-gridbase-container.dx-datagrid-borders {\n border: none !important;\n border-radius: 16px 16px 0 0;\n }\n & .dx-datagrid-borders > .dx-datagrid-filter-panel,\n & .dx-datagrid-borders > .dx-datagrid-headers {\n border: 0 !important;\n }\n & .dx-datagrid-search-panel {\n margin-left: 0;\n }\n & .dx-toolbar-after .dx-toolbar-item,\n & .dx-toolbar-after .dx-toolbar-item:last-child {\n padding: 0;\n }\n & .dx-toolbar .dx-toolbar-after {\n display: inline-flex;\n gap: 5px;\n }\n .dx-datagrid-borders > .dx-datagrid-headers,\n .dx-datagrid-borders > .dx-datagrid-rowsview,\n .dx-datagrid-borders > .dx-datagrid-total-footer {\n border-radius: 0;\n }\n\n .dx-datagrid-headers .dx-datagrid-table .dx-row > td {\n text-align: start !important;\n }\n\n & .dx-column-indicators {\n float: right !important;\n }\n\n .dx-header-row .dx-header-filter-indicator.dx-text-content-alignment-right, .dx-header-row .dx-sort-indicator.dx-text-content-alignment-right {\n margin-right: 3px;\n margin-left: unset;\n }\n "]))),
35440
35557
  gridCustomSummary: css(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n background-color: rgb(255, 255, 255);\n border-radius: 0px 0px 16px 16px;\n font-size: 13px;\n text-align: unset;\n padding: 17px 16px 3px 15px;\n font-weight: 600;\n border-top: 1px solid #ededed;\n "])))
35441
35558
  };
35442
35559
  });
@@ -35714,7 +35831,7 @@ var OdsInlineEditDataGrid = function OdsInlineEditDataGrid(props) {
35714
35831
  onOptionChangedFromProps = props.onOptionChanged,
35715
35832
  onExportingFromProps = props.onExporting,
35716
35833
  AllGridOptions = _objectWithoutPropertiesLoose(props, _excluded$5);
35717
- var _useStyles = useStyles$2(),
35834
+ var _useStyles = useStyles$3(),
35718
35835
  gridStyle = _useStyles.styles;
35719
35836
  var _useState = React.useState(0),
35720
35837
  currentPage = _useState[0],
@@ -35870,113 +35987,6 @@ var OdsInlineEditDataGrid = function OdsInlineEditDataGrid(props) {
35870
35987
  }, React__default.createElement("p", null, renderTotal())));
35871
35988
  };
35872
35989
 
35873
- var client = createCommonjsModule(function (module, exports) {
35874
-
35875
-
35876
- if (process.env.NODE_ENV === 'production') {
35877
- exports.createRoot = reactDom.createRoot;
35878
- exports.hydrateRoot = reactDom.hydrateRoot;
35879
- } else {
35880
- var i = reactDom.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
35881
- exports.createRoot = function(c, o) {
35882
- i.usingClientEntryPoint = true;
35883
- try {
35884
- return reactDom.createRoot(c, o);
35885
- } finally {
35886
- i.usingClientEntryPoint = false;
35887
- }
35888
- };
35889
- exports.hydrateRoot = function(c, h, o) {
35890
- i.usingClientEntryPoint = true;
35891
- try {
35892
- return reactDom.hydrateRoot(c, h, o);
35893
- } finally {
35894
- i.usingClientEntryPoint = false;
35895
- }
35896
- };
35897
- }
35898
- });
35899
- var client_1 = client.createRoot;
35900
-
35901
- var useOnToolbarButtonHandler = function useOnToolbarButtonHandler(props) {
35902
- var _theme$useToken = antd.theme.useToken(),
35903
- token = _theme$useToken.token;
35904
- var onToolbarPreparing = React.useMemo(function () {
35905
- return function (e) {
35906
- var toolbarButtonGroup = props.toolbarButtonGroup;
35907
- var primaryButtons = toolbarButtonGroup.slice(0, 3);
35908
- var additionalButtons = toolbarButtonGroup.length > 3 ? toolbarButtonGroup.slice(3) : [];
35909
- primaryButtons.forEach(function (button, index) {
35910
- var buttonContainer = document.createElement('div');
35911
- var rootButton = client_1(buttonContainer);
35912
- rootButton.render(React__default.createElement(React__default.StrictMode, null, React__default.createElement(OdsButton, {
35913
- key: index,
35914
- style: {
35915
- marginLeft: token.margin
35916
- },
35917
- type: button.type,
35918
- onClick: function onClick() {
35919
- return button.onclick();
35920
- },
35921
- disabled: button.disabled
35922
- }, button.label)));
35923
- e.toolbarOptions.items.push({
35924
- location: 'before',
35925
- widget: 'dxTemplate',
35926
- template: function template(_, __, container) {
35927
- container.appendChild(buttonContainer);
35928
- }
35929
- });
35930
- });
35931
- if (additionalButtons.length > 0) {
35932
- var dropdownContainer = document.createElement('div');
35933
- dropdownContainer.style.marginLeft = '10px';
35934
- var rootDropdown = client_1(dropdownContainer);
35935
- rootDropdown.render(React__default.createElement(React__default.StrictMode, null, React__default.createElement(OdsDropdown, {
35936
- key: "dropdown-custom-toolbar",
35937
- menuItems: additionalButtons.map(function (button) {
35938
- return {
35939
- label: button.label,
35940
- onClick: button.onclick
35941
- };
35942
- })
35943
- }, React__default.createElement(OdsButton, {
35944
- type: "text",
35945
- icon: React__default.createElement(DynamicIcon, {
35946
- iconName: "kebabMenu"
35947
- })
35948
- }))));
35949
- e.toolbarOptions.items.push({
35950
- location: 'before',
35951
- widget: 'dxTemplate',
35952
- template: function template(_, __, container) {
35953
- container.appendChild(dropdownContainer);
35954
- }
35955
- });
35956
- }
35957
- var titleContainer = document.createElement('div');
35958
- var rootTitle = client_1(titleContainer);
35959
- rootTitle.render(React__default.createElement(React__default.StrictMode, null, React__default.createElement(OdsTitle, {
35960
- level: 5,
35961
- style: {
35962
- display: "flex",
35963
- alignItems: "center",
35964
- alignSelf: "stretch",
35965
- margin: 0
35966
- }
35967
- }, props.pageTitle)));
35968
- e.toolbarOptions.items.unshift({
35969
- location: 'before',
35970
- cssClass: 'toolbarTitleItem',
35971
- template: function template(_, __, container) {
35972
- container.appendChild(titleContainer);
35973
- }
35974
- });
35975
- };
35976
- }, [props.toolbarButtonGroup, props.pageTitle, token.margin]);
35977
- return onToolbarPreparing;
35978
- };
35979
-
35980
35990
  var checkCellSelectionConstraints$1 = function checkCellSelectionConstraints(e) {
35981
35991
  return e.rowType == "data" && e.columnIndex > -1 && e.rowIndex > -1;
35982
35992
  };