sccoreui 6.5.13 → 6.5.14

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.
@@ -13,7 +13,7 @@ const multi_select_dropdown_1 = tslib_1.__importDefault(require("../../../../mul
13
13
  const svg_component_1 = tslib_1.__importDefault(require("../../../../../directives/svg-component"));
14
14
  const chips_1 = require("primereact/chips");
15
15
  const Conditions = (props) => {
16
- const { columnName, condition, value, columnsArray, index, id, updateconditionsArray, removeConditionFromArray, addEmptyCondition, conditionsLength, conditionType, conditionTypes, handleConditionType, filterModelText, validationErrors, validationTouched, } = props;
16
+ const { columnName, condition, value, columnsArray, index, id, updateconditionsArray, removeConditionFromArray, addEmptyCondition, conditionsLength, conditionType, conditionTypes, handleConditionType, filterModelText, validationErrors, validationTouched, renderSelectField, renderMultiSelectField, } = props;
17
17
  const valueError = Boolean(validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.value) && Boolean(validationTouched === null || validationTouched === void 0 ? void 0 : validationTouched.value);
18
18
  // Filter available conditions based on column data type using fieldOperators
19
19
  const filteredConditions = constants_2.default.conditionsList.filter((cond) => cond.fieldOperators.includes(columnName === null || columnName === void 0 ? void 0 : columnName.dataType));
@@ -310,14 +310,49 @@ const Conditions = (props) => {
310
310
  if (spec.type === "Date" || spec.type === "DateTime") {
311
311
  return renderCalendar(spec);
312
312
  }
313
- // SELECT data type — uses Dropdown / MultiSelectDropDown with options
313
+ // SELECT data type
314
+ const hasNoStaticOptions = !(selectedColumn === null || selectedColumn === void 0 ? void 0 : selectedColumn.options) || selectedColumn.options.length === 0;
314
315
  if (isSelectType) {
315
- return spec.kind === "Scalar"
316
- ? renderScalarSelect(selectedColumn)
317
- : renderMultiSelect(selectedColumn);
316
+ if (spec.kind === "Scalar") {
317
+ if (renderSelectField && hasNoStaticOptions) {
318
+ return renderSelectField({
319
+ selectedColumn,
320
+ value,
321
+ condition,
322
+ onChange: handleDynamicFieldState,
323
+ disabled: !condition,
324
+ showError,
325
+ placeholder: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.elementThreePlaceHolder_DropDown) || "Select",
326
+ });
327
+ }
328
+ return renderScalarSelect(selectedColumn);
329
+ }
330
+ if (renderMultiSelectField && hasNoStaticOptions) {
331
+ return renderMultiSelectField({
332
+ selectedColumn,
333
+ value,
334
+ condition,
335
+ onChange: handleDynamicFieldState,
336
+ disabled: !condition,
337
+ showError,
338
+ placeholder: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.elementThreePlaceHolder_MultiSelect) || "Select",
339
+ });
340
+ }
341
+ return renderMultiSelect(selectedColumn);
318
342
  }
319
- // MULTISELECT data type — always multi-select dropdown
343
+ // MULTISELECT data type
320
344
  if (isMultiSelectType) {
345
+ if (renderMultiSelectField && hasNoStaticOptions) {
346
+ return renderMultiSelectField({
347
+ selectedColumn,
348
+ value,
349
+ condition,
350
+ onChange: handleDynamicFieldState,
351
+ disabled: !condition,
352
+ showError,
353
+ placeholder: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.elementThreePlaceHolder_MultiSelect) || "Select",
354
+ });
355
+ }
321
356
  return renderMultiSelect(selectedColumn);
322
357
  }
323
358
  // Number types
@@ -145,8 +145,6 @@ const conditionsList = [
145
145
  Types_1.FilterDataType.CURRENCY,
146
146
  Types_1.FilterDataType.BIGINTEGER,
147
147
  Types_1.FilterDataType.PERCENT,
148
- Types_1.FilterDataType.DATE,
149
- Types_1.FilterDataType.DATEANDTIME
150
148
  ],
151
149
  },
