sccoreui 6.5.16 → 6.5.17

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/App.scss CHANGED
@@ -2037,6 +2037,15 @@ div:has(ul.date_filter) .p-datepicker-footer {
2037
2037
  }
2038
2038
  }
2039
2039
  }
2040
+ .grid-global-search {
2041
+ width: 21rem;
2042
+ .p-input-icon-left {
2043
+ width: 100%;
2044
+ }
2045
+ .p-inputtext {
2046
+ width: 100%;
2047
+ }
2048
+ }
2040
2049
 
2041
2050
  .panel_withIcon.p-multiselect-panel {
2042
2051
  .p-multiselect-items {
@@ -2055,7 +2064,7 @@ div:has(ul.date_filter) .p-datepicker-footer {
2055
2064
  .errorField {
2056
2065
  color: var(--red-500);
2057
2066
  max-height: 50px;
2058
- padding-block: 6px;
2067
+ padding-block: 2px 6px;
2059
2068
  }
2060
2069
 
2061
2070
  .full_form_field {
@@ -31,7 +31,7 @@ function AdvancedFeatures({ props }) {
31
31
  };
32
32
  return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (props === null || props === void 0 ? void 0 : props.editMode) ? ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `flex align-items-center justify-content-between py-3 px-4 bg-white grid-header` }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flex align-items-center gap-3" }, { children: isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayEditHeading) &&
33
33
  (props === null || props === void 0 ? void 0 : props.EditHeadingDetails) && (0, jsx_runtime_1.jsx)(EditDetails, {}) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flex align-items-center gap-3" }, { children: isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displaySearch) && ((0, jsx_runtime_1.jsx)(gridS_search_1.default, {})) })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center gap-3" }, { children: [isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displaySidePanel) && ((0, jsx_runtime_1.jsx)(hide_column_1.default, {})), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayBulkEdit) &&
34
- (props === null || props === void 0 ? void 0 : props.BulkEditComponent) && (0, jsx_runtime_1.jsx)(BulkEdit, {}), (props === null || props === void 0 ? void 0 : props.editMode) && (0, jsx_runtime_1.jsx)(bulk_edit_action_1.default, { props: props })] }))] }))) : ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `flex align-items-center justify-content-between py-3 px-4 bg-white grid-header` }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center gap-3" }, { children: [isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displaySearch) && ((0, jsx_runtime_1.jsx)(global_search_1.default, { searchPlaceHolder: props === null || props === void 0 ? void 0 : props.placeholder })), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayFilter) && ((0, jsx_runtime_1.jsx)(table_filter_1.default, {})), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayAdvancedFilter) && ((0, jsx_runtime_1.jsx)(AdvanceFilterWrapper, {})), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayRowGroupingElement) && (0, jsx_runtime_1.jsx)(column_group_1.default, { dataFromProps: props })] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center gap-3" }, { children: [isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displaySidePanel) && ((0, jsx_runtime_1.jsx)(hide_column_1.default, {})), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayGridViewListView) && (0, jsx_runtime_1.jsx)(grid_view_list_view_1.default, {}), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayRemoveItems) && ((0, jsx_runtime_1.jsx)(remove_items_1.default, { removeCallBack: props.removeCallBack })), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayBulkEdit) &&
34
+ (props === null || props === void 0 ? void 0 : props.BulkEditComponent) && (0, jsx_runtime_1.jsx)(BulkEdit, {}), (props === null || props === void 0 ? void 0 : props.editMode) && (0, jsx_runtime_1.jsx)(bulk_edit_action_1.default, { props: props })] }))] }))) : ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `flex align-items-center justify-content-between py-3 px-4 bg-white grid-header` }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center gap-3 grid-global-search" }, { children: [isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displaySearch) && ((0, jsx_runtime_1.jsx)(global_search_1.default, { searchPlaceHolder: props === null || props === void 0 ? void 0 : props.placeholder })), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayFilter) && ((0, jsx_runtime_1.jsx)(table_filter_1.default, {})), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayAdvancedFilter) && ((0, jsx_runtime_1.jsx)(AdvanceFilterWrapper, {})), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayRowGroupingElement) && (0, jsx_runtime_1.jsx)(column_group_1.default, { dataFromProps: props })] })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center gap-3" }, { children: [isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displaySidePanel) && ((0, jsx_runtime_1.jsx)(hide_column_1.default, {})), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayGridViewListView) && (0, jsx_runtime_1.jsx)(grid_view_list_view_1.default, {}), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayRemoveItems) && ((0, jsx_runtime_1.jsx)(remove_items_1.default, { removeCallBack: props.removeCallBack })), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayBulkEdit) &&
35
35
  (props === null || props === void 0 ? void 0 : props.BulkEditComponent) && (0, jsx_runtime_1.jsx)(BulkEdit, {}), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayBulkAction) &&
