added 'action agissante', 'superposition' and 'proximité' fields

admin node edit boussole, over and hightlight on boussole or form-item mouseover
This commit is contained in:
Bachir Soussi Chiadmi 2023-04-25 18:03:11 +02:00
parent 7d989bad5d
commit 0608f7d91c
11 changed files with 324 additions and 31 deletions

View File

@ -4,8 +4,11 @@ status: true
dependencies:
config:
- field.field.node.entite.field_action
- field.field.node.entite.field_entite_agissante
- field.field.node.entite.field_menace_maintien
- field.field.node.entite.field_proximite
- field.field.node.entite.field_sources
- field.field.node.entite.field_superposition
- node.type.entite
module:
- advanced_text_formatter
@ -22,7 +25,7 @@ third_party_settings:
label: Details
region: content
parent_name: ''
weight: 4
weight: 1
format_type: details_sidebar
format_settings:
classes: ''
@ -32,6 +35,71 @@ third_party_settings:
description: ''
required_fields: true
weight: -100
group_tabs:
children:
- group_contenu
- group_superpositions
- group_proximites
label: Tabs
region: content
parent_name: ''
weight: 0
format_type: tabs
format_settings:
classes: ''
show_empty_fields: false
id: ''
direction: horizontal
width_breakpoint: 640
group_contenu:
children:
- title
- field_entite_agissante
- field_action
- field_menace_maintien
- field_sources
label: Contenu
region: content
parent_name: group_tabs
weight: 13
format_type: tab
format_settings:
classes: ''
show_empty_fields: false
id: ''
formatter: open
description: ''
required_fields: true
group_proximites:
children:
- field_proximite
label: Proximités
region: content
parent_name: group_tabs
weight: 15
format_type: tab
format_settings:
classes: ''
show_empty_fields: false
id: ''
formatter: closed
description: ''
required_fields: true
group_superpositions:
children:
- field_superposition
label: Superpositions
region: content
parent_name: group_tabs
weight: 14
format_type: tab
format_settings:
classes: ''
show_empty_fields: false
id: ''
formatter: closed
description: ''
required_fields: true
id: node.entite.default
targetEntityType: node
bundle: entite
@ -44,20 +112,6 @@ content:
settings: { }
third_party_settings: { }
field_action:
type: string_textarea
weight: 1
region: content
settings:
rows: 8
placeholder: ''
third_party_settings:
maxlength:
maxlength_js: null
maxlength_js_label: 'Contenu limité à @limit caractères, restant : <strong>@remaining</strong>'
maxlength_js_enforce: false
advanced_text_formatter:
show_token_tree: 0
field_menace_maintien:
type: string_textarea
weight: 2
region: content
@ -71,9 +125,40 @@ content:
maxlength_js_enforce: false
advanced_text_formatter:
show_token_tree: 0
field_entite_agissante:
type: boolean_checkbox
weight: 1
region: content
settings:
display_label: true
third_party_settings: { }
field_menace_maintien:
type: string_textarea
weight: 3
region: content
settings:
rows: 8
placeholder: ''
third_party_settings:
maxlength:
maxlength_js: null
maxlength_js_label: 'Contenu limité à @limit caractères, restant : <strong>@remaining</strong>'
maxlength_js_enforce: false
advanced_text_formatter:
show_token_tree: 0
field_proximite:
type: entity_reference_autocomplete
weight: 5
region: content
settings:
match_operator: CONTAINS
match_limit: 10
size: 60
placeholder: ''
third_party_settings: { }
field_sources:
type: paragraphs
weight: 3
weight: 4
region: content
settings:
title: Paragraphe
@ -89,6 +174,16 @@ content:
collapse_edit_all: collapse_edit_all
duplicate: duplicate
third_party_settings: { }
field_superposition:
type: entity_reference_autocomplete
weight: 6
region: content
settings:
match_operator: CONTAINS
match_limit: 10
size: 60
placeholder: ''
third_party_settings: { }
status:
type: boolean_checkbox
weight: 31

View File

