@syook/react-tabulous 4.5.0 → 4.6.0-beta.2

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Installation
4
4
 
5
- To use in your own project, install it via [npm package](https://www.npmjs.com/package/@syook/react-tabulous).
5
+ To use in your own project, install it via [npm package](https://www.npmjs.com/package/react-tabulous).
6
6
 
7
7
  `npm i @syook/react-tabulous`
8
8
 
package/lib/index.d.ts CHANGED
@@ -172,10 +172,59 @@ interface FilterFieldProps {
172
172
  type: 'string' | 'number' | 'date' | 'dateTime' | 'boolean' | 'singleSelect';
173
173
  operator: string;
174
174
  value: any;
175
+ value2?: any;
175
176
  field?: string;
176
177
  options?: string[] | OptionInterface[];
177
178
  }
178
179
 
180
+ type ConditionalFormattingOperator = string;
181
+ interface GridConditionalFormattingRule {
182
+ /**
183
+ * Unique ID for the rule.
184
+ */
185
+ id: string;
186
+ /**
187
+ * The field (column) to evaluate condition and apply style to.
188
+ * (Relies on this key/value; no separate columns array needed.)
189
+ */
190
+ field: string;
191
+ /**
192
+ * Operator for the condition (reuses filter operators).
193
+ */
194
+ operator: ConditionalFormattingOperator;
195
+ /**
196
+ * Value for condition (e.g. threshold, text).
197
+ */
198
+ value?: any;
199
+ /**
200
+ * Second value for operators like 'between'.
201
+ */
202
+ value2?: any;
203
+ /**
204
+ * Styles to apply if condition matches.
205
+ */
206
+ style: {
207
+ textColor?: string;
208
+ backgroundColor?: string;
209
+ };
210
+ /**
211
+ * Higher number = higher priority (last in array wins on ties).
212
+ * Managed by rule order in UI.
213
+ */
214
+ priority: number;
215
+ }
216
+ interface GridConditionalFormattingProps {
217
+ /**
218
+ * Array of conditional formatting rules.
219
+ * Rules are evaluated in order for each cell/row.
220
+ */
221
+ conditionalFormatting?: GridConditionalFormattingRule[];
222
+ /**
223
+ * Callback when rules change (e.g. add/edit/delete).
224
+ */
225
+ onConditionalFormattingChange?: (rules: GridConditionalFormattingRule[]) => void;
226
+ }
227
+
179
228
  interface DataGridPropsWithDefaultValues {
180
229
  data: any;
181
230
  rootData: [];
@@ -329,12 +378,23 @@ interface DataGridPropsWithDefaultValues {
329
378
  * if the export is custom.
330
379
  *
331
380
  */
332
- customExport: null | ((filteredAndSortedData: any, searchText: string, columns: any) => void);
381
+ customExport: null | ((filteredAndSortedData: any, searchText: string, columns: any, conditionalFormatting?: any) => void);
333
382
  /**
334
383
  * Callback fired when filter is changed with filters as arguments.
335
384
  *
336
385
  */
337
386
  onFilterChange: null | ((filters: FilterFieldProps[]) => void);
387
+ /**
388
+ * Conditional formatting rules to apply to cells/rows.
389
+ * Rules evaluated independently (after filters/sorts).
390
+ * Multiple rules; later rules override on conflicts based on order/priority.
391
+ * @default []
392
+ */
393
+ conditionalFormatting: GridConditionalFormattingRule[];
394
+ /**
395
+ * Callback fired when conditional formatting rules change.
396
+ */
397
+ onConditionalFormattingChange: null | ((rules: GridConditionalFormattingRule[]) => void);
338
398
  /**
339
399
  * custom placeholder for the search field.
340
400
  */
@@ -347,4 +407,4 @@ type DataGridProps<R extends GridValidRowModel = any> = Partial<DataGridPropsWit
347
407
  type DataGridComponent = React$1.ForwardRefExoticComponent<DataGridProps<GridValidRowModel> & React$1.RefAttributes<HTMLDivElement>>;
348
408
  declare const ReactTabulous: DataGridComponent;
349
409
 
350
- export { ColumnType, DataGridProps, DataGridPropsWithDefaultValues, FilterFieldProps, GridActionsColDef, GridBaseColDef, GridColDef, GridColumnPinningApi, GridColumnPinningInternalCache, GridColumnPinningState, GridDensity, GridPinnedColumns, GridPinnedPosition, GridRowId, GridSortDirection, GridValidRowModel, Logger, NativeColTypes, ReactTabulous };
410
+ export { ColumnType, ConditionalFormattingOperator, DataGridProps, DataGridPropsWithDefaultValues, FilterFieldProps, GridActionsColDef, GridBaseColDef, GridColDef, GridColumnPinningApi, GridColumnPinningInternalCache, GridColumnPinningState, GridConditionalFormattingProps, GridConditionalFormattingRule, GridDensity, GridPinnedColumns, GridPinnedPosition, GridRowId, GridSortDirection, GridValidRowModel, Logger, NativeColTypes, ReactTabulous };