36
36
  (props === null || props === void 0 ? void 0 : props.bulkActionComponent) && ((0, jsx_runtime_1.jsx)(BulkAction, { checkBoxSelection: featureDetails.checkBoxSelection })), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayRefresh) && ((0, jsx_runtime_1.jsx)(refresh_grid_1.default, {})), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displaySort) && (0, jsx_runtime_1.jsx)(custom_sort_1.default, {}), isComponentVisible(conditionsToDisplay === null || conditionsToDisplay === void 0 ? void 0 : conditionsToDisplay.displayRecords) && ((0, jsx_runtime_1.jsx)(record_detail_1.default, {}))] }))] }))) }));
37
37
  }
@@ -9,7 +9,7 @@ const hooks_1 = require("primereact/hooks");
9
9
  const constants_1 = tslib_1.__importDefault(require("./constants"));
10
10
  exports.FeatureContext = (0, react_1.createContext)(null);
11
11
  function MyProvider({ children, value }) {
12
- const { featureDetails, setFeatureDetails, gridData, callGrid, totalRecords, initialFeature, defaultFilters, defaultSort, createView, enableViewCreate, filterModelText, sortModelText, recordDetailModelText, sidePanelText, sortOptions, filterConditions, clearFilters, setGridData, gridApi, updateColumnsForGrid, enableManageColumnsCallback, columnToRender, selectedGroup, setSelectedGroup, initialCheckBoxData, intialColumns, setIntialColumns, rowModelType, quickSearch, enableAdvancedFilter, conditionsToDisplay, gridViewFun, gridViewData, setGridViewData, gridView, serverSideSelectRow, defaultViewName, isDataLoading,
12
+ const { featureDetails, setFeatureDetails, gridData, callGrid, totalRecords, initialFeature, defaultFilters, defaultSearchText, defaultSort, createView, enableViewCreate, filterModelText, sortModelText, recordDetailModelText, sidePanelText, sortOptions, filterConditions, clearFilters, setGridData, gridApi, updateColumnsForGrid, enableManageColumnsCallback, columnToRender, selectedGroup, setSelectedGroup, initialCheckBoxData, intialColumns, setIntialColumns, rowModelType, quickSearch, enableAdvancedFilter, conditionsToDisplay, gridViewFun, gridViewData, setGridViewData, gridView, serverSideSelectRow, defaultViewName, isDataLoading,
13
13
  // dynamicText
14
14
  renderSelectField, renderMultiSelectField, } = value;
15
15
  // States for sort
@@ -19,7 +19,7 @@ function MyProvider({ children, value }) {
19
19
  setColumnData(gridData.columnData);
20
20
  }
21
21
  }, [gridData === null || gridData === void 0 ? void 0 : gridData.columnData]);
22
- const [inputValue, deboucedValue, setInputValue] = (0, hooks_1.useDebounce)("", 500);
22
+ const [inputValue, deboucedValue, setInputValue] = (0, hooks_1.useDebounce)(defaultSearchText || "", 500);
23
23
  const [sortValue, setSortValue] = (0, react_1.useState)({});
24
24
  const [sortBy, setSortBy] = (0, react_1.useState)({});
25
25
  const [isOverlayOpened, setIsOverlayOpened] = (0, react_1.useState)(false);
@@ -111,6 +111,10 @@ function MyProvider({ children, value }) {
111
111
  }
112
112
  }
113
113
  }, [defaultSort, columnData, sortOptions]);
114
+ // Sync search input when defaultSearchText changes (e.g. switching saved views)
115
+ (0, react_1.useEffect)(() => {
116
+ setInputValue(defaultSearchText || "");
117
+ }, [defaultSearchText]);
114
118
  // Update viewName when defaultViewName changes