@ -4,8 +4,11 @@ status: true
dependencies:
config:
- field.field.node.entite.field_action
- field.field.node.entite.field_entite_agissante
- field.field.node.entite.field_menace_maintien
- field.field.node.entite.field_proximite
- field.field.node.entite.field_sources
- field.field.node.entite.field_superposition
- node.type.entite
module:
- entity_reference_revisions
@ -22,6 +25,16 @@ content:
third_party_settings: { }
weight: 101
region: content
field_entite_agissante:
type: boolean
label: above
settings:
format: default
format_custom_false: ''
format_custom_true: ''
third_party_settings: { }
weight: 106
region: content
field_menace_maintien:
type: basic_string
label: above
@ -29,6 +42,14 @@ content:
third_party_settings: { }
weight: 102
region: content
field_proximite:
type: entity_reference_label
label: above
settings:
link: true
third_party_settings: { }
weight: 104
region: content
field_sources:
type: entity_reference_revisions_entity_view
label: above
@ -38,6 +59,14 @@ content:
third_party_settings: { }
weight: 103
region: content
field_superposition:
type: entity_reference_label
label: above
settings:
link: true
third_party_settings: { }
weight: 105
region: content
links:
settings: { }
third_party_settings: { }

View File

@ -5,8 +5,11 @@ dependencies:
config:
- core.entity_view_mode.node.teaser
- field.field.node.entite.field_action
- field.field.node.entite.field_entite_agissante
- field.field.node.entite.field_menace_maintien
- field.field.node.entite.field_proximite
- field.field.node.entite.field_sources
- field.field.node.entite.field_superposition
- node.type.entite
module:
- user
@ -22,7 +25,10 @@ content:
region: content
hidden:
field_action: true
field_entite_agissante: true
field_menace_maintien: true
field_proximite: true
field_sources: true
field_superposition: true
langcode: true
search_api_excerpt: true

View File

@ -0,0 +1,23 @@
uuid: 40172a2e-56e3-40d1-92c1-8d0c911ee810
langcode: fr
status: true
dependencies:
config:
- field.storage.node.field_entite_agissante
- node.type.entite
id: node.entite.field_entite_agissante
field_name: field_entite_agissante
entity_type: node
bundle: entite
label: 'Entite agissante'
description: ''
required: false
translatable: false
default_value:
-
value: 0
default_value_callback: ''
settings:
on_label: Activé
off_label: Désactivé
field_type: boolean

View File

@ -0,0 +1,28 @@
uuid: 450ee658-81f3-418c-a443-7422c174b8b3
langcode: fr
status: true
dependencies:
config:
- field.storage.node.field_proximite
- node.type.entite
id: node.entite.field_proximite
field_name: field_proximite
entity_type: node
bundle: entite
label: Proximité
description: ''
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:node'
handler_settings:
target_bundles:
entite: entite
sort:
field: _none
direction: ASC
auto_create: false
auto_create_bundle: ''
field_type: entity_reference

View File

@ -0,0 +1,28 @@
uuid: f3d5d8f1-f419-485e-bd13-261b26d7bbb0
langcode: fr
status: true
dependencies:
config:
- field.storage.node.field_superposition
- node.type.entite
id: node.entite.field_superposition
field_name: field_superposition
entity_type: node
bundle: entite
label: Superposition
description: ''
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:node'
handler_settings:
target_bundles:
entite: entite
sort:
field: _none
direction: ASC
auto_create: false
auto_create_bundle: ''
field_type: entity_reference

View File

