@adaptabletools/adaptable 21.0.0-canary.7 → 21.0.0

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.
@@ -6,6 +6,7 @@ import { usePredicateDef } from './hooks';
6
6
  import Radio from '../../../components/Radio';
7
7
  import { useAdaptable } from '../../AdaptableContext';
8
8
  import { Select } from '../../../components/Select';
9
+ import { mapQlPredicateToAdaptablePredicate } from './utils';
9
10
  const ColumnFilterPredicateDropdown = (props) => {
10
11
  const predicateDef = usePredicateDef(props.predicate?.operator, props.predicateDefs);
11
12
  const options = props.predicateDefs.map((predicateDef) => {
@@ -78,6 +79,10 @@ export const ColumnFilterComponent = (props) => {
78
79
  setPredicateNotYetApplied(predicate);
79
80
  }
80
81
  };
82
+ const clearAllFilters = () => {
83
+ props.onPredicateChange(null);
84
+ setPredicateNotYetApplied(undefined);
85
+ };
81
86
  const onNewPredicate = (predicateDef) => {
82
87
  const currentPredicate = currentPredicateRef.current;
83
88
  const newPredicate = {
@@ -111,10 +116,29 @@ export const ColumnFilterComponent = (props) => {
111
116
  variant: 'raised',
112
117
  children: 'Add Condition',
113
118
  } }));
119
+ const isAtLeastOneColumnFilterValid = (qlPredicates) => {
120
+ if (!qlPredicates?.length) {
121
+ return false;
122
+ }
123
+ return qlPredicates
124
+ .map((qlPredicate) => mapQlPredicateToAdaptablePredicate(qlPredicate))
125
+ .some((adaptablePredicate) => adaptable.api.predicateApi.isValidPredicate(adaptablePredicate));
126
+ };
114
127
  return (React.createElement(React.Fragment, null,
115
- React.createElement(Flex, { m: 2 },
116
- React.createElement(AndOrInput, { onChange: onCombineChange, operator: currentPredicate.operator }),
117
- React.createElement(SimpleButton, { ml: 2, onClick: () => onPredicateChange(null) }, "Clear All")),
128
+ React.createElement(Flex, { flexDirection: "column", backgroundColor: "primarylight", pb: !props.hideActionButtons ? 2 : undefined, mb: props.location === 'filterForm' ? 2 : undefined, mt: props.location === 'columnMenu' ? 2 : undefined, ml: props.location === 'columnMenu' ? 2 : undefined, mr: props.location === 'columnMenu' ? 2 : undefined, style: { borderRadius: 'var(--ab__border-radius)' } },
129
+ React.createElement(Flex, { m: 2 },
130
+ React.createElement(AndOrInput, { onChange: onCombineChange, operator: currentPredicate.operator })),
131
+ !props.hideActionButtons && (React.createElement(Flex, { ml: 2, mr: 2, className: "ab-ColumnFilter-actions", justifyContent: "space-between" },
132
+ React.createElement(Box, { className: "ab-ColumnFilter-action-clearall" },
133
+ React.createElement(SimpleButton, { "aria-label": 'Clear All Filters', onClick: () => clearAllFilters() }, "Clear All")),
134
+ manuallyApplyColumnFilter ? (React.createElement(React.Fragment, null,
135
+ React.createElement(Box, { flex: 1, "data-name": "spacer" }),
136
+ React.createElement(Box, { className: "ab-ColumnFilter-action-reset", mr: 2 },
137
+ React.createElement(SimpleButton, { "aria-label": 'Reset All', tone: "neutral", variant: "raised", onClick: () => {
138
+ setPredicateNotYetApplied(props.predicate);
139
+ } }, "Reset")),
140
+ React.createElement(Box, { className: "ab-ColumnFilter-action-apply" },
141
+ React.createElement(SimpleButton, { "aria-label": 'Apply Filter', tone: "accent", variant: "raised", onClick: applyFilter, disabled: !isAtLeastOneColumnFilterValid(predicateNotYetApplied?.args) && !isAtLeastOneColumnFilterValid(currentPredicate.args) }, "Apply")))) : null))),
118
142
  React.createElement(Flex, { flexDirection: "column", className: "ab-ColumnFilter", flex: 1, minHeight: 0, ...props.wrapperProps },
119
143
  React.createElement(Box, { style: { overflow: 'auto' } },
120
144
  currentPredicate.args.map((predicate, index) => {
@@ -140,14 +164,5 @@ export const ColumnFilterComponent = (props) => {
140
164
  });
141
165
  } }));
142
166
  }),
