@evoke-platform/ui-components 1.0.0-dev.239 → 1.0.0-dev.240

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.
@@ -9,22 +9,22 @@ import { Box } from '../../layout';
9
9
  import { difference } from '../util';
10
10
  import ValueEditor from './ValueEditor';
11
11
  const ALL_OPERATORS = [
12
- { name: '=', label: '=' },
13
- { name: '!=', label: '!=' },
14
- { name: '<', label: '<' },
15
- { name: '>', label: '>' },
16
- { name: '<=', label: '<=' },
17
- { name: '>=', label: '>=' },
18
- { name: 'contains', label: 'contains' },
19
- { name: 'beginsWith', label: 'begins with' },
20
- { name: 'endsWith', label: 'ends with' },
21
- { name: 'doesNotContain', label: 'does not contain' },
22
- { name: 'doesNotBeginWith', label: 'does not begin with' },
23
- { name: 'doesNotEndWith', label: 'does not end with' },
24
- { name: 'null', label: 'is null' },
25
- { name: 'notNull', label: 'is not null' },
26
- { name: 'in', label: 'in' },
27
- { name: 'notIn', label: 'not in' },
12
+ { name: '=', label: 'Is' },
13
+ { name: '!=', label: 'Is not' },
14
+ { name: '<', label: 'Less than' },
15
+ { name: '>', label: 'Greater than' },
16
+ { name: '<=', label: 'Less than or equal to' },
17
+ { name: '>=', label: 'Greater than or equal to' },
18
+ { name: 'contains', label: 'Contains' },
19
+ { name: 'beginsWith', label: 'Starts with' },
20
+ { name: 'endsWith', label: 'Ends with' },
21
+ { name: 'doesNotContain', label: 'Does not contain' },
22
+ { name: 'doesNotBeginWith', label: 'Does not start with' },
23
+ { name: 'doesNotEndWith', label: 'Does not end with' },
24
+ { name: 'null', label: 'Is empty' },
25
+ { name: 'notNull', label: 'Is not empty' },
26
+ { name: 'in', label: 'In' },
27
+ { name: 'notIn', label: 'Not in' },
28
28
  ];
29
29
  const CustomRuleGroup = (props) => {
30
30
  const rg = { ...props, ...useRuleGroup(props) };
@@ -86,6 +86,7 @@ const customSelector = (props) => {
86
86
  let width = '90px';
87
87
  let val = value;
88
88
  let opts = options;
89
+ const inputType = props.fieldData?.inputType;
89
90
  let readOnly = false;
90
91
  if (context.disabledCriteria) {
91
92
  readOnly =
@@ -98,18 +99,42 @@ const customSelector = (props) => {
98
99
  switch (title) {
99
100
  case 'Operators':
100
101
  width = '20%';
101
- if (props.fieldData?.inputType === 'array') {
102
+ if (inputType === 'array') {
102
103
  opts = options
103
104
  .filter((option) => ['null', 'notNull', 'in', 'notIn'].includes(option.name))
104
105
  .map((option) => ({ name: option.name, label: option.label }));
105
106
  val = val === '=' ? '' : options.find((option) => option.name === val).name;
106
107
  }
107
- else if (props.fieldData?.inputType === 'document') {
108
+ else if (inputType === 'document') {
108
109
  opts = options
109
110
  .filter((option) => ['null', 'notNull'].includes(option.name))
110
111
  .map((option) => ({ name: option.name, label: option.label }));
111
112
  val = val === '=' ? '' : options.find((option) => option.name === val).name;
112
113
  }
114
+ else if (inputType === 'date' || inputType === 'date-time' || inputType === 'time') {
115
+ opts = options
116
+ .filter((option) => ['=', '!=', '<', '>', '<=', '>=', 'null', 'notNull'].includes(option.name))
117
+ .map((option) => ({
118
+ ...option,
119
+ label: option.name === '>'
120
+ ? inputType === 'time'
121
+ ? 'Later than'
122
+ : 'After'
123
+ : option.name === '>='
124
+ ? inputType === 'time'
125
+ ? 'Later than or at'
126
+ : 'After or on'
127
+ : option.name === '<'
128
+ ? inputType === 'time'
129
+ ? 'Earlier than'
130
+ : 'Before'
131
+ : option.name === '<='
132
+ ? inputType === 'time'
133
+ ? 'Earlier than or at'
134
+ : 'Before or on'
135
+ : option.label,
136
+ }));
137
+ }
113
138
  break;
114
139
  case 'Fields':
115
140
  width = '33%';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evoke-platform/ui-components",
3
- "version": "1.0.0-dev.239",
3
+ "version": "1.0.0-dev.240",
4
4
  "description": "",
5
5
  "main": "dist/published/index.js",
6
6
  "module": "dist/published/index.js",