corvée(dépendances) ajoute Carbon Fields
This commit is contained in:
parent
135cc65eed
commit
62368587e5
459 changed files with 72750 additions and 26 deletions
55
web/vendor/htmlburger/carbon-fields/packages/blocks/fields/association/index.js
vendored
Normal file
55
web/vendor/htmlburger/carbon-fields/packages/blocks/fields/association/index.js
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* External dependencies.
|
||||
*/
|
||||
import { addFilter } from '@wordpress/hooks';
|
||||
import { select } from '@wordpress/data';
|
||||
import { get, find } from 'lodash';
|
||||
|
||||
/**
|
||||
* Carbon Fields dependencies.
|
||||
*/
|
||||
import { withProps } from '@carbon-fields/core';
|
||||
|
||||
/**
|
||||
* Internal dependencies.
|
||||
*/
|
||||
import './style.scss';
|
||||
|
||||
addFilter( 'carbon-fields.association.block', 'carbon-fields/blocks', withProps( ( props ) => {
|
||||
return {
|
||||
hierarchyResolver() {
|
||||
// Get the block that contains the field.
|
||||
const block = select( 'core/block-editor' ).getBlock( props.blockId );
|
||||
|
||||
// Get the path.
|
||||
const path = props.id.split( '__' );
|
||||
|
||||
// Remove the chunk that contains the block identifier.
|
||||
path.shift();
|
||||
|
||||
// Get the hierarchy.
|
||||
let hierarchy = path.shift();
|
||||
let accessor = `data.${ hierarchy }`;
|
||||
|
||||
// Visit every branch in the tree so we can get the full hierarchy.
|
||||
while ( path.length > 0 ) {
|
||||
const chunk = path.shift();
|
||||
const isGroup = chunk.indexOf( 'cf-' ) === 0;
|
||||
|
||||
if ( isGroup ) {
|
||||
const groups = get( block.attributes, `${ accessor }` );
|
||||
const group = find( groups, [ '_id', chunk ] );
|
||||
const groupIndex = groups.indexOf( group );
|
||||
|
||||
accessor = `${ accessor }.${ groupIndex }`;
|
||||
hierarchy = `${ hierarchy }[${ groupIndex }]:${ group._type }/`;
|
||||
} else {
|
||||
accessor = `${ accessor }.${ chunk }`;
|
||||
hierarchy = `${ hierarchy }${ chunk }`;
|
||||
}
|
||||
}
|
||||
|
||||
return hierarchy;
|
||||
}
|
||||
};
|
||||
} ) );
|
||||
72
web/vendor/htmlburger/carbon-fields/packages/blocks/fields/association/style.scss
vendored
Normal file
72
web/vendor/htmlburger/carbon-fields/packages/blocks/fields/association/style.scss
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/* ==========================================================================
|
||||
Association
|
||||
========================================================================== */
|
||||
|
||||
.cf-association__cols {
|
||||
.block-editor & {
|
||||
border-top-width: 1px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.edit-post-sidebar & {
|
||||
border-color: $gb-dark-gray-150;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.edit-post-sidebar &::before {
|
||||
background-color: $gb-dark-gray-150;
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.cf-association__counter {
|
||||
.edit-post-sidebar & {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.cf-association__option {
|
||||
.edit-post-sidebar & {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.edit-post-sidebar & + & {
|
||||
border-top-color: $gb-dark-gray-150;
|
||||
}
|
||||
}
|
||||
|
||||
.cf-association__option-thumb {
|
||||
.edit-post-sidebar & {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.cf-association__option-content {
|
||||
.edit-post-sidebar & {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.cf-association__option-title {
|
||||
.edit-post-sidebar & {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.cf-association__option-actions {
|
||||
.edit-post-sidebar .cf-association__col:first-child & {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.edit-post-sidebar & {
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.cf-association__option-action {
|
||||
.edit-post-sidebar &--edit {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue