@performant-software/user-defined-fields 0.6.3-beta.4 → 1.0.0
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 +53 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#UserDefinedFields
|
|
2
|
+
This package is designed to be used with the [user_defined_fields](https://github.com/performant-software/user-defined-fields) Rails gem. The idea is to allow users to define what type of metadata they want to collection about specific models and use these components to add, remove, and modify the configuration of the fields.
|
|
3
|
+
|
|
4
|
+
## Installation
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
yarn add @performant-software/user-defined-fields
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
or
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @performant-software/user-defined-fields
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
To load user defined fields directly from the API endpoint, use the `UserDefinedFieldsList` component.
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
<UserDefinedFieldsList />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
To add the user defined fields from nested attributes of a parent record, use the `UserDefinedFieldsEmbeddedList` component.
|
|
24
|
+
|
|
25
|
+
```jsx
|
|
26
|
+
<UserDefinedFieldsEmbeddedList
|
|
27
|
+
items={props.item.user_defined_fields}
|
|
28
|
+
onDelete={props.onDeleteChildAssociation.bind(this, 'user_defined_fields')}
|
|
29
|
+
onSave={props.onSaveChildAssociation.bind(this, 'user_defined_fields')}
|
|
30
|
+
/>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Services
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
// Fetch the list of user defined fields
|
|
37
|
+
UserDefinedFieldsService.fetchAll(params)
|
|
38
|
+
|
|
39
|
+
// Fetch a single user defined field
|
|
40
|
+
UserDefinedFieldsService.fetchOne(id)
|
|
41
|
+
|
|
42
|
+
// Save a user defined field
|
|
43
|
+
UserDefinedFieldsService.save(udf)
|
|
44
|
+
|
|
45
|
+
// Delete a user defined field
|
|
46
|
+
UserDefinedFieldsService.delete(udf)
|
|
47
|
+
|
|
48
|
+
// Fetch a list of tables to which user defined fields can be added
|
|
49
|
+
UserDefinedFieldsService.fetchTables()
|
|
50
|
+
|
|
51
|
+
// Fetch a list of allowed data types
|
|
52
|
+
UserDefinedFieldsService.fetchDataTypes()
|
|
53
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@performant-software/user-defined-fields",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A package of components used for allowing end users to define fields on models. Use with the \"user_defined_fields\" gem.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./build/index.js",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"build": "webpack --mode production && flow-copy-source -v src types"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@performant-software/semantic-components": "^0.
|
|
13
|
-
"@performant-software/shared-components": "^0.
|
|
12
|
+
"@performant-software/semantic-components": "^1.0.0",
|
|
13
|
+
"@performant-software/shared-components": "^1.0.0",
|
|
14
14
|
"i18next": "^21.9.1",
|
|
15
15
|
"semantic-ui-react": "^2.1.2",
|
|
16
16
|
"underscore": "^1.13.2"
|