@wordpress/dataviews 4.1.0 → 4.2.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 +17 -0
- package/README.md +31 -23
- package/build/components/dataviews/index.js +9 -11
- package/build/components/dataviews/index.js.map +1 -1
- package/build/components/dataviews-filters/index.js +3 -0
- package/build/components/dataviews-filters/index.js.map +1 -1
- package/build/components/dataviews-filters/search-widget.js +2 -5
- package/build/components/dataviews-filters/search-widget.js.map +1 -1
- package/build/components/dataviews-pagination/index.js +23 -15
- package/build/components/dataviews-pagination/index.js.map +1 -1
- package/build/components/dataviews-view-config/index.js +26 -9
- package/build/components/dataviews-view-config/index.js.map +1 -1
- package/build/dataform-controls/datetime.js +49 -0
- package/build/dataform-controls/datetime.js.map +1 -0
- package/build/dataform-controls/index.js +50 -0
- package/build/dataform-controls/index.js.map +1 -0
- package/build/dataform-controls/integer.js +45 -0
- package/build/dataform-controls/integer.js.map +1 -0
- package/build/dataform-controls/radio.js +45 -0
- package/build/dataform-controls/radio.js.map +1 -0
- package/build/dataform-controls/select.js +58 -0
- package/build/dataform-controls/select.js.map +1 -0
- package/build/dataform-controls/text.js +45 -0
- package/build/dataform-controls/text.js.map +1 -0
- package/build/dataforms-layouts/panel/index.js +6 -3
- package/build/dataforms-layouts/panel/index.js.map +1 -1
- package/build/dataforms-layouts/regular/index.js +6 -3
- package/build/dataforms-layouts/regular/index.js.map +1 -1
- package/build/dataviews-layouts/grid/density-picker.js +23 -52
- package/build/dataviews-layouts/grid/density-picker.js.map +1 -1
- package/build/dataviews-layouts/grid/index.js +1 -1
- package/build/dataviews-layouts/grid/index.js.map +1 -1
- package/build/dataviews-layouts/list/index.js +6 -2
- package/build/dataviews-layouts/list/index.js.map +1 -1
- package/build/dataviews-layouts/table/column-header-menu.js +2 -5
- package/build/dataviews-layouts/table/column-header-menu.js.map +1 -1
- package/build/field-types/datetime.js +30 -0
- package/build/field-types/datetime.js.map +1 -0
- package/build/field-types/index.js +4 -0
- package/build/field-types/index.js.map +1 -1
- package/build/field-types/integer.js +1 -60
- package/build/field-types/integer.js.map +1 -1
- package/build/field-types/text.js +1 -60
- package/build/field-types/text.js.map +1 -1
- package/build/normalize-fields.js +6 -7
- package/build/normalize-fields.js.map +1 -1
- package/build/types.js.map +1 -1
- package/build-module/components/dataviews/index.js +9 -11
- package/build-module/components/dataviews/index.js.map +1 -1
- package/build-module/components/dataviews-filters/index.js +3 -0
- package/build-module/components/dataviews-filters/index.js.map +1 -1
- package/build-module/components/dataviews-filters/search-widget.js +2 -5
- package/build-module/components/dataviews-filters/search-widget.js.map +1 -1
- package/build-module/components/dataviews-pagination/index.js +23 -15
- package/build-module/components/dataviews-pagination/index.js.map +1 -1
- package/build-module/components/dataviews-view-config/index.js +27 -10
- package/build-module/components/dataviews-view-config/index.js.map +1 -1
- package/build-module/dataform-controls/datetime.js +43 -0
- package/build-module/dataform-controls/datetime.js.map +1 -0
- package/build-module/dataform-controls/index.js +42 -0
- package/build-module/dataform-controls/index.js.map +1 -0
- package/build-module/dataform-controls/integer.js +38 -0
- package/build-module/dataform-controls/integer.js.map +1 -0
- package/build-module/dataform-controls/radio.js +38 -0
- package/build-module/dataform-controls/radio.js.map +1 -0
- package/build-module/dataform-controls/select.js +51 -0
- package/build-module/dataform-controls/select.js.map +1 -0
- package/build-module/dataform-controls/text.js +38 -0
- package/build-module/dataform-controls/text.js.map +1 -0
- package/build-module/dataforms-layouts/panel/index.js +6 -3
- package/build-module/dataforms-layouts/panel/index.js.map +1 -1
- package/build-module/dataforms-layouts/regular/index.js +6 -3
- package/build-module/dataforms-layouts/regular/index.js.map +1 -1
- package/build-module/dataviews-layouts/grid/density-picker.js +25 -56
- package/build-module/dataviews-layouts/grid/density-picker.js.map +1 -1
- package/build-module/dataviews-layouts/grid/index.js +1 -1
- package/build-module/dataviews-layouts/grid/index.js.map +1 -1
- package/build-module/dataviews-layouts/list/index.js +5 -2
- package/build-module/dataviews-layouts/list/index.js.map +1 -1
- package/build-module/dataviews-layouts/table/column-header-menu.js +2 -5
- package/build-module/dataviews-layouts/table/column-header-menu.js.map +1 -1
- package/build-module/field-types/datetime.js +24 -0
- package/build-module/field-types/datetime.js.map +1 -0
- package/build-module/field-types/index.js +4 -0
- package/build-module/field-types/index.js.map +1 -1
- package/build-module/field-types/integer.js +2 -60
- package/build-module/field-types/integer.js.map +1 -1
- package/build-module/field-types/text.js +2 -60
- package/build-module/field-types/text.js.map +1 -1
- package/build-module/normalize-fields.js +7 -7
- package/build-module/normalize-fields.js.map +1 -1
- package/build-module/types.js.map +1 -1
- package/build-style/style-rtl.css +15 -18
- package/build-style/style.css +15 -18
- package/build-types/components/dataform/stories/index.story.d.ts.map +1 -1
- package/build-types/components/dataviews/index.d.ts.map +1 -1
- package/build-types/components/dataviews/stories/fixtures.d.ts +22 -3
- package/build-types/components/dataviews/stories/fixtures.d.ts.map +1 -1
- package/build-types/components/dataviews/stories/index.story.d.ts +9 -0
- package/build-types/components/dataviews/stories/index.story.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/index.d.ts +1 -1
- package/build-types/components/dataviews-filters/index.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/search-widget.d.ts.map +1 -1
- package/build-types/components/dataviews-pagination/index.d.ts.map +1 -1
- package/build-types/components/dataviews-view-config/index.d.ts +4 -3
- package/build-types/components/dataviews-view-config/index.d.ts.map +1 -1
- package/build-types/dataform-controls/datetime.d.ts +6 -0
- package/build-types/dataform-controls/datetime.d.ts.map +1 -0
- package/build-types/dataform-controls/index.d.ts +11 -0
- package/build-types/dataform-controls/index.d.ts.map +1 -0
- package/build-types/dataform-controls/integer.d.ts +6 -0
- package/build-types/dataform-controls/integer.d.ts.map +1 -0
- package/build-types/dataform-controls/radio.d.ts +6 -0
- package/build-types/dataform-controls/radio.d.ts.map +1 -0
- package/build-types/dataform-controls/select.d.ts +6 -0
- package/build-types/dataform-controls/select.d.ts.map +1 -0
- package/build-types/dataform-controls/text.d.ts +6 -0
- package/build-types/dataform-controls/text.d.ts.map +1 -0
- package/build-types/dataforms-layouts/panel/index.d.ts.map +1 -1
- package/build-types/dataforms-layouts/regular/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/grid/density-picker.d.ts.map +1 -1
- package/build-types/dataviews-layouts/list/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/table/column-header-menu.d.ts.map +1 -1
- package/build-types/field-types/datetime.d.ts +13 -0
- package/build-types/field-types/datetime.d.ts.map +1 -0
- package/build-types/field-types/index.d.ts +1 -1
- package/build-types/field-types/index.d.ts.map +1 -1
- package/build-types/field-types/integer.d.ts +2 -3
- package/build-types/field-types/integer.d.ts.map +1 -1
- package/build-types/field-types/text.d.ts +2 -3
- package/build-types/field-types/text.d.ts.map +1 -1
- package/build-types/normalize-fields.d.ts.map +1 -1
- package/build-types/types.d.ts +41 -21
- package/build-types/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/components/dataform/stories/index.story.tsx +43 -2
- package/src/components/dataviews/index.tsx +13 -13
- package/src/components/dataviews/stories/fixtures.js +29 -1
- package/src/components/dataviews/stories/index.story.js +7 -1
- package/src/components/dataviews/style.scss +0 -12
- package/src/components/dataviews-bulk-actions-toolbar/style.scss +1 -1
- package/src/components/dataviews-filters/index.tsx +3 -0
- package/src/components/dataviews-filters/search-widget.tsx +1 -8
- package/src/components/dataviews-filters/style.scss +1 -1
- package/src/components/dataviews-pagination/index.tsx +35 -16
- package/src/components/dataviews-pagination/style.scss +9 -4
- package/src/components/dataviews-view-config/index.tsx +45 -16
- package/src/dataform-controls/datetime.tsx +43 -0
- package/src/dataform-controls/index.tsx +61 -0
- package/src/dataform-controls/integer.tsx +38 -0
- package/src/dataform-controls/radio.tsx +42 -0
- package/src/dataform-controls/select.tsx +52 -0
- package/src/dataform-controls/style.scss +4 -0
- package/src/dataform-controls/text.tsx +40 -0
- package/src/dataforms-layouts/panel/index.tsx +6 -2
- package/src/dataforms-layouts/regular/index.tsx +6 -2
- package/src/dataviews-layouts/grid/density-picker.tsx +33 -67
- package/src/dataviews-layouts/grid/index.tsx +1 -1
- package/src/dataviews-layouts/grid/style.scss +0 -4
- package/src/dataviews-layouts/list/index.tsx +6 -2
- package/src/dataviews-layouts/table/column-header-menu.tsx +3 -5
- package/src/field-types/datetime.tsx +28 -0
- package/src/field-types/index.tsx +5 -0
- package/src/field-types/integer.tsx +2 -71
- package/src/field-types/text.tsx +2 -70
- package/src/normalize-fields.ts +8 -10
- package/src/style.scss +1 -0
- package/src/test/filter-and-sort-data-view.js +28 -0
- package/src/types.ts +54 -32
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
function sort(a, b, direction) {
|
|
6
|
+
const timeA = new Date(a).getTime();
|
|
7
|
+
const timeB = new Date(b).getTime();
|
|
8
|
+
return direction === 'asc' ? timeA - timeB : timeB - timeA;
|
|
9
|
+
}
|
|
10
|
+
function isValid(value, context) {
|
|
11
|
+
if (context?.elements) {
|
|
12
|
+
const validValues = context?.elements.map(f => f.value);
|
|
13
|
+
if (!validValues.includes(value)) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
export default {
|
|
20
|
+
sort,
|
|
21
|
+
isValid,
|
|
22
|
+
Edit: 'datetime'
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=datetime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sort","a","b","direction","timeA","Date","getTime","timeB","isValid","value","context","elements","validValues","map","f","includes","Edit"],"sources":["@wordpress/dataviews/src/field-types/datetime.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { SortDirection, ValidationContext } from '../types';\n\nfunction sort( a: any, b: any, direction: SortDirection ) {\n\tconst timeA = new Date( a ).getTime();\n\tconst timeB = new Date( b ).getTime();\n\n\treturn direction === 'asc' ? timeA - timeB : timeB - timeA;\n}\n\nfunction isValid( value: any, context?: ValidationContext ) {\n\tif ( context?.elements ) {\n\t\tconst validValues = context?.elements.map( ( f ) => f.value );\n\t\tif ( ! validValues.includes( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\nexport default {\n\tsort,\n\tisValid,\n\tEdit: 'datetime',\n};\n"],"mappings":"AAAA;AACA;AACA;;AAGA,SAASA,IAAIA,CAAEC,CAAM,EAAEC,CAAM,EAAEC,SAAwB,EAAG;EACzD,MAAMC,KAAK,GAAG,IAAIC,IAAI,CAAEJ,CAAE,CAAC,CAACK,OAAO,CAAC,CAAC;EACrC,MAAMC,KAAK,GAAG,IAAIF,IAAI,CAAEH,CAAE,CAAC,CAACI,OAAO,CAAC,CAAC;EAErC,OAAOH,SAAS,KAAK,KAAK,GAAGC,KAAK,GAAGG,KAAK,GAAGA,KAAK,GAAGH,KAAK;AAC3D;AAEA,SAASI,OAAOA,CAAEC,KAAU,EAAEC,OAA2B,EAAG;EAC3D,IAAKA,OAAO,EAAEC,QAAQ,EAAG;IACxB,MAAMC,WAAW,GAAGF,OAAO,EAAEC,QAAQ,CAACE,GAAG,CAAIC,CAAC,IAAMA,CAAC,CAACL,KAAM,CAAC;IAC7D,IAAK,CAAEG,WAAW,CAACG,QAAQ,CAAEN,KAAM,CAAC,EAAG;MACtC,OAAO,KAAK;IACb;EACD;EAEA,OAAO,IAAI;AACZ;AAEA,eAAe;EACdT,IAAI;EACJQ,OAAO;EACPQ,IAAI,EAAE;AACP,CAAC","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { default as integer } from './integer';
|
|
6
6
|
import { default as text } from './text';
|
|
7
|
+
import { default as datetime } from './datetime';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
*
|
|
@@ -18,6 +19,9 @@ export default function getFieldTypeDefinition(type) {
|
|
|
18
19
|
if ('text' === type) {
|
|
19
20
|
return text;
|
|
20
21
|
}
|
|
22
|
+
if ('datetime' === type) {
|
|
23
|
+
return datetime;
|
|
24
|
+
}
|
|
21
25
|
return {
|
|
22
26
|
sort: (a, b, direction) => {
|
|
23
27
|
if (typeof a === 'number' && typeof b === 'number') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["default","integer","text","getFieldTypeDefinition","type","sort","a","b","direction","localeCompare","isValid","value","context","elements","validValues","map","f","includes","Edit"],"sources":["@wordpress/dataviews/src/field-types/index.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { FieldType, SortDirection, ValidationContext } from '../types';\nimport { default as integer } from './integer';\nimport { default as text } from './text';\n\n/**\n *\n * @param {FieldType} type The field type definition to get.\n *\n * @return A field type definition.\n */\nexport default function getFieldTypeDefinition( type?: FieldType ) {\n\tif ( 'integer' === type ) {\n\t\treturn integer;\n\t}\n\n\tif ( 'text' === type ) {\n\t\treturn text;\n\t}\n\n\treturn {\n\t\tsort: ( a: any, b: any, direction: SortDirection ) => {\n\t\t\tif ( typeof a === 'number' && typeof b === 'number' ) {\n\t\t\t\treturn direction === 'asc' ? a - b : b - a;\n\t\t\t}\n\n\t\t\treturn direction === 'asc'\n\t\t\t\t? a.localeCompare( b )\n\t\t\t\t: b.localeCompare( a );\n\t\t},\n\t\tisValid: ( value: any, context?: ValidationContext ) => {\n\t\t\tif ( context?.elements ) {\n\t\t\t\tconst validValues = context?.elements?.map( ( f ) => f.value );\n\t\t\t\tif ( ! validValues.includes( value ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t\tEdit: () => null,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,OAAO,IAAIC,OAAO,QAAQ,WAAW;AAC9C,SAASD,OAAO,IAAIE,IAAI,QAAQ,QAAQ;;
|
|
1
|
+
{"version":3,"names":["default","integer","text","datetime","getFieldTypeDefinition","type","sort","a","b","direction","localeCompare","isValid","value","context","elements","validValues","map","f","includes","Edit"],"sources":["@wordpress/dataviews/src/field-types/index.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { FieldType, SortDirection, ValidationContext } from '../types';\nimport { default as integer } from './integer';\nimport { default as text } from './text';\nimport { default as datetime } from './datetime';\n\n/**\n *\n * @param {FieldType} type The field type definition to get.\n *\n * @return A field type definition.\n */\nexport default function getFieldTypeDefinition( type?: FieldType ) {\n\tif ( 'integer' === type ) {\n\t\treturn integer;\n\t}\n\n\tif ( 'text' === type ) {\n\t\treturn text;\n\t}\n\n\tif ( 'datetime' === type ) {\n\t\treturn datetime;\n\t}\n\n\treturn {\n\t\tsort: ( a: any, b: any, direction: SortDirection ) => {\n\t\t\tif ( typeof a === 'number' && typeof b === 'number' ) {\n\t\t\t\treturn direction === 'asc' ? a - b : b - a;\n\t\t\t}\n\n\t\t\treturn direction === 'asc'\n\t\t\t\t? a.localeCompare( b )\n\t\t\t\t: b.localeCompare( a );\n\t\t},\n\t\tisValid: ( value: any, context?: ValidationContext ) => {\n\t\t\tif ( context?.elements ) {\n\t\t\t\tconst validValues = context?.elements?.map( ( f ) => f.value );\n\t\t\t\tif ( ! validValues.includes( value ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t\tEdit: () => null,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,OAAO,IAAIC,OAAO,QAAQ,WAAW;AAC9C,SAASD,OAAO,IAAIE,IAAI,QAAQ,QAAQ;AACxC,SAASF,OAAO,IAAIG,QAAQ,QAAQ,YAAY;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,sBAAsBA,CAAEC,IAAgB,EAAG;EAClE,IAAK,SAAS,KAAKA,IAAI,EAAG;IACzB,OAAOJ,OAAO;EACf;EAEA,IAAK,MAAM,KAAKI,IAAI,EAAG;IACtB,OAAOH,IAAI;EACZ;EAEA,IAAK,UAAU,KAAKG,IAAI,EAAG;IAC1B,OAAOF,QAAQ;EAChB;EAEA,OAAO;IACNG,IAAI,EAAEA,CAAEC,CAAM,EAAEC,CAAM,EAAEC,SAAwB,KAAM;MACrD,IAAK,OAAOF,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAG;QACrD,OAAOC,SAAS,KAAK,KAAK,GAAGF,CAAC,GAAGC,CAAC,GAAGA,CAAC,GAAGD,CAAC;MAC3C;MAEA,OAAOE,SAAS,KAAK,KAAK,GACvBF,CAAC,CAACG,aAAa,CAAEF,CAAE,CAAC,GACpBA,CAAC,CAACE,aAAa,CAAEH,CAAE,CAAC;IACxB,CAAC;IACDI,OAAO,EAAEA,CAAEC,KAAU,EAAEC,OAA2B,KAAM;MACvD,IAAKA,OAAO,EAAEC,QAAQ,EAAG;QACxB,MAAMC,WAAW,GAAGF,OAAO,EAAEC,QAAQ,EAAEE,GAAG,CAAIC,CAAC,IAAMA,CAAC,CAACL,KAAM,CAAC;QAC9D,IAAK,CAAEG,WAAW,CAACG,QAAQ,CAAEN,KAAM,CAAC,EAAG;UACtC,OAAO,KAAK;QACb;MACD;MAEA,OAAO,IAAI;IACZ,CAAC;IACDO,IAAI,EAAEA,CAAA,KAAM;EACb,CAAC;AACF","ignoreList":[]}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __experimentalNumberControl as NumberControl, SelectControl } from '@wordpress/components';
|
|
5
|
-
import { useCallback } from '@wordpress/element';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
|
|
8
1
|
/**
|
|
9
2
|
* Internal dependencies
|
|
10
3
|
*/
|
|
11
|
-
|
|
4
|
+
|
|
12
5
|
function sort(a, b, direction) {
|
|
13
6
|
return direction === 'asc' ? a - b : b - a;
|
|
14
7
|
}
|
|
@@ -28,60 +21,9 @@ function isValid(value, context) {
|
|
|
28
21
|
}
|
|
29
22
|
return true;
|
|
30
23
|
}
|
|
31
|
-
function Edit({
|
|
32
|
-
data,
|
|
33
|
-
field,
|
|
34
|
-
onChange,
|
|
35
|
-
hideLabelFromVision
|
|
36
|
-
}) {
|
|
37
|
-
var _field$getValue;
|
|
38
|
-
const {
|
|
39
|
-
id,
|
|
40
|
-
label,
|
|
41
|
-
description
|
|
42
|
-
} = field;
|
|
43
|
-
const value = (_field$getValue = field.getValue({
|
|
44
|
-
item: data
|
|
45
|
-
})) !== null && _field$getValue !== void 0 ? _field$getValue : '';
|
|
46
|
-
const onChangeControl = useCallback(newValue => onChange(prevItem => ({
|
|
47
|
-
...prevItem,
|
|
48
|
-
[id]: newValue
|
|
49
|
-
})), [id, onChange]);
|
|
50
|
-
if (field.elements) {
|
|
51
|
-
const elements = [
|
|
52
|
-
/*
|
|
53
|
-
* Value can be undefined when:
|
|
54
|
-
*
|
|
55
|
-
* - the field is not required
|
|
56
|
-
* - in bulk editing
|
|
57
|
-
*
|
|
58
|
-
*/
|
|
59
|
-
{
|
|
60
|
-
label: __('Select item'),
|
|
61
|
-
value: ''
|
|
62
|
-
}, ...field.elements];
|
|
63
|
-
return /*#__PURE__*/_jsx(SelectControl, {
|
|
64
|
-
label: label,
|
|
65
|
-
value: value,
|
|
66
|
-
options: elements,
|
|
67
|
-
onChange: onChangeControl,
|
|
68
|
-
__next40pxDefaultSize: true,
|
|
69
|
-
__nextHasNoMarginBottom: true,
|
|
70
|
-
hideLabelFromVision: hideLabelFromVision
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
return /*#__PURE__*/_jsx(NumberControl, {
|
|
74
|
-
label: label,
|
|
75
|
-
help: description,
|
|
76
|
-
value: value,
|
|
77
|
-
onChange: onChangeControl,
|
|
78
|
-
__next40pxDefaultSize: true,
|
|
79
|
-
hideLabelFromVision: hideLabelFromVision
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
24
|
export default {
|
|
83
25
|
sort,
|
|
84
26
|
isValid,
|
|
85
|
-
Edit
|
|
27
|
+
Edit: 'integer'
|
|
86
28
|
};
|
|
87
29
|
//# sourceMappingURL=integer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["sort","a","b","direction","isValid","value","context","Number","isInteger","elements","validValues","map","f","includes","Edit"],"sources":["@wordpress/dataviews/src/field-types/integer.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { SortDirection, ValidationContext } from '../types';\n\nfunction sort( a: any, b: any, direction: SortDirection ) {\n\treturn direction === 'asc' ? a - b : b - a;\n}\n\nfunction isValid( value: any, context?: ValidationContext ) {\n\t// TODO: this implicitely means the value is required.\n\tif ( value === '' ) {\n\t\treturn false;\n\t}\n\n\tif ( ! Number.isInteger( Number( value ) ) ) {\n\t\treturn false;\n\t}\n\n\tif ( context?.elements ) {\n\t\tconst validValues = context?.elements.map( ( f ) => f.value );\n\t\tif ( ! validValues.includes( Number( value ) ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\nexport default {\n\tsort,\n\tisValid,\n\tEdit: 'integer',\n};\n"],"mappings":"AAAA;AACA;AACA;;AAGA,SAASA,IAAIA,CAAEC,CAAM,EAAEC,CAAM,EAAEC,SAAwB,EAAG;EACzD,OAAOA,SAAS,KAAK,KAAK,GAAGF,CAAC,GAAGC,CAAC,GAAGA,CAAC,GAAGD,CAAC;AAC3C;AAEA,SAASG,OAAOA,CAAEC,KAAU,EAAEC,OAA2B,EAAG;EAC3D;EACA,IAAKD,KAAK,KAAK,EAAE,EAAG;IACnB,OAAO,KAAK;EACb;EAEA,IAAK,CAAEE,MAAM,CAACC,SAAS,CAAED,MAAM,CAAEF,KAAM,CAAE,CAAC,EAAG;IAC5C,OAAO,KAAK;EACb;EAEA,IAAKC,OAAO,EAAEG,QAAQ,EAAG;IACxB,MAAMC,WAAW,GAAGJ,OAAO,EAAEG,QAAQ,CAACE,GAAG,CAAIC,CAAC,IAAMA,CAAC,CAACP,KAAM,CAAC;IAC7D,IAAK,CAAEK,WAAW,CAACG,QAAQ,CAAEN,MAAM,CAAEF,KAAM,CAAE,CAAC,EAAG;MAChD,OAAO,KAAK;IACb;EACD;EAEA,OAAO,IAAI;AACZ;AAEA,eAAe;EACdL,IAAI;EACJI,OAAO;EACPU,IAAI,EAAE;AACP,CAAC","ignoreList":[]}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { SelectControl, TextControl } from '@wordpress/components';
|
|
5
|
-
import { useCallback } from '@wordpress/element';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
|
|
8
1
|
/**
|
|
9
2
|
* Internal dependencies
|
|
10
3
|
*/
|
|
11
|
-
|
|
4
|
+
|
|
12
5
|
function sort(valueA, valueB, direction) {
|
|
13
6
|
return direction === 'asc' ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
|
|
14
7
|
}
|
|
@@ -21,60 +14,9 @@ function isValid(value, context) {
|
|
|
21
14
|
}
|
|
22
15
|
return true;
|
|
23
16
|
}
|
|
24
|
-
function Edit({
|
|
25
|
-
data,
|
|
26
|
-
field,
|
|
27
|
-
onChange,
|
|
28
|
-
hideLabelFromVision
|
|
29
|
-
}) {
|
|
30
|
-
const {
|
|
31
|
-
id,
|
|
32
|
-
label,
|
|
33
|
-
placeholder
|
|
34
|
-
} = field;
|
|
35
|
-
const value = field.getValue({
|
|
36
|
-
item: data
|
|
37
|
-
});
|
|
38
|
-
const onChangeControl = useCallback(newValue => onChange(prevItem => ({
|
|
39
|
-
...prevItem,
|
|
40
|
-
[id]: newValue
|
|
41
|
-
})), [id, onChange]);
|
|
42
|
-
if (field.elements) {
|
|
43
|
-
const elements = [
|
|
44
|
-
/*
|
|
45
|
-
* Value can be undefined when:
|
|
46
|
-
*
|
|
47
|
-
* - the field is not required
|
|
48
|
-
* - in bulk editing
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
{
|
|
52
|
-
label: __('Select item'),
|
|
53
|
-
value: ''
|
|
54
|
-
}, ...field.elements];
|
|
55
|
-
return /*#__PURE__*/_jsx(SelectControl, {
|
|
56
|
-
label: label,
|
|
57
|
-
value: value,
|
|
58
|
-
options: elements,
|
|
59
|
-
onChange: onChangeControl,
|
|
60
|
-
__next40pxDefaultSize: true,
|
|
61
|
-
__nextHasNoMarginBottom: true,
|
|
62
|
-
hideLabelFromVision: hideLabelFromVision
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return /*#__PURE__*/_jsx(TextControl, {
|
|
66
|
-
label: label,
|
|
67
|
-
placeholder: placeholder,
|
|
68
|
-
value: value !== null && value !== void 0 ? value : '',
|
|
69
|
-
onChange: onChangeControl,
|
|
70
|
-
__next40pxDefaultSize: true,
|
|
71
|
-
__nextHasNoMarginBottom: true,
|
|
72
|
-
hideLabelFromVision: hideLabelFromVision
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
17
|
export default {
|
|
76
18
|
sort,
|
|
77
19
|
isValid,
|
|
78
|
-
Edit
|
|
20
|
+
Edit: 'text'
|
|
79
21
|
};
|
|
80
22
|
//# sourceMappingURL=text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["sort","valueA","valueB","direction","localeCompare","isValid","value","context","elements","validValues","map","f","includes","Edit"],"sources":["@wordpress/dataviews/src/field-types/text.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { SortDirection, ValidationContext } from '../types';\n\nfunction sort( valueA: any, valueB: any, direction: SortDirection ) {\n\treturn direction === 'asc'\n\t\t? valueA.localeCompare( valueB )\n\t\t: valueB.localeCompare( valueA );\n}\n\nfunction isValid( value: any, context?: ValidationContext ) {\n\tif ( context?.elements ) {\n\t\tconst validValues = context?.elements?.map( ( f ) => f.value );\n\t\tif ( ! validValues.includes( value ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\nexport default {\n\tsort,\n\tisValid,\n\tEdit: 'text',\n};\n"],"mappings":"AAAA;AACA;AACA;;AAGA,SAASA,IAAIA,CAAEC,MAAW,EAAEC,MAAW,EAAEC,SAAwB,EAAG;EACnE,OAAOA,SAAS,KAAK,KAAK,GACvBF,MAAM,CAACG,aAAa,CAAEF,MAAO,CAAC,GAC9BA,MAAM,CAACE,aAAa,CAAEH,MAAO,CAAC;AAClC;AAEA,SAASI,OAAOA,CAAEC,KAAU,EAAEC,OAA2B,EAAG;EAC3D,IAAKA,OAAO,EAAEC,QAAQ,EAAG;IACxB,MAAMC,WAAW,GAAGF,OAAO,EAAEC,QAAQ,EAAEE,GAAG,CAAIC,CAAC,IAAMA,CAAC,CAACL,KAAM,CAAC;IAC9D,IAAK,CAAEG,WAAW,CAACG,QAAQ,CAAEN,KAAM,CAAC,EAAG;MACtC,OAAO,KAAK;IACb;EACD;EAEA,OAAO,IAAI;AACZ;AAEA,eAAe;EACdN,IAAI;EACJK,OAAO;EACPQ,IAAI,EAAE;AACP,CAAC","ignoreList":[]}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import getFieldTypeDefinition from './field-types';
|
|
5
|
+
import { getControl } from './dataform-controls';
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Apply default values and normalize the fields config.
|
|
7
9
|
*
|
|
@@ -27,24 +29,22 @@ export function normalizeFields(fields) {
|
|
|
27
29
|
item
|
|
28
30
|
}), context);
|
|
29
31
|
};
|
|
30
|
-
const Edit = field
|
|
32
|
+
const Edit = getControl(field, fieldTypeDefinition);
|
|
31
33
|
const renderFromElements = ({
|
|
32
34
|
item
|
|
33
35
|
}) => {
|
|
34
36
|
const value = getValue({
|
|
35
37
|
item
|
|
36
38
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return element.value == value;
|
|
41
|
-
})?.label;
|
|
42
|
-
return label || value;
|
|
39
|
+
return field?.elements?.find(element => element.value === value)?.label || getValue({
|
|
40
|
+
item
|
|
41
|
+
});
|
|
43
42
|
};
|
|
44
43
|
const render = field.render || (field.elements ? renderFromElements : getValue);
|
|
45
44
|
return {
|
|
46
45
|
...field,
|
|
47
46
|
label: field.label || field.id,
|
|
47
|
+
header: field.header || field.label || field.id,
|
|
48
48
|
getValue,
|
|
49
49
|
render,
|
|
50
50
|
sort,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getFieldTypeDefinition","normalizeFields","fields","map","field","_field$sort","_field$isValid","fieldTypeDefinition","type","getValue","item","id","sort","a","b","direction","isValid","context","Edit","renderFromElements","value","
|
|
1
|
+
{"version":3,"names":["getFieldTypeDefinition","getControl","normalizeFields","fields","map","field","_field$sort","_field$isValid","fieldTypeDefinition","type","getValue","item","id","sort","a","b","direction","isValid","context","Edit","renderFromElements","value","elements","find","element","label","render","header"],"sources":["@wordpress/dataviews/src/normalize-fields.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getFieldTypeDefinition from './field-types';\nimport type { Field, NormalizedField } from './types';\nimport { getControl } from './dataform-controls';\n\n/**\n * Apply default values and normalize the fields config.\n *\n * @param fields Fields config.\n * @return Normalized fields config.\n */\nexport function normalizeFields< Item >(\n\tfields: Field< Item >[]\n): NormalizedField< Item >[] {\n\treturn fields.map( ( field ) => {\n\t\tconst fieldTypeDefinition = getFieldTypeDefinition( field.type );\n\n\t\tconst getValue =\n\t\t\tfield.getValue || ( ( { item } ) => ( item as any )[ field.id ] );\n\n\t\tconst sort =\n\t\t\tfield.sort ??\n\t\t\tfunction sort( a, b, direction ) {\n\t\t\t\treturn fieldTypeDefinition.sort(\n\t\t\t\t\tgetValue( { item: a } ),\n\t\t\t\t\tgetValue( { item: b } ),\n\t\t\t\t\tdirection\n\t\t\t\t);\n\t\t\t};\n\n\t\tconst isValid =\n\t\t\tfield.isValid ??\n\t\t\tfunction isValid( item, context ) {\n\t\t\t\treturn fieldTypeDefinition.isValid(\n\t\t\t\t\tgetValue( { item } ),\n\t\t\t\t\tcontext\n\t\t\t\t);\n\t\t\t};\n\n\t\tconst Edit = getControl( field, fieldTypeDefinition );\n\n\t\tconst renderFromElements = ( { item }: { item: Item } ) => {\n\t\t\tconst value = getValue( { item } );\n\t\t\treturn (\n\t\t\t\tfield?.elements?.find( ( element ) => element.value === value )\n\t\t\t\t\t?.label || getValue( { item } )\n\t\t\t);\n\t\t};\n\n\t\tconst render =\n\t\t\tfield.render || ( field.elements ? renderFromElements : getValue );\n\n\t\treturn {\n\t\t\t...field,\n\t\t\tlabel: field.label || field.id,\n\t\t\theader: field.header || field.label || field.id,\n\t\t\tgetValue,\n\t\t\trender,\n\t\t\tsort,\n\t\t\tisValid,\n\t\t\tEdit,\n\t\t};\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,sBAAsB,MAAM,eAAe;AAElD,SAASC,UAAU,QAAQ,qBAAqB;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC9BC,MAAuB,EACK;EAC5B,OAAOA,MAAM,CAACC,GAAG,CAAIC,KAAK,IAAM;IAAA,IAAAC,WAAA,EAAAC,cAAA;IAC/B,MAAMC,mBAAmB,GAAGR,sBAAsB,CAAEK,KAAK,CAACI,IAAK,CAAC;IAEhE,MAAMC,QAAQ,GACbL,KAAK,CAACK,QAAQ,KAAM,CAAE;MAAEC;IAAK,CAAC,KAAQA,IAAI,CAAWN,KAAK,CAACO,EAAE,CAAE,CAAE;IAElE,MAAMC,IAAI,IAAAP,WAAA,GACTD,KAAK,CAACQ,IAAI,cAAAP,WAAA,cAAAA,WAAA,GACV,SAASO,IAAIA,CAAEC,CAAC,EAAEC,CAAC,EAAEC,SAAS,EAAG;MAChC,OAAOR,mBAAmB,CAACK,IAAI,CAC9BH,QAAQ,CAAE;QAAEC,IAAI,EAAEG;MAAE,CAAE,CAAC,EACvBJ,QAAQ,CAAE;QAAEC,IAAI,EAAEI;MAAE,CAAE,CAAC,EACvBC,SACD,CAAC;IACF,CAAC;IAEF,MAAMC,OAAO,IAAAV,cAAA,GACZF,KAAK,CAACY,OAAO,cAAAV,cAAA,cAAAA,cAAA,GACb,SAASU,OAAOA,CAAEN,IAAI,EAAEO,OAAO,EAAG;MACjC,OAAOV,mBAAmB,CAACS,OAAO,CACjCP,QAAQ,CAAE;QAAEC;MAAK,CAAE,CAAC,EACpBO,OACD,CAAC;IACF,CAAC;IAEF,MAAMC,IAAI,GAAGlB,UAAU,CAAEI,KAAK,EAAEG,mBAAoB,CAAC;IAErD,MAAMY,kBAAkB,GAAGA,CAAE;MAAET;IAAqB,CAAC,KAAM;MAC1D,MAAMU,KAAK,GAAGX,QAAQ,CAAE;QAAEC;MAAK,CAAE,CAAC;MAClC,OACCN,KAAK,EAAEiB,QAAQ,EAAEC,IAAI,CAAIC,OAAO,IAAMA,OAAO,CAACH,KAAK,KAAKA,KAAM,CAAC,EAC5DI,KAAK,IAAIf,QAAQ,CAAE;QAAEC;MAAK,CAAE,CAAC;IAElC,CAAC;IAED,MAAMe,MAAM,GACXrB,KAAK,CAACqB,MAAM,KAAMrB,KAAK,CAACiB,QAAQ,GAAGF,kBAAkB,GAAGV,QAAQ,CAAE;IAEnE,OAAO;MACN,GAAGL,KAAK;MACRoB,KAAK,EAAEpB,KAAK,CAACoB,KAAK,IAAIpB,KAAK,CAACO,EAAE;MAC9Be,MAAM,EAAEtB,KAAK,CAACsB,MAAM,IAAItB,KAAK,CAACoB,KAAK,IAAIpB,KAAK,CAACO,EAAE;MAC/CF,QAAQ;MACRgB,MAAM;MACNb,IAAI;MACJI,OAAO;MACPE;IACD,CAAC;EACF,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/dataviews/src/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tReactElement,\n\tComponentType,\n\tDispatch,\n\tSetStateAction,\n} from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SetSelection } from './private-types';\n\nexport type SortDirection = 'asc' | 'desc';\n\n/**\n * Generic option type.\n */\nexport interface Option< Value extends any = any > {\n\tvalue: Value;\n\tlabel: string;\n\tdescription?: string;\n}\n\ninterface FilterByConfig {\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators?: Operator[];\n\n\t/**\n\t * Whether it is a primary filter.\n\t *\n\t * A primary filter is always visible and is not listed in the \"Add filter\" component,\n\t * except for the list layout where it behaves like a secondary filter.\n\t */\n\tisPrimary?: boolean;\n}\n\nexport type Operator =\n\t| 'is'\n\t| 'isNot'\n\t| 'isAny'\n\t| 'isNone'\n\t| 'isAll'\n\t| 'isNotAll';\n\nexport type ItemRecord = Record< string, unknown >;\n\nexport type FieldType = 'text' | 'integer';\n\nexport type ValidationContext = {\n\telements?: Option[];\n};\n\n/**\n * A dataview field for a specific property of a data type.\n */\nexport type Field< Item > = {\n\t/**\n\t * Type of the fields.\n\t */\n\ttype?: FieldType;\n\n\t/**\n\t * The unique identifier of the field.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the field. Defaults to the id.\n\t */\n\tlabel?: string;\n\n\t/**\n\t * A description of the field.\n\t */\n\tdescription?: string;\n\n\t/**\n\t * Placeholder for the field.\n\t */\n\tplaceholder?: string;\n\n\t/**\n\t * Callback used to render the field. Defaults to `field.getValue`.\n\t */\n\trender?: ComponentType< { item: Item } >;\n\n\t/**\n\t * Callback used to render an edit control for the field.\n\t */\n\tEdit?: ComponentType< DataFormControlProps< Item > >;\n\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort?: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid?: ( item: Item, context?: ValidationContext ) => boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting?: boolean;\n\n\t/**\n\t * Whether the field is searchable.\n\t */\n\tenableGlobalSearch?: boolean;\n\n\t/**\n\t * Whether the field is filterable.\n\t */\n\tenableHiding?: boolean;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements?: Option[];\n\n\t/**\n\t * Filter config for the field.\n\t */\n\tfilterBy?: FilterByConfig | undefined;\n} & ( Item extends ItemRecord\n\t? {\n\t\t\t/**\n\t\t\t * Callback used to retrieve the value of the field from the item.\n\t\t\t * Defaults to `item[ field.id ]`.\n\t\t\t */\n\t\t\tgetValue?: ( args: { item: Item } ) => any;\n\t }\n\t: {\n\t\t\t/**\n\t\t\t * Callback used to retrieve the value of the field from the item.\n\t\t\t * Defaults to `item[ field.id ]`.\n\t\t\t */\n\t\t\tgetValue: ( args: { item: Item } ) => any;\n\t } );\n\nexport type NormalizedField< Item > = Field< Item > & {\n\tlabel: string;\n\tgetValue: ( args: { item: Item } ) => any;\n\trender: ComponentType< { item: Item } >;\n\tEdit: ComponentType< DataFormControlProps< Item > >;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: ( item: Item, context?: ValidationContext ) => boolean;\n};\n\n/**\n * A collection of dataview fields for a data type.\n */\nexport type Fields< Item > = Field< Item >[];\n\nexport type Data< Item > = Item[];\n\n/**\n * The form configuration.\n */\nexport type Form = {\n\ttype?: 'regular' | 'panel';\n\tfields?: string[];\n};\n\nexport type DataFormControlProps< Item > = {\n\tdata: Item;\n\tfield: NormalizedField< Item >;\n\tonChange: Dispatch< SetStateAction< Item > >;\n\thideLabelFromVision?: boolean;\n};\n\n/**\n * The filters applied to the dataset.\n */\nexport interface Filter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The operator to use.\n\t */\n\toperator: Operator;\n\n\t/**\n\t * The value to filter by.\n\t */\n\tvalue: any;\n}\n\nexport interface NormalizedFilter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The field name.\n\t */\n\tname: string;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements: Option[];\n\n\t/**\n\t * Is a single selection filter.\n\t */\n\tsingleSelection: boolean;\n\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether the filter is visible.\n\t */\n\tisVisible: boolean;\n\n\t/**\n\t * Whether it is a primary filter.\n\t */\n\tisPrimary: boolean;\n}\n\ninterface ViewBase {\n\t/**\n\t * The layout of the view.\n\t */\n\ttype: string;\n\n\t/**\n\t * The global search term.\n\t */\n\tsearch?: string;\n\n\t/**\n\t * The filters to apply.\n\t */\n\tfilters?: Filter[];\n\n\t/**\n\t * The sorting configuration.\n\t */\n\tsort?: {\n\t\t/**\n\t\t * The field to sort by.\n\t\t */\n\t\tfield: string;\n\n\t\t/**\n\t\t * The direction to sort by.\n\t\t */\n\t\tdirection: SortDirection;\n\t};\n\n\t/**\n\t * The active page\n\t */\n\tpage?: number;\n\n\t/**\n\t * The number of items per page\n\t */\n\tperPage?: number;\n\n\t/**\n\t * The fields to render\n\t */\n\tfields?: string[];\n}\n\nexport interface CombinedField {\n\tid: string;\n\n\tlabel: string;\n\n\t/**\n\t * The fields to use as columns.\n\t */\n\tchildren: string[];\n\n\t/**\n\t * The direction of the stack.\n\t */\n\tdirection: 'horizontal' | 'vertical';\n}\n\nexport interface ColumnStyle {\n\t/**\n\t * The width of the field column.\n\t */\n\twidth?: string | number;\n\n\t/**\n\t * The minimum width of the field column.\n\t */\n\tmaxWidth?: string | number;\n\n\t/**\n\t * The maximum width of the field column.\n\t */\n\tminWidth?: string | number;\n}\n\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcombinedFields?: CombinedField[];\n\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\t};\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcolumnFields?: string[];\n\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\t};\n}\n\nexport type View = ViewList | ViewGrid | ViewTable;\n\ninterface ActionBase< Item > {\n\t/**\n\t * The unique identifier of the action.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the action.\n\t * In case we want to adjust the label based on the selected items,\n\t * a function can be provided.\n\t */\n\tlabel: string | ( ( items: Item[] ) => string );\n\n\t/**\n\t * The icon of the action. (Either a string or an SVG element)\n\t * This should be IconType from the components package\n\t * but that import is breaking typescript build for the moment.\n\t */\n\ticon?: any;\n\n\t/**\n\t * Whether the action is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the action is destructive.\n\t */\n\tisDestructive?: boolean;\n\n\t/**\n\t * Whether the action is a primary action.\n\t */\n\tisPrimary?: boolean;\n\n\t/**\n\t * Whether the item passed as an argument supports the current action.\n\t */\n\tisEligible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the action can be used as a bulk action.\n\t */\n\tsupportsBulk?: boolean;\n}\n\nexport interface ActionModal< Item > extends ActionBase< Item > {\n\t/**\n\t * Modal to render when the action is triggered.\n\t */\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionPerformed,\n\t}: {\n\t\titems: Item[];\n\t\tcloseModal?: () => void;\n\t\tonActionPerformed?: ( items: Item[] ) => void;\n\t} ) => ReactElement;\n\n\t/**\n\t * Whether to hide the modal header.\n\t */\n\thideModalHeader?: boolean;\n\n\t/**\n\t * The header of the modal.\n\t */\n\tmodalHeader?: string;\n}\n\nexport interface ActionButton< Item > extends ActionBase< Item > {\n\t/**\n\t * The callback to execute when the action is triggered.\n\t */\n\tcallback: (\n\t\titems: Item[],\n\t\tcontext: {\n\t\t\tregistry: any;\n\t\t\tonActionPerformed?: ( items: Item[] ) => void;\n\t\t}\n\t) => void;\n}\n\nexport type Action< Item > = ActionModal< Item > | ActionButton< Item >;\n\nexport interface ViewBaseProps< Item > {\n\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tview: View;\n\tdensity: number;\n}\n\nexport interface ViewTableProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewTable;\n}\n\nexport interface ViewListProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewList;\n}\n\nexport interface ViewGridProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewGrid;\n}\n\nexport type ViewProps< Item > =\n\t| ViewTableProps< Item >\n\t| ViewGridProps< Item >\n\t| ViewListProps< Item >;\n\nexport interface SupportedLayouts {\n\tlist?: Omit< ViewList, 'type' >;\n\tgrid?: Omit< ViewGrid, 'type' >;\n\ttable?: Omit< ViewTable, 'type' >;\n}\n\nexport interface DataFormProps< Item > {\n\tdata: Item;\n\tfields: Field< Item >[];\n\tform: Form;\n\tonChange: Dispatch< SetStateAction< Item > >;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/dataviews/src/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactElement, ComponentType } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SetSelection } from './private-types';\n\nexport type SortDirection = 'asc' | 'desc';\n\n/**\n * Generic option type.\n */\nexport interface Option< Value extends any = any > {\n\tvalue: Value;\n\tlabel: string;\n\tdescription?: string;\n}\n\ninterface FilterByConfig {\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators?: Operator[];\n\n\t/**\n\t * Whether it is a primary filter.\n\t *\n\t * A primary filter is always visible and is not listed in the \"Add filter\" component,\n\t * except for the list layout where it behaves like a secondary filter.\n\t */\n\tisPrimary?: boolean;\n}\n\nexport type Operator =\n\t| 'is'\n\t| 'isNot'\n\t| 'isAny'\n\t| 'isNone'\n\t| 'isAll'\n\t| 'isNotAll';\n\nexport type FieldType = 'text' | 'integer' | 'datetime';\n\nexport type ValidationContext = {\n\telements?: Option[];\n};\n\n/**\n * An abstract interface for Field based on the field type.\n */\nexport type FieldTypeDefinition< Item > = {\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid: ( item: Item, context?: ValidationContext ) => boolean;\n\n\t/**\n\t * Callback used to render an edit control for the field or control name.\n\t */\n\tEdit: ComponentType< DataFormControlProps< Item > > | string;\n};\n\n/**\n * A dataview field for a specific property of a data type.\n */\nexport type Field< Item > = {\n\t/**\n\t * Type of the fields.\n\t */\n\ttype?: FieldType;\n\n\t/**\n\t * The unique identifier of the field.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the field. Defaults to the id.\n\t */\n\tlabel?: string;\n\n\t/**\n\t * The header of the field. Defaults to the label.\n\t * It allows the usage of a React Element to render the field labels.\n\t */\n\theader?: string | ReactElement;\n\n\t/**\n\t * A description of the field.\n\t */\n\tdescription?: string;\n\n\t/**\n\t * Placeholder for the field.\n\t */\n\tplaceholder?: string;\n\n\t/**\n\t * Callback used to render the field. Defaults to `field.getValue`.\n\t */\n\trender?: ComponentType< { item: Item } >;\n\n\t/**\n\t * Callback used to render an edit control for the field.\n\t */\n\tEdit?: ComponentType< DataFormControlProps< Item > > | string;\n\n\t/**\n\t * Callback used to sort the field.\n\t */\n\tsort?: ( a: Item, b: Item, direction: SortDirection ) => number;\n\n\t/**\n\t * Callback used to validate the field.\n\t */\n\tisValid?: ( item: Item, context?: ValidationContext ) => boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting?: boolean;\n\n\t/**\n\t * Whether the field is searchable.\n\t */\n\tenableGlobalSearch?: boolean;\n\n\t/**\n\t * Whether the field is filterable.\n\t */\n\tenableHiding?: boolean;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements?: Option[];\n\n\t/**\n\t * Filter config for the field.\n\t */\n\tfilterBy?: FilterByConfig | undefined;\n\n\t/**\n\t * Callback used to retrieve the value of the field from the item.\n\t * Defaults to `item[ field.id ]`.\n\t */\n\tgetValue?: ( args: { item: Item } ) => any;\n};\n\nexport type NormalizedField< Item > = Field< Item > & {\n\tlabel: string;\n\theader: string | ReactElement;\n\tgetValue: ( args: { item: Item } ) => any;\n\trender: ComponentType< { item: Item } >;\n\tEdit: ComponentType< DataFormControlProps< Item > >;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: ( item: Item, context?: ValidationContext ) => boolean;\n};\n\n/**\n * A collection of dataview fields for a data type.\n */\nexport type Fields< Item > = Field< Item >[];\n\nexport type Data< Item > = Item[];\n\n/**\n * The form configuration.\n */\nexport type Form = {\n\ttype?: 'regular' | 'panel';\n\tfields?: string[];\n};\n\nexport type DataFormControlProps< Item > = {\n\tdata: Item;\n\tfield: NormalizedField< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\n};\n\n/**\n * The filters applied to the dataset.\n */\nexport interface Filter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The operator to use.\n\t */\n\toperator: Operator;\n\n\t/**\n\t * The value to filter by.\n\t */\n\tvalue: any;\n}\n\nexport interface NormalizedFilter {\n\t/**\n\t * The field to filter by.\n\t */\n\tfield: string;\n\n\t/**\n\t * The field name.\n\t */\n\tname: string;\n\n\t/**\n\t * The list of options to pick from when using the field as a filter.\n\t */\n\telements: Option[];\n\n\t/**\n\t * Is a single selection filter.\n\t */\n\tsingleSelection: boolean;\n\n\t/**\n\t * The list of operators supported by the field.\n\t */\n\toperators: Operator[];\n\n\t/**\n\t * Whether the filter is visible.\n\t */\n\tisVisible: boolean;\n\n\t/**\n\t * Whether it is a primary filter.\n\t */\n\tisPrimary: boolean;\n}\n\ninterface ViewBase {\n\t/**\n\t * The layout of the view.\n\t */\n\ttype: string;\n\n\t/**\n\t * The global search term.\n\t */\n\tsearch?: string;\n\n\t/**\n\t * The filters to apply.\n\t */\n\tfilters?: Filter[];\n\n\t/**\n\t * The sorting configuration.\n\t */\n\tsort?: {\n\t\t/**\n\t\t * The field to sort by.\n\t\t */\n\t\tfield: string;\n\n\t\t/**\n\t\t * The direction to sort by.\n\t\t */\n\t\tdirection: SortDirection;\n\t};\n\n\t/**\n\t * The active page\n\t */\n\tpage?: number;\n\n\t/**\n\t * The number of items per page\n\t */\n\tperPage?: number;\n\n\t/**\n\t * The fields to render\n\t */\n\tfields?: string[];\n}\n\nexport interface CombinedField {\n\tid: string;\n\n\tlabel: string;\n\n\theader?: string | ReactElement;\n\n\t/**\n\t * The fields to use as columns.\n\t */\n\tchildren: string[];\n\n\t/**\n\t * The direction of the stack.\n\t */\n\tdirection: 'horizontal' | 'vertical';\n}\n\nexport interface ColumnStyle {\n\t/**\n\t * The width of the field column.\n\t */\n\twidth?: string | number;\n\n\t/**\n\t * The minimum width of the field column.\n\t */\n\tmaxWidth?: string | number;\n\n\t/**\n\t * The maximum width of the field column.\n\t */\n\tminWidth?: string | number;\n}\n\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcombinedFields?: CombinedField[];\n\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\t};\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The field to use as the primary field.\n\t\t */\n\t\tprimaryField?: string;\n\n\t\t/**\n\t\t * The field to use as the media field.\n\t\t */\n\t\tmediaField?: string;\n\n\t\t/**\n\t\t * The fields to use as columns.\n\t\t */\n\t\tcolumnFields?: string[];\n\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\t};\n}\n\nexport type View = ViewList | ViewGrid | ViewTable;\n\ninterface ActionBase< Item > {\n\t/**\n\t * The unique identifier of the action.\n\t */\n\tid: string;\n\n\t/**\n\t * The label of the action.\n\t * In case we want to adjust the label based on the selected items,\n\t * a function can be provided.\n\t */\n\tlabel: string | ( ( items: Item[] ) => string );\n\n\t/**\n\t * The icon of the action. (Either a string or an SVG element)\n\t * This should be IconType from the components package\n\t * but that import is breaking typescript build for the moment.\n\t */\n\ticon?: any;\n\n\t/**\n\t * Whether the action is disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the action is destructive.\n\t */\n\tisDestructive?: boolean;\n\n\t/**\n\t * Whether the action is a primary action.\n\t */\n\tisPrimary?: boolean;\n\n\t/**\n\t * Whether the item passed as an argument supports the current action.\n\t */\n\tisEligible?: ( item: Item ) => boolean;\n\n\t/**\n\t * Whether the action can be used as a bulk action.\n\t */\n\tsupportsBulk?: boolean;\n\n\t/**\n\t * The context in which the action is visible.\n\t * This is only a \"meta\" information for now.\n\t */\n\tcontext?: 'list' | 'single';\n}\n\nexport interface RenderModalProps< Item > {\n\titems: Item[];\n\tcloseModal?: () => void;\n\tonActionPerformed?: ( items: Item[] ) => void;\n}\n\nexport interface ActionModal< Item > extends ActionBase< Item > {\n\t/**\n\t * Modal to render when the action is triggered.\n\t */\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionPerformed,\n\t}: RenderModalProps< Item > ) => ReactElement;\n\n\t/**\n\t * Whether to hide the modal header.\n\t */\n\thideModalHeader?: boolean;\n\n\t/**\n\t * The header of the modal.\n\t */\n\tmodalHeader?: string;\n}\n\nexport interface ActionButton< Item > extends ActionBase< Item > {\n\t/**\n\t * The callback to execute when the action is triggered.\n\t */\n\tcallback: (\n\t\titems: Item[],\n\t\tcontext: {\n\t\t\tregistry: any;\n\t\t\tonActionPerformed?: ( items: Item[] ) => void;\n\t\t}\n\t) => void;\n}\n\nexport type Action< Item > = ActionModal< Item > | ActionButton< Item >;\n\nexport interface ViewBaseProps< Item > {\n\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tview: View;\n\tdensity: number;\n}\n\nexport interface ViewTableProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewTable;\n}\n\nexport interface ViewListProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewList;\n}\n\nexport interface ViewGridProps< Item > extends ViewBaseProps< Item > {\n\tview: ViewGrid;\n}\n\nexport type ViewProps< Item > =\n\t| ViewTableProps< Item >\n\t| ViewGridProps< Item >\n\t| ViewListProps< Item >;\n\nexport interface SupportedLayouts {\n\tlist?: Omit< ViewList, 'type' >;\n\tgrid?: Omit< ViewGrid, 'type' >;\n\ttable?: Omit< ViewTable, 'type' >;\n}\n\nexport interface DataFormProps< Item > {\n\tdata: Item;\n\tfields: Field< Item >[];\n\tform: Form;\n\tonChange: ( value: Record< string, any > ) => void;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
* Radius scale.
|
|
38
38
|
*/
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Elevation scale.
|
|
41
41
|
*/
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Dimensions.
|
|
44
44
|
*/
|
|
45
45
|
/**
|
|
46
46
|
* Editor widths.
|
|
@@ -134,10 +134,6 @@
|
|
|
134
134
|
transition-delay: 0s;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
.dataviews__view-actions .components-search-control .components-base-control__field,
|
|
138
|
-
.dataviews-filters__container .components-search-control .components-base-control__field {
|
|
139
|
-
max-width: 240px;
|
|
140
|
-
}
|
|
141
137
|
|
|
142
138
|
.dataviews-view-list__primary-field,
|
|
143
139
|
.dataviews-view-grid__primary-field,
|
|
@@ -213,10 +209,6 @@
|
|
|
213
209
|
.dataviews-filters__container {
|
|
214
210
|
padding: 12px 24px;
|
|
215
211
|
}
|
|
216
|
-
.dataviews__view-actions .components-search-control .components-base-control__field,
|
|
217
|
-
.dataviews-filters__container .components-search-control .components-base-control__field {
|
|
218
|
-
max-width: 112px;
|
|
219
|
-
}
|
|
220
212
|
|
|
221
213
|
.dataviews-view-grid,
|
|
222
214
|
.dataviews-no-results,
|
|
@@ -549,7 +541,6 @@
|
|
|
549
541
|
background-color: #fff;
|
|
550
542
|
padding: 12px 48px;
|
|
551
543
|
border-top: 1px solid #f0f0f0;
|
|
552
|
-
color: #757575;
|
|
553
544
|
flex-shrink: 0;
|
|
554
545
|
transition: padding ease-out 0.1s;
|
|
555
546
|
}
|
|
@@ -560,11 +551,16 @@
|
|
|
560
551
|
}
|
|
561
552
|
}
|
|
562
553
|
|
|
563
|
-
.dataviews-pagination__page-
|
|
554
|
+
.dataviews-pagination__page-select {
|
|
564
555
|
font-size: 11px;
|
|
565
|
-
text-transform: uppercase;
|
|
566
556
|
font-weight: 500;
|
|
567
|
-
|
|
557
|
+
text-transform: uppercase;
|
|
558
|
+
}
|
|
559
|
+
@media (min-width: 600px) {
|
|
560
|
+
.dataviews-pagination__page-select .components-select-control__input {
|
|
561
|
+
font-size: 11px !important;
|
|
562
|
+
font-weight: 500;
|
|
563
|
+
}
|
|
568
564
|
}
|
|
569
565
|
|
|
570
566
|
/* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
|
|
@@ -766,10 +762,6 @@
|
|
|
766
762
|
}
|
|
767
763
|
}
|
|
768
764
|
|
|
769
|
-
.dataviews-density-picker__range-control {
|
|
770
|
-
width: 200px;
|
|
771
|
-
}
|
|
772
|
-
|
|
773
765
|
.dataviews-view-grid__field-value:empty,
|
|
774
766
|
.dataviews-view-grid__field:empty {
|
|
775
767
|
display: none;
|
|
@@ -1108,6 +1100,11 @@
|
|
|
1108
1100
|
}
|
|
1109
1101
|
}
|
|
1110
1102
|
|
|
1103
|
+
.dataviews-controls__datetime {
|
|
1104
|
+
border: none;
|
|
1105
|
+
padding: 0;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1111
1108
|
.dataforms-layouts-panel__field {
|
|
1112
1109
|
width: 100%;
|
|
1113
1110
|
min-height: 32px;
|
package/build-style/style.css
CHANGED
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
* Radius scale.
|
|
38
38
|
*/
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Elevation scale.
|
|
41
41
|
*/
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Dimensions.
|
|
44
44
|
*/
|
|
45
45
|
/**
|
|
46
46
|
* Editor widths.
|
|
@@ -134,10 +134,6 @@
|
|
|
134
134
|
transition-delay: 0s;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
.dataviews__view-actions .components-search-control .components-base-control__field,
|
|
138
|
-
.dataviews-filters__container .components-search-control .components-base-control__field {
|
|
139
|
-
max-width: 240px;
|
|
140
|
-
}
|
|
141
137
|
|
|
142
138
|
.dataviews-view-list__primary-field,
|
|
143
139
|
.dataviews-view-grid__primary-field,
|
|
@@ -213,10 +209,6 @@
|
|
|
213
209
|
.dataviews-filters__container {
|
|
214
210
|
padding: 12px 24px;
|
|
215
211
|
}
|
|
216
|
-
.dataviews__view-actions .components-search-control .components-base-control__field,
|
|
217
|
-
.dataviews-filters__container .components-search-control .components-base-control__field {
|
|
218
|
-
max-width: 112px;
|
|
219
|
-
}
|
|
220
212
|
|
|
221
213
|
.dataviews-view-grid,
|
|
222
214
|
.dataviews-no-results,
|
|
@@ -549,7 +541,6 @@
|
|
|
549
541
|
background-color: #fff;
|
|
550
542
|
padding: 12px 48px;
|
|
551
543
|
border-top: 1px solid #f0f0f0;
|
|
552
|
-
color: #757575;
|
|
553
544
|
flex-shrink: 0;
|
|
554
545
|
transition: padding ease-out 0.1s;
|
|
555
546
|
}
|
|
@@ -560,11 +551,16 @@
|
|
|
560
551
|
}
|
|
561
552
|
}
|
|
562
553
|
|
|
563
|
-
.dataviews-pagination__page-
|
|
554
|
+
.dataviews-pagination__page-select {
|
|
564
555
|
font-size: 11px;
|
|
565
|
-
text-transform: uppercase;
|
|
566
556
|
font-weight: 500;
|
|
567
|
-
|
|
557
|
+
text-transform: uppercase;
|
|
558
|
+
}
|
|
559
|
+
@media (min-width: 600px) {
|
|
560
|
+
.dataviews-pagination__page-select .components-select-control__input {
|
|
561
|
+
font-size: 11px !important;
|
|
562
|
+
font-weight: 500;
|
|
563
|
+
}
|
|
568
564
|
}
|
|
569
565
|
|
|
570
566
|
/* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
|
|
@@ -766,10 +762,6 @@
|
|
|
766
762
|
}
|
|
767
763
|
}
|
|
768
764
|
|
|
769
|
-
.dataviews-density-picker__range-control {
|
|
770
|
-
width: 200px;
|
|
771
|
-
}
|
|
772
|
-
|
|
773
765
|
.dataviews-view-grid__field-value:empty,
|
|
774
766
|
.dataviews-view-grid__field:empty {
|
|
775
767
|
display: none;
|
|
@@ -1108,6 +1100,11 @@
|
|
|
1108
1100
|
}
|
|
1109
1101
|
}
|
|
1110
1102
|
|
|
1103
|
+
.dataviews-controls__datetime {
|
|
1104
|
+
border: none;
|
|
1105
|
+
padding: 0;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1111
1108
|
.dataforms-layouts-panel__field {
|
|
1112
1109
|
width: 100%;
|
|
1113
1110
|
min-height: 32px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/components/dataform/stories/index.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,QAAA,MAAM,IAAI;;;;;;;;;;;;CAWT,CAAC;AACF,eAAe,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/components/dataform/stories/index.story.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,QAAA,MAAM,IAAI;;;;;;;;;;;;CAWT,CAAC;AACF,eAAe,IAAI,CAAC;AA0DpB,eAAO,MAAM,OAAO,aAAe;IAAE,IAAI,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,gCAuC/D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAwBvC,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAwBvC,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGzE,KAAK,UAAU,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC,KAAK,cAAc,CAAE,IAAI,IAAK;IAC7B,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IACrC,MAAM,EAAE,KAAK,CAAE,IAAI,CAAE,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAE,IAAI,CAAE,EAAE,CAAC;IAC3B,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,cAAc,EAAE,gBAAgB,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,iBAAiB,CAAC,EAAE,CAAE,KAAK,EAAE,MAAM,EAAE,KAAM,IAAI,CAAC;IAChD,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB,GAAG,CAAE,IAAI,SAAS,UAAU,GAC1B;IAAE,SAAS,CAAC,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,MAAM,CAAA;CAAE,GACxC;IAAE,SAAS,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,MAAM,CAAA;CAAE,CAAE,CAAC;AAI7C,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,IAAI,EAAI,EAC1C,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,MAAa,EACb,WAAuB,EACvB,OAAY,EACZ,IAAI,EACJ,SAA4B,EAC5B,SAAiB,EACjB,cAAc,EACd,cAAc,EACd,SAAS,EAAE,iBAAiB,EAC5B,iBAAiB,EACjB,MAAM,GACN,EAAE,cAAc,CAAE,IAAI,CAAE,+BA0FxB"}
|
|
@@ -6,6 +6,7 @@ export const data: {
|
|
|
6
6
|
type: string;
|
|
7
7
|
categories: string[];
|
|
8
8
|
satellites: number;
|
|
9
|
+
date: string;
|
|
9
10
|
}[];
|
|
10
11
|
export namespace DEFAULT_VIEW {
|
|
11
12
|
export { LAYOUT_TABLE as type };
|
|
@@ -39,14 +40,15 @@ export const actions: ({
|
|
|
39
40
|
export const fields: ({
|
|
40
41
|
label: string;
|
|
41
42
|
id: string;
|
|
43
|
+
header: import("react").JSX.Element;
|
|
42
44
|
render: ({ item }: {
|
|
43
45
|
item: any;
|
|
44
46
|
}) => import("react").JSX.Element;
|
|
45
47
|
enableSorting: boolean;
|
|
46
48
|
enableHiding?: undefined;
|
|
47
49
|
enableGlobalSearch?: undefined;
|
|
48
|
-
elements?: undefined;
|
|
49
50
|
type?: undefined;
|
|
51
|
+
elements?: undefined;
|
|
50
52
|
filterBy?: undefined;
|
|
51
53
|
getValue?: undefined;
|
|
52
54
|
} | {
|
|
@@ -54,10 +56,23 @@ export const fields: ({
|
|
|
54
56
|
id: string;
|
|
55
57
|
enableHiding: boolean;
|
|
56
58
|
enableGlobalSearch: boolean;
|
|
59
|
+
header?: undefined;
|
|
57
60
|
render?: undefined;
|
|
58
61
|
enableSorting?: undefined;
|
|
59
|
-
elements?: undefined;
|
|
60
62
|
type?: undefined;
|
|
63
|
+
elements?: undefined;
|
|
64
|
+
filterBy?: undefined;
|
|
65
|
+
getValue?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
id: string;
|
|
68
|
+
label: string;
|
|
69
|
+
type: string;
|
|
70
|
+
header?: undefined;
|
|
71
|
+
render?: undefined;
|
|
72
|
+
enableSorting?: undefined;
|
|
73
|
+
enableHiding?: undefined;
|
|
74
|
+
enableGlobalSearch?: undefined;
|
|
75
|
+
elements?: undefined;
|
|
61
76
|
filterBy?: undefined;
|
|
62
77
|
getValue?: undefined;
|
|
63
78
|
} | {
|
|
@@ -68,6 +83,7 @@ export const fields: ({
|
|
|
68
83
|
value: string;
|
|
69
84
|
label: string;
|
|
70
85
|
}[];
|
|
86
|
+
header?: undefined;
|
|
71
87
|
render?: undefined;
|
|
72
88
|
enableSorting?: undefined;
|
|
73
89
|
enableGlobalSearch?: undefined;
|
|
@@ -79,6 +95,7 @@ export const fields: ({
|
|
|
79
95
|
id: string;
|
|
80
96
|
type: string;
|
|
81
97
|
enableSorting: boolean;
|
|
98
|
+
header?: undefined;
|
|
82
99
|
render?: undefined;
|
|
83
100
|
enableHiding?: undefined;
|
|
84
101
|
enableGlobalSearch?: undefined;
|
|
@@ -90,15 +107,17 @@ export const fields: ({
|
|
|
90
107
|
id: string;
|
|
91
108
|
enableSorting: boolean;
|
|
92
109
|
enableGlobalSearch: boolean;
|
|
110
|
+
header?: undefined;
|
|
93
111
|
render?: undefined;
|
|
94
112
|
enableHiding?: undefined;
|
|
95
|
-
elements?: undefined;
|
|
96
113
|
type?: undefined;
|
|
114
|
+
elements?: undefined;
|
|
97
115
|
filterBy?: undefined;
|
|
98
116
|
getValue?: undefined;
|
|
99
117
|
} | {
|
|
100
118
|
label: string;
|
|
101
119
|
id: string;
|
|
120
|
+
header: import("react").JSX.Element;
|
|
102
121
|
elements: {
|
|
103
122
|
value: string;
|
|
104
123
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../src/components/dataviews/stories/fixtures.js"],"names":[],"mappings":"AAgBA
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../src/components/dataviews/stories/fixtures.js"],"names":[],"mappings":"AAgBA;;;;;;;;;IA+GE;;;;;;;;;;AAYF;;;;;;;;;;;;;;;;;;;KA8BE;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8EE;6BA3O2B,oBAAoB"}
|