mirror of
https://github.com/Combodo/iTop.git
synced 2026-08-17 11:18:21 +02:00
N°8772 - Form dependencies manager implementation
- Form SDK implementation - Basic Forms - Dynamics Forms - Basic Blocks + Data Model Block - Form Compilation - Turbo integration
This commit is contained in:
70
node_modules/tom-select/src/plugins/remove_button/plugin.scss
generated
vendored
Normal file
70
node_modules/tom-select/src/plugins/remove_button/plugin.scss
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
.#{$select-ns}-wrapper.plugin-remove_button{
|
||||
.item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.item .remove {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
padding: 0 $select-padding-item-x;
|
||||
border-radius: 0 2px 2px 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.item .remove:hover {
|
||||
background: rgba(0, 0, 0, 5%);
|
||||
}
|
||||
|
||||
&.disabled .item .remove:hover {
|
||||
background: none;
|
||||
}
|
||||
|
||||
|
||||
.remove-single {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
font-size: 23px;
|
||||
}
|
||||
}
|
||||
|
||||
.#{$select-ns}-wrapper.plugin-remove_button:not(.rtl){
|
||||
.item {
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
|
||||
.item .remove {
|
||||
border-left: 1px solid $select-color-item-border;
|
||||
margin-left: $select-padding-item-x;
|
||||
}
|
||||
|
||||
.item.active .remove {
|
||||
border-left-color: $select-color-item-active-border;
|
||||
}
|
||||
|
||||
&.disabled .item .remove {
|
||||
border-left-color: lighten(desaturate($select-color-item-border, 100%), $select-lighten-disabled-item-border);
|
||||
}
|
||||
}
|
||||
|
||||
.#{$select-ns}-wrapper.plugin-remove_button.rtl {
|
||||
.item {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
.item .remove {
|
||||
border-right: 1px solid $select-color-item-border;
|
||||
margin-right: $select-padding-item-x;
|
||||
}
|
||||
|
||||
.item.active .remove {
|
||||
border-right-color: $select-color-item-active-border;
|
||||
}
|
||||
|
||||
&.disabled .item .remove {
|
||||
border-right-color: lighten(desaturate($select-color-item-border, 100%), $select-lighten-disabled-item-border);
|
||||
}
|
||||
}
|
||||
78
node_modules/tom-select/src/plugins/remove_button/plugin.ts
generated
vendored
Normal file
78
node_modules/tom-select/src/plugins/remove_button/plugin.ts
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Plugin: "remove_button" (Tom Select)
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
||||
* file except in compliance with the License. You may obtain a copy of the License at:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
import type TomSelect from '../../tom-select.ts';
|
||||
import { getDom } from '../../vanilla.ts';
|
||||
import { escape_html, preventDefault, addEvent } from '../../utils.ts';
|
||||
import { TomOption, TomItem } from '../../types/index.ts';
|
||||
import { RBOptions } from './types.ts';
|
||||
|
||||
export default function(this:TomSelect, userOptions:RBOptions) {
|
||||
|
||||
const options = Object.assign({
|
||||
label : '×',
|
||||
title : 'Remove',
|
||||
className : 'remove',
|
||||
append : true
|
||||
}, userOptions);
|
||||
|
||||
|
||||
//options.className = 'remove-single';
|
||||
var self = this;
|
||||
|
||||
// override the render method to add remove button to each item
|
||||
if( !options.append ){
|
||||
return;
|
||||
}
|
||||
|
||||
var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
|
||||
|
||||
self.hook('after','setupTemplates',() => {
|
||||
|
||||
var orig_render_item = self.settings.render.item;
|
||||
|
||||
self.settings.render.item = (data:TomOption, escape:typeof escape_html) => {
|
||||
|
||||
var item = getDom(orig_render_item.call(self, data, escape)) as TomItem;
|
||||
|
||||
var close_button = getDom(html);
|
||||
item.appendChild(close_button);
|
||||
|
||||
addEvent(close_button,'mousedown',(evt) => {
|
||||
preventDefault(evt,true);
|
||||
});
|
||||
|
||||
addEvent(close_button,'click',(evt) => {
|
||||
|
||||
if( self.isLocked ) return;
|
||||
|
||||
// propagating will trigger the dropdown to show for single mode
|
||||
preventDefault(evt,true);
|
||||
|
||||
if( self.isLocked ) return;
|
||||
if( !self.shouldDelete([item],evt as MouseEvent) ) return;
|
||||
|
||||
self.removeItem(item);
|
||||
self.refreshOptions(false);
|
||||
self.inputState();
|
||||
});
|
||||
|
||||
return item;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
7
node_modules/tom-select/src/plugins/remove_button/types.ts
generated
vendored
Normal file
7
node_modules/tom-select/src/plugins/remove_button/types.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
export type RBOptions = {
|
||||
label ?: string,
|
||||
title ?: string,
|
||||
className ?: string,
|
||||
append ?: boolean
|
||||
};
|
||||
Reference in New Issue
Block a user