143
- isLastPredicateValid && filterPredicateDropdown),
144
- manuallyApplyColumnFilter ? (React.createElement(React.Fragment, null,
145
- React.createElement(Box, { flex: 1, "data-name": "spacer" }),
146
- React.createElement(Flex, { pt: 2, className: "ab-ColumnFilter-actions", justifyContent: "space-between" },
147
- React.createElement(Box, { className: "ab-ColumnFilter-action-apply" },
148
- React.createElement(SimpleButton, { tone: "accent", variant: "raised", onClick: applyFilter }, "Apply Filter")),
149
- React.createElement(Box, { className: "ab-ColumnFilter-action-reset" },
150
- React.createElement(SimpleButton, { tone: "neutral", variant: "raised", onClick: () => {
151
- setPredicateNotYetApplied(props.predicate);
152
- } }, "Reset Filter"))))) : null)));
167
+ isLastPredicateValid && filterPredicateDropdown))));
153
168
  };
@@ -29,5 +29,5 @@ export const ColumnFilterWindow = (props) => {
29
29
  }
30
30
  return label;
31
31
  }, onChange: (column) => setColumnId(column), filterColumn: (column) => column.queryable, isMulti: false, value: columnId })))),
32
- React.createElement(AdaptableColumnFilter, { columnId: columnId })));
32
+ React.createElement(AdaptableColumnFilter, { columnId: columnId, location: 'filterForm' })));
33
33
  };
@@ -21,5 +21,5 @@ export const LayoutColumnFilter = (props) => {
21
21
  };
22
22
  props.onColumnFilterChange(newFilter);
23
23
  };
24
- return (React.createElement(ColumnFilterComponent, { columnId: props.columnFilter.ColumnId, predicate: qlPredicate, predicateDefs: qlPredicateDefs, disabled: props.columnFilter?.IsSuspended, onPredicateChange: handlePredicateChange }));
24
+ return (React.createElement(ColumnFilterComponent, { location: 'filterForm', columnId: props.columnFilter.ColumnId, predicate: qlPredicate, predicateDefs: qlPredicateDefs, disabled: props.columnFilter?.IsSuspended, onPredicateChange: handlePredicateChange, hideActionButtons: true }));
25
25
  };
@@ -108,7 +108,7 @@ export const EntityRulesEditor = (props) => {
108
108
  }
109
109
  };
110
110
  const filteredPredicateDefs = predicateDefs.filter((def) => {
111
- if (api.predicateApi.internalApi.IsInorNotInPredicateDef(def)) {
111
+ if (api.predicateApi.internalApi.IsInOrNotInPredicateDef(def)) {
112
112
  return 'ColumnIds' in data.Scope && data.Scope.ColumnIds.length === 1;
113
113
  }
114
114
  return true;
@@ -79,7 +79,7 @@ export const PredicateEditor = (props) => {
79
79
  index > 0 && React.createElement(HelpBlock, { margin: 2 }, "AND"),
80
80
  React.createElement(Flex, { key: index, flex: 1, flexDirection: "column" },
81
81
  React.createElement(AdaptableInput, { "data-name": `predicate-input-${index}`, marginTop: 2, type: predicateDefInput.type, autoFocus: index === 0, value: props.predicate.Inputs?.[index] ?? '', onChange: (e) => handlePredicateInputChange(e, index) })))))),
