-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QuickEdit: Add slug field control #65196
Merged
Merged
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5682b92
Page view: Add link field control
gigitux 395cc25
Add @wordpress/fields package
gigitux e820a6c
Merge branch 'add/@wordpress-fields' of github.com:gigitux/gutenberg …
gigitux b00ec03
remove not used references
gigitux 6e71a98
add marker to generate API documentation
gigitux 43b8a93
improve package description
gigitux 7e04069
not use lock/unlock api
gigitux e5fd361
remove apostrophe
gigitux 9bfd08f
fix build
gigitux 30def0b
Merge branch 'add/@wordpress-fields' of github.com:gigitux/gutenberg …
gigitux 0855668
move slug field control to @wordpress/fields package
gigitux bc60075
Merge branch 'trunk' of github.com:WordPress/gutenberg into add/link-…
gigitux d95c35d
Merge branch 'trunk' of github.com:WordPress/gutenberg into add/link-…
gigitux 934bc1e
improve definition
gigitux dc2e1b8
disable slug field control in bulk mode
gigitux 500b848
improve css classnames
gigitux 4d1f022
Merge branch 'trunk' of github.com:WordPress/gutenberg into add/link-…
gigitux d7e0e6f
Merge branch 'trunk' of github.com:WordPress/gutenberg into add/link-…
gigitux 4efda74
add type property
gigitux f53239c
Merge branch 'trunk' of github.com:WordPress/gutenberg into add/link-…
gigitux 075a2b0
update layout
gigitux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 @@ | ||
package-lock=false |
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,5 @@ | ||
<!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. --> | ||
|
||
## Unreleased | ||
|
||
Initial release. |
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 @@ | ||
# Fields | ||
|
||
This package provides core elements for the DataView library, designed to simplify the creation and management of data display elements in WordPress. | ||
|
||
## Installation | ||
|
||
Install the module | ||
|
||
```bash | ||
npm install @wordpress/fields --save | ||
``` | ||
|
||
## Usage | ||
|
||
<!-- START TOKEN(Autogenerated API docs) --> | ||
|
||
### SlugEdit | ||
|
||
Undocumented declaration. | ||
|
||
### SlugView | ||
|
||
Undocumented declaration. | ||
|
||
<!-- END TOKEN(Autogenerated API docs) --> | ||
|
||
## Contributing to this package | ||
|
||
This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects. | ||
|
||
To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md). | ||
|
||
<br /><br /><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p> |
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,52 @@ | ||
{ | ||
"name": "@wordpress/fields", | ||
"version": "0.0.1", | ||
"description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).", | ||
"author": "The WordPress Contributors", | ||
"license": "GPL-2.0-or-later", | ||
"keywords": [ | ||
"wordpress", | ||
"gutenberg", | ||
"dataviews" | ||
], | ||
"homepage": "https://github.com/WordPress/gutenberg/tree/HEAD/packages/fields/README.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/WordPress/gutenberg.git", | ||
"directory": "packages/fields" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/WordPress/gutenberg/issues" | ||
}, | ||
"engines": { | ||
"node": ">=18.12.0", | ||
"npm": ">=8.19.2" | ||
}, | ||
"main": "build/index.js", | ||
"module": "build-module/index.js", | ||
"types": "build-types", | ||
"sideEffects": [ | ||
"build-style/**", | ||
"src/**/*.scss" | ||
], | ||
"dependencies": { | ||
"@babel/runtime": "^7.16.0", | ||
"@wordpress/components": "file:../components", | ||
"@wordpress/compose": "file:../compose", | ||
"@wordpress/data": "file:../data", | ||
"@wordpress/element": "file:../element", | ||
"@wordpress/i18n": "file:../i18n", | ||
"@wordpress/icons": "file:../icons", | ||
"@wordpress/notices": "file:../notices", | ||
"@wordpress/primitives": "file:../primitives", | ||
"@wordpress/private-apis": "file:../private-apis", | ||
"@wordpress/url": "file:../url", | ||
"@wordpress/warning": "file:../warning" | ||
}, | ||
"peerDependencies": { | ||
"react": "^18.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
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 @@ | ||
export { default as SlugEdit } from './slug/slug.edit'; | ||
export { default as SlugView } from './slug/slug.view'; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works because our APIs are already extensible. However, there's an alternative that @joshuatf mentioned somewhere. Instead of doing:
we can do something along these lines:
This has a few advantages:
It gets us a bit closer to making the
type
field required. We're not there there yet because there are a couple of missing types we need (image, for example), but we should aim to do it.We offer higher semantics and gets us a bit closer to having no-code JSON-oriented fields. This may sound a bit abstract, but imagine the following scenario: in the future, there's a mechanism for users to create screens based on declaring which fields they want from a dataset. All via UI. In that scenario, that UI needs to be no-code, and users shouldn't have to provide a "custom render", "custom edit", "custom validation", etc. if they just want a field to be a "slug". Instead, they should work with types: the basic ones provided by DataViews (string, integer, date, etc.) but also any other one that is domain-specific (slug, cart-status, etc.).
Another aspect of this PR is what should be the API offered by the
wordpress/field
package?This suggest it should export individual field properties (render, edit, isValid, etc.). There are a few. What if it exported the whole field instead? An advantage of exporting the whole Field is that the
wordpress/field
package can implement new APIs as they come without having to modify the consumers: