@civicactions/cmsds-open-data-components 4.0.16-alpha.1 → 4.0.16-alpha.3

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/main.js CHANGED
@@ -3622,6 +3622,16 @@ const $eadd6431fddf4b6c$var$FilterItem = ({ id: id, condition: condition, index:
3622
3622
  }, [
3623
3623
  operator
3624
3624
  ]);
3625
+ // Clear value when switching to an empty operator
3626
+ const isEmptyOperator = operator === 'is_empty' || operator === 'not_empty';
3627
+ (0, $hgUW1$useEffect)(()=>{
3628
+ if (isEmptyOperator && value !== '') {
3629
+ setValue('');
3630
+ update(index, 'value', '');
3631
+ }
3632
+ }, [
3633
+ isEmptyOperator
3634
+ ]);
3625
3635
  (0, $hgUW1$useEffect)(()=>{
3626
3636
  if (value !== condition.value) {
3627
3637
  if (value) update(index, 'value', value);
@@ -3649,7 +3659,7 @@ const $eadd6431fddf4b6c$var$FilterItem = ({ id: id, condition: condition, index:
3649
3659
  name: `${condition.key}_operator`,
3650
3660
  onChange: (e)=>setOperator(e.target.value)
3651
3661
  }),
3652
- schema[id].fields[property].mysql_type === 'date' ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3662
+ isEmptyOperator ? /*#__PURE__*/ (0, $hgUW1$jsx)("div", {}) : schema[id].fields[property].mysql_type === 'date' ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3653
3663
  children: [
3654
3664
  /*#__PURE__*/ (0, $hgUW1$jsx)("label", {
3655
3665
  className: "ds-c-label",
@@ -4270,7 +4280,7 @@ const $85f8ff1ff89899c7$var$DataTableToolbar = ({ resource: resource, id: id, co
4270
4280
  children: [
4271
4281
  conditions.length > 0 ? conditions.map((condition, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $c5b172e8d1a8197c$export$2e2bcd8739ae039), {
4272
4282
  iconClass: "far fa-filter",
4273
- text: `"${condition.property}" ${(0, $7264a673914aa746$export$d243819c3ad678fb)(condition.operator).toLowerCase()}${condition.value === '' ? '' : ` ${condition.value}`}`,
4283
+ text: `"${condition.property}" ${(0, $7264a673914aa746$export$d243819c3ad678fb)(condition.operator).toLowerCase()}${condition.value === '' || condition.operator === 'is_empty' || condition.operator === 'not_empty' ? '' : ` ${condition.value}`}`,
4274
4284
  onClick: ()=>{
4275
4285
  removeCondition(index);
4276
4286
  }