@wordpress/dataviews 5.0.0 → 6.0.1-next.46f643fa0.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 +18 -1
- package/README.md +45 -23
- package/build/components/dataviews/index.js +2 -1
- package/build/components/dataviews/index.js.map +1 -1
- package/build/components/dataviews-context/index.js +1 -0
- package/build/components/dataviews-context/index.js.map +1 -1
- package/build/components/dataviews-filters/filter.js +2 -2
- package/build/components/dataviews-filters/filter.js.map +1 -1
- package/build/components/dataviews-filters/input-widget.js +7 -1
- package/build/components/dataviews-filters/input-widget.js.map +1 -1
- package/build/dataform-controls/boolean.js +15 -1
- package/build/dataform-controls/boolean.js.map +1 -1
- package/build/dataform-controls/date.js +385 -0
- package/build/dataform-controls/date.js.map +1 -0
- package/build/dataform-controls/datetime.js +5 -84
- package/build/dataform-controls/datetime.js.map +1 -1
- package/build/dataform-controls/email.js +15 -1
- package/build/dataform-controls/email.js.map +1 -1
- package/build/dataform-controls/index.js +2 -0
- package/build/dataform-controls/index.js.map +1 -1
- package/build/dataform-controls/integer.js +23 -4
- package/build/dataform-controls/integer.js.map +1 -1
- package/build/dataform-controls/relative-date-control.js +109 -0
- package/build/dataform-controls/relative-date-control.js.map +1 -0
- package/build/dataform-controls/text.js +15 -1
- package/build/dataform-controls/text.js.map +1 -1
- package/build/dataviews-layouts/grid/index.js +37 -21
- package/build/dataviews-layouts/grid/index.js.map +1 -1
- package/build/dataviews-layouts/grid/preview-size-picker.js +39 -85
- package/build/dataviews-layouts/grid/preview-size-picker.js.map +1 -1
- package/build/dataviews-layouts/list/index.js +4 -1
- package/build/dataviews-layouts/list/index.js.map +1 -1
- package/build/dataviews-layouts/table/column-primary.js +4 -1
- package/build/dataviews-layouts/table/column-primary.js.map +1 -1
- package/build/dataviews-layouts/table/index.js +9 -2
- package/build/dataviews-layouts/table/index.js.map +1 -1
- package/build/field-types/array.js +27 -18
- package/build/field-types/array.js.map +1 -1
- package/build/field-types/boolean.js +11 -7
- package/build/field-types/boolean.js.map +1 -1
- package/build/field-types/date.js +21 -12
- package/build/field-types/date.js.map +1 -1
- package/build/field-types/datetime.js +19 -10
- package/build/field-types/datetime.js.map +1 -1
- package/build/field-types/email.js +22 -18
- package/build/field-types/email.js.map +1 -1
- package/build/field-types/index.js +16 -6
- package/build/field-types/index.js.map +1 -1
- package/build/field-types/integer.js +22 -17
- package/build/field-types/integer.js.map +1 -1
- package/build/field-types/media.js +19 -10
- package/build/field-types/media.js.map +1 -1
- package/build/field-types/text.js +19 -10
- package/build/field-types/text.js.map +1 -1
- package/build/filter-and-sort-data-view.js +6 -4
- package/build/filter-and-sort-data-view.js.map +1 -1
- package/build/normalize-fields.js +4 -5
- package/build/normalize-fields.js.map +1 -1
- package/build/types.js.map +1 -1
- package/build/validation.js +15 -2
- package/build/validation.js.map +1 -1
- package/build-module/components/dataviews/index.js +3 -2
- package/build-module/components/dataviews/index.js.map +1 -1
- package/build-module/components/dataviews-context/index.js +1 -0
- package/build-module/components/dataviews-context/index.js.map +1 -1
- package/build-module/components/dataviews-filters/filter.js +2 -2
- package/build-module/components/dataviews-filters/filter.js.map +1 -1
- package/build-module/components/dataviews-filters/input-widget.js +7 -1
- package/build-module/components/dataviews-filters/input-widget.js.map +1 -1
- package/build-module/dataform-controls/boolean.js +17 -2
- package/build-module/dataform-controls/boolean.js.map +1 -1
- package/build-module/dataform-controls/date.js +376 -0
- package/build-module/dataform-controls/date.js.map +1 -0
- package/build-module/dataform-controls/datetime.js +3 -84
- package/build-module/dataform-controls/datetime.js.map +1 -1
- package/build-module/dataform-controls/email.js +17 -2
- package/build-module/dataform-controls/email.js.map +1 -1
- package/build-module/dataform-controls/index.js +2 -0
- package/build-module/dataform-controls/index.js.map +1 -1
- package/build-module/dataform-controls/integer.js +24 -5
- package/build-module/dataform-controls/integer.js.map +1 -1
- package/build-module/dataform-controls/relative-date-control.js +100 -0
- package/build-module/dataform-controls/relative-date-control.js.map +1 -0
- package/build-module/dataform-controls/text.js +17 -2
- package/build-module/dataform-controls/text.js.map +1 -1
- package/build-module/dataviews-layouts/grid/index.js +38 -22
- package/build-module/dataviews-layouts/grid/index.js.map +1 -1
- package/build-module/dataviews-layouts/grid/preview-size-picker.js +40 -85
- package/build-module/dataviews-layouts/grid/preview-size-picker.js.map +1 -1
- package/build-module/dataviews-layouts/list/index.js +4 -1
- package/build-module/dataviews-layouts/list/index.js.map +1 -1
- package/build-module/dataviews-layouts/table/column-primary.js +4 -1
- package/build-module/dataviews-layouts/table/column-primary.js.map +1 -1
- package/build-module/dataviews-layouts/table/index.js +9 -2
- package/build-module/dataviews-layouts/table/index.js.map +1 -1
- package/build-module/field-types/array.js +27 -18
- package/build-module/field-types/array.js.map +1 -1
- package/build-module/field-types/boolean.js +11 -7
- package/build-module/field-types/boolean.js.map +1 -1
- package/build-module/field-types/date.js +21 -12
- package/build-module/field-types/date.js.map +1 -1
- package/build-module/field-types/datetime.js +19 -10
- package/build-module/field-types/datetime.js.map +1 -1
- package/build-module/field-types/email.js +22 -18
- package/build-module/field-types/email.js.map +1 -1
- package/build-module/field-types/index.js +16 -6
- package/build-module/field-types/index.js.map +1 -1
- package/build-module/field-types/integer.js +22 -17
- package/build-module/field-types/integer.js.map +1 -1
- package/build-module/field-types/media.js +19 -10
- package/build-module/field-types/media.js.map +1 -1
- package/build-module/field-types/text.js +19 -10
- package/build-module/field-types/text.js.map +1 -1
- package/build-module/filter-and-sort-data-view.js +6 -4
- package/build-module/filter-and-sort-data-view.js.map +1 -1
- package/build-module/normalize-fields.js +4 -5
- package/build-module/normalize-fields.js.map +1 -1
- package/build-module/types.js.map +1 -1
- package/build-module/validation.js +15 -2
- package/build-module/validation.js.map +1 -1
- package/build-style/style-rtl.css +53 -39
- package/build-style/style.css +53 -39
- package/build-types/components/dataform/stories/index.story.d.ts +21 -0
- 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.map +1 -1
- package/build-types/components/dataviews-context/index.d.ts +1 -0
- package/build-types/components/dataviews-context/index.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/input-widget.d.ts.map +1 -1
- package/build-types/constants.d.ts +2 -2
- package/build-types/dataform-controls/boolean.d.ts.map +1 -1
- package/build-types/dataform-controls/date.d.ts +3 -0
- package/build-types/dataform-controls/date.d.ts.map +1 -0
- package/build-types/dataform-controls/datetime.d.ts.map +1 -1
- package/build-types/dataform-controls/email.d.ts.map +1 -1
- package/build-types/dataform-controls/index.d.ts.map +1 -1
- package/build-types/dataform-controls/integer.d.ts.map +1 -1
- package/build-types/dataform-controls/relative-date-control.d.ts +46 -0
- package/build-types/dataform-controls/relative-date-control.d.ts.map +1 -0
- package/build-types/dataform-controls/text.d.ts.map +1 -1
- package/build-types/dataviews-layouts/grid/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/grid/preview-size-picker.d.ts +0 -1
- package/build-types/dataviews-layouts/grid/preview-size-picker.d.ts.map +1 -1
- package/build-types/dataviews-layouts/index.d.ts +3 -3
- package/build-types/dataviews-layouts/list/index.d.ts.map +1 -1
- package/build-types/dataviews-layouts/table/column-primary.d.ts.map +1 -1
- package/build-types/dataviews-layouts/table/index.d.ts.map +1 -1
- package/build-types/field-types/array.d.ts.map +1 -1
- package/build-types/field-types/boolean.d.ts +5 -4
- package/build-types/field-types/boolean.d.ts.map +1 -1
- package/build-types/field-types/date.d.ts +9 -5
- package/build-types/field-types/date.d.ts.map +1 -1
- package/build-types/field-types/datetime.d.ts +4 -3
- package/build-types/field-types/datetime.d.ts.map +1 -1
- package/build-types/field-types/email.d.ts +4 -3
- package/build-types/field-types/email.d.ts.map +1 -1
- package/build-types/field-types/index.d.ts.map +1 -1
- package/build-types/field-types/integer.d.ts +4 -3
- package/build-types/field-types/integer.d.ts.map +1 -1
- package/build-types/field-types/media.d.ts +4 -3
- package/build-types/field-types/media.d.ts.map +1 -1
- package/build-types/field-types/text.d.ts +4 -3
- package/build-types/field-types/text.d.ts.map +1 -1
- package/build-types/filter-and-sort-data-view.d.ts.map +1 -1
- package/build-types/normalize-fields.d.ts.map +1 -1
- package/build-types/types.d.ts +10 -6
- package/build-types/types.d.ts.map +1 -1
- package/build-types/validation.d.ts.map +1 -1
- package/build-wp/index.js +1373 -600
- package/package.json +15 -14
- package/src/components/dataform/stories/index.story.tsx +228 -2
- package/src/components/dataviews/index.tsx +3 -5
- package/src/components/dataviews/stories/fixtures.tsx +1 -0
- package/src/components/dataviews-context/index.ts +4 -0
- package/src/components/dataviews-filters/filter.tsx +2 -2
- package/src/components/dataviews-filters/input-widget.tsx +7 -1
- package/src/components/dataviews-filters/style.scss +3 -1
- package/src/dataform-controls/boolean.tsx +19 -2
- package/src/dataform-controls/date.tsx +499 -0
- package/src/dataform-controls/datetime.tsx +5 -91
- package/src/dataform-controls/email.tsx +19 -2
- package/src/dataform-controls/index.tsx +2 -0
- package/src/dataform-controls/integer.tsx +30 -4
- package/src/dataform-controls/relative-date-control.tsx +106 -0
- package/src/dataform-controls/style.scss +19 -2
- package/src/dataform-controls/text.tsx +19 -2
- package/src/dataviews-layouts/grid/index.tsx +44 -23
- package/src/dataviews-layouts/grid/preview-size-picker.tsx +48 -73
- package/src/dataviews-layouts/grid/style.scss +13 -26
- package/src/dataviews-layouts/list/index.tsx +5 -1
- package/src/dataviews-layouts/list/style.scss +3 -3
- package/src/dataviews-layouts/table/column-primary.tsx +5 -1
- package/src/dataviews-layouts/table/index.tsx +22 -6
- package/src/dataviews-layouts/table/style.scss +22 -0
- package/src/field-types/array.tsx +33 -21
- package/src/field-types/boolean.tsx +15 -9
- package/src/field-types/date.ts +51 -15
- package/src/field-types/datetime.tsx +19 -13
- package/src/field-types/email.tsx +26 -21
- package/src/field-types/index.tsx +18 -8
- package/src/field-types/integer.tsx +26 -22
- package/src/field-types/media.tsx +19 -13
- package/src/field-types/text.tsx +19 -13
- package/src/filter-and-sort-data-view.ts +11 -4
- package/src/normalize-fields.ts +4 -8
- package/src/test/dataviews.tsx +129 -0
- package/src/test/filter-and-sort-data-view.js +48 -0
- package/src/test/validation.ts +4 -15
- package/src/types.ts +11 -7
- package/src/validation.ts +30 -1
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getFieldTypeDefinition","getControl","ALL_OPERATORS","OPERATOR_BETWEEN","SINGLE_SELECTION_OPERATORS","getValueFromId","id","item","path","split","value","segment","hasOwnProperty","undefined","getFilterBy","field","fieldTypeDefinition","filterBy","operators","Array","isArray","defaultOperators","validOperators","filter","operator","includes","elements","hasSingleSelectionOperator","some","length","isPrimary","normalizeFields","fields","map","_field$sort","_field$
|
|
1
|
+
{"version":3,"names":["getFieldTypeDefinition","getControl","ALL_OPERATORS","OPERATOR_BETWEEN","SINGLE_SELECTION_OPERATORS","getValueFromId","id","item","path","split","value","segment","hasOwnProperty","undefined","getFilterBy","field","fieldTypeDefinition","filterBy","operators","Array","isArray","defaultOperators","validOperators","filter","operator","includes","elements","hasSingleSelectionOperator","some","length","isPrimary","normalizeFields","fields","map","_field$sort","_field$render","_field$enableHiding","_ref","_field$enableSorting","_ref2","_field$readOnly","type","getValue","sort","a","b","direction","isValid","Edit","render","renderedField","label","header","enableHiding","enableSorting","readOnly"],"sources":["@wordpress/dataviews/src/normalize-fields.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { FunctionComponent } from 'react';\n\n/**\n * Internal dependencies\n */\nimport getFieldTypeDefinition from './field-types';\nimport type {\n\tDataViewRenderFieldProps,\n\tField,\n\tFieldTypeDefinition,\n\tNormalizedFilterByConfig,\n\tNormalizedField,\n} from './types';\nimport { getControl } from './dataform-controls';\nimport {\n\tALL_OPERATORS,\n\tOPERATOR_BETWEEN,\n\tSINGLE_SELECTION_OPERATORS,\n} from './constants';\n\nconst getValueFromId =\n\t( id: string ) =>\n\t( { item }: { item: any } ) => {\n\t\tconst path = id.split( '.' );\n\t\tlet value = item;\n\t\tfor ( const segment of path ) {\n\t\t\tif ( value.hasOwnProperty( segment ) ) {\n\t\t\t\tvalue = value[ segment ];\n\t\t\t} else {\n\t\t\t\tvalue = undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t};\n\nfunction getFilterBy< Item >(\n\tfield: Field< Item >,\n\tfieldTypeDefinition: FieldTypeDefinition< Item >\n): NormalizedFilterByConfig | false {\n\tif ( field.filterBy === false ) {\n\t\treturn false;\n\t}\n\n\tif ( typeof field.filterBy === 'object' ) {\n\t\tlet operators = field.filterBy.operators;\n\n\t\t// Assign default values if no operator was provided.\n\t\tif ( ! operators || ! Array.isArray( operators ) ) {\n\t\t\toperators = !! fieldTypeDefinition.filterBy\n\t\t\t\t? fieldTypeDefinition.filterBy.defaultOperators\n\t\t\t\t: [];\n\t\t}\n\n\t\t// Make sure only valid operators are included.\n\t\tlet validOperators = ALL_OPERATORS;\n\t\tif ( typeof fieldTypeDefinition.filterBy === 'object' ) {\n\t\t\tvalidOperators = fieldTypeDefinition.filterBy.validOperators;\n\t\t}\n\t\toperators = operators.filter( ( operator ) =>\n\t\t\tvalidOperators.includes( operator )\n\t\t);\n\n\t\t// The `between` operator is not supported when elements are provided.\n\t\tif ( field.elements && operators.includes( OPERATOR_BETWEEN ) ) {\n\t\t\toperators = operators.filter(\n\t\t\t\t( operator ) => operator !== OPERATOR_BETWEEN\n\t\t\t);\n\t\t}\n\n\t\t// Do not allow mixing single & multiselection operators.\n\t\t// Remove multiselection operators if any of the single selection ones is present.\n\t\tconst hasSingleSelectionOperator = operators.some( ( operator ) =>\n\t\t\tSINGLE_SELECTION_OPERATORS.includes( operator )\n\t\t);\n\t\tif ( hasSingleSelectionOperator ) {\n\t\t\toperators = operators.filter( ( operator ) =>\n\t\t\t\t// The 'Between' operator is unique as it can be combined with single selection operators.\n\t\t\t\t[ ...SINGLE_SELECTION_OPERATORS, OPERATOR_BETWEEN ].includes(\n\t\t\t\t\toperator\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t// If no operators are left at this point,\n\t\t// the filters should be disabled.\n\t\tif ( operators.length === 0 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn {\n\t\t\tisPrimary: !! field.filterBy.isPrimary,\n\t\t\toperators,\n\t\t};\n\t}\n\n\tif ( fieldTypeDefinition.filterBy === false ) {\n\t\treturn false;\n\t}\n\n\tlet defaultOperators = fieldTypeDefinition.filterBy.defaultOperators;\n\t// The `between` operator is not supported when elements are provided.\n\tif ( field.elements && defaultOperators.includes( OPERATOR_BETWEEN ) ) {\n\t\tdefaultOperators = defaultOperators.filter(\n\t\t\t( operator ) => operator !== OPERATOR_BETWEEN\n\t\t);\n\t}\n\n\treturn {\n\t\toperators: defaultOperators,\n\t};\n}\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< Item >(\n\t\t\tfield.type\n\t\t);\n\t\tconst getValue = field.getValue || getValueFromId( 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\t...fieldTypeDefinition.isValid,\n\t\t\t...field.isValid,\n\t\t};\n\n\t\tconst Edit = getControl( field, fieldTypeDefinition );\n\n\t\tconst render =\n\t\t\tfield.render ??\n\t\t\tfunction render( {\n\t\t\t\titem,\n\t\t\t\tfield: renderedField,\n\t\t\t}: DataViewRenderFieldProps< Item > ) {\n\t\t\t\treturn (\n\t\t\t\t\tfieldTypeDefinition.render as FunctionComponent<\n\t\t\t\t\t\tDataViewRenderFieldProps< Item >\n\t\t\t\t\t>\n\t\t\t\t )( { item, field: renderedField } );\n\t\t\t};\n\n\t\tconst filterBy = getFilterBy( field, fieldTypeDefinition );\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\tenableHiding: field.enableHiding ?? true,\n\t\t\tenableSorting:\n\t\t\t\tfield.enableSorting ??\n\t\t\t\tfieldTypeDefinition.enableSorting ??\n\t\t\t\ttrue,\n\t\t\tfilterBy,\n\t\t\treadOnly: field.readOnly ?? fieldTypeDefinition.readOnly ?? false,\n\t\t};\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAOA,sBAAsB,MAAM,eAAe;AAQlD,SAASC,UAAU,QAAQ,qBAAqB;AAChD,SACCC,aAAa,EACbC,gBAAgB,EAChBC,0BAA0B,QACpB,aAAa;AAEpB,MAAMC,cAAc,GACjBC,EAAU,IACZ,CAAE;EAAEC;AAAoB,CAAC,KAAM;EAC9B,MAAMC,IAAI,GAAGF,EAAE,CAACG,KAAK,CAAE,GAAI,CAAC;EAC5B,IAAIC,KAAK,GAAGH,IAAI;EAChB,KAAM,MAAMI,OAAO,IAAIH,IAAI,EAAG;IAC7B,IAAKE,KAAK,CAACE,cAAc,CAAED,OAAQ,CAAC,EAAG;MACtCD,KAAK,GAAGA,KAAK,CAAEC,OAAO,CAAE;IACzB,CAAC,MAAM;MACND,KAAK,GAAGG,SAAS;IAClB;EACD;EAEA,OAAOH,KAAK;AACb,CAAC;AAEF,SAASI,WAAWA,CACnBC,KAAoB,EACpBC,mBAAgD,EACb;EACnC,IAAKD,KAAK,CAACE,QAAQ,KAAK,KAAK,EAAG;IAC/B,OAAO,KAAK;EACb;EAEA,IAAK,OAAOF,KAAK,CAACE,QAAQ,KAAK,QAAQ,EAAG;IACzC,IAA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KAAK,EAAEC,mBAAoB,CAAC;IAErD,MAAMiC,MAAM,IAAAd,aAAA,GACXpB,KAAK,CAACkC,MAAM,cAAAd,aAAA,cAAAA,aAAA,GACZ,SAASc,MAAMA,CAAE;MAChB1C,IAAI;MACJQ,KAAK,EAAEmC;IAC0B,CAAC,EAAG;MACrC,OACClC,mBAAmB,CAACiC,MAAM,CAGvB;QAAE1C,IAAI;QAAEQ,KAAK,EAAEmC;MAAc,CAAE,CAAC;IACrC,CAAC;IAEF,MAAMjC,QAAQ,GAAGH,WAAW,CAAEC,KAAK,EAAEC,mBAAoB,CAAC;IAE1D,OAAO;MACN,GAAGD,KAAK;MACRoC,KAAK,EAAEpC,KAAK,CAACoC,KAAK,IAAIpC,KAAK,CAACT,EAAE;MAC9B8C,MAAM,EAAErC,KAAK,CAACqC,MAAM,IAAIrC,KAAK,CAACoC,KAAK,IAAIpC,KAAK,CAACT,EAAE;MAC/CoC,QAAQ;MACRO,MAAM;MACNN,IAAI;MACJI,OAAO;MACPC,IAAI;MACJK,YAAY,GAAAjB,mBAAA,GAAErB,KAAK,CAACsC,YAAY,cAAAjB,mBAAA,cAAAA,mBAAA,GAAI,IAAI;MACxCkB,aAAa,GAAAjB,IAAA,IAAAC,oBAAA,GACZvB,KAAK,CAACuC,aAAa,cAAAhB,oBAAA,cAAAA,oBAAA,GACnBtB,mBAAmB,CAACsC,aAAa,cAAAjB,IAAA,cAAAA,IAAA,GACjC,IAAI;MACLpB,QAAQ;MACRsC,QAAQ,GAAAhB,KAAA,IAAAC,eAAA,GAAEzB,KAAK,CAACwC,QAAQ,cAAAf,eAAA,cAAAA,eAAA,GAAIxB,mBAAmB,CAACuC,QAAQ,cAAAhB,KAAA,cAAAA,KAAA,GAAI;IAC7D,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 { ReactElement, ComponentType, ComponentProps } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SetSelection } from './private-types';\n\n/**\n * WordPress dependencies\n */\nimport type { useFocusOnMount } from '@wordpress/compose';\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\nexport interface 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 interface NormalizedFilterByConfig {\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\ninterface FilterConfigForType {\n\t/**\n\t * What operators are used by default.\n\t */\n\tdefaultOperators: Operator[];\n\n\t/**\n\t * What operators are supported by the field.\n\t */\n\tvalidOperators: Operator[];\n}\n\nexport type Operator =\n\t| 'is'\n\t| 'isNot'\n\t| 'isAny'\n\t| 'isNone'\n\t| 'isAll'\n\t| 'isNotAll'\n\t| 'lessThan'\n\t| 'greaterThan'\n\t| 'lessThanOrEqual'\n\t| 'greaterThanOrEqual'\n\t| 'before'\n\t| 'after'\n\t| 'beforeInc'\n\t| 'afterInc'\n\t| 'contains'\n\t| 'notContains'\n\t| 'startsWith'\n\t| 'between'\n\t| 'on'\n\t| 'notOn'\n\t| 'inThePast'\n\t| 'over';\n\nexport type FieldType =\n\t| 'text'\n\t| 'integer'\n\t| 'datetime'\n\t| 'date'\n\t| 'media'\n\t| 'boolean'\n\t| 'email'\n\t| 'array';\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 | null;\n\n\t/**\n\t * Callback used to render the field.\n\t */\n\trender: ComponentType< DataViewRenderFieldProps< Item > >;\n\n\t/**\n\t * The filter config for the field.\n\t */\n\tfilterBy: FilterConfigForType | false;\n\n\t/**\n\t * Whether the field is readOnly.\n\t * If `true`, the value will be rendered using the `render` callback.\n\t */\n\treadOnly?: boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting: boolean;\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< DataViewRenderFieldProps< 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 * Callback used to decide if a field should be displayed.\n\t */\n\tisVisible?: ( item: Item ) => 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 | false;\n\n\t/**\n\t * Whether the field is readOnly.\n\t * If `true`, the value will be rendered using the `render` callback.\n\t */\n\treadOnly?: boolean;\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 > = Omit< Field< Item >, 'Edit' > & {\n\tlabel: string;\n\theader: string | ReactElement;\n\tgetValue: ( args: { item: Item } ) => any;\n\trender: ComponentType< DataViewRenderFieldProps< Item > >;\n\tEdit: ComponentType< DataFormControlProps< Item > > | null;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: ( item: Item, context?: ValidationContext ) => boolean;\n\tenableHiding: boolean;\n\tenableSorting: boolean;\n\tfilterBy: NormalizedFilterByConfig | false;\n\treadOnly: 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\nexport type DataFormControlProps< Item > = {\n\tdata: Item;\n\tfield: NormalizedField< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\n\t/**\n\t * The currently selected filter operator for this field.\n\t *\n\t * Used by DataViews filters to determine which control to render based on the operator type.\n\t */\n\toperator?: Operator;\n};\n\nexport type DataViewRenderFieldProps< Item > = {\n\titem: Item;\n\tfield: NormalizedField< Item >;\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\t/**\n\t * Title field\n\t */\n\ttitleField?: string;\n\n\t/**\n\t * Media field\n\t */\n\tmediaField?: string;\n\n\t/**\n\t * Description field\n\t */\n\tdescriptionField?: string;\n\n\t/**\n\t * Whether to show the title\n\t */\n\tshowTitle?: boolean;\n\n\t/**\n\t * Whether to show the media\n\t */\n\tshowMedia?: boolean;\n\n\t/**\n\t * Whether to show the description\n\t */\n\tshowDescription?: boolean;\n\n\t/**\n\t * Whether to show the hierarchical levels.\n\t */\n\tshowLevels?: boolean;\n\n\t/**\n\t * The field to group by.\n\t */\n\tgroupByField?: string;\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\t/**\n\t * The alignment of the field column, defaults to left.\n\t */\n\talign?: 'start' | 'center' | 'end';\n}\n\nexport type Density = 'compact' | 'balanced' | 'comfortable';\n\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\n\t\t/**\n\t\t * The density of the view.\n\t\t */\n\t\tdensity?: Density;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\n\t\t/**\n\t\t * The preview size of the grid.\n\t\t */\n\t\tpreviewSize?: number;\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\t/**\n\t * The size of the modal.\n\t *\n\t * @default 'medium'\n\t */\n\tmodalSize?: 'small' | 'medium' | 'large' | 'fill';\n\n\t/**\n\t * The focus on mount property of the modal.\n\t */\n\tmodalFocusOnMount?:\n\t\t| Parameters< typeof useFocusOnMount >[ 0 ]\n\t\t| 'firstContentElement';\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\tclassName?: string;\n\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tgetItemLevel?: ( item: Item ) => number;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tonClickItem?: ( item: Item ) => void;\n\trenderItemLink?: (\n\t\tprops: {\n\t\t\titem: Item;\n\t\t} & ComponentProps< 'a' >\n\t) => ReactElement;\n\tisItemClickable: ( item: Item ) => boolean;\n\tview: View;\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 type SimpleFormField = {\n\tid: string;\n\tlayout?: 'regular' | 'panel';\n\tlabelPosition?: 'side' | 'top' | 'none';\n};\n\nexport type CombinedFormField = {\n\tid: string;\n\tlabel?: string;\n\tlayout?: 'regular' | 'panel';\n\tlabelPosition?: 'side' | 'top' | 'none';\n\tchildren: Array< FormField | string >;\n};\n\nexport type FormField = SimpleFormField | CombinedFormField;\n\n/**\n * The form configuration.\n */\nexport type Form = {\n\ttype?: 'regular' | 'panel';\n\tfields?: Array< FormField | string >;\n\tlabelPosition?: 'side' | 'top' | 'none';\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\nexport interface FieldLayoutProps< Item > {\n\tdata: Item;\n\tfield: FormField;\n\tonChange: ( value: any ) => void;\n\thideLabelFromVision?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/dataviews/src/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactElement, ComponentType, ComponentProps } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SetSelection } from './private-types';\n\n/**\n * WordPress dependencies\n */\nimport type { useFocusOnMount } from '@wordpress/compose';\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\nexport interface 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 interface NormalizedFilterByConfig {\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\ninterface FilterConfigForType {\n\t/**\n\t * What operators are used by default.\n\t */\n\tdefaultOperators: Operator[];\n\n\t/**\n\t * What operators are supported by the field.\n\t */\n\tvalidOperators: Operator[];\n}\n\nexport type Operator =\n\t| 'is'\n\t| 'isNot'\n\t| 'isAny'\n\t| 'isNone'\n\t| 'isAll'\n\t| 'isNotAll'\n\t| 'lessThan'\n\t| 'greaterThan'\n\t| 'lessThanOrEqual'\n\t| 'greaterThanOrEqual'\n\t| 'before'\n\t| 'after'\n\t| 'beforeInc'\n\t| 'afterInc'\n\t| 'contains'\n\t| 'notContains'\n\t| 'startsWith'\n\t| 'between'\n\t| 'on'\n\t| 'notOn'\n\t| 'inThePast'\n\t| 'over';\n\nexport type FieldType =\n\t| 'text'\n\t| 'integer'\n\t| 'datetime'\n\t| 'date'\n\t| 'media'\n\t| 'boolean'\n\t| 'email'\n\t| 'array';\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: Rules< Item >;\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 | null;\n\n\t/**\n\t * Callback used to render the field.\n\t */\n\trender: ComponentType< DataViewRenderFieldProps< Item > >;\n\n\t/**\n\t * The filter config for the field.\n\t */\n\tfilterBy: FilterConfigForType | false;\n\n\t/**\n\t * Whether the field is readOnly.\n\t * If `true`, the value will be rendered using the `render` callback.\n\t */\n\treadOnly?: boolean;\n\n\t/**\n\t * Whether the field is sortable.\n\t */\n\tenableSorting: boolean;\n};\n\nexport type Rules< Item > = {\n\trequired?: boolean;\n\tcustom?: ( item: Item, field: NormalizedField< Item > ) => null | 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< DataViewRenderFieldProps< 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?: Rules< Item >;\n\n\t/**\n\t * Callback used to decide if a field should be displayed.\n\t */\n\tisVisible?: ( item: Item ) => 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 | false;\n\n\t/**\n\t * Whether the field is readOnly.\n\t * If `true`, the value will be rendered using the `render` callback.\n\t */\n\treadOnly?: boolean;\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 > = Omit< Field< Item >, 'Edit' > & {\n\tlabel: string;\n\theader: string | ReactElement;\n\tgetValue: ( args: { item: Item } ) => any;\n\trender: ComponentType< DataViewRenderFieldProps< Item > >;\n\tEdit: ComponentType< DataFormControlProps< Item > > | null;\n\tsort: ( a: Item, b: Item, direction: SortDirection ) => number;\n\tisValid: Rules< Item >;\n\tenableHiding: boolean;\n\tenableSorting: boolean;\n\tfilterBy: NormalizedFilterByConfig | false;\n\treadOnly: 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\nexport type DataFormControlProps< Item > = {\n\tdata: Item;\n\tfield: NormalizedField< Item >;\n\tonChange: ( value: Record< string, any > ) => void;\n\thideLabelFromVision?: boolean;\n\t/**\n\t * The currently selected filter operator for this field.\n\t *\n\t * Used by DataViews filters to determine which control to render based on the operator type.\n\t */\n\toperator?: Operator;\n};\n\nexport type DataViewRenderFieldProps< Item > = {\n\titem: Item;\n\tfield: NormalizedField< Item >;\n\tconfig?: {\n\t\tsizes: string;\n\t};\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\t/**\n\t * Title field\n\t */\n\ttitleField?: string;\n\n\t/**\n\t * Media field\n\t */\n\tmediaField?: string;\n\n\t/**\n\t * Description field\n\t */\n\tdescriptionField?: string;\n\n\t/**\n\t * Whether to show the title\n\t */\n\tshowTitle?: boolean;\n\n\t/**\n\t * Whether to show the media\n\t */\n\tshowMedia?: boolean;\n\n\t/**\n\t * Whether to show the description\n\t */\n\tshowDescription?: boolean;\n\n\t/**\n\t * Whether to show the hierarchical levels.\n\t */\n\tshowLevels?: boolean;\n\n\t/**\n\t * The field to group by.\n\t */\n\tgroupByField?: string;\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\t/**\n\t * The alignment of the field column, defaults to left.\n\t */\n\talign?: 'start' | 'center' | 'end';\n}\n\nexport type Density = 'compact' | 'balanced' | 'comfortable';\n\nexport interface ViewTable extends ViewBase {\n\ttype: 'table';\n\n\tlayout?: {\n\t\t/**\n\t\t * The styles for the columns.\n\t\t */\n\t\tstyles?: Record< string, ColumnStyle >;\n\n\t\t/**\n\t\t * The density of the view.\n\t\t */\n\t\tdensity?: Density;\n\t};\n}\n\nexport interface ViewList extends ViewBase {\n\ttype: 'list';\n}\n\nexport interface ViewGrid extends ViewBase {\n\ttype: 'grid';\n\n\tlayout?: {\n\t\t/**\n\t\t * The fields to use as badge fields.\n\t\t */\n\t\tbadgeFields?: string[];\n\n\t\t/**\n\t\t * The preview size of the grid.\n\t\t */\n\t\tpreviewSize?: number;\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\t/**\n\t * The size of the modal.\n\t *\n\t * @default 'medium'\n\t */\n\tmodalSize?: 'small' | 'medium' | 'large' | 'fill';\n\n\t/**\n\t * The focus on mount property of the modal.\n\t */\n\tmodalFocusOnMount?:\n\t\t| Parameters< typeof useFocusOnMount >[ 0 ]\n\t\t| 'firstContentElement';\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\tclassName?: string;\n\tactions: Action< Item >[];\n\tdata: Item[];\n\tfields: NormalizedField< Item >[];\n\tgetItemId: ( item: Item ) => string;\n\tgetItemLevel?: ( item: Item ) => number;\n\tisLoading?: boolean;\n\tonChangeView: ( view: View ) => void;\n\tonChangeSelection: SetSelection;\n\tselection: string[];\n\tsetOpenedFilter: ( fieldId: string ) => void;\n\tonClickItem?: ( item: Item ) => void;\n\trenderItemLink?: (\n\t\tprops: {\n\t\t\titem: Item;\n\t\t} & ComponentProps< 'a' >\n\t) => ReactElement;\n\tisItemClickable: ( item: Item ) => boolean;\n\tview: View;\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 type SimpleFormField = {\n\tid: string;\n\tlayout?: 'regular' | 'panel';\n\tlabelPosition?: 'side' | 'top' | 'none';\n};\n\nexport type CombinedFormField = {\n\tid: string;\n\tlabel?: string;\n\tlayout?: 'regular' | 'panel';\n\tlabelPosition?: 'side' | 'top' | 'none';\n\tchildren: Array< FormField | string >;\n};\n\nexport type FormField = SimpleFormField | CombinedFormField;\n\n/**\n * The form configuration.\n */\nexport type Form = {\n\ttype?: 'regular' | 'panel';\n\tfields?: Array< FormField | string >;\n\tlabelPosition?: 'side' | 'top' | 'none';\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\nexport interface FieldLayoutProps< Item > {\n\tdata: Item;\n\tfield: FormField;\n\tonChange: ( value: any ) => void;\n\thideLabelFromVision?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -15,10 +15,23 @@ export function isItemValid(item, fields, form) {
|
|
|
15
15
|
const _fields = normalizeFields(fields.filter(({
|
|
16
16
|
id
|
|
17
17
|
}) => !!form.fields?.includes(id)));
|
|
18
|
+
const isEmptyNullOrUndefined = value => [undefined, '', null].includes(value);
|
|
18
19
|
return _fields.every(field => {
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const value = field.getValue({
|
|
21
|
+
item
|
|
21
22
|
});
|
|
23
|
+
if (field.isValid.required) {
|
|
24
|
+
if (field.type === 'text' && isEmptyNullOrUndefined(value) || field.type === 'email' && isEmptyNullOrUndefined(value) || field.type === 'integer' && isEmptyNullOrUndefined(value) || field.type === undefined && isEmptyNullOrUndefined(value)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (field.type === 'boolean' && value !== true) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (typeof field.isValid.custom === 'function' && field.isValid.custom(item, field) !== null) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
22
35
|
});
|
|
23
36
|
}
|
|
24
37
|
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["normalizeFields","isItemValid","item","fields","form","_fields","filter","id","includes","every","field","isValid","
|
|
1
|
+
{"version":3,"names":["normalizeFields","isItemValid","item","fields","form","_fields","filter","id","includes","isEmptyNullOrUndefined","value","undefined","every","field","getValue","isValid","required","type","custom"],"sources":["@wordpress/dataviews/src/validation.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { normalizeFields } from './normalize-fields';\nimport type { Field, Form } from './types';\n\n/**\n * Whether or not the given item's value is valid according to the fields and form config.\n *\n * @param item The item to validate.\n * @param fields Fields config.\n * @param form Form config.\n *\n * @return A boolean indicating if the item is valid (true) or not (false).\n */\nexport function isItemValid< Item >(\n\titem: Item,\n\tfields: Field< Item >[],\n\tform: Form\n): boolean {\n\tconst _fields = normalizeFields(\n\t\tfields.filter( ( { id } ) => !! form.fields?.includes( id ) )\n\t);\n\n\tconst isEmptyNullOrUndefined = ( value: any ) =>\n\t\t[ undefined, '', null ].includes( value );\n\n\treturn _fields.every( ( field ) => {\n\t\tconst value = field.getValue( { item } );\n\n\t\tif ( field.isValid.required ) {\n\t\t\tif (\n\t\t\t\t( field.type === 'text' && isEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'email' && isEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === 'integer' &&\n\t\t\t\t\tisEmptyNullOrUndefined( value ) ) ||\n\t\t\t\t( field.type === undefined && isEmptyNullOrUndefined( value ) )\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif ( field.type === 'boolean' && value !== true ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\ttypeof field.isValid.custom === 'function' &&\n\t\t\tfield.isValid.custom( item, field ) !== null\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,oBAAoB;AAGpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAC1BC,IAAU,EACVC,MAAuB,EACvBC,IAAU,EACA;EACV,MAAMC,OAAO,GAAGL,eAAe,CAC9BG,MAAM,CAACG,MAAM,CAAE,CAAE;IAAEC;EAAG,CAAC,KAAM,CAAC,CAAEH,IAAI,CAACD,MAAM,EAAEK,QAAQ,CAAED,EAAG,CAAE,CAC7D,CAAC;EAED,MAAME,sBAAsB,GAAKC,KAAU,IAC1C,CAAEC,SAAS,EAAE,EAAE,EAAE,IAAI,CAAE,CAACH,QAAQ,CAAEE,KAAM,CAAC;EAE1C,OAAOL,OAAO,CAACO,KAAK,CAAIC,KAAK,IAAM;IAClC,MAAMH,KAAK,GAAGG,KAAK,CAACC,QAAQ,CAAE;MAAEZ;IAAK,CAAE,CAAC;IAExC,IAAKW,KAAK,CAACE,OAAO,CAACC,QAAQ,EAAG;MAC7B,IACGH,KAAK,CAACI,IAAI,KAAK,MAAM,IAAIR,sBAAsB,CAAEC,KAAM,CAAC,IACxDG,KAAK,CAACI,IAAI,KAAK,OAAO,IAAIR,sBAAsB,CAAEC,KAAM,CAAG,IAC3DG,KAAK,CAACI,IAAI,KAAK,SAAS,IACzBR,sBAAsB,CAAEC,KAAM,CAAG,IAChCG,KAAK,CAACI,IAAI,KAAKN,SAAS,IAAIF,sBAAsB,CAAEC,KAAM,CAAG,EAC9D;QACD,OAAO,KAAK;MACb;MAEA,IAAKG,KAAK,CAACI,IAAI,KAAK,SAAS,IAAIP,KAAK,KAAK,IAAI,EAAG;QACjD,OAAO,KAAK;MACb;IACD;IAEA,IACC,OAAOG,KAAK,CAACE,OAAO,CAACG,MAAM,KAAK,UAAU,IAC1CL,KAAK,CAACE,OAAO,CAACG,MAAM,CAAEhB,IAAI,EAAEW,KAAM,CAAC,KAAK,IAAI,EAC3C;MACD,OAAO,KAAK;IACb;IAEA,OAAO,IAAI;EACZ,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -399,7 +399,9 @@
|
|
|
399
399
|
line-height: 1.4;
|
|
400
400
|
}
|
|
401
401
|
.dataviews-filters__summary-popover .components-popover__content {
|
|
402
|
-
width:
|
|
402
|
+
width: 100%;
|
|
403
|
+
min-width: 230px;
|
|
404
|
+
max-width: 250px;
|
|
403
405
|
border-radius: 4px;
|
|
404
406
|
}
|
|
405
407
|
.dataviews-filters__summary-popover.components-dropdown__content .components-popover__content {
|
|
@@ -1044,9 +1046,22 @@
|
|
|
1044
1046
|
|
|
1045
1047
|
.dataviews-view-grid {
|
|
1046
1048
|
margin-bottom: auto;
|
|
1049
|
+
display: grid;
|
|
1050
|
+
gap: 32px;
|
|
1047
1051
|
grid-template-rows: max-content;
|
|
1052
|
+
grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
|
|
1048
1053
|
padding: 0 48px 24px;
|
|
1049
1054
|
container-type: inline-size;
|
|
1055
|
+
/**
|
|
1056
|
+
* Breakpoints were adjusted from media queries breakpoints to account for
|
|
1057
|
+
* the sidebar width. This was done to match the existing styles we had.
|
|
1058
|
+
*/
|
|
1059
|
+
}
|
|
1060
|
+
@container (max-width: 480px) {
|
|
1061
|
+
.dataviews-view-grid {
|
|
1062
|
+
padding-right: 24px;
|
|
1063
|
+
padding-left: 24px;
|
|
1064
|
+
}
|
|
1050
1065
|
}
|
|
1051
1066
|
@media not (prefers-reduced-motion) {
|
|
1052
1067
|
.dataviews-view-grid {
|
|
@@ -1086,7 +1101,7 @@
|
|
|
1086
1101
|
width: 100%;
|
|
1087
1102
|
min-height: 200px;
|
|
1088
1103
|
aspect-ratio: 1/1;
|
|
1089
|
-
background-color: #
|
|
1104
|
+
background-color: #fff;
|
|
1090
1105
|
border-radius: 4px;
|
|
1091
1106
|
position: relative;
|
|
1092
1107
|
}
|
|
@@ -1140,40 +1155,6 @@
|
|
|
1140
1155
|
padding-bottom: 12px;
|
|
1141
1156
|
}
|
|
1142
1157
|
|
|
1143
|
-
.dataviews-view-grid.dataviews-view-grid {
|
|
1144
|
-
/**
|
|
1145
|
-
* Breakpoints were adjusted from media queries breakpoints to account for
|
|
1146
|
-
* the sidebar width. This was done to match the existing styles we had.
|
|
1147
|
-
*/
|
|
1148
|
-
}
|
|
1149
|
-
@container (max-width: 480px) {
|
|
1150
|
-
.dataviews-view-grid.dataviews-view-grid {
|
|
1151
|
-
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
1152
|
-
padding-right: 24px;
|
|
1153
|
-
padding-left: 24px;
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
@container (min-width: 480px) {
|
|
1157
|
-
.dataviews-view-grid.dataviews-view-grid {
|
|
1158
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
@container (min-width: 780px) {
|
|
1162
|
-
.dataviews-view-grid.dataviews-view-grid {
|
|
1163
|
-
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
@container (min-width: 1140px) {
|
|
1167
|
-
.dataviews-view-grid.dataviews-view-grid {
|
|
1168
|
-
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
@container (min-width: 1520px) {
|
|
1172
|
-
.dataviews-view-grid.dataviews-view-grid {
|
|
1173
|
-
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
1158
|
.dataviews-view-grid__field-value:empty,
|
|
1178
1159
|
.dataviews-view-grid__field:empty {
|
|
1179
1160
|
display: none;
|
|
@@ -1322,7 +1303,7 @@ div.dataviews-view-list {
|
|
|
1322
1303
|
overflow: hidden;
|
|
1323
1304
|
position: relative;
|
|
1324
1305
|
flex-shrink: 0;
|
|
1325
|
-
background-color: #
|
|
1306
|
+
background-color: #fff;
|
|
1326
1307
|
border-radius: 4px;
|
|
1327
1308
|
}
|
|
1328
1309
|
.dataviews-view-list .dataviews-view-list__media-wrapper img {
|
|
@@ -1574,6 +1555,26 @@ div.dataviews-view-list {
|
|
|
1574
1555
|
|
|
1575
1556
|
.dataviews-column-primary__media {
|
|
1576
1557
|
max-width: 60px;
|
|
1558
|
+
overflow: hidden;
|
|
1559
|
+
position: relative;
|
|
1560
|
+
flex-shrink: 0;
|
|
1561
|
+
background-color: #fff;
|
|
1562
|
+
border-radius: 4px;
|
|
1563
|
+
}
|
|
1564
|
+
.dataviews-column-primary__media img {
|
|
1565
|
+
width: 100%;
|
|
1566
|
+
height: 100%;
|
|
1567
|
+
object-fit: cover;
|
|
1568
|
+
}
|
|
1569
|
+
.dataviews-column-primary__media::after {
|
|
1570
|
+
content: "";
|
|
1571
|
+
position: absolute;
|
|
1572
|
+
top: 0;
|
|
1573
|
+
right: 0;
|
|
1574
|
+
width: 100%;
|
|
1575
|
+
height: 100%;
|
|
1576
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
1577
|
+
border-radius: 4px;
|
|
1577
1578
|
}
|
|
1578
1579
|
|
|
1579
1580
|
.dataviews-controls__datetime {
|
|
@@ -1581,11 +1582,24 @@ div.dataviews-view-list {
|
|
|
1581
1582
|
padding: 0;
|
|
1582
1583
|
}
|
|
1583
1584
|
|
|
1584
|
-
.dataviews-
|
|
1585
|
-
.dataviews-
|
|
1585
|
+
.dataviews-controls__relative-date-number,
|
|
1586
|
+
.dataviews-controls__relative-date-unit {
|
|
1586
1587
|
flex: 1 1 50%;
|
|
1587
1588
|
}
|
|
1588
1589
|
|
|
1590
|
+
.dataviews-controls__date input[type=date]::-webkit-inner-spin-button,
|
|
1591
|
+
.dataviews-controls__date input[type=date]::-webkit-calendar-picker-indicator {
|
|
1592
|
+
display: none;
|
|
1593
|
+
-webkit-appearance: none;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
.dataviews-controls__date-preset {
|
|
1597
|
+
border: 1px solid #ddd;
|
|
1598
|
+
}
|
|
1599
|
+
.dataviews-controls__date-preset:active {
|
|
1600
|
+
background-color: #000;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1589
1603
|
.dataforms-layouts-panel__field {
|
|
1590
1604
|
width: 100%;
|
|
1591
1605
|
min-height: 32px;
|
package/build-style/style.css
CHANGED
|
@@ -399,7 +399,9 @@
|
|
|
399
399
|
line-height: 1.4;
|
|
400
400
|
}
|
|
401
401
|
.dataviews-filters__summary-popover .components-popover__content {
|
|
402
|
-
width:
|
|
402
|
+
width: 100%;
|
|
403
|
+
min-width: 230px;
|
|
404
|
+
max-width: 250px;
|
|
403
405
|
border-radius: 4px;
|
|
404
406
|
}
|
|
405
407
|
.dataviews-filters__summary-popover.components-dropdown__content .components-popover__content {
|
|
@@ -1044,9 +1046,22 @@
|
|
|
1044
1046
|
|
|
1045
1047
|
.dataviews-view-grid {
|
|
1046
1048
|
margin-bottom: auto;
|
|
1049
|
+
display: grid;
|
|
1050
|
+
gap: 32px;
|
|
1047
1051
|
grid-template-rows: max-content;
|
|
1052
|
+
grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
|
|
1048
1053
|
padding: 0 48px 24px;
|
|
1049
1054
|
container-type: inline-size;
|
|
1055
|
+
/**
|
|
1056
|
+
* Breakpoints were adjusted from media queries breakpoints to account for
|
|
1057
|
+
* the sidebar width. This was done to match the existing styles we had.
|
|
1058
|
+
*/
|
|
1059
|
+
}
|
|
1060
|
+
@container (max-width: 480px) {
|
|
1061
|
+
.dataviews-view-grid {
|
|
1062
|
+
padding-left: 24px;
|
|
1063
|
+
padding-right: 24px;
|
|
1064
|
+
}
|
|
1050
1065
|
}
|
|
1051
1066
|
@media not (prefers-reduced-motion) {
|
|
1052
1067
|
.dataviews-view-grid {
|
|
@@ -1086,7 +1101,7 @@
|
|
|
1086
1101
|
width: 100%;
|
|
1087
1102
|
min-height: 200px;
|
|
1088
1103
|
aspect-ratio: 1/1;
|
|
1089
|
-
background-color: #
|
|
1104
|
+
background-color: #fff;
|
|
1090
1105
|
border-radius: 4px;
|
|
1091
1106
|
position: relative;
|
|
1092
1107
|
}
|
|
@@ -1140,40 +1155,6 @@
|
|
|
1140
1155
|
padding-bottom: 12px;
|
|
1141
1156
|
}
|
|
1142
1157
|
|
|
1143
|
-
.dataviews-view-grid.dataviews-view-grid {
|
|
1144
|
-
/**
|
|
1145
|
-
* Breakpoints were adjusted from media queries breakpoints to account for
|
|
1146
|
-
* the sidebar width. This was done to match the existing styles we had.
|
|
1147
|
-
*/
|
|
1148
|
-
}
|
|
1149
|
-
@container (max-width: 480px) {
|
|
1150
|
-
.dataviews-view-grid.dataviews-view-grid {
|
|
1151
|
-
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
1152
|
-
padding-left: 24px;
|
|
1153
|
-
padding-right: 24px;
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
@container (min-width: 480px) {
|
|
1157
|
-
.dataviews-view-grid.dataviews-view-grid {
|
|
1158
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
@container (min-width: 780px) {
|
|
1162
|
-
.dataviews-view-grid.dataviews-view-grid {
|
|
1163
|
-
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
@container (min-width: 1140px) {
|
|
1167
|
-
.dataviews-view-grid.dataviews-view-grid {
|
|
1168
|
-
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
@container (min-width: 1520px) {
|
|
1172
|
-
.dataviews-view-grid.dataviews-view-grid {
|
|
1173
|
-
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
1158
|
.dataviews-view-grid__field-value:empty,
|
|
1178
1159
|
.dataviews-view-grid__field:empty {
|
|
1179
1160
|
display: none;
|
|
@@ -1322,7 +1303,7 @@ div.dataviews-view-list {
|
|
|
1322
1303
|
overflow: hidden;
|
|
1323
1304
|
position: relative;
|
|
1324
1305
|
flex-shrink: 0;
|
|
1325
|
-
background-color: #
|
|
1306
|
+
background-color: #fff;
|
|
1326
1307
|
border-radius: 4px;
|
|
1327
1308
|
}
|
|
1328
1309
|
.dataviews-view-list .dataviews-view-list__media-wrapper img {
|
|
@@ -1574,6 +1555,26 @@ div.dataviews-view-list {
|
|
|
1574
1555
|
|
|
1575
1556
|
.dataviews-column-primary__media {
|
|
1576
1557
|
max-width: 60px;
|
|
1558
|
+
overflow: hidden;
|
|
1559
|
+
position: relative;
|
|
1560
|
+
flex-shrink: 0;
|
|
1561
|
+
background-color: #fff;
|
|
1562
|
+
border-radius: 4px;
|
|
1563
|
+
}
|
|
1564
|
+
.dataviews-column-primary__media img {
|
|
1565
|
+
width: 100%;
|
|
1566
|
+
height: 100%;
|
|
1567
|
+
object-fit: cover;
|
|
1568
|
+
}
|
|
1569
|
+
.dataviews-column-primary__media::after {
|
|
1570
|
+
content: "";
|
|
1571
|
+
position: absolute;
|
|
1572
|
+
top: 0;
|
|
1573
|
+
left: 0;
|
|
1574
|
+
width: 100%;
|
|
1575
|
+
height: 100%;
|
|
1576
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
|
|
1577
|
+
border-radius: 4px;
|
|
1577
1578
|
}
|
|
1578
1579
|
|
|
1579
1580
|
.dataviews-controls__datetime {
|
|
@@ -1581,11 +1582,24 @@ div.dataviews-view-list {
|
|
|
1581
1582
|
padding: 0;
|
|
1582
1583
|
}
|
|
1583
1584
|
|
|
1584
|
-
.dataviews-
|
|
1585
|
-
.dataviews-
|
|
1585
|
+
.dataviews-controls__relative-date-number,
|
|
1586
|
+
.dataviews-controls__relative-date-unit {
|
|
1586
1587
|
flex: 1 1 50%;
|
|
1587
1588
|
}
|
|
1588
1589
|
|
|
1590
|
+
.dataviews-controls__date input[type=date]::-webkit-inner-spin-button,
|
|
1591
|
+
.dataviews-controls__date input[type=date]::-webkit-calendar-picker-indicator {
|
|
1592
|
+
display: none;
|
|
1593
|
+
-webkit-appearance: none;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
.dataviews-controls__date-preset {
|
|
1597
|
+
border: 1px solid #ddd;
|
|
1598
|
+
}
|
|
1599
|
+
.dataviews-controls__date-preset:active {
|
|
1600
|
+
background-color: #000;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1589
1603
|
.dataforms-layouts-panel__field {
|
|
1590
1604
|
width: 100%;
|
|
1591
1605
|
min-height: 32px;
|
|
@@ -53,4 +53,25 @@ export declare const CombinedFields: {
|
|
|
53
53
|
type: string;
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
|
+
export declare const Validation: {
|
|
57
|
+
title: string;
|
|
58
|
+
render: ({ required }: {
|
|
59
|
+
required: boolean;
|
|
60
|
+
}) => import("react").JSX.Element;
|
|
61
|
+
argTypes: {
|
|
62
|
+
required: {
|
|
63
|
+
control: {
|
|
64
|
+
type: string;
|
|
65
|
+
};
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
args: {
|
|
70
|
+
required: boolean;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export declare const Visibility: {
|
|
74
|
+
title: string;
|
|
75
|
+
render: () => import("react").JSX.Element;
|
|
76
|
+
};
|
|
56
77
|
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/components/dataform/stories/index.story.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/components/dataform/stories/index.story.tsx"],"names":[],"mappings":"AAUA;;GAEG;AACH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAoBhC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;CAgBT,CAAC;AACF,eAAe,IAAI,CAAC;AAgGpB,eAAO,MAAM,OAAO,6BAGjB;IACF,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACtC,aAAa,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;CACnD,gCAoDA,CAAC;AAwDF,eAAO,MAAM,cAAc;;uCAnDxB;QACF,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;QACtC,aAAa,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;KACnD;;;;;;;;;;;;;;;;;;;;CAyDA,CAAC;AA2JF,eAAO,MAAM,UAAU;;2BAzH6B;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE;;;;;;;;;;;;CAqIxE,CAAC;AA+CF,eAAO,MAAM,UAAU;;;CAGtB,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,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAarE,OAAO,EACN,OAAO,IAAI,gBAAgB,EAE3B,aAAa,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,eAAe,MAAM,qBAAqB,CAAC;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MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,WAAW,EAgJ7B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAAK,EA2Y5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAE,KAAK,CAAE,EAoBvC,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAaxB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAAM,CAAE,WAAW,CAAE,EAwC1C,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAAK,CAAE,WAAW,CAAE,EAsGxC,CAAC"}
|
|
@@ -31,6 +31,7 @@ type DataViewsContextType<Item> = {
|
|
|
31
31
|
isItemClickable: (item: Item) => boolean;
|
|
32
32
|
containerWidth: number;
|
|
33
33
|
containerRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
34
|
+
resizeObserverRef: ((element?: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement>;
|
|
34
35
|
defaultLayouts: SupportedLayouts;
|
|
35
36
|
filters: NormalizedFilter[];
|
|
36
37
|
isShowingFilter: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources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AAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG3E,UAAU,oBAAoB;IAC7B,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,gBAAgB,CAAC;IACzB,YAAY,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IACrC,MAAM,EAAE,eAAe,CAAE,GAAG,CAAE,EAAE,CAAC;CACjC;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,EACpC,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,MAAM,GACN,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"input-widget.d.ts","sourceRoot":"","sources":["../../../src/components/dataviews-filters/input-widget.tsx"],"names":[],"mappings":"AAYA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG3E,UAAU,oBAAoB;IAC7B,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,gBAAgB,CAAC;IACzB,YAAY,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IACrC,MAAM,EAAE,eAAe,CAAE,GAAG,CAAE,EAAE,CAAC;CACjC;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,EACpC,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,MAAM,GACN,EAAE,oBAAoB,sCAkEtB"}
|
|
@@ -40,8 +40,8 @@ export declare const sortValues: {
|
|
|
40
40
|
readonly desc: "descending";
|
|
41
41
|
};
|
|
42
42
|
export declare const sortLabels: {
|
|
43
|
-
asc: import("@wordpress/i18n
|
|
44
|
-
desc: import("@wordpress/i18n
|
|
43
|
+
asc: import("@wordpress/i18n").TranslatableText<"Sort ascending">;
|
|
44
|
+
desc: import("@wordpress/i18n").TranslatableText<"Sort descending">;
|
|
45
45
|
};
|
|
46
46
|
export declare const sortIcons: {
|
|
47
47
|
asc: import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/dataform-controls/boolean.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/dataform-controls/boolean.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKrD,MAAM,CAAC,OAAO,UAAU,OAAO,CAAE,IAAI,EAAI,EACxC,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,mBAAmB,GACnB,EAAE,oBAAoB,CAAE,IAAI,CAAE,+BA4B9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/dataform-controls/date.tsx"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAiZrD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,IAAI,EAAI,EAC5C,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,mBAAmB,EACnB,QAAQ,GACR,EAAE,oBAAoB,CAAE,IAAI,CAAE,+BAmD9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime.d.ts","sourceRoot":"","sources":["../../src/dataform-controls/datetime.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"datetime.d.ts","sourceRoot":"","sources":["../../src/dataform-controls/datetime.tsx"],"names":[],"mappings":"AAMA;;GAEG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAMrD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAE,IAAI,EAAI,EACzC,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,mBAAmB,EACnB,QAAQ,GACR,EAAE,oBAAoB,CAAE,IAAI,CAAE,+BAuC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/dataform-controls/email.tsx"],"names":[],"mappings":"AAMA;;GAEG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/dataform-controls/email.tsx"],"names":[],"mappings":"AAMA;;GAEG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKrD,MAAM,CAAC,OAAO,UAAU,KAAK,CAAE,IAAI,EAAI,EACtC,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,mBAAmB,GACnB,EAAE,oBAAoB,CAAE,IAAI,CAAE,+BAuC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dataform-controls/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;GAEG;AACH,OAAO,KAAK,EACX,oBAAoB,EACpB,KAAK,EACL,mBAAmB,EACnB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dataform-controls/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;GAEG;AACH,OAAO,KAAK,EACX,oBAAoB,EACpB,KAAK,EACL,mBAAmB,EACnB,MAAM,UAAU,CAAC;AA6BlB,wBAAgB,UAAU,CAAE,IAAI,EAC/B,KAAK,EAAE,KAAK,CAAE,IAAI,CAAE,EACpB,mBAAmB,EAAE,mBAAmB,CAAE,IAAI,CAAE,+FAmBhD;AAED,wBAAgB,gBAAgB,CAAE,IAAI,EAAE,MAAM,4CAM7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integer.d.ts","sourceRoot":"","sources":["../../src/dataform-controls/integer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"integer.d.ts","sourceRoot":"","sources":["../../src/dataform-controls/integer.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AA6DrD,MAAM,CAAC,OAAO,UAAU,OAAO,CAAE,IAAI,EAAI,EACxC,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,mBAAmB,EACnB,QAAQ,GACR,EAAE,oBAAoB,CAAE,IAAI,CAAE,+BAsD9B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
interface RelativeDateControlProps {
|
|
2
|
+
id: string;
|
|
3
|
+
value: {
|
|
4
|
+
value?: string | number;
|
|
5
|
+
unit?: string;
|
|
6
|
+
};
|
|
7
|
+
onChange: (value: any) => void;
|
|
8
|
+
label: string;
|
|
9
|
+
hideLabelFromVision?: boolean;
|
|
10
|
+
options: {
|
|
11
|
+
value: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}[];
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const TIME_UNITS_OPTIONS: {
|
|
17
|
+
inThePast: ({
|
|
18
|
+
value: string;
|
|
19
|
+
label: import("@wordpress/i18n").TranslatableText<"Days">;
|
|
20
|
+
} | {
|
|
21
|
+
value: string;
|
|
22
|
+
label: import("@wordpress/i18n").TranslatableText<"Weeks">;
|
|
23
|
+
} | {
|
|
24
|
+
value: string;
|
|
25
|
+
label: import("@wordpress/i18n").TranslatableText<"Months">;
|
|
26
|
+
} | {
|
|
27
|
+
value: string;
|
|
28
|
+
label: import("@wordpress/i18n").TranslatableText<"Years">;
|
|
29
|
+
})[];
|
|
30
|
+
over: ({
|
|
31
|
+
value: string;
|
|
32
|
+
label: import("@wordpress/i18n").TranslatableText<"Days ago">;
|
|
33
|
+
} | {
|
|
34
|
+
value: string;
|
|
35
|
+
label: import("@wordpress/i18n").TranslatableText<"Weeks ago">;
|
|
36
|
+
} | {
|
|
37
|
+
value: string;
|
|
38
|
+
label: import("@wordpress/i18n").TranslatableText<"Months ago">;
|
|
39
|
+
} | {
|
|
40
|
+
value: string;
|
|
41
|
+
label: import("@wordpress/i18n").TranslatableText<"Years ago">;
|
|
42
|
+
})[];
|
|
43
|
+
};
|
|
44
|
+
export default function RelativeDateControl({ id, value, onChange, label, hideLabelFromVision, options, className, }: RelativeDateControlProps): import("react").JSX.Element;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=relative-date-control.d.ts.map
|