@wordpress/dataviews 10.3.0 → 10.3.1-next.16d95556a.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/CHANGELOG.md CHANGED
@@ -6,6 +6,7 @@
6
6
 
7
7
  ### Enhancements
8
8
 
9
+ - Improve docs for Edit component. [#73202](https://github.com/WordPress/gutenberg/pull/73202)
9
10
  - DataForm: add new details layout. [#72355](https://github.com/WordPress/gutenberg/pull/72355)
10
11
  - DatViews list layout: remove link variant from primary actions's button. [#72920](https://github.com/WordPress/gutenberg/pull/72920)
11
12
  - DataForm: simplify form normalization. [#72848](https://github.com/WordPress/gutenberg/pull/72848)
package/README.md CHANGED
@@ -1302,7 +1302,7 @@ Example:
1302
1302
 
1303
1303
  React component that renders the control to edit the field.
1304
1304
 
1305
- - Type: React component | `string`. If it's a string, it needs to be one of `array`, `checkbox`, `color`, `datetime`, `date`, `email`, `telephone`, `url`, `integer`, `number`, `password`, `radio`, `select`, `text`, `toggle`, `textarea`, `toggleGroup`.
1305
+ - Type: `string` | `object` | React component.
1306
1306
  - Required by DataForm. Optional if the field provided a `type`.
1307
1307
  - Props:
1308
1308
  - `data`: the item to be processed
@@ -1311,25 +1311,18 @@ React component that renders the control to edit the field.
1311
1311
  - `hideLabelFromVision`: boolean representing if the label should be hidden
1312
1312
  - Returns a React element to edit the field's value.
1313
1313
 
1314
- Example:
1314
+ Fields that provide a `type` will have a default Edit control:
1315
1315
 
1316
1316
  ```js
1317
- // A custom control defined by the field.
1317
+ // Edit is optional when field's type is present.
1318
+ // The field will use the default Edit function for text.
1318
1319
  {
1319
- Edit: ( { data, field, onChange, hideLabelFromVision } ) => {
1320
- const value = field.getValue( { item: data } );
1321
-
1322
- return (
1323
- <CustomTimePicker
1324
- value={ value }
1325
- onChange={ onChange }
1326
- hideLabelFromVision
1327
- />
1328
- );
1329
- };
1320
+ type: 'text';
1330
1321
  }
1331
1322
  ```
1332
1323
 
1324
+ Field authors can override the default Edit control by providing a string that maps to one of the bundled UI controls: `array`, `checkbox`, `color`, `date`, `datetime`, `email`, `integer`, `number`, `password`, `radio`, `select`, `telephone`, `text`, `textarea`, `toggle`, `toggleGroup`, or `url`.
1325
+
1333
1326
  ```js
1334
1327
  // Use one of the core controls.
1335
1328
  {
@@ -1337,13 +1330,6 @@ Example:
1337
1330
  }
1338
1331
  ```
1339
1332
 
1340
- ```js
1341
- // Edit is optional when field's type is present.
1342
- // The field will use the default Edit function for text.
1343
- {
1344
- type: 'text';
1345
- }
1346
- ```
1347
1333
 
1348
1334
  ```js
1349
1335
  // Edit can be provided even if field's type is present.
@@ -1354,6 +1340,51 @@ Example:
1354
1340
  }
1355
1341
  ```
1356
1342
 
1343
+ Additionally, some of the bundled Edit controls are configurable via a config object:
1344
+
1345
+ - `textarea` configuration:
1346
+
1347
+ ```js
1348
+ {
1349
+ Edit: {
1350
+ control: 'textarea',
1351
+ rows: 5
1352
+ }
1353
+ }
1354
+ ```
1355
+
1356
+ - `text` configuration:
1357
+
1358
+ ```js
1359
+ {
1360
+ Edit: {
1361
+ control: 'text',
1362
+ prefix: ReactComponent,
1363
+ suffix: ReactComponent,
1364
+ }
1365
+ }
1366
+ ```
1367
+
1368
+ Finally, the field author can always provide its own custom control:
1369
+
1370
+ ```js
1371
+ // A custom control defined by the field.
1372
+ {
1373
+ Edit: ( { data, field, onChange, hideLabelFromVision } ) => {
1374
+ const value = field.getValue( { item: data } );
1375
+
1376
+ return (
1377
+ <CustomTimePicker
1378
+ value={ value }
1379
+ onChange={ onChange }
1380
+ hideLabelFromVision
1381
+ />
1382
+ );
1383
+ };
1384
+ }
1385
+ ```
1386
+
1387
+
1357
1388
  ### `sort`
1358
1389
 
1359
1390
  Function to sort the records.
package/build-wp/index.js CHANGED
@@ -11593,6 +11593,7 @@ var CORE_MODULES_USING_PRIVATE_APIS = [
11593
11593
  "@wordpress/patterns",
11594
11594
  "@wordpress/preferences",
11595
11595
  "@wordpress/reusable-blocks",
11596
+ "@wordpress/route",
11596
11597
  "@wordpress/router",
11597
11598
  "@wordpress/routes",
11598
11599
  "@wordpress/sync",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/dataviews",
3
- "version": "10.3.0",
3
+ "version": "10.3.1-next.16d95556a.0",
4
4
  "description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -44,19 +44,19 @@
44
44
  "sideEffects": false,
45
45
  "dependencies": {
46
46
  "@ariakit/react": "^0.4.15",
47
- "@wordpress/base-styles": "^6.11.0",
48
- "@wordpress/components": "^30.8.0",
49
- "@wordpress/compose": "^7.35.0",
50
- "@wordpress/data": "^10.35.0",
51
- "@wordpress/date": "^5.35.0",
52
- "@wordpress/element": "^6.35.0",
53
- "@wordpress/i18n": "^6.8.0",
54
- "@wordpress/icons": "^11.2.0",
55
- "@wordpress/keycodes": "^4.35.0",
56
- "@wordpress/primitives": "^4.35.0",
57
- "@wordpress/private-apis": "^1.35.0",
58
- "@wordpress/url": "^4.35.0",
59
- "@wordpress/warning": "^3.35.0",
47
+ "@wordpress/base-styles": "^6.11.1-next.16d95556a.0",
48
+ "@wordpress/components": "^30.8.1-next.16d95556a.0",
49
+ "@wordpress/compose": "^7.35.1-next.16d95556a.0",
50
+ "@wordpress/data": "^10.35.1-next.16d95556a.0",
51
+ "@wordpress/date": "^5.35.1-next.16d95556a.0",
52
+ "@wordpress/element": "^6.35.1-next.16d95556a.0",
53
+ "@wordpress/i18n": "^6.8.1-next.16d95556a.0",
54
+ "@wordpress/icons": "^11.2.1-next.16d95556a.0",
55
+ "@wordpress/keycodes": "^4.35.1-next.16d95556a.0",
56
+ "@wordpress/primitives": "^4.35.1-next.16d95556a.0",
57
+ "@wordpress/private-apis": "^1.35.1-next.16d95556a.0",
58
+ "@wordpress/url": "^4.35.1-next.16d95556a.0",
59
+ "@wordpress/warning": "^3.35.1-next.16d95556a.0",
60
60
  "clsx": "^2.1.1",
61
61
  "colord": "^2.7.0",
62
62
  "date-fns": "^4.1.0",
@@ -74,5 +74,5 @@
74
74
  "scripts": {
75
75
  "build:wp": "node build"
76
76
  },
77
- "gitHead": "77aa1f194edceafe8ac2a1b9438bf84b557e76e3"
77
+ "gitHead": "59a9383612bbe16e21af84d13b035bfbca7fe833"
78
78
  }