@ -0,0 +1,18 @@
uuid: c1282e42-a56d-4e45-84fc-b600d93904e1
langcode: fr
status: true
dependencies:
module:
- node
id: node.field_entite_agissante
field_name: field_entite_agissante
entity_type: node
type: boolean
settings: { }
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@ -0,0 +1,19 @@
uuid: af04b192-2da8-4d00-8728-d04db546eb07
langcode: fr
status: true
dependencies:
module:
- node
id: node.field_proximite
field_name: field_proximite
entity_type: node
type: entity_reference
settings:
target_type: node
module: core
locked: false
cardinality: -1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@ -0,0 +1,19 @@
uuid: ebbf362e-80ee-4f54-8a2f-c9a442e80305
langcode: fr
status: true
dependencies:
module:
- node
id: node.field_superposition
field_name: field_superposition
entity_type: node
type: entity_reference
settings:
target_type: node
module: core
locked: false
cardinality: -1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@ -239,6 +239,11 @@
padding:0.5em;
border: 1px solid #bbb;
border-radius: 5px;
transition: all 2s ease-in-out;
}
#boussole-layout .form-item[data-drupal-selector="edit-field-entite"] table.field-multiple-table>tbody>tr>td:not(.field-multiple-drag)>div.entite-over{
border-color: #f00;
transition: all 0.2s ease-in-out;
}
#boussole-layout .form-item[data-drupal-selector="edit-field-entite"] table.field-multiple-table>tbody>tr>td:not(.field-multiple-drag) > div .horizontal-tabs-panes>details>.seven-details__wrapper{
@ -365,10 +370,17 @@ div.field--name-field-menace-maintien label{
transform: translate(-5px, -5px);
cursor:move;
}
#boussole-layout .boussole-wrapper .boussole .entity.entite-over{
background-color: #f00;
}
#boussole-layout .boussole-wrapper .boussole .entity.ajax-new{
background-color: #fff;
border: 1px solid black;
}
#boussole-layout .boussole-wrapper .boussole .entity.ajax-new.entite-over{
border: 1px solid red;
}
#boussole-layout .boussole-wrapper .boussole .entity.hide{
display: none;
}

View File

@ -1,11 +1,12 @@
(function ($, Drupal, once) {
var _boussole;
// behaviour is attached by preporcess ouatminimal_preprocess_field_multiple_value_form__field_entite__node_concernement() on ouatminimal.theme file
Drupal.behaviors.boussole = {
attach: function (context, settings) {
console.log("Drupal Boussole behavior", context);
let $boussole_wrapper = document.querySelector('#boussole-layout');
once('boussole-class-behaviour', '#boussole-layout', context).forEach(element => {
let tabs =
// let tabs =
// div.field-group-tabs-wrapper
// input.horizontal-tabs-active-tab
_boussole = new Boussole($boussole_wrapper);
@ -32,6 +33,7 @@
let $p = $entity.querySelector('.paragraphs-subform .field--name-field-prise input');
let $mm = $entity.querySelector('.paragraphs-subform .field--name-field-menace-maintien-degres input');
let e = {
form: $form,
wrapper:{
$dom: $entity,
id: id
@ -185,7 +187,8 @@
this.$container.append(this.$e);
console.log(this.$e);
this.updatePos();
this.initDraggable()
this.initOverEvents();
this.initDraggable();
}
updateDomElemt(){
@ -199,6 +202,32 @@
}
}
initOverEvents(){
// on mouseover point on boussole
this.$e.addEventListener('mouseenter', (event) => {
console.log('enter boussole entité', this.values);
this.values.wrapper.$dom.classList.add('entite-over');
// scroll to form item
var $tr = this.values.wrapper.$dom.closest("tr.draggable");
var top = $tr.offsetTop;
// console.log('offsetTop', top, $tr);
this.values.form.scrollTo({top: top, left: 0, behaviour: "smooth"});
});
this.$e.addEventListener('mouseleave', (event) => {
// console.log('leave boussole entité', this.values);
this.values.wrapper.$dom.classList.remove('entite-over');
});
// on mouseover formitem on drupal form
this.values.wrapper.$dom.addEventListener('mouseenter', (event) => {
this.$e.classList.add('entite-over');
})
this.values.wrapper.$dom.addEventListener('mouseleave', (event) => {
this.$e.classList.remove('entite-over');
})
}
initDraggable(){
this.$e.setAttribute('draggable', true);
this.$e.addEventListener('dragstart', event => {
@ -315,17 +344,4 @@
})(jQuery, Drupal, once);