152
150
  {
@@ -28,7 +28,7 @@ const form_1 = tslib_1.__importDefault(require("../../../form/form"));
28
28
  */
29
29
  const TableFilter = () => {
30
30
  // Context values for filter state management
31
- const { featureDetails, columnData, conditionType, conditionTypes, globalFilters, setConditionType, setGlobalFilters, setFeatureDetails, callGrid, setViewName, viewName, createView, enableViewCreate, filterModelText, enableAdvancedFilter, gridApi, conditionsToDisplay, } = (0, react_1.useContext)(context_provider_1.FeatureContext);
31
+ const { featureDetails, columnData, conditionType, conditionTypes, globalFilters, setConditionType, setGlobalFilters, setFeatureDetails, callGrid, setViewName, viewName, createView, enableViewCreate, filterModelText, enableAdvancedFilter, gridApi, conditionsToDisplay, renderSelectField, renderMultiSelectField, } = (0, react_1.useContext)(context_provider_1.FeatureContext);
32
32
  // Form reference for validation
33
33
  const formRef = (0, react_1.useRef)(null);
34
34
  // Column mapping keys
@@ -322,7 +322,7 @@ const TableFilter = () => {
322
322
  */
323
323
  const renderCondition = (conditions, key, formSetter, formErrors, formTouched) => {
324
324
  const { columnName, condition, value, id } = conditions;
325
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "" }, { children: (0, jsx_runtime_1.jsx)(Conditions_1.default, { index: key, setEnableApply: (value) => setEnableApply(value), id: id, columnName: columnName, condition: condition, conditionType: conditionType, conditionTypes: conditionTypes, value: value, columnsArray: tableColumns, conditionsArray: constants_1.default.conditionsList, handleConditionType: handleConditionType, updateconditionsArray: (conditionObj, conditionIndex) => updateConditionsArray(conditionObj, conditionIndex, formSetter), addEmptyCondition: (index) => addEmptyCondition(index, formSetter), removeConditionFromArray: (conditionIndex) => removeConditionFromArray(conditionIndex, formSetter), conditionsLength: conditionsArray.length, filterModelText: filterModelText, validationErrors: formErrors, validationTouched: formTouched }, key) })));
325
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "" }, { children: (0, jsx_runtime_1.jsx)(Conditions_1.default, { index: key, setEnableApply: (value) => setEnableApply(value), id: id, columnName: columnName, condition: condition, conditionType: conditionType, conditionTypes: conditionTypes, value: value, columnsArray: tableColumns, conditionsArray: constants_1.default.conditionsList, handleConditionType: handleConditionType, updateconditionsArray: (conditionObj, conditionIndex) => updateConditionsArray(conditionObj, conditionIndex, formSetter), addEmptyCondition: (index) => addEmptyCondition(index, formSetter), removeConditionFromArray: (conditionIndex) => removeConditionFromArray(conditionIndex, formSetter), conditionsLength: conditionsArray.length, filterModelText: filterModelText, validationErrors: formErrors, validationTouched: formTouched, renderSelectField: renderSelectField, renderMultiSelectField: renderMultiSelectField }, key) })));
326
326
  };
327
327
  // ============================================================================
328
328
  // Effects
@@ -388,7 +388,6 @@ const TableFilter = () => {
388
388
  ? values.conditions
389
389
  : conditionsArray;
390
390
  const isFormReady = isValid && allFieldsFilled && enableApply;
391
- console.log(errors, "errors-data-check");
392
391
  return ((0, jsx_runtime_1.jsxs)(dialog_1.Dialog, Object.assign({ visible: isVisible, onHide: () => filterLogoToggle(), className: "modal_filter mt-5 -ml-2" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-4" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex justify-content-between text-lg font-semibold line-height-3 text-gray-900" }, { children: [(filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.header) ? filterModelText.header : "Filter", (0, jsx_runtime_1.jsx)(button_1.Button, { className: "p-0 h-auto px-1 bg-transparent hover:bg-gray-100", onClick: () => setIsVisible(false), icon: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "x-close", size: 15, color: "text-gray-600" }) })] })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-sm text-gray-600" }, { children: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.subHeader)
393
392
  ? filterModelText.subHeader
394
393
  : "Streamline Your Search With Filters" }))] })), (0, jsx_runtime_1.jsx)(divider_1.Divider, { className: "w-full p-0 m-0" }), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "p-2" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "max-h-14rem overflow-y-auto overflow-x-hidden flex flex-column gap-1" }, { children: conditionsToRender.map((eachCondition, index) => {
@@ -9,9 +9,9 @@ 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, 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
- } = value;
14
+ renderSelectField, renderMultiSelectField, } = value;
15
15
  // States for sort
16
16
  const [columnData, setColumnData] = (0, react_1.useState)(gridData === null || gridData === void 0 ? void 0 : gridData.columnData);
17
17
  (0, react_1.useEffect)(() => {
@@ -83,6 +83,10 @@ function MyProvider({ children, value }) {
83
83
  });
84
84
  setGlobalFilters(filtersToAdd);
85
85
  }
86
+ else {
87
+ // Clear filters when switching to a view with no filters (e.g. "All" view)
88
+ setGlobalFilters([]);
89
+ }
86
90
  }, [defaultFilters]);