82
- adaptable.api.predicateApi.internalApi.IsInorNotInPredicateDef(currentPredicateDef) && (React.createElement(Box, { mt: 2 },
82
+ adaptable.api.predicateApi.internalApi.IsInOrNotInPredicateDef(currentPredicateDef) && (React.createElement(Box, { mt: 2 },
83
83
  React.createElement(ColumnValuesSelect, { isLoading: isDistinctColumnValuesLoading, column: column, options: quickFilterValues.values, selectProps: {
84
84
  onMenuOpen,
85
85
  onInputChange,
@@ -37,6 +37,7 @@ export const AgGridFilterAdapterFactory = (adaptable) => {
37
37
  this.unmountReactRoot = adaptable.renderReactRoot(renderWithAdaptableContext(React.createElement(AdaptableColumnFilter, {
38
38
  columnId,
39
39
  wrapperProps: { p: 2 },
40
+ location: 'columnMenu',
40
41
  }), adaptable), this.filterContainer);
41
42
  }
42
43
  }
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
3
- PUBLISH_TIMESTAMP: 1757331083218 || Date.now(),
4
- VERSION: "21.0.0-canary.7" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1757490972135 || Date.now(),
4
+ VERSION: "21.0.0" || '--current-version--',
5
5
  };
@@ -3021,33 +3021,6 @@ export declare const ADAPTABLE_METAMODEL: {
3021
3021
  kind: string;
3022
3022
  desc: string;
3023
3023
  };
3024
- DefaultLayoutProperties: {
3025
- name: string;
3026
- kind: string;
3027
- desc: string;
3028
- props: {
3029
- name: string;
3030
- kind: string;
3031
- desc: string;
3032
- isOpt: boolean;
3033
- ref: string;
3034
- }[];
3035
- };
3036
- DefaultLayoutPropertiesContext: {
3037
- name: string;
3038
- kind: string;
3039
- desc: string;
3040
- props: {
3041
- name: string;
3042
- kind: string;
3043
- desc: string;
3044
- }[];
3045
- };
3046
- DefaultPivotLayoutProperties: {
3047
- name: string;
3048
- kind: string;
3049
- desc: string;
3050
- };
3051
3024
  DefaultPredicateFilterContext: {
3052
3025
  name: string;
3053
3026
  kind: string;
@@ -3064,11 +3037,6 @@ export declare const ADAPTABLE_METAMODEL: {
3064
3037
  ref: string;
3065
3038
  })[];
3066
3039
  };
3067
- DefaultTableLayoutProperties: {
3068
- name: string;
3069
- kind: string;
3070
- desc: string;
3071
- };
3072
3040
  DetailInitContext: {
3073
3041
  name: string;
3074
3042
  kind: string;
@@ -4249,6 +4217,28 @@ export declare const ADAPTABLE_METAMODEL: {
4249
4217
  ref?: undefined;
4250
4218
  })[];
4251
4219
  };
4220
+ LayoutCreationDefaultProperties: {
4221
+ name: string;
4222
+ kind: string;
4223
+ desc: string;
4224
+ props: {
4225
+ name: string;
4226
+ kind: string;
4227
+ desc: string;
4228
+ isOpt: boolean;
4229
+ ref: string;
4230
+ }[];
4231
+ };
4232
+ LayoutCreationDefaultPropertiesContext: {
4233
+ name: string;
4234
+ kind: string;
4235
+ desc: string;
4236
+ props: {
4237
+ name: string;
4238
+ kind: string;
4239
+ desc: string;
4240
+ }[];
4241
+ };
4252
4242
  LayoutExtendedConfig: {
4253
4243
  name: string;
4254
4244
  kind: string;
@@ -4707,6 +4697,11 @@ export declare const ADAPTABLE_METAMODEL: {
4707
4697
  ref?: undefined;
4708
4698
  })[];
4709
4699
  };
4700
+ PivotLayoutCreationDefaultProperties: {
4701
+ name: string;
4702
+ kind: string;
4703
+ desc: string;
4704
+ };
4710
4705
  PivotPreviewColumnsContext: {
4711
4706
  name: string;
4712
4707
  kind: string;
@@ -5895,6 +5890,11 @@ export declare const ADAPTABLE_METAMODEL: {
5895
5890
  ref?: undefined;
5896
5891
  })[];
5897
5892
  };
5893
+ TableLayoutCreationDefaultProperties: {
5894
+ name: string;
5895
+ kind: string;
5896
+ desc: string;
5897
+ };
5898
5898
  TeamSharingOptions: {
5899
5899
  name: string;
5900
5900
  kind: string;