115
119
  (0, react_1.useEffect)(() => {
116
120
  if (defaultViewName) {
@@ -43,6 +43,7 @@ function ParentForGrid(props) {
43
43
  const [gridReadyEvent, setGridReadyEvent] = (0, react_1.useState)();
44
44
  const [intialColumns, setIntialColumns] = (0, react_1.useState)(null);
45
45
  const [defaultFilters, setDefaultFilters] = (0, react_1.useState)((props === null || props === void 0 ? void 0 : props.defaultFilters) || []);
46
+ const [defaultSearchText, setDefaultSearchText] = (0, react_1.useState)((props === null || props === void 0 ? void 0 : props.defaultSearchText) || "");
46
47
  const [defaultSort] = (0, react_1.useState)((props === null || props === void 0 ? void 0 : props.defaultSort) || null);
47
48
  const [selectedGroup, setSelectedGroup] = (0, react_1.useState)([]);
48
49
  const emptyResponse = EMPTY_RESPONSE;
@@ -59,7 +60,7 @@ function ParentForGrid(props) {
59
60
  isRemoveClicked: false,
60
61
  }), [initialCheckBoxData]);
61
62
  const [featureDetails, setFeatureDetails] = (0, react_1.useState)({
62
- searchedText: "",
63
+ searchedText: (props === null || props === void 0 ? void 0 : props.defaultSearchText) || "",
63
64
  filterQueries: (props === null || props === void 0 ? void 0 : props.defaultFilters)
64
65
  ? (0, helper_1.applyDefaultFilters)(props === null || props === void 0 ? void 0 : props.defaultFilters)
65
66
  : [],
@@ -80,6 +81,7 @@ function ParentForGrid(props) {
80
81
  });
81
82
  // const [columnToRender,setColumnToRender] = useState<ColumnDef[]>([])
82
83
  const isInitialLoadRef = (0, react_1.useRef)(true);
84
+ const isRefetchingRef = (0, react_1.useRef)(false);
83
85
  const gridRef = (0, react_1.useRef)(null);
84
86
  const groupingColumns = (0, react_1.useMemo)(() => {
85
87
  var _a, _b;
@@ -419,6 +421,10 @@ function ParentForGrid(props) {
419
421
  (0, react_1.useEffect)(() => {
420
422
  if (isInitialLoadRef.current)
421
423
  return;
424
+ if (isRefetchingRef.current) {
425
+ isRefetchingRef.current = false;
426
+ return;
427
+ }
422
428
  if (api && gridReadyEvent) {
423
429
  !props.rowData && callGrid(featureDetails);
424
430
  }
@@ -435,8 +441,12 @@ function ParentForGrid(props) {
435
441
  const newFilterQueries = ((_a = props === null || props === void 0 ? void 0 : props.defaultFilters) === null || _a === void 0 ? void 0 : _a.length)
436
442
  ? (0, helper_1.applyDefaultFilters)(props.defaultFilters)
437
443
  : [];
438
- const currentFeature = Object.assign(Object.assign({}, featureDetails), { filterQueries: newFilterQueries });
444
+ const newSearchText = (props === null || props === void 0 ? void 0 : props.defaultSearchText) || "";
445
+ const currentFeature = Object.assign(Object.assign({}, featureDetails), { filterQueries: newFilterQueries, searchedText: newSearchText });
439
446
  setDefaultFilters((props === null || props === void 0 ? void 0 : props.defaultFilters) || []);
447
+ setDefaultSearchText(newSearchText);
448
+ // Prevent the searchedText useEffect from triggering a duplicate callGrid
449
+ isRefetchingRef.current = true;
440
450
  setFeatureDetails(currentFeature);
441
451
  callGrid(currentFeature);
442
452
  }
@@ -513,6 +523,7 @@ function ParentForGrid(props) {
513
523
  totalRecords,
514
524
  initialFeature,
515
525
  defaultFilters,
526
+ defaultSearchText,
516
527
  defaultSort, createView: props === null || props === void 0 ? void 0 : props.createView, enableViewCreate: (_a = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _a === void 0 ? void 0 : _a.enableViewCreate, filterModelText: (_b = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _b === void 0 ? void 0 : _b.filterModelText, sortModelText: (_c = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _c === void 0 ? void 0 : _c.sortModelText, recordDetailModelText: (_d = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _d === void 0 ? void 0 : _d.recordDetailModelText, sidePanelText: (_e = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _e === void 0 ? void 0 : _e.sidePanelText, sortOptions: (props === null || props === void 0 ? void 0 : props.sortOptions) ? props.sortOptions : constants_1.COLUMN_SORT_OPTIONS, filterConditions: props === null || props === void 0 ? void 0 : props.filterConditions, clearFilters: props === null || props === void 0 ? void 0 : props.clearFilters, setGridData, gridApi: gridRef, updateColumnsForGrid: props === null || props === void 0 ? void 0 : props.updateColumnsForGrid, enableManageColumnsCallback: props.enableManageColumnsCallback, columnToRender: gridData.columnData, selectedGroup: selectedGroup, setSelectedGroup: setSelectedGroup, initialCheckBoxData: initialCheckBoxData, intialColumns,
517
528
  setIntialColumns,
518
529
  gridViewFun,
@@ -524,7 +535,7 @@ function ParentForGrid(props) {
524
535
  props.rowModelType,
525
536
  props === null || props === void 0 ? void 0 : props.quickSearch,
526
537
  featureDetails, gridData, callGrid,
527
- totalRecords, initialFeature, defaultFilters, defaultSort,
538
+ totalRecords, initialFeature, defaultFilters, defaultSearchText, defaultSort,
528
539
  props === null || props === void 0 ? void 0 : props.createView,
529
540
  props === null || props === void 0 ? void 0 : props.conditionsToDisplay,
530
541
  props === null || props === void 0 ? void 0 : props.dynamicText,
@@ -10,6 +10,7 @@ interface MyProviderProps {
10
10
  totalRecords: number;
11
11
  initialFeature: Features;
12
12
  defaultFilters: any;
13
+ defaultSearchText: string;
13
14
  defaultSort: any;
14
15
  createView: () => void;
15
16
  enableViewCreate: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sccoreui",
3
- "version": "6.5.16",
3
+ "version": "6.5.17",
4
4
  "description": "ui-sccore",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",