drf-react-by-schema 0.2.0 → 0.2.2

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/.gitlab-ci.yml ADDED
@@ -0,0 +1,14 @@
1
+ image: node:latest
2
+
3
+ pages:
4
+ cache:
5
+ paths:
6
+ - node_modules/
7
+ script:
8
+ - yarn install
9
+ - yarn styleguide:build
10
+ only:
11
+ - master
12
+ artifacts:
13
+ paths:
14
+ - public
package/README.md CHANGED
@@ -1,92 +1,25 @@
1
1
  # DRF and React By Schema - JS
2
2
 
3
+ *This Package will offer out-of-the-box Components, Providers and other tools to make it a breeze to build editable tables and complete forms, completely integrated to Django Rest Framework schemas for validations and widgets, and all CRUD operations working, based diractly, primarily and automatically on the Model, Viewsets and Serializers built in Django.*
3
4
 
5
+ ## About
4
6
 
5
- ## Getting started
7
+ Working with forms and CRUD operations in React having Django as the Backend Server can be too "manual" and prone for errors.
6
8
 
7
- To make it easy for you to get started with GitLab, here's a list of recommended next steps.
9
+ There are no simple ways to make things more integrated among both systems.
8
10
 
9
- Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
11
+ There will be two solutions: one for react (this very one!) and one for Django, with the same name (still not released).
10
12
 
11
- ## Add your files
13
+ **Warning:** This is still a work in progress! At the moment, only some of the components are built, besides the Provider Component.
12
14
 
13
- - [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
14
- - [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
15
+ For `drf-react-by-schema` to work, you will have to install other important packages, as MUI, YUP, among others (listed as Peer Dependencies in `package.json`).
15
16
 
16
- ```
17
- cd existing_repo
18
- git remote add origin https://gitlab.com/eita/drf-react-by-schema/drf-react-by-schema-js.git
19
- git branch -M master
20
- git push -uf origin master
21
- ```
17
+ In the next weeks, we hope to offer full Documentation, guides to install, and other useful informations for using it.
22
18
 
23
- ## Integrate with your tools
19
+ For now, if you have interest in using this solution or helping to develop, send us an e-mail at dtygel@eita.org.br or create issues directly at our repository.
24
20
 
25
- - [ ] [Set up project integrations](https://gitlab.com/eita/drf-react-by-schema/drf-react-by-schema-js/-/settings/integrations)
21
+ ## Styleguides
26
22
 
27
- ## Collaborate with your team
23
+ Components documentation is available and constantly updated at https://eita.gitlab.io/drf-react-by-schema/drf-react-by-schema-js/
28
24
 
29
- - [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
30
- - [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
31
- - [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
32
- - [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
33
- - [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
34
-
35
- ## Test and Deploy
36
-
37
- Use the built-in continuous integration in GitLab.
38
-
39
- - [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
40
- - [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
41
- - [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
42
- - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
43
- - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
44
-
45
- ***
46
-
47
- # Editing this README
48
-
49
- When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
50
-
51
- ## Suggestions for a good README
52
- Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
53
-
54
- ## Name
55
- Choose a self-explaining name for your project.
56
-
57
- ## Description
58
- Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
59
-
60
- ## Badges
61
- On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
62
-
63
- ## Visuals
64
- Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
65
-
66
- ## Installation
67
- Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
68
-
69
- ## Usage
70
- Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
71
-
72
- ## Support
73
- Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
74
-
75
- ## Roadmap
76
- If you have ideas for releases in the future, it is a good idea to list them in the README.
77
-
78
- ## Contributing
79
- State if you are open to contributions and what your requirements are for accepting them.
80
-
81
- For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
82
-
83
- You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
84
-
85
- ## Authors and acknowledgment
86
- Show your appreciation to those who have contributed to the project.
87
-
88
- ## License
89
- For open source projects, say how it is licensed.
90
-
91
- ## Project status
92
- If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
25
+ We do welcome suggestions for examples and more details on the props and components.
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "drf-react-by-schema",
3
- "version": "0.2.0",
4
- "description": "Tools for building a React App having Django Rest Framework (DRF) as server",
3
+ "version": "0.2.2",
4
+ "description": "Components and Tools for building a React App having Django Rest Framework (DRF) as server",
5
5
  "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
6
7
  "scripts": {
7
8
  "test": "echo \"There are (still) no tests in this package\"",
8
9
  "build": "tsc",
@@ -17,7 +18,12 @@
17
18
  "keywords": [
18
19
  "react",
19
20
  "drf",
20
- "django"
21
+ "django",
22
+ "django rest framework",
23
+ "schema based forms",
24
+ "MUI",
25
+ "MUI DataGrid",
26
+ "yup"
21
27
  ],
22
28
  "author": "Coletivo EITA",
23
29
  "license": "MIT",
@@ -2,13 +2,8 @@ const path = require('path');
2
2
  const glob = require('glob');
3
3
 
4
4
  module.exports = {
5
- title: 'React Style Guide Example',
6
- // components: function () {
7
- // return glob.sync(path.resolve(__dirname, 'src/components/**/*.tsx'))
8
- // .filter(function (module) {
9
- // return /\/[A-Z]\w*\.tsx$/.test(module);
10
- // });
11
- // },
5
+ title: 'Styleguides for DRF React By Schema Package',
6
+ styleguideDir: 'public',
12
7
  components: [
13
8
  'src/components/*.tsx',
14
9
  'src/context/*.tsx'
@@ -1,62 +0,0 @@
1
- import React from 'react';
2
- import { Control } from "react-hook-form";
3
- import TextField from '@mui/material/TextField';
4
-
5
- import { errorProps } from '../utils';
6
-
7
- export interface TextFieldBySchemaType {
8
- name: string;
9
- Controller: React.ReactNode;
10
- control: Control;
11
- errors:
12
- }
13
-
14
- export default function TextFieldBySchema ({
15
- Controller,
16
- name,
17
- schema,
18
- control,
19
- errors,
20
- multiline = false,
21
- fieldKey = null,
22
- index = null,
23
- sx = { mr: 2 },
24
- ...other
25
- }) {
26
- const model = name;
27
- if (fieldKey && index >= 0) {
28
- name = `${fieldKey}.${index}.${name}`;
29
- }
30
- const { error, helperText } = (fieldKey && index >= 0)
31
- ? errorProps({
32
- fieldKey,
33
- index,
34
- fieldKeyProp: name,
35
- errors
36
- })
37
- : {
38
- error: errors && Boolean(errors[name]),
39
- helperText: (errors && errors[name]) ? errors[name].message : ''
40
- };
41
- return (
42
- <Controller
43
- name={name}
44
- control={control}
45
- render={({ field }) => (
46
- <TextField
47
- {...field}
48
- {...other}
49
- id={name}
50
- key={name}
51
- label={schema[model].label}
52
- margin="normal"
53
- fullWidth
54
- multiline={multiline}
55
- error={error}
56
- helperText={helperText}
57
- sx={sx}
58
- />
59
- )}
60
- />
61
- );
62
- }