@bigbinary/neeto-filters-frontend 4.3.19 → 4.3.21
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 +160 -92
- package/app/javascript/src/translations/en.json +17 -17
- package/dist/Bar.js +16 -9
- package/dist/Bar.js.map +1 -1
- package/dist/Segments.js +22 -31
- package/dist/Segments.js.map +1 -1
- package/dist/cjs/Bar.js +16 -9
- package/dist/cjs/Bar.js.map +1 -1
- package/dist/cjs/Segments.js +22 -31
- package/dist/cjs/Segments.js.map +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/{index-BNNArTNq.js → index-CZTELJO_.js} +19 -14
- package/dist/index-CZTELJO_.js.map +1 -0
- package/dist/{index-C5P8bAFt.js → index-sWA5jMeL.js} +18 -13
- package/dist/index-sWA5jMeL.js.map +1 -0
- package/dist/index.js +2 -2
- package/package.json +42 -39
- package/types.d.ts +6 -0
- package/dist/index-BNNArTNq.js.map +0 -1
- package/dist/index-C5P8bAFt.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,88 +1,116 @@
|
|
|
1
1
|
# neeto-filters-nano
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
The `neeto-filters-nano` manages filters across neeto products. The nano exports
|
|
4
|
+
the `@bigbinary/neeto-filters-frontend` NPM package and `neeto-filters-engine`
|
|
5
|
+
Rails engine for development.
|
|
3
6
|
|
|
4
7
|
# Contents
|
|
8
|
+
|
|
5
9
|
1. [Development with Host Application](#development-with-host-application)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
- [Engine](#engine)
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Usage](#usage)
|
|
13
|
+
- [Frontend package](#frontend-package)
|
|
14
|
+
- [Installation](#installation-1)
|
|
15
|
+
- [Components](#components)
|
|
12
16
|
2. [Instructions for Publishing](#instructions-for-publishing)
|
|
13
17
|
3. [Releasing beta versions](#releasing-beta-versions)
|
|
14
18
|
|
|
15
19
|
# Development with Host Application
|
|
20
|
+
|
|
16
21
|
## Engine
|
|
22
|
+
|
|
17
23
|
The engine is used to manage filters across neeto products.
|
|
18
24
|
|
|
19
25
|
### Installation
|
|
26
|
+
|
|
20
27
|
1. Add this line to your application's Gemfile:
|
|
21
|
-
```ruby
|
|
22
|
-
source "NEETO_GEM_SERVER_URL" do
|
|
23
|
-
# ..existing gems
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
```ruby
|
|
30
|
+
source "NEETO_GEM_SERVER_URL" do
|
|
31
|
+
# ..existing gems
|
|
32
|
+
|
|
33
|
+
gem 'neeto-filters-engine'
|
|
34
|
+
end
|
|
35
|
+
```
|
|
36
|
+
|
|
28
37
|
2. And then execute:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
```zsh
|
|
39
|
+
bundle install
|
|
40
|
+
```
|
|
32
41
|
3. Add this line to your application's `config/routes.rb` file:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
4. Execute the following command to generate the migration to generate the
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
```ruby
|
|
43
|
+
mount NeetoFiltersEngine::Engine, at: "/neeto_filters"
|
|
44
|
+
```
|
|
45
|
+
4. Execute the following command to generate the migration to generate the
|
|
46
|
+
`neeto_filters_engine_segments` table.
|
|
47
|
+
|
|
48
|
+
```zsh
|
|
49
|
+
bundle exec rails neeto_filters_engine:install:migrations
|
|
50
|
+
|
|
51
|
+
bundle exec rails db:migrate
|
|
52
|
+
```
|
|
53
|
+
|
|
42
54
|
5. Add the following line to `models/organization.rb` file.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
```ruby
|
|
56
|
+
has_many :segments, class_name: "NeetoFiltersEngine::Segment", dependent: :destroy
|
|
57
|
+
```
|
|
46
58
|
|
|
47
59
|
### Usage
|
|
60
|
+
|
|
48
61
|
You can learn more about setup and usage here:
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
|
|
63
|
+
1. [Models](/docs/engine/models.md)
|
|
64
|
+
2. [Verify Installation](/docs/engine/verify_installation.md)
|
|
51
65
|
|
|
52
66
|
## Frontend package
|
|
67
|
+
|
|
53
68
|
### Installation
|
|
69
|
+
|
|
54
70
|
1. Install the latest `neeto-filters-frontend` package using the below command:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
2. `neeto-filters-frontend` has a few peer dependencies that are required for
|
|
71
|
+
```zsh
|
|
72
|
+
yarn add @bigbinary/neeto-filters-frontend
|
|
73
|
+
```
|
|
74
|
+
2. `neeto-filters-frontend` has a few peer dependencies that are required for
|
|
75
|
+
the proper functioning of the package. Install all the peer dependencies
|
|
76
|
+
using the below command:
|
|
59
77
|
```zsh
|
|
60
78
|
yarn add @bigbinary/neetoui @bigbinary/neeto-icons axios@0.27.2 classnames@2.3.1 dayjs@1.11.1 formik@2.2.0 ramda@0.28.0 react-router-dom@5.3.0 react-router-nav-prompt@0.4.1 react-toastify@9.0.1 yup@0.32.11
|
|
61
79
|
```
|
|
62
80
|
|
|
63
81
|
### Components
|
|
82
|
+
|
|
64
83
|
#### 1. `Filters` ([source code](https://github.com/bigbinary/neeto-filters-nano/blob/472fc52c3358a822bdb7d1a9d6fe7eed6335247a/app/javascript/src/components/Filters.jsx))
|
|
65
84
|
|
|
66
85
|
**Props**
|
|
86
|
+
|
|
67
87
|
- `isOpen`: To specify whether the Pane component is open or not.
|
|
68
88
|
- `setIsOpen`: To trigger the isOpen state.
|
|
69
|
-
- `columns`: The list of columns/fields that needs to be represented in the
|
|
70
|
-
|
|
89
|
+
- `columns`: The list of columns/fields that needs to be represented in the
|
|
90
|
+
filters pane.
|
|
91
|
+
- `onChange`: To specify the callback function that is triggered whenever a
|
|
92
|
+
filter is applied or cleared. This function will get the updated filters as
|
|
93
|
+
argument.
|
|
71
94
|
- `onSelectorsChange`: To specify the callback function that is triggered
|
|
72
|
-
|
|
73
|
-
|
|
95
|
+
whenever a selector value is changed. This function will get the updated
|
|
96
|
+
selectors as argument.
|
|
74
97
|
- `buttonProps`: To specify the props to be passed to the button component.
|
|
75
98
|
- `paneProps`: To specify the props to be passed to the pane component.
|
|
76
|
-
- `isSearchable`: To specify whether you need a search bar in filters pane to
|
|
99
|
+
- `isSearchable`: To specify whether you need a search bar in filters pane to
|
|
100
|
+
search through filter fields.
|
|
77
101
|
- `className`: To specify classes to the Filters component.
|
|
78
102
|
- `keyword`: To specify the props related to searching.
|
|
79
|
-
- `childrenKeys`: The list of keys which has to be cleared from url during clear
|
|
103
|
+
- `childrenKeys`: The list of keys which has to be cleared from url during clear
|
|
104
|
+
filters operation.
|
|
80
105
|
- `children`: To specify the custom components specific to the host application.
|
|
81
106
|
|
|
82
107
|
**Configuration**
|
|
83
|
-
|
|
108
|
+
|
|
109
|
+
- Refer to the [Filters](/docs/frontend/filters.md) section for detailed
|
|
110
|
+
information on the available configurations for the `Filters` component.
|
|
84
111
|
|
|
85
112
|
**Usage**
|
|
113
|
+
|
|
86
114
|
```jsx
|
|
87
115
|
import React, { useMemo, useState } from "react";
|
|
88
116
|
|
|
@@ -96,18 +124,18 @@ const App = () => {
|
|
|
96
124
|
const { t } = useTranslation();
|
|
97
125
|
|
|
98
126
|
return (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
127
|
+
<Container>
|
|
128
|
+
<SubHeader
|
|
129
|
+
rightActionBlock={
|
|
130
|
+
<Filters
|
|
131
|
+
{...{ isOpen, setIsOpen }}
|
|
132
|
+
isSearchable
|
|
133
|
+
columns={FILTER_COLUMNS}
|
|
134
|
+
keyword={SEARCH_TERM_PROPS}
|
|
135
|
+
/>
|
|
136
|
+
}
|
|
137
|
+
/>
|
|
138
|
+
</Container>
|
|
111
139
|
);
|
|
112
140
|
};
|
|
113
141
|
|
|
@@ -117,23 +145,41 @@ export default App;
|
|
|
117
145
|
#### 2. `Bar` ([source code](https://github.com/bigbinary/neeto-filters-nano/blob/472fc52c3358a822bdb7d1a9d6fe7eed6335247a/app/javascript/src/components/Bar/index.jsx))
|
|
118
146
|
|
|
119
147
|
**Props**
|
|
120
|
-
|
|
121
|
-
- `
|
|
148
|
+
|
|
149
|
+
- `columns`: The list of columns/fields that needs to be represented in the
|
|
150
|
+
filters pane.
|
|
151
|
+
- `onChange`: To specify the callback function that is triggered whenever a
|
|
152
|
+
filter is applied or cleared. This function will get the updated filters as
|
|
153
|
+
argument.
|
|
122
154
|
- `setIsPaneOpen`: To trigger the isOpen state.
|
|
123
155
|
- `className`: To specify classes to the Bar component.
|
|
124
156
|
- `keyword`: To specify the props related to searching.
|
|
125
|
-
- `onSelectorsChange`: To specify the callback function that is triggered
|
|
126
|
-
|
|
157
|
+
- `onSelectorsChange`: To specify the callback function that is triggered
|
|
158
|
+
whenever a selector value is changed. This function will get the updated
|
|
159
|
+
selectors as argument.
|
|
160
|
+
- `childrenKeys`: The list of keys which has to be cleared from url during clear
|
|
161
|
+
filters operation.
|
|
127
162
|
- `entity`: The entity associated with the filters.
|
|
128
|
-
- `defaultSegmentName`: The name of segment which results all entities without
|
|
129
|
-
|
|
130
|
-
- `
|
|
163
|
+
- `defaultSegmentName`: The name of segment which results all entities without
|
|
164
|
+
applying any filter. Default name is "All results".
|
|
165
|
+
- `customFilters`: To specify the custom components specific to the host
|
|
166
|
+
application. This should be same as `children` passed to the `Filters`
|
|
167
|
+
component.
|
|
168
|
+
- `showSegmentName`: To specify whether to show the segment name in the Bar
|
|
169
|
+
component.
|
|
170
|
+
- `segmentsBaseUrl`: The base url to which the segments will be appended after
|
|
171
|
+
creating the segment. by default the current path will be used.
|
|
172
|
+
- `segmentHelpPopoverProps`: Props to customize the help popover displayed next
|
|
173
|
+
to the segment form title in the Add new segment form in the form's
|
|
174
|
+
submission. This prop should have title, description and the help link with a
|
|
175
|
+
label.
|
|
131
176
|
|
|
132
177
|
All these props must be same as that passed to the `Filters` component. The
|
|
133
178
|
option to save filters as segments will be enabled only when the entity prop is
|
|
134
179
|
passed to the component.
|
|
135
180
|
|
|
136
181
|
**Usage**
|
|
182
|
+
|
|
137
183
|
```jsx
|
|
138
184
|
import React, { useMemo, useState } from "react";
|
|
139
185
|
|
|
@@ -167,6 +213,14 @@ const App = () => {
|
|
|
167
213
|
columns={filterColumns}
|
|
168
214
|
entity="User"
|
|
169
215
|
setIsPaneOpen={setIsOpen}
|
|
216
|
+
segmentHelpPopoverProps={{
|
|
217
|
+
title: "Test title,
|
|
218
|
+
description: "Test description",
|
|
219
|
+
helpLinkProps: {
|
|
220
|
+
href: "https://www.example.com",
|
|
221
|
+
label: "Test label",
|
|
222
|
+
},
|
|
223
|
+
}}
|
|
170
224
|
/>
|
|
171
225
|
}
|
|
172
226
|
/>
|
|
@@ -177,22 +231,28 @@ const App = () => {
|
|
|
177
231
|
export default App;
|
|
178
232
|
```
|
|
179
233
|
|
|
180
|
-
|
|
181
234
|
#### 3. `Segments` ([source code](https://github.com/bigbinary/neeto-filters-nano/blob/472fc52c3358a822bdb7d1a9d6fe7eed6335247a/app/javascript/src/components/Segments/index.jsx))
|
|
182
235
|
|
|
183
236
|
**Props**
|
|
184
237
|
|
|
185
|
-
- `columns`: The list of columns/fields that needs to be represented in the
|
|
238
|
+
- `columns`: The list of columns/fields that needs to be represented in the
|
|
239
|
+
filters pane.
|
|
186
240
|
- `entity`: The entity associated with the segments.
|
|
187
241
|
- `setIsPaneOpen`: To trigger the isOpen state of the filters pane.
|
|
188
|
-
- `defaultSegmentName`: The name of segment which results all entities without
|
|
189
|
-
|
|
190
|
-
- `
|
|
191
|
-
|
|
242
|
+
- `defaultSegmentName`: The name of segment which results all entities without
|
|
243
|
+
applying any filter. Default name is "All results".
|
|
244
|
+
- `customFilters`: To specify the custom components specific to the host
|
|
245
|
+
application. This should be same as `children` passed to the `Filters`
|
|
246
|
+
component.
|
|
247
|
+
- `childrenKeys`: The list of keys which has to be cleared from url during clear
|
|
248
|
+
filters operation.
|
|
249
|
+
- `baseUrl`: The base url to which the segments will be appended. by default the
|
|
250
|
+
current path will be used.
|
|
192
251
|
|
|
193
252
|
The "columns" prop must be same as that passed to the `Filters` component.
|
|
194
253
|
|
|
195
254
|
**Usage**
|
|
255
|
+
|
|
196
256
|
```jsx
|
|
197
257
|
import React, { useMemo, useState } from "react";
|
|
198
258
|
|
|
@@ -219,14 +279,13 @@ const App = () => {
|
|
|
219
279
|
);
|
|
220
280
|
|
|
221
281
|
return (
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
282
|
+
<MenuBar showMenu={showMenuBar}>
|
|
283
|
+
<Segments
|
|
284
|
+
columns={filterColumns}
|
|
285
|
+
entity="User"
|
|
286
|
+
setIsFilterPaneOpen={setIsOpen}
|
|
287
|
+
/>
|
|
288
|
+
</MenuBar>
|
|
230
289
|
);
|
|
231
290
|
};
|
|
232
291
|
|
|
@@ -234,6 +293,7 @@ export default App;
|
|
|
234
293
|
```
|
|
235
294
|
|
|
236
295
|
### Funtions
|
|
296
|
+
|
|
237
297
|
#### 1. `buildFiltersFromURL` ([source code](https://github.com/bigbinary/neeto-filters-nano/blob/472fc52c3358a822bdb7d1a9d6fe7eed6335247a/app/javascript/src/components/utils.js#L403-#L406))
|
|
238
298
|
|
|
239
299
|
- This function takes a list as argument.
|
|
@@ -241,7 +301,8 @@ export default App;
|
|
|
241
301
|
to `keyword` prop of `Filters` and `Bar`.
|
|
242
302
|
- It builds the filter payload from the URL search params. This function should
|
|
243
303
|
be called for initializing the `filters` state.
|
|
244
|
-
- Usage in
|
|
304
|
+
- Usage in
|
|
305
|
+
[neetoTrail](https://github.com/bigbinary/neeto-trail-web/blob/91b58802bbb5f9520d2d2f9a621b6a31358d49aa/app/javascript/src/hooks/common/useFilter.js#L22).
|
|
245
306
|
|
|
246
307
|
```js
|
|
247
308
|
const [filters, setFilters] = useState(() =>
|
|
@@ -265,7 +326,8 @@ const [filters, setFilters] = useState(() =>
|
|
|
265
326
|
should be called for initializing the `selectors` state.
|
|
266
327
|
- `selectors` will be an object with keys same as provided in filter fields and
|
|
267
328
|
selected value as its value.
|
|
268
|
-
- Usage in
|
|
329
|
+
- Usage in
|
|
330
|
+
[neetoMonitor](https://github.com/bigbinary/neeto-monitor-web/blob/f892ccdb9c72db8ae4b9bba5fee135c45968a750/app/javascript/src/hooks/common/useFilter.js#L27-L29).
|
|
269
331
|
|
|
270
332
|
```js
|
|
271
333
|
const [selectors, setSelectors] = useState(() =>
|
|
@@ -288,7 +350,8 @@ and selected field names.
|
|
|
288
350
|
to show the rule selector for each filter or not. It is `false` by default.
|
|
289
351
|
- `groupName` (string, optional): A name to be given to the group of filters
|
|
290
352
|
built from fields.
|
|
291
|
-
- Usage in
|
|
353
|
+
- Usage in
|
|
354
|
+
[neetoTestify](https://github.com/bigbinary/neeto-testify-web/blob/1de65b93c9455a88511c5c261b474bd23d9af8e2/app/javascript/src/utils/index.js#L131).
|
|
292
355
|
|
|
293
356
|
```js
|
|
294
357
|
const fields = [
|
|
@@ -308,26 +371,27 @@ const fields = [
|
|
|
308
371
|
const selectedFields = ["name", "age"];
|
|
309
372
|
|
|
310
373
|
const filterColumns = buildFilterColumnsFromFields({ fields, selectedFields });
|
|
311
|
-
|
|
312
374
|
```
|
|
313
375
|
|
|
314
376
|
#### 4. `useFetchSegments`([source code](https://github.com/bigbinary/neeto-filters-nano/blob/b6421775adb20ba859609e71610fad944492147e/app/javascript/src/hooks/reactQuery/useSegmentsApi.js#L10-L18))
|
|
315
377
|
|
|
316
|
-
The `useFetchSegments` hook is used to fetch the array of segments based on the
|
|
378
|
+
The `useFetchSegments` hook is used to fetch the array of segments based on the
|
|
379
|
+
provided `entity`.
|
|
317
380
|
|
|
318
381
|
#### Parameters
|
|
319
382
|
|
|
320
383
|
- `entity`: The entity associated with the segments to be fetched.
|
|
321
|
-
- `searchTerm`: The search term for fetching the segments filtered by names
|
|
384
|
+
- `searchTerm`: The search term for fetching the segments filtered by names
|
|
385
|
+
containing the search term.
|
|
322
386
|
|
|
323
387
|
```js
|
|
324
|
-
|
|
388
|
+
const { data: segments = [], isLoading } = useFetchSegments({ entity: "User" });
|
|
325
389
|
```
|
|
326
390
|
|
|
327
391
|
## Basic Usage
|
|
328
392
|
|
|
329
|
-
Here is an example of how to use the `neeto-filters-engine` gem assuming that
|
|
330
|
-
`users` table has been created.
|
|
393
|
+
Here is an example of how to use the `neeto-filters-engine` gem assuming that
|
|
394
|
+
the `users` table has been created.
|
|
331
395
|
|
|
332
396
|
```rb
|
|
333
397
|
class HomeController < ApplicationController
|
|
@@ -346,7 +410,9 @@ class HomeController < ApplicationController
|
|
|
346
410
|
end
|
|
347
411
|
```
|
|
348
412
|
|
|
349
|
-
Note: If you wish to use `select()` method after calling
|
|
413
|
+
Note: If you wish to use `select()` method after calling
|
|
414
|
+
`apply_neeto_filters()`, please note to use `reselect()` since neeto-filters
|
|
415
|
+
itself performs a 'select' operation internally.
|
|
350
416
|
|
|
351
417
|
Here, the param `filters` is a hash with the following structure, where each
|
|
352
418
|
`node` corresponds to a column in the `users` table.
|
|
@@ -407,14 +473,14 @@ this case, all the users whose email address contains `bigbinary` in the
|
|
|
407
473
|
### Custom Types
|
|
408
474
|
|
|
409
475
|
- Some projects will have custom attributes to the tables that will be added or
|
|
410
|
-
updated dynamically. `NeetoFiltersEngine` can handle these attributes by
|
|
411
|
-
proper filters to the `apply_neeto_filters` method.
|
|
476
|
+
updated dynamically. `NeetoFiltersEngine` can handle these attributes by
|
|
477
|
+
passing the proper filters to the `apply_neeto_filters` method.
|
|
412
478
|
- The implementation of custom attributes is different for different projects.
|
|
413
479
|
`NeetoFiltersEngine` is built in the same way as `neetoCRM`. If the custom
|
|
414
480
|
attributes feature needs to be added to a project where the custom attributes
|
|
415
481
|
implementation is different, you need to override the
|
|
416
|
-
`NeetoFiltersEngine::Custom::BaseSearchService` class specifiying the proper
|
|
417
|
-
operations.
|
|
482
|
+
`NeetoFiltersEngine::Custom::BaseSearchService` class specifiying the proper
|
|
483
|
+
join operations.
|
|
418
484
|
- Refer to the below video for an overview of the same.
|
|
419
485
|
|
|
420
486
|
https://vimeo.com/724489868/94dfc6cd43
|
|
@@ -425,8 +491,8 @@ this case, all the users whose email address contains `bigbinary` in the
|
|
|
425
491
|
table on which the `apply_neeto_filters` method is applied. Instead these will
|
|
426
492
|
be present in another table to which the first table has a foreign key to. For
|
|
427
493
|
instance, the `deals` table can have an association with the `companies` table
|
|
428
|
-
and the company name can be displayed in the UI. `NeetoFiltersEngine` can be
|
|
429
|
-
filter these columns by properly specifying the filters.
|
|
494
|
+
and the company name can be displayed in the UI. `NeetoFiltersEngine` can be
|
|
495
|
+
used to filter these columns by properly specifying the filters.
|
|
430
496
|
- Refer to te below video for an overview of the same.
|
|
431
497
|
|
|
432
498
|
https://vimeo.com/724484259/f305257f37
|
|
@@ -453,9 +519,11 @@ this case, all the users whose email address contains `bigbinary` in the
|
|
|
453
519
|
|
|
454
520
|
https://vimeo.com/724495909/034668f738
|
|
455
521
|
|
|
456
|
-
|
|
457
522
|
# Instructions for Publishing
|
|
458
|
-
|
|
523
|
+
|
|
524
|
+
Consult the
|
|
525
|
+
[building and releasing packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages)
|
|
526
|
+
guide for details on how to publish.
|
|
459
527
|
|
|
460
528
|
# Releasing beta versions
|
|
461
529
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"no": "No",
|
|
12
12
|
"proceed": "Proceed",
|
|
13
13
|
"rename": "Rename",
|
|
14
|
-
"
|
|
14
|
+
"views": "Views",
|
|
15
15
|
"userCount": "{{count}} Users",
|
|
16
16
|
"yes": "Yes",
|
|
17
17
|
"update": "Update",
|
|
@@ -50,28 +50,28 @@
|
|
|
50
50
|
"openFilterPane": "Open filter pane",
|
|
51
51
|
"closePane": "Close pane"
|
|
52
52
|
},
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"deleteAlertMessage": "You are permanently deleting the
|
|
58
|
-
"deleteAlertTitle": "Delete
|
|
59
|
-
"
|
|
60
|
-
"name": "
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
53
|
+
"views": {
|
|
54
|
+
"addNewView": "Add new view",
|
|
55
|
+
"saveAsNewView": "Save as new view",
|
|
56
|
+
"editView": "Edit view",
|
|
57
|
+
"deleteAlertMessage": "You are permanently deleting the view <strong>{{entity,anyCase}}</strong>. This can't be undone.",
|
|
58
|
+
"deleteAlertTitle": "Delete view?",
|
|
59
|
+
"manageViews": "Manage views",
|
|
60
|
+
"name": "View name",
|
|
61
|
+
"noViewsFound": "No views found",
|
|
62
|
+
"saveView": "Save view",
|
|
63
|
+
"updateView": "Update view",
|
|
64
|
+
"searchViews": "Search views",
|
|
65
|
+
"viewName": "View name",
|
|
66
66
|
"showLess": "See less",
|
|
67
67
|
"showMoreNumbers": "See {{entity}} more",
|
|
68
|
-
"nameIsRequired": "
|
|
68
|
+
"nameIsRequired": "View name is required",
|
|
69
69
|
"reservedNameErrorMessage": "This name is reserved. Please choose another name.",
|
|
70
70
|
"addFilter": "Add filter",
|
|
71
71
|
"newFilter": "New filter",
|
|
72
72
|
"selectFilter": "Select filter",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
73
|
+
"view_one": "view",
|
|
74
|
+
"view_other": "views"
|
|
75
75
|
},
|
|
76
76
|
"labels": {
|
|
77
77
|
"keyword": "Keyword"
|
package/dist/Bar.js
CHANGED
|
@@ -6,7 +6,7 @@ import { t } from 'i18next';
|
|
|
6
6
|
import { findBy, humanize, removeBy, hyphenate, isPresent, isNotEmpty, noop, findById, isNotPresent } from '@bigbinary/neeto-cist';
|
|
7
7
|
import { useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
8
8
|
import { reject, modify, sortBy, prop, project, has, omit, isEmpty, assoc, identity } from 'ramda';
|
|
9
|
-
import { S as SegmentForm } from './index-
|
|
9
|
+
import { S as SegmentForm } from './index-CZTELJO_.js';
|
|
10
10
|
import { c as useCreateSegment, b as useUpdateSegment, Q as QUERY_KEYS } from './useSegmentsApi-wYy0UPCH.js';
|
|
11
11
|
import { dateFormat, dayjs, buildUrl, showThumbsUpToastr } from '@bigbinary/neeto-commons-frontend/utils';
|
|
12
12
|
import Button from '@bigbinary/neetoui/Button';
|
|
@@ -24,6 +24,7 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
|
24
24
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
25
25
|
import Dropdown from '@bigbinary/neetoui/Dropdown';
|
|
26
26
|
import '@bigbinary/neeto-icons/Delete';
|
|
27
|
+
import '@bigbinary/neeto-molecules/HelpPopover';
|
|
27
28
|
import '@bigbinary/neetoui/Accordion';
|
|
28
29
|
import '@bigbinary/neetoui/Pane';
|
|
29
30
|
import '@bigbinary/neetoui/formik/ActionBlock';
|
|
@@ -342,7 +343,7 @@ var FilterBar = function FilterBar(_ref) {
|
|
|
342
343
|
className: "flex items-center gap-x-2",
|
|
343
344
|
children: [isPresent(entity) && !hasOnlyKeywordFilter(filters) && /*#__PURE__*/jsx(Button, {
|
|
344
345
|
"data-cy": "save-segment-button",
|
|
345
|
-
label: t("neetoFilters.
|
|
346
|
+
label: t("neetoFilters.views.saveAsNewView"),
|
|
346
347
|
style: "secondary",
|
|
347
348
|
onClick: function onClick() {
|
|
348
349
|
setIsPaneOpen(false);
|
|
@@ -509,7 +510,8 @@ var SegmentBar = function SegmentBar(_ref) {
|
|
|
509
510
|
setIsSavePaneOpen = _ref.setIsSavePaneOpen,
|
|
510
511
|
setIsPaneOpen = _ref.setIsPaneOpen,
|
|
511
512
|
handleApplyFilters = _ref.handleApplyFilters,
|
|
512
|
-
childrenKeys = _ref.childrenKeys
|
|
513
|
+
childrenKeys = _ref.childrenKeys,
|
|
514
|
+
showSegmentName = _ref.showSegmentName;
|
|
513
515
|
var _useTranslation = useTranslation(),
|
|
514
516
|
t = _useTranslation.t;
|
|
515
517
|
var history = useHistory();
|
|
@@ -538,7 +540,7 @@ var SegmentBar = function SegmentBar(_ref) {
|
|
|
538
540
|
};
|
|
539
541
|
var changedFilters = deepCompare(segment.filters[0].conditions, filters);
|
|
540
542
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
541
|
-
children: [/*#__PURE__*/jsx(Typography, {
|
|
543
|
+
children: [showSegmentName && /*#__PURE__*/jsx(Typography, {
|
|
542
544
|
className: "neeto-ui-text-gray-600 mr-4 px-2",
|
|
543
545
|
"data-cy": "neeto-filters-segment-name",
|
|
544
546
|
style: "h4",
|
|
@@ -549,7 +551,7 @@ var SegmentBar = function SegmentBar(_ref) {
|
|
|
549
551
|
className: "mr-2"
|
|
550
552
|
},
|
|
551
553
|
buttonStyle: "secondary",
|
|
552
|
-
label: t("neetoFilters.
|
|
554
|
+
label: t("neetoFilters.views.updateView"),
|
|
553
555
|
children: /*#__PURE__*/jsxs(Menu, {
|
|
554
556
|
children: [/*#__PURE__*/jsx(MenuItem.Button, {
|
|
555
557
|
onClick: function onClick() {
|
|
@@ -557,7 +559,7 @@ var SegmentBar = function SegmentBar(_ref) {
|
|
|
557
559
|
action: SEGMENT_ACTIONS.EDIT
|
|
558
560
|
});
|
|
559
561
|
},
|
|
560
|
-
children: t("neetoFilters.
|
|
562
|
+
children: t("neetoFilters.views.updateView")
|
|
561
563
|
}), /*#__PURE__*/jsx(MenuItem.Button, {
|
|
562
564
|
onClick: function onClick() {
|
|
563
565
|
setIsPaneOpen(false);
|
|
@@ -565,7 +567,7 @@ var SegmentBar = function SegmentBar(_ref) {
|
|
|
565
567
|
action: SEGMENT_ACTIONS.CREATE
|
|
566
568
|
});
|
|
567
569
|
},
|
|
568
|
-
children: t("neetoFilters.
|
|
570
|
+
children: t("neetoFilters.views.saveAsNewView")
|
|
569
571
|
})]
|
|
570
572
|
})
|
|
571
573
|
}), changedFilters.map(function (filter) {
|
|
@@ -589,6 +591,7 @@ var Bar = function Bar(_ref) {
|
|
|
589
591
|
className = _ref.className,
|
|
590
592
|
_ref$columns = _ref.columns,
|
|
591
593
|
columns = _ref$columns === void 0 ? [] : _ref$columns,
|
|
594
|
+
segmentHelpPopoverProps = _ref.segmentHelpPopoverProps,
|
|
592
595
|
_ref$keyword = _ref.keyword,
|
|
593
596
|
keyword = _ref$keyword === void 0 ? {
|
|
594
597
|
node: "",
|
|
@@ -603,7 +606,9 @@ var Bar = function Bar(_ref) {
|
|
|
603
606
|
defaultSegmentName = _ref$defaultSegmentNa === void 0 ? t("neetoFilters.common.allResults") : _ref$defaultSegmentNa,
|
|
604
607
|
_ref$segmentsBaseUrl = _ref.segmentsBaseUrl,
|
|
605
608
|
segmentsBaseUrl = _ref$segmentsBaseUrl === void 0 ? window.location.pathname : _ref$segmentsBaseUrl,
|
|
606
|
-
customFilters = _ref.customFilters
|
|
609
|
+
customFilters = _ref.customFilters,
|
|
610
|
+
_ref$showSegmentName = _ref.showSegmentName,
|
|
611
|
+
showSegmentName = _ref$showSegmentName === void 0 ? true : _ref$showSegmentName;
|
|
607
612
|
var queryClient = useQueryClient();
|
|
608
613
|
var _useQueryParams = useQueryParams(),
|
|
609
614
|
segmentId = _useQueryParams.segmentId;
|
|
@@ -641,7 +646,8 @@ var Bar = function Bar(_ref) {
|
|
|
641
646
|
keywordFilter: keywordFilter,
|
|
642
647
|
nonHiddenFilters: nonHiddenFilters,
|
|
643
648
|
setIsPaneOpen: setIsPaneOpen,
|
|
644
|
-
setIsSavePaneOpen: setIsSavePaneOpen
|
|
649
|
+
setIsSavePaneOpen: setIsSavePaneOpen,
|
|
650
|
+
showSegmentName: showSegmentName
|
|
645
651
|
})
|
|
646
652
|
}), /*#__PURE__*/jsx(SegmentForm, {
|
|
647
653
|
childrenKeys: childrenKeys,
|
|
@@ -654,6 +660,7 @@ var Bar = function Bar(_ref) {
|
|
|
654
660
|
isSubmitting: isSubmitting,
|
|
655
661
|
keywordFilter: keywordFilter,
|
|
656
662
|
segmentFormInitialRef: segmentFormInitialRef,
|
|
663
|
+
segmentHelpPopoverProps: segmentHelpPopoverProps,
|
|
657
664
|
isOpen: isPresent(isSavePaneOpen.action),
|
|
658
665
|
initialValues: isEdit ? assoc("filters", [{
|
|
659
666
|
conditions: filters
|