@synerise/ds-filter 1.2.1 → 1.2.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/CHANGELOG.md +429 -1373
- package/README.md +26 -25
- package/dist/Filter.d.ts +1 -1
- package/dist/Filter.js +3 -3
- package/dist/components/ExpressionItem/DraggableExpressionItem.js +1 -1
- package/dist/components/ExpressionItem/ExpressionItem.js +2 -1
- package/dist/components/ExpressionItem/ExpressionItem.types.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ title: Filter
|
|
|
6
6
|
Filter UI Component
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
|
+
|
|
9
10
|
```
|
|
10
11
|
npm i @synerise/ds-filter
|
|
11
12
|
or
|
|
@@ -13,6 +14,7 @@ yarn add @synerise/ds-filter
|
|
|
13
14
|
```
|
|
14
15
|
|
|
15
16
|
## Usage
|
|
17
|
+
|
|
16
18
|
```
|
|
17
19
|
import Filter from '@synerise/ds-filter'
|
|
18
20
|
|
|
@@ -57,37 +59,36 @@ import Filter from '@synerise/ds-filter'
|
|
|
57
59
|
|
|
58
60
|
## API
|
|
59
61
|
|
|
60
|
-
| Property
|
|
61
|
-
|
|
|
62
|
-
| expressions
|
|
63
|
-
| matching
|
|
64
|
-
| onChangeOrder
|
|
65
|
-
| onChangeLogic
|
|
66
|
-
| onChangeStepMatching
|
|
67
|
-
| onChangeStepName
|
|
68
|
-
| onDeleteStep
|
|
69
|
-
| onDuplicateStep
|
|
70
|
-
| renderHeaderRightSide
|
|
71
|
-
| renderStepFooter
|
|
72
|
-
| renderStepContent
|
|
73
|
-
| renderStepHeaderRightSide
|
|
74
|
-
| onAdd
|
|
75
|
-
| texts
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
| Property | Description | Type | Default |
|
|
63
|
+
| ------------------------- | ----------------------------------------------------------- | ---------------------------------------------------------- | ------- |
|
|
64
|
+
| expressions | Array of expressions | Expression[] | - |
|
|
65
|
+
| matching | Main matching configuration | : MatchingProps | - |
|
|
66
|
+
| onChangeOrder | Function called when user change order of StepCards | (newOrder: Expression[]) => void | - |
|
|
67
|
+
| onChangeLogic | Function called when user change value of Logic | (id: string, logic: LogicOperatorValue) => void | - |
|
|
68
|
+
| onChangeStepMatching | Function called when user change value of StepCard matching | (id: string, matching: boolean) => void | - |
|
|
69
|
+
| onChangeStepName | Function called when user change name of StepCard | (id: string, name: string) => void | - |
|
|
70
|
+
| onDeleteStep | Function called when user click on delete StepCard icon | (id: string) => void | - |
|
|
71
|
+
| onDuplicateStep | Function called when user click on duplicate StepCard icon | (id: string) => void | - |
|
|
72
|
+
| renderHeaderRightSide | Renders filter header right side slot | (expressions: Expression[]) => React.ReactNode; | - |
|
|
73
|
+
| renderStepFooter | Function which renders footer of StepCard | (expression: Expression) => React.ReactNode | - |
|
|
74
|
+
| renderStepContent | Function which render content of StepCard | (expression: Expression) => React.ReactNode | - |
|
|
75
|
+
| renderStepHeaderRightSide | Function which renders right side slot in StepCard header | (expression: Expression, index: number) => React.ReactNode | - |
|
|
76
|
+
| onAdd | Function called when user click on AddFilter button | () => void | - |
|
|
77
|
+
| texts | Object with translations | FilterTexts | - |
|
|
78
78
|
|
|
79
79
|
### Expression
|
|
80
80
|
|
|
81
|
-
| Property | Description | Type
|
|
82
|
-
|
|
|
83
|
-
| type | Type of expression: `STEP` or `LOGIC` | `STEP` \ `LOGIC`
|
|
84
|
-
| id | Id of expression | string
|
|
85
|
-
| data | Object with props of expression, base of type value | `Partial<StepCardProps>` \ `Partial<LogicProps>` | - |
|
|
86
|
-
| logic | Logic component related to Step expression | `Expression`
|
|
81
|
+
| Property | Description | Type | Default |
|
|
82
|
+
| -------- | --------------------------------------------------- | ------------------------------------------------ | ------- |
|
|
83
|
+
| type | Type of expression: `STEP` or `LOGIC` | `STEP` \ `LOGIC` | - |
|
|
84
|
+
| id | Id of expression | string | - |
|
|
85
|
+
| data | Object with props of expression, base of type value | `Partial<StepCardProps>` \ `Partial<LogicProps>` | - |
|
|
86
|
+
| logic | Logic component related to Step expression | `Expression` | - |
|
|
87
87
|
|
|
88
88
|
### FilterTexts
|
|
89
|
+
|
|
89
90
|
| Property | Description | Type | Default |
|
|
90
|
-
|
|
|
91
|
+
| ---------- | ----------------------------------------------- | ------------- | -------------- |
|
|
91
92
|
| matching | Object with translations for Matching component | MatchingTexts | - |
|
|
92
93
|
| step | Object with translations for StepCard component | StepCardTexts | - |
|
|
93
94
|
| addFilter | Label of AddFilter button | string | 'Add filter' |
|
package/dist/Filter.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FilterProps } from './Filter.types';
|
|
2
|
+
import { type FilterProps } from './Filter.types';
|
|
3
3
|
declare const Filter: ({ maxConditionsLimit, expressions, matching, onChangeOrder, onChangeLogic, onChangeStepMatching, onChangeStepName, onDeleteStep, onDuplicateStep, renderStepFooter, renderStepContent, renderStepHeaderRightSide, addFilterComponent, texts, logicOptions, renderHeaderRightSide, visibilityConfig, readOnly, singleStepCondition, getMoveByLabel, }: FilterProps) => React.JSX.Element;
|
|
4
4
|
export default Filter;
|
package/dist/Filter.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useCallback, useMemo,
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
|
-
import Sortable from '@synerise/ds-sortable';
|
|
5
4
|
import { Matching, Placeholder } from '@synerise/ds-logic';
|
|
5
|
+
import Sortable from '@synerise/ds-sortable';
|
|
6
6
|
import { NOOP, usePrevious } from '@synerise/ds-utils';
|
|
7
7
|
import * as S from './Filter.styles';
|
|
8
|
-
import {
|
|
8
|
+
import { DraggableExpressionItem, ExpressionItem } from './components/ExpressionItem';
|
|
9
9
|
import { isStepType } from './utils';
|
|
10
10
|
var TRANSITION_DURATION = 0.5;
|
|
11
11
|
var TRANSITION_DURATION_MAX = 1.5;
|
|
@@ -2,7 +2,7 @@ var _excluded = ["expressionsOrder", "expression", "index"];
|
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React, { useEffect, useState } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { arrayMove, useDndMonitor } from '@synerise/ds-sortable';
|
|
6
6
|
import { ExpressionItem } from './ExpressionItem';
|
|
7
7
|
export var DraggableExpressionItem = function DraggableExpressionItem(_ref) {
|
|
8
8
|
var expressionsOrder = _ref.expressionsOrder,
|
|
@@ -5,6 +5,7 @@ import StepCard from '@synerise/ds-step-card';
|
|
|
5
5
|
import * as S from '../../Filter.styles';
|
|
6
6
|
import { isStepType } from '../../utils';
|
|
7
7
|
export var ExpressionItem = function ExpressionItem(_ref) {
|
|
8
|
+
var _expression$logic;
|
|
8
9
|
var handleTransitionEnd = _ref.handleTransitionEnd,
|
|
9
10
|
dragHandleProps = _ref.dragHandleProps,
|
|
10
11
|
isDragged = _ref.isDragged,
|
|
@@ -39,7 +40,7 @@ export var ExpressionItem = function ExpressionItem(_ref) {
|
|
|
39
40
|
dragIndex: dragIndex
|
|
40
41
|
})), shouldRenderLogic && /*#__PURE__*/React.createElement(S.LogicWrapper, {
|
|
41
42
|
"data-testid": "condition-logic"
|
|
42
|
-
}, /*#__PURE__*/React.createElement(Logic, _extends({}, logicProps, expression.logic.data, {
|
|
43
|
+
}, /*#__PURE__*/React.createElement(Logic, _extends({}, logicProps, (_expression$logic = expression.logic) == null ? void 0 : _expression$logic.data, {
|
|
43
44
|
readOnly: readOnly
|
|
44
45
|
}))));
|
|
45
46
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MouseEventHandler, ReactNode, TransitionEventHandler } from 'react';
|
|
2
2
|
import type { LogicProps } from '@synerise/ds-logic';
|
|
3
|
-
import type { StepCardProps } from '@synerise/ds-step-card';
|
|
4
3
|
import type { DragHandlePropType } from '@synerise/ds-sortable';
|
|
4
|
+
import type { StepCardProps } from '@synerise/ds-step-card';
|
|
5
5
|
import type { Expression } from '../../Filter.types';
|
|
6
6
|
export type ExpressionItemProps = {
|
|
7
7
|
handleTransitionEnd: TransitionEventHandler;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from './Filter';
|
|
2
|
-
export type { Expression, StepType, LogicType, FilterProps } from './Filter.types';
|
|
2
|
+
export type { Expression, StepType, LogicType, FilterProps, } from './Filter.types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-filter",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Filter UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-button": "^1.4.
|
|
38
|
-
"@synerise/ds-logic": "^1.1.
|
|
39
|
-
"@synerise/ds-sortable": "^1.3.
|
|
40
|
-
"@synerise/ds-step-card": "^1.2.
|
|
41
|
-
"@synerise/ds-utils": "^1.3.
|
|
37
|
+
"@synerise/ds-button": "^1.4.2",
|
|
38
|
+
"@synerise/ds-logic": "^1.1.3",
|
|
39
|
+
"@synerise/ds-sortable": "^1.3.2",
|
|
40
|
+
"@synerise/ds-step-card": "^1.2.2",
|
|
41
|
+
"@synerise/ds-utils": "^1.3.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@synerise/ds-core": "*",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
47
47
|
"styled-components": "^5.3.3"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "2161bdb04f3db0f79b7d0465ce6b41121f1543ef"
|
|
50
50
|
}
|