87
91
  /**
88
92
  * Transform and set default sort to sortValue and sortBy states
@@ -175,7 +179,8 @@ function MyProvider({ children, value }) {
175
179
  gridViewData,
176
180
  setGridViewData,
177
181
  gridView,
178
- inputValue, deboucedValue, setInputValue, serverSideSelectRow, isDataLoading
182
+ inputValue, deboucedValue, setInputValue, serverSideSelectRow, isDataLoading,
183
+ renderSelectField, renderMultiSelectField,
179
184
  } }, { children: children })));
180
185
  }
181
186
  exports.default = MyProvider;
@@ -28,7 +28,7 @@ const INITIAL_CHECKBOX_DATA = {
28
28
  };
29
29
  function ParentForGrid(props) {
30
30
  var _a, _b, _c, _d, _e, _f, _g, _h;
31
- const { gridProps = {}, gridViewTemplate, selectColumns = () => { }, enableCheckboxForGroupHeader = false, serverSideSelectRow, blockSize } = props;
31
+ const { gridProps = {}, gridViewTemplate, selectColumns = () => { }, enableCheckboxForGroupHeader = false, serverSideSelectRow, blockSize, renderSelectField, renderMultiSelectField } = props;
32
32
  const effectiveBlockSize = blockSize || constants_1.BLOCK_SIZE;
33
33
  const [gridData, setGridData] = (0, react_1.useState)({
34
34
  rowData: (props === null || props === void 0 ? void 0 : props.rowData) || [],
@@ -115,6 +115,8 @@ function ParentForGrid(props) {
115
115
  : constants_1.GRID_CHECKBOX_STATUS.UNCHECKED });
116
116
  const updatedRows = [];
117
117
  gridRef.current.api.forEachNode((node) => {
118
+ if (!node.data)
119
+ return;
118
120
  node.data.isSelected = currentStatus;
119
121
  updatedRows.push(Object.assign({}, node.data));
120
122
  });
@@ -399,9 +401,19 @@ function ParentForGrid(props) {
399
401
  })), ((props === null || props === void 0 ? void 0 : props.onRowClicked) ? { onRowClicked: props === null || props === void 0 ? void 0 : props.onRowClicked } : {})), ((props === null || props === void 0 ? void 0 : props.quickSearch) ? { quickSearch: props.quickSearch } : {})), {
400
402
  // ...(props?.getDataPath && { getDataPath: props?.getDataPath }), // for clint side tree data enable fetuare
401
403
  onGridPreDestroyed: onGridPreDestroyed }), ((props === null || props === void 0 ? void 0 : props.rowDragManaged) ? { rowDragManaged: props === null || props === void 0 ? void 0 : props.rowDragManaged } : {})), gridProps);
404
+ console.log("grid-props", props.serverSideSelectRow);
402
405
  // Fucntion to call the grid
403
406
  const callGrid = (featureDetails) => {
404
- onGridReady(gridReadyEvent, featureDetails);
407
+ // Reset checkbox selection on search/filter/sort changes for server-side selection
408
+ if (serverSideSelectRow) {
409
+ const resetFeatures = Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: initialCheckBoxData });
410
+ setFeatureDetails(resetFeatures);
411
+ setSelectedGroup([]);
412
+ onGridReady(gridReadyEvent, resetFeatures);
413
+ }
414
+ else {
415
+ onGridReady(gridReadyEvent, featureDetails);
416
+ }
405
417
  };
406
418
  // Call Grid if something is searched
407
419
  (0, react_1.useEffect)(() => {
@@ -506,7 +518,8 @@ function ParentForGrid(props) {
506
518
  gridViewFun,
507
519
  gridViewData,
508
520
  setGridViewData,
509
- gridView, enableAdvancedFilter: props === null || props === void 0 ? void 0 : props.enableAdvancedFilter }, ((props === null || props === void 0 ? void 0 : props.rowData) && { rowData: props === null || props === void 0 ? void 0 : props.rowData })), { conditionsToDisplay: props === null || props === void 0 ? void 0 : props.conditionsToDisplay, serverSideSelectRow: props.serverSideSelectRow, defaultViewName: props === null || props === void 0 ? void 0 : props.defaultViewName, isDataLoading, dynamicText: props === null || props === void 0 ? void 0 : props.dynamicText }));
521
+ gridView, enableAdvancedFilter: props === null || props === void 0 ? void 0 : props.enableAdvancedFilter }, ((props === null || props === void 0 ? void 0 : props.rowData) && { rowData: props === null || props === void 0 ? void 0 : props.rowData })), { conditionsToDisplay: props === null || props === void 0 ? void 0 : props.conditionsToDisplay, serverSideSelectRow: props.serverSideSelectRow, defaultViewName: props === null || props === void 0 ? void 0 : props.defaultViewName, isDataLoading, dynamicText: props === null || props === void 0 ? void 0 : props.dynamicText, renderSelectField,
522
+ renderMultiSelectField }));
510
523
  }, [
511
524
  props.rowModelType,
512
525
  props === null || props === void 0 ? void 0 : props.quickSearch,
@@ -526,6 +539,7 @@ function ParentForGrid(props) {
526
539
  props.serverSideSelectRow,
527
540
  props === null || props === void 0 ? void 0 : props.defaultViewName,
528
541
  isDataLoading,
542
+ renderSelectField, renderMultiSelectField,
529
543
  ]);
530
544
  return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(error_ui_1.default, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ id: "wrapper", style: { height: gridStyle === null || gridStyle === void 0 ? void 0 : gridStyle.height, width: gridStyle === null || gridStyle === void 0 ? void 0 : gridStyle.width }, className: `ag-grid-container ag-grid-parent-div ${(props === null || props === void 0 ? void 0 : props.enableAdvancedFilter) ? "hide-advance-filter" : ""}` }, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(context_provider_1.default, Object.assign({ value: contextValue }, { children: ((_h = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _h === void 0 ? void 0 : _h.displayFeaturesHeader) && ((0, jsx_runtime_1.jsx)(advanced_feature_1.default, { props: props })) })), gridView ? (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: gridViewTemplate(gridViewData) }) : (0, jsx_runtime_1.jsx)(AgGrid_1.default, { style: gridStyle, gridOptions: gridOptions, onGridReady: (props === null || props === void 0 ? void 0 : props.rowData) ? undefined : onGridReady, gridRef: gridRef })] }) })) }) }));
531
545
  }
@@ -266,4 +266,15 @@ export declare enum FilteredConditionTypes {
266
266
  IS_EQUAL_TO_ALL_OF = 24,
267
267
  IS_EQUAL_TO_ANY_OF = 25
268
268
  }
269
+ export interface SelectFieldRenderProps {
270
+ selectedColumn: any;
271
+ value: any;
272
+ condition: any;
273
+ onChange: (value: any) => void;
274
+ disabled: boolean;
275
+ showError: boolean;
276
+ placeholder?: string;
277
+ }
278
+ export type RenderSelectField = (props: SelectFieldRenderProps) => JSX.Element;
279
+ export type RenderMultiSelectField = (props: SelectFieldRenderProps) => JSX.Element;
269
280
  export {};
@@ -1,4 +1,4 @@
1
- import { CheckBoxSelection, ColumnDef, ConditionsToDisplay, Features, FilterCondition, FilterModelText, GridData, RecordDetailModelText, SidePanelText, SortModelText } from "./Types";
1
+ import { CheckBoxSelection, ColumnDef, ConditionsToDisplay, Features, FilterCondition, FilterModelText, GridData, RecordDetailModelText, RenderSelectField, RenderMultiSelectField, SidePanelText, SortModelText } from "./Types";
2
2
  export declare const FeatureContext: import("react").Context<any>;
3
3
  interface MyProviderProps {
4
4
  children: React.ReactNode;
@@ -42,6 +42,8 @@ interface MyProviderProps {
42
42
  defaultViewName?: string;
43
43
  isDataLoading?: boolean;
44
44
  dynamicText?: any;
45
+ renderSelectField?: RenderSelectField;
46
+ renderMultiSelectField?: RenderMultiSelectField;
45
47
  };
46
48
  }
47
49
  declare function MyProvider({ children, value }: MyProviderProps): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sccoreui",
3
- "version": "6.5.13",
3
+ "version": "6.5.14",
4
4
  "description": "ui-sccore",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",