@bigbinary/neeto-fields-frontend 1.3.25 → 1.3.26

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 CHANGED
@@ -1,33 +1,35 @@
1
1
  # neeto-fields-nano
2
2
 
3
- The `neeto-fields-nano` enables the management of dynamically added fields (often
4
- referred to as custom fields) across neeto applications. The nano exports the `@bigbinary/neeto-fields-frontend` NPM package and `neeto-fields-engine` Rails engine for development.
3
+ The `neeto-fields-nano` enables the management of dynamically added fields
4
+ (often referred to as custom fields) across neeto applications. The nano exports
5
+ the `@bigbinary/neeto-fields-frontend` NPM package and `neeto-fields-engine`
6
+ Rails engine for development.
5
7
 
6
8
  # Contents
7
9
 
8
10
  1. [Development with Host Application](#development-with-host-application)
9
- - [Engine](#engine)
10
- - [Installation](#installation)
11
- - [customizability](#customizability)
12
- - [Frontend package](#frontend-package)
13
- - [Installation](#installation-1)
14
- - [Instructions for development](#instructions-for-development)
15
- - [Components](#components)
16
- - [FieldsDashBoard](#1-fieldsdashboard)
17
- - [FieldsPane](#2-fieldspane)
18
- - [FieldValuesContainer](#3-fieldvaluescontainer)
19
- - [FieldInputs](#4-fieldinputs)
20
- - [InlineFieldValueInputProps](#5-inlinefieldvalueinput)
21
- - [FieldDeleteAlert](#6-fielddeletealert)
22
- - [Functions](#functions)
23
- - [mergeInitialValues](#1-neetofieldsutilsmergeinitialvalues)
24
- - [transformValues](#2-neetofieldsutilstransformvalues)
25
- - [Hooks](#hooks)
26
- - [useFetchFields](#1-usefetchfields)
27
- - [useShowFields](#2-useshowfield)
28
- - [useCreateField](#3-usecreatefield)
29
- - [useUpdateField](#4-useupdatefield)
30
- - [useDestroyField](#5-usedestroyfield)
11
+ - [Engine](#engine)
12
+ - [Installation](#installation)
13
+ - [customizability](#customizability)
14
+ - [Frontend package](#frontend-package)
15
+ - [Installation](#installation-1)
16
+ - [Instructions for development](#instructions-for-development)
17
+ - [Components](#components)
18
+ - [FieldsDashBoard](#1-fieldsdashboard)
19
+ - [FieldsPane](#2-fieldspane)
20
+ - [FieldValuesContainer](#3-fieldvaluescontainer)
21
+ - [FieldInputs](#4-fieldinputs)
22
+ - [InlineFieldValueInputProps](#5-inlinefieldvalueinput)
23
+ - [FieldDeleteAlert](#6-fielddeletealert)
24
+ - [Functions](#functions)
25
+ - [mergeInitialValues](#1-neetofieldsutilsmergeinitialvalues)
26
+ - [transformValues](#2-neetofieldsutilstransformvalues)
27
+ - [Hooks](#hooks)
28
+ - [useFetchFields](#1-usefetchfields)
29
+ - [useShowFields](#2-useshowfield)
30
+ - [useCreateField](#3-usecreatefield)
31
+ - [useUpdateField](#4-useupdatefield)
32
+ - [useDestroyField](#5-usedestroyfield)
31
33
  2. [Instructions for Publishing](#instructions-for-publishing)
32
34
 
33
35
  ## Development with Host Application
@@ -40,54 +42,59 @@ The engine is used to manage fields for any entity across neeto products.
40
42
 
41
43
  1. Add this line to your application's Gemfile:
42
44
 
43
- ```ruby
44
- source "NEETO_GEM_SERVER_URL" do
45
- # ..existing gems
45
+ ```ruby
46
+ source "NEETO_GEM_SERVER_URL" do
47
+ # ..existing gems
46
48
 
47
- gem 'neeto-fields-engine'
48
- end
49
- ```
49
+ gem 'neeto-fields-engine'
50
+ end
51
+ ```
50
52
 
51
53
  2. And then execute:
52
54
 
53
- ```ruby
54
- bundle install
55
- ```
55
+ ```ruby
56
+ bundle install
57
+ ```
56
58
 
57
59
  3. Add this line to your application's `config/routes.rb` file:
58
60
 
59
- ```ruby
60
- mount NeetoFieldsEngine::Engine => "/neeto_fields_engine"
61
- ```
61
+ ```ruby
62
+ mount NeetoFieldsEngine::Engine => "/neeto_fields_engine"
63
+ ```
62
64
 
63
- 4. Run the following command to copy the migrations from the engine to the host application:
65
+ 4. Run the following command to copy the migrations from the engine to the host
66
+ application:
64
67
 
65
- ```ruby
66
- rails g neeto_fields_engine:install
67
- ```
68
+ ```ruby
69
+ rails g neeto_fields_engine:install
70
+ ```
68
71
 
69
72
  5. Add the migrations to the database:
70
73
 
71
- ```ruby
72
- bundle exec rails db:migrate
73
- ```
74
+ ```ruby
75
+ bundle exec rails db:migrate
76
+ ```
74
77
 
75
- 6. Generate the required associations between models using the following command:
78
+ 6. Generate the required associations between models using the following
79
+ command:
76
80
 
77
- ```ruby
78
- rails g neeto_fields_engine:associations
79
- ```
81
+ ```ruby
82
+ rails g neeto_fields_engine:associations
83
+ ```
80
84
 
81
- This will prompt the user to enter 2 things:
85
+ This will prompt the user to enter 2 things:
82
86
 
83
- 1. Name of Owner model.
84
- 2. Names of Resource models.
87
+ 1. Name of Owner model.
88
+ 2. Names of Resource models.
85
89
 
86
- Explore [Owner & Resource Information](docs/engine/owner-resource-information.md) for details.
90
+ Explore
91
+ [Owner & Resource Information](docs/engine/owner-resource-information.md) for
92
+ details.
87
93
 
88
94
  #### Customizability
89
95
 
90
- Refer [Engine customizability](docs/engine/customizability.md) to learn about customizing the engine's default behavior.
96
+ Refer [Engine customizability](docs/engine/customizability.md) to learn about
97
+ customizing the engine's default behavior.
91
98
 
92
99
  ### Frontend package
93
100
 
@@ -110,7 +117,9 @@ yarn add uuid
110
117
 
111
118
  ### Instructions for development
112
119
 
113
- Check the [Frontend package development guide](https://neeto-engineering.neetokb.com/p/a-d34cb4b0) for step-by-step instructions to develop the frontend package.
120
+ Check the
121
+ [Frontend package development guide](https://neeto-engineering.neetokb.com/p/a-d34cb4b0)
122
+ for step-by-step instructions to develop the frontend package.
114
123
 
115
124
  ### Components
116
125
 
@@ -158,12 +167,15 @@ default, but you can customize its behavior by passing optional props.
158
167
  `inactive` states.
159
168
  9. `breadcrumbs`: Specifies the breadcrumbs to be displayed on the dashboard
160
169
  page.
161
- 10. `helpDocUrl`: Specify the URL to the help documentation about fields. This
170
+ 10. `helpDescription`: To set the description of the popover, this can be a
171
+ string or a custom component.
172
+ 11. `helpDocUrl`: Specify the URL to the help documentation about fields. This
162
173
  URL will be shown in the `NoData` screen.
163
- 11. `nameAliases`: This property accepts alias names as key-value pairs to be
174
+ 12. `nameAliases`: This property accepts alias names as key-value pairs to be
164
175
  displayed for the names of resource types in header and menubar.
165
- 12. `headerTitle`: Specify the header title explicitly. Default is 'fields'
166
- 13. `resources`: For owner-based field categorization, provide an array of
176
+ 13. `headerTitle`: Specify the header title explicitly. Default is 'fields'. TIt
177
+ also specifies the title of `HelpPopover`.
178
+ 14. `resources`: For owner-based field categorization, provide an array of
167
179
  objects with `id` and `name` properties for each owner. For resource
168
180
  type-based categorization, use an array of objects with `label` and `value`
169
181
  properties representing each resource types.
@@ -176,81 +188,80 @@ default, but you can customize its behavior by passing optional props.
176
188
 
177
189
  1. When `Organization` is the owner of the fields.
178
190
 
179
- ```jsx
180
- import { FieldsDashboard } from "@bigbinary/neeto-fields-frontend";
181
-
182
- <FieldsDashboard
183
- allowedKinds={["text", "number"]}
184
- buildColumnData={({ defaultColumns }) => [
185
- ...defaultColumns,
186
- {
187
- dataIndex: "isSystem",
188
- index: "isSystem",
189
- title: t("titles.systemField"),
190
- render: boolVal => (boolVal ? "Yes" : "No"),
191
- },
192
- ]}
193
- fieldStatesTaxonomy={{ active: "Active", inactive: "Deactivated" }}
194
- paneProps={{
195
- children: <HostSpecificInputFields />,
196
- validations: {
197
- hostSpecificInputName: validationSchema,
198
- },
199
- initialValues: {
200
- hostSpecificInputName: initialValue,
201
- },
202
- }}
203
- breadcrumbs={[
204
- {
205
- link: "/",
206
- text: "Home",
207
- },
208
- {
209
- link: "/",
210
- text: "Settings",
211
- },
212
- ]}
213
- />;
214
- ```
215
-
216
- #### Usage in [neetoDesk](https://github.com/bigbinary/neeto-desk-web/blob/34068bb579335d3eb6041279f6f3f660099d7f1c/app/javascript/src/components/TicketFields/List/index.jsx#L119C8-L130C11)
217
-
218
-
219
- 2. When `Organization` is not owner of the fields. Let's say the owner is `Project`.
220
-
221
- ```jsx
222
- import { FieldsDashboard } from "@bigbinary/neeto-fields-frontend";
223
-
224
- <FieldsDashboard
225
- allowedKinds={["text", "number"]}
226
- resourceType="tasks"
227
- showOwnersInMenu
228
- fieldStatesTaxonomy={{ active: "Active", inactive: "Deactivated" }}
229
- paneProps={{
230
- children: <HostSpecificInputFields />,
231
- validations: {
232
- hostSpecificInputName: validationSchema,
233
- },
234
- initialValues: {
235
- hostSpecificInputName: initialValue,
236
- },
237
- }}
238
- breadcrumbs={[
239
- {
240
- link: "/",
241
- text: "Home",
242
- },
243
- {
244
- link: "/",
245
- text: "Settings",
246
- },
247
- ]}
248
- />;
249
- ```
191
+ ```jsx
192
+ import { FieldsDashboard } from "@bigbinary/neeto-fields-frontend";
193
+
194
+ <FieldsDashboard
195
+ allowedKinds={["text", "number"]}
196
+ buildColumnData={({ defaultColumns }) => [
197
+ ...defaultColumns,
198
+ {
199
+ dataIndex: "isSystem",
200
+ index: "isSystem",
201
+ title: t("titles.systemField"),
202
+ render: boolVal => (boolVal ? "Yes" : "No"),
203
+ },
204
+ ]}
205
+ fieldStatesTaxonomy={{ active: "Active", inactive: "Deactivated" }}
206
+ paneProps={{
207
+ children: <HostSpecificInputFields />,
208
+ validations: {
209
+ hostSpecificInputName: validationSchema,
210
+ },
211
+ initialValues: {
212
+ hostSpecificInputName: initialValue,
213
+ },
214
+ }}
215
+ breadcrumbs={[
216
+ {
217
+ link: "/",
218
+ text: "Home",
219
+ },
220
+ {
221
+ link: "/",
222
+ text: "Settings",
223
+ },
224
+ ]}
225
+ />;
226
+ ```
227
+
228
+ #### Usage in [neetoDesk](https://github.com/bigbinary/neeto-desk-web/blob/34068bb579335d3eb6041279f6f3f660099d7f1c/app/javascript/src/components/TicketFields/List/index.jsx#L119C8-L130C11)
229
+
230
+ 2. When `Organization` is not owner of the fields. Let's say the owner is
231
+ `Project`.
232
+
233
+ ```jsx
234
+ import { FieldsDashboard } from "@bigbinary/neeto-fields-frontend";
235
+
236
+ <FieldsDashboard
237
+ allowedKinds={["text", "number"]}
238
+ resourceType="tasks"
239
+ showOwnersInMenu
240
+ fieldStatesTaxonomy={{ active: "Active", inactive: "Deactivated" }}
241
+ paneProps={{
242
+ children: <HostSpecificInputFields />,
243
+ validations: {
244
+ hostSpecificInputName: validationSchema,
245
+ },
246
+ initialValues: {
247
+ hostSpecificInputName: initialValue,
248
+ },
249
+ }}
250
+ breadcrumbs={[
251
+ {
252
+ link: "/",
253
+ text: "Home",
254
+ },
255
+ {
256
+ link: "/",
257
+ text: "Settings",
258
+ },
259
+ ]}
260
+ />;
261
+ ```
250
262
 
251
263
  #### Usage in [neetoForm](https://github.com/bigbinary/neeto-form-web/blob/1ae06a0f49f62b20ced313c1672fb336553b867c/app/javascript/src/components/Form/Settings/Fields.jsx#L35C7-L47C9)
252
264
 
253
-
254
265
  #### 2. `FieldsPane`
255
266
 
256
267
  <div align="center">
@@ -281,24 +292,24 @@ The `FieldsPane` component handles the `Add / Edit` operations of the field.
281
292
 
282
293
  #### Usage
283
294
 
284
- ```jsx
285
- import { FieldsPane } from "@biginary/neeto-fields-frontend";
286
-
287
- const [fieldPaneOpen, setFieldPaneOpen] = useState(false);
288
-
289
- <FieldsPane
290
- isOpen={fieldPaneOpen}
291
- allowedKinds={["text", "number"]}
292
- resourceType="users"
293
- additionalValidations={{
294
- hostSpecificInputName: validationSchema,
295
- }}
296
- initialValues={{ hostSpecificInputName: initialValue }}
297
- onClose={() => setFieldPaneOpen(false)}
298
- >
299
- <HostSpecificInputFields />
300
- </FieldsPane>;
301
- ```
295
+ ```jsx
296
+ import { FieldsPane } from "@biginary/neeto-fields-frontend";
297
+
298
+ const [fieldPaneOpen, setFieldPaneOpen] = useState(false);
299
+
300
+ <FieldsPane
301
+ isOpen={fieldPaneOpen}
302
+ allowedKinds={["text", "number"]}
303
+ resourceType="users"
304
+ additionalValidations={{
305
+ hostSpecificInputName: validationSchema,
306
+ }}
307
+ initialValues={{ hostSpecificInputName: initialValue }}
308
+ onClose={() => setFieldPaneOpen(false)}
309
+ >
310
+ <HostSpecificInputFields />
311
+ </FieldsPane>;
312
+ ```
302
313
 
303
314
  ## 3. `FieldValuesContainer`
304
315
 
@@ -405,8 +416,8 @@ The `FieldInputs` component render the input UI for the fetched fields.
405
416
  > [`mergeInitialValues`](#1-neetofieldsutilsmergeinitialvalues) function.
406
417
  >
407
418
  > To submit the values from this formik form, you need to use
408
- > [`transformValues`](#2-neetofieldsutilstransformvalues) function to capture the right
409
- > data from neeto-fields.
419
+ > [`transformValues`](#2-neetofieldsutilstransformvalues) function to capture
420
+ > the right data from neeto-fields.
410
421
 
411
422
  #### Usage
412
423
 
@@ -496,7 +507,8 @@ const buildColumnDataForFields = (fields, onFieldValueUpdateSuccess) =>
496
507
  <img src="https://github.com/bigbinary/neeto-fields-nano/assets/35305344/6518b206-58f3-4375-bc68-7134ad68c168" alt="Field delete alert" width="500"/>
497
508
  </div>
498
509
 
499
- The `FieldDeleteAlert` component handles delete operation on fields. It accepts the following props:
510
+ The `FieldDeleteAlert` component handles delete operation on fields. It accepts
511
+ the following props:
500
512
 
501
513
  #### Props
502
514
 
@@ -505,8 +517,10 @@ The `FieldDeleteAlert` component handles delete operation on fields. It accepts
505
517
  3. `resourceTypeName`: The type of resource.
506
518
  4. `isDeleteAlertOpen`: Boolean state which specifies whether the alert is open.
507
519
  5. `isDeleting`: Boolean state indicating whether the field is being deleted.
508
- 6. `handleDelete`: The callback function responsible for deleting the specified field.
509
- 7. `handleAlertClose`: The callback function to be executed on closing the alert.
520
+ 6. `handleDelete`: The callback function responsible for deleting the specified
521
+ field.
522
+ 7. `handleAlertClose`: The callback function to be executed on closing the
523
+ alert.
510
524
 
511
525
  #### Usage
512
526
 
@@ -672,16 +686,18 @@ organization._
672
686
 
673
687
  ## Instructions for Publishing
674
688
 
675
- Consult the [building and releasing packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages) guide for details on how to publish.
689
+ Consult the
690
+ [building and releasing packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages)
691
+ guide for details on how to publish.
676
692
 
677
693
  ## Integrations
678
694
 
679
- | Projects | Integrated |
680
- | ------------- | :----------------: |
681
- | neetoForm | :white_check_mark: |
682
- | neetoDesk | :white_check_mark: |
683
- | neetoPlanner | :white_check_mark: |
684
- | neetoCrm | :white_check_mark: |
685
- | neetoChat | :white_check_mark: |
686
- | neetoCal | :white_check_mark: |
687
- | neetoTestify | :white_check_mark: |
695
+ | Projects | Integrated |
696
+ | ------------ | :----------------: |
697
+ | neetoForm | :white_check_mark: |
698
+ | neetoDesk | :white_check_mark: |
699
+ | neetoPlanner | :white_check_mark: |
700
+ | neetoCrm | :white_check_mark: |
701
+ | neetoChat | :white_check_mark: |
702
+ | neetoCal | :white_check_mark: |
703
+ | neetoTestify | :white_check_mark: |
package/dist/index.cjs.js CHANGED
@@ -2520,7 +2520,7 @@ var buildDefaultColumns = function buildDefaultColumns(_ref2) {
2520
2520
  key: "name",
2521
2521
  dataIndex: "name",
2522
2522
  title: i18next.t("neetoFields.titles.fieldName"),
2523
- width: "300px",
2523
+ width: 300,
2524
2524
  render: function render(name, field) {
2525
2525
  return /*#__PURE__*/React__default["default"].createElement("div", {
2526
2526
  className: "flex items-center justify-between gap-x-3"
@@ -2548,12 +2548,12 @@ var buildDefaultColumns = function buildDefaultColumns(_ref2) {
2548
2548
  render: function render(kind) {
2549
2549
  return DISPLAY_KINDS[kind];
2550
2550
  },
2551
- width: "300px"
2551
+ width: 180
2552
2552
  }, {
2553
2553
  key: "isRequired",
2554
2554
  dataIndex: "isRequired",
2555
2555
  title: i18next.t("neetoFields.titles.required"),
2556
- width: "300px",
2556
+ width: 140,
2557
2557
  render: function render(boolVal) {
2558
2558
  return boolVal ? i18next.t("neetoFields.common.yes") : i18next.t("neetoFields.common.no");
2559
2559
  }
@@ -3072,14 +3072,17 @@ var Header = reactUtils.withT(function (_ref) {
3072
3072
  actionBlock: /*#__PURE__*/React__default["default"].createElement(ActionBlock, actionBlockProps),
3073
3073
  searchProps: searchInputProps,
3074
3074
  size: "small",
3075
- title: /*#__PURE__*/React__default["default"].createElement("span", null, title, /*#__PURE__*/React__default["default"].createElement(HelpPopover__default["default"], {
3076
- title: title,
3077
- className: "ml-2 self-center",
3078
- description: helpDescription,
3075
+ title: /*#__PURE__*/React__default["default"].createElement("span", null, title, (helpDocUrl || helpDescription) && /*#__PURE__*/React__default["default"].createElement(HelpPopover__default["default"], _extends({
3076
+ className: "ml-2 self-center"
3077
+ }, helpDocUrl && {
3078
+ title: title
3079
+ }, helpDescription && {
3080
+ description: helpDescription
3081
+ }, helpDocUrl && {
3079
3082
  helpLinkProps: {
3080
3083
  href: helpDocUrl
3081
3084
  }
3082
- }))
3085
+ })))
3083
3086
  });
3084
3087
  });
3085
3088