-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Add inputs search to editComponent * chore: proptypes * wip: some components to ts * wip: more components * wip: move to typescript * wip: more components * wip: components / build * chore: tsconfig * wip: typescript * fix: typescript * feat: lint * chore: types * chore: format * fix: build * feat: add new fields and update render field and edit component, also improve move and delete item action * chore: interface guillotina * feat: new interface, required all fields * feat: prevent default some components * feat: add form in example * chore: version
- Loading branch information
1 parent
f6c17df
commit 7df3300
Showing
132 changed files
with
3,581 additions
and
1,014 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es2021: true, | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react/recommended', | ||
'plugin:react/jsx-runtime', | ||
], | ||
overrides: [ | ||
{ | ||
env: { | ||
node: true, | ||
}, | ||
files: ['.eslintrc.{js,cjs}'], | ||
parserOptions: { | ||
sourceType: 'script', | ||
}, | ||
}, | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint', 'react'], | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'warn', | ||
'no-extra-semi': 'warn', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
guillotina_example/guillotina_react_app/guillotina_react_app/gmi_required/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import content | ||
from . import interface |
18 changes: 18 additions & 0 deletions
18
guillotina_example/guillotina_react_app/guillotina_react_app/gmi_required/content.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from guillotina import configure | ||
from guillotina import content | ||
from guillotina_react_app.gmi_required.interface import IGMIAllRequired | ||
|
||
@configure.contenttype( | ||
type_name="GMIAllRequired", | ||
schema=IGMIAllRequired, | ||
behaviors=[ | ||
"guillotina.behaviors.dublincore.IDublinCore", | ||
"guillotina.behaviors.attachment.IAttachment", | ||
"guillotina.contrib.image.behaviors.IImageAttachment", | ||
"guillotina.contrib.workflows.interfaces.IWorkflowBehavior", | ||
"guillotina.contrib.image.behaviors.IMultiImageOrderedAttachment", | ||
], | ||
add_permission="guillotina.AddContent" | ||
) | ||
class GMIAllRequired(content.Folder): | ||
pass |
119 changes: 119 additions & 0 deletions
119
guillotina_example/guillotina_react_app/guillotina_react_app/gmi_required/interface.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import json | ||
from guillotina import interfaces | ||
from guillotina import schema | ||
from guillotina.directives import index_field | ||
from guillotina.fields import CloudFileField | ||
|
||
JSON_EXAMPLE_SCHEMA = json.dumps( | ||
{ | ||
"title": "My Json Field", | ||
"type": "object", | ||
"properties": { | ||
"items": { | ||
"type": "array", | ||
"title": "Array in json" | ||
}, | ||
"text": { | ||
"type": "string", | ||
"title": "Text in json" | ||
}, | ||
"second_level": { | ||
"type": "object", | ||
"title": "Two levels", | ||
"properties": { | ||
"first_item_second_level": { | ||
"type": "string", | ||
"title": "Item second level text", | ||
}, | ||
}, | ||
}, | ||
} | ||
} | ||
) | ||
class IGMIAllRequired(interfaces.IFolder): | ||
|
||
json_example = schema.JSONField(schema=JSON_EXAMPLE_SCHEMA, required=False) | ||
|
||
index_field("text_richtext_field", type="searchabletext") | ||
text_richtext_field = schema.Text(title="Text richtext field", required=True, widget="richtext") | ||
|
||
index_field("text_field", type="searchabletext") | ||
text_field = schema.Text(title="Text field", required=True) | ||
|
||
index_field("textarea_field", type="searchabletext") | ||
textarea_field = schema.Text(title="Text area field", required=True, widget="textarea") | ||
|
||
|
||
text_line_field = schema.TextLine(title="Text line field", required=True) | ||
index_field("number_field", type="int") | ||
number_field = schema.Int(title="Number field", required=True) | ||
index_field("boolean_field", type="boolean") | ||
boolean_field = schema.Bool(title="Boolean field") | ||
cloud_file_field = CloudFileField(title="Cloud file field") | ||
list_field = schema.List(title="List field", value_type=schema.TextLine(), missing_value=[], required=True) | ||
|
||
index_field("datetime_field", type="date") | ||
datetime_field = schema.Datetime(title="Datetime field", required=True) | ||
|
||
index_field("time_field", type="text") | ||
time_field = schema.Time(title="Time field", required=True) | ||
|
||
index_field("date_field", type="date") | ||
date_field = schema.Date(title="Date field", required=True) | ||
|
||
index_field("choice_field_vocabulary", type="keyword") | ||
choice_field_vocabulary = schema.Choice( | ||
title="Choice field vocabulary", | ||
vocabulary="gmi_vocabulary", | ||
required=True | ||
) | ||
|
||
index_field("choice_field", type="keyword") | ||
choice_field = schema.Choice( | ||
title="Choice field", | ||
values=["date", "integer", "text", "float", "keyword", "boolean"], | ||
required=True, | ||
) | ||
|
||
index_field("multiple_choice_field", type="keyword") | ||
multiple_choice_field = schema.List( | ||
title="Multiple choice field", | ||
value_type=schema.Choice( | ||
title="Choice field", | ||
values=["date", "integer", "text", "float", "keyword", "boolean"], | ||
), | ||
missing_value=[], | ||
required=True | ||
) | ||
|
||
index_field("multiple_choice_field_vocabulary", type="keyword") | ||
multiple_choice_field_vocabulary = schema.List( | ||
title="Multiple choice field vocabulary", | ||
value_type=schema.Choice( | ||
title="Choice field vocabulary", | ||
vocabulary="gmi_vocabulary", | ||
required=True, | ||
), | ||
missing_value=[], | ||
required=True | ||
) | ||
|
||
gmi_ids = schema.List( | ||
title="GMI list", | ||
value_type=schema.TextLine(), | ||
default=[], | ||
null=True, | ||
blank=True, | ||
widget="search_list", | ||
labelProperty="title", | ||
typeNameQuery="GMI", | ||
required=True | ||
) | ||
|
||
brother_gmi = schema.Text( | ||
title="Brother GMI", | ||
widget="search", | ||
typeNameQuery="GMI", | ||
labelProperty="title", | ||
required=True | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
{ | ||
"version": "0.27.0", | ||
"version": "0.28.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:guillotinaweb/guillotina_react.git" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"source": "./src/guillo-gmi/index.js", | ||
"source": "./src/guillo-gmi/index.ts", | ||
"main": "./dist/react-gmi.js", | ||
"exports": "./dist/react-gmi.modern.js", | ||
"types": "./dist/index.d.ts", | ||
|
@@ -31,32 +31,39 @@ | |
"@babel/cli": "7.12.10", | ||
"@babel/core": "7.12.10", | ||
"@formatjs/cli": "^6.2.4", | ||
"@formatjs/ts-transformer": "^3.13.11", | ||
"@testing-library/jest-dom": "5.11.6", | ||
"@testing-library/react": "11.2.2", | ||
"@testing-library/user-event": "12.6.0", | ||
"@typescript-eslint/eslint-plugin": "^6.18.1", | ||
"@typescript-eslint/parser": "^6.18.1", | ||
"babel-plugin-formatjs": "^10.5.10", | ||
"eslint": "^8.56.0", | ||
"eslint-plugin-react": "^7.33.2", | ||
"husky": "4.3.6", | ||
"microbundle": "0.13.0", | ||
"prettier": "2.2.1", | ||
"sass": "1.69.5", | ||
"serialize-javascript": "5.0.1", | ||
"vitest": "^0.34.6" | ||
"typescript": "^5.3.3", | ||
"vitest": "^0.34.6", | ||
"@types/react-beautiful-dnd": "13.1.8" | ||
}, | ||
"scripts": { | ||
"format": "prettier --write \"src/**/*.js\"", | ||
"format": "prettier --write \"src/**/*.{js,ts,tsx}\"", | ||
"format:tests": "prettier --write \"e2e/cypress/**/*.js\"", | ||
"format:check": "prettier --check \"src/**/*.js\"", | ||
"build": "yarn build:js && yarn build:css", | ||
"build:js": "rm -rf ./dist && microbundle --jsx React.createElement --no-compress --sourcemap", | ||
"build:css": "rm -rf ./dist/css && mkdir ./dist/css && sass ./src/guillo-gmi/scss/styles.sass ./dist/css/style.css", | ||
"build:css": "rm -rf ./dist/css && mkdir -p ./dist/css && sass ./src/guillo-gmi/scss/styles.sass ./dist/css/style.css", | ||
"prepublish": "yarn build", | ||
"test": "vitest run", | ||
"lint": "eslint src", | ||
"intl-extract": "formatjs extract 'src/**/*.js' --out-file src/guillo-gmi/locales/en.json --id-interpolation-pattern '[sha512:contenthash:base64:6]'", | ||
"intl-compile-en": "formatjs compile src/guillo-gmi/locales/en.json --ast --out-file src/guillo-gmi/locales/compiled/en.json", | ||
"intl-compile-ca": "formatjs compile src/guillo-gmi/locales/ca.json --ast --out-file src/guillo-gmi/locales/compiled/ca.json", | ||
"intl-compile-es": "formatjs compile src/guillo-gmi/locales/es.json --ast --out-file src/guillo-gmi/locales/compiled/es.json", | ||
"intl-compile": "npm run intl-compile-en && npm run intl-compile-es && npm run intl-compile-ca" | ||
|
||
}, | ||
"eslintConfig": { | ||
"extends": "react-app" | ||
|
7 changes: 5 additions & 2 deletions
7
src/guillo-gmi/actions/add_item.js → src/guillo-gmi/actions/add_item.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.