mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +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:
17
node_modules/tom-select/dist/cjs/plugins/checkbox_options/plugin.d.ts
generated
vendored
Normal file
17
node_modules/tom-select/dist/cjs/plugins/checkbox_options/plugin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Plugin: "checkbox_options" (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 { CBOptions } from './types.ts';
|
||||
export default function (this: TomSelect, userOptions: CBOptions): void;
|
||||
108
node_modules/tom-select/dist/cjs/plugins/checkbox_options/plugin.js
generated
vendored
Normal file
108
node_modules/tom-select/dist/cjs/plugins/checkbox_options/plugin.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Plugin: "checkbox_options" (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.
|
||||
*
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
const utils_ts_1 = require("../../utils.js");
|
||||
const vanilla_ts_1 = require("../../vanilla.js");
|
||||
function default_1(userOptions) {
|
||||
var self = this;
|
||||
var orig_onOptionSelect = self.onOptionSelect;
|
||||
self.settings.hideSelected = false;
|
||||
const cbOptions = Object.assign({
|
||||
// so that the user may add different ones as well
|
||||
className: "tomselect-checkbox",
|
||||
// the following default to the historic plugin's values
|
||||
checkedClassNames: undefined,
|
||||
uncheckedClassNames: undefined,
|
||||
}, userOptions);
|
||||
var UpdateChecked = function (checkbox, toCheck) {
|
||||
if (toCheck) {
|
||||
checkbox.checked = true;
|
||||
if (cbOptions.uncheckedClassNames) {
|
||||
checkbox.classList.remove(...cbOptions.uncheckedClassNames);
|
||||
}
|
||||
if (cbOptions.checkedClassNames) {
|
||||
checkbox.classList.add(...cbOptions.checkedClassNames);
|
||||
}
|
||||
}
|
||||
else {
|
||||
checkbox.checked = false;
|
||||
if (cbOptions.checkedClassNames) {
|
||||
checkbox.classList.remove(...cbOptions.checkedClassNames);
|
||||
}
|
||||
if (cbOptions.uncheckedClassNames) {
|
||||
checkbox.classList.add(...cbOptions.uncheckedClassNames);
|
||||
}
|
||||
}
|
||||
};
|
||||
// update the checkbox for an option
|
||||
var UpdateCheckbox = function (option) {
|
||||
setTimeout(() => {
|
||||
var checkbox = option.querySelector('input.' + cbOptions.className);
|
||||
if (checkbox instanceof HTMLInputElement) {
|
||||
UpdateChecked(checkbox, option.classList.contains('selected'));
|
||||
}
|
||||
}, 1);
|
||||
};
|
||||
// add checkbox to option template
|
||||
self.hook('after', 'setupTemplates', () => {
|
||||
var orig_render_option = self.settings.render.option;
|
||||
self.settings.render.option = ((data, escape_html) => {
|
||||
var rendered = (0, vanilla_ts_1.getDom)(orig_render_option.call(self, data, escape_html));
|
||||
var checkbox = document.createElement('input');
|
||||
if (cbOptions.className) {
|
||||
checkbox.classList.add(cbOptions.className);
|
||||
}
|
||||
checkbox.addEventListener('click', function (evt) {
|
||||
(0, utils_ts_1.preventDefault)(evt);
|
||||
});
|
||||
checkbox.type = 'checkbox';
|
||||
const hashed = (0, utils_ts_1.hash_key)(data[self.settings.valueField]);
|
||||
UpdateChecked(checkbox, !!(hashed && self.items.indexOf(hashed) > -1));
|
||||
rendered.prepend(checkbox);
|
||||
return rendered;
|
||||
});
|
||||
});
|
||||
// uncheck when item removed
|
||||
self.on('item_remove', (value) => {
|
||||
var option = self.getOption(value);
|
||||
if (option) { // if dropdown hasn't been opened yet, the option won't exist
|
||||
option.classList.remove('selected'); // selected class won't be removed yet
|
||||
UpdateCheckbox(option);
|
||||
}
|
||||
});
|
||||
// check when item added
|
||||
self.on('item_add', (value) => {
|
||||
var option = self.getOption(value);
|
||||
if (option) { // if dropdown hasn't been opened yet, the option won't exist
|
||||
UpdateCheckbox(option);
|
||||
}
|
||||
});
|
||||
// remove items when selected option is clicked
|
||||
self.hook('instead', 'onOptionSelect', (evt, option) => {
|
||||
if (option.classList.contains('selected')) {
|
||||
option.classList.remove('selected');
|
||||
self.removeItem(option.dataset.value);
|
||||
self.refreshOptions();
|
||||
(0, utils_ts_1.preventDefault)(evt, true);
|
||||
return;
|
||||
}
|
||||
orig_onOptionSelect.call(self, evt, option);
|
||||
UpdateCheckbox(option);
|
||||
});
|
||||
}
|
||||
;
|
||||
//# sourceMappingURL=plugin.js.map
|
||||
1
node_modules/tom-select/dist/cjs/plugins/checkbox_options/plugin.js.map
generated
vendored
Normal file
1
node_modules/tom-select/dist/cjs/plugins/checkbox_options/plugin.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../src/plugins/checkbox_options/plugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AASH,4BA2GC;AAhHD,6CAA0D;AAC1D,iDAA0C;AAI1C,mBAAwC,WAAqB;I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,GAAG,EAAE,MAAM,CAAC,CAAC;QAE5C,cAAc,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;AAEJ,CAAC;AAAA,CAAC"}
|
||||
14
node_modules/tom-select/dist/cjs/plugins/checkbox_options/types.d.ts
generated
vendored
Normal file
14
node_modules/tom-select/dist/cjs/plugins/checkbox_options/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export type CBOptions = {
|
||||
/**
|
||||
* a unique class name for the checkbox to find the input
|
||||
*/
|
||||
className?: string;
|
||||
/**
|
||||
* class name to add if checkbox is checked and remove otherwise
|
||||
*/
|
||||
checkedClassNames?: string[];
|
||||
/**
|
||||
* class name to add if checkbox was not checked and remove otherwise
|
||||
*/
|
||||
uncheckedClassNames?: string[];
|
||||
};
|
||||
3
node_modules/tom-select/dist/cjs/plugins/checkbox_options/types.js
generated
vendored
Normal file
3
node_modules/tom-select/dist/cjs/plugins/checkbox_options/types.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/tom-select/dist/cjs/plugins/checkbox_options/types.js.map
generated
vendored
Normal file
1
node_modules/tom-select/dist/cjs/plugins/checkbox_options/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/plugins/checkbox_options/types.ts"],"names":[],"mappings":""}
|
||||
Reference in New Issue
Block a user