remove form.js and tab

This commit is contained in:
wxiaoguang 2025-03-11 01:20:57 +08:00
parent e5c11584b2
commit eb500e15fd
9 changed files with 34 additions and 3125 deletions

View File

@ -18,6 +18,7 @@
@import "./modules/checkbox.css";
@import "./modules/dimmer.css";
@import "./modules/modal.css";
@import "./modules/tab.css";
@import "./modules/tippy.css";
@import "./modules/breadcrumb.css";

View File

@ -0,0 +1,7 @@
.ui.tab {
display: none;
}
.ui.tab.active {
display: block;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,86 +0,0 @@
/*!
* # Fomantic-UI - Tab
* http://github.com/fomantic/Fomantic-UI/
*
*
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
UI Tabs
*******************************/
.ui.tab {
display: none;
}
/*******************************
States
*******************************/
/*--------------------
Active
---------------------*/
.ui.tab.active,
.ui.tab.open {
display: block;
}
/*--------------------
Loading
---------------------*/
.ui.tab.loading {
position: relative;
overflow: hidden;
display: block;
min-height: 250px;
}
.ui.tab.loading * {
position: relative !important;
left: -10000px !important;
}
.ui.tab.loading:before,
.ui.tab.loading.segment:before {
position: absolute;
content: '';
top: 50%;
left: 50%;
margin: -1.25em 0 0 -1.25em;
width: 2.5em;
height: 2.5em;
border-radius: 500rem;
border: 0.2em solid rgba(0, 0, 0, 0.1);
}
.ui.tab.loading:after,
.ui.tab.loading.segment:after {
position: absolute;
content: '';
top: 50%;
left: 50%;
margin: -1.25em 0 0 -1.25em;
width: 2.5em;
height: 2.5em;
animation: loader 0.6s infinite linear;
border: 0.2em solid #767676;
border-radius: 500rem;
box-shadow: 0 0 0 1px transparent;
}
/*******************************
Tab Overrides
*******************************/
/*******************************
User Overrides
*******************************/

File diff suppressed because it is too large Load Diff

View File

@ -2,4 +2,3 @@
@import "./components/form.css";
@import "./components/modal.css";
@import "./components/search.css";
@import "./components/tab.css";

View File

@ -1,9 +1,7 @@
import './components/api.js';
import './components/dropdown.js';
import './components/form.js';
import './components/modal.js';
import './components/search.js';
import './components/tab.js';
// Hard forked from Fomantic 2.8.7

View File

@ -7,14 +7,13 @@ import {initAriaModalPatch} from './fomantic/modal.ts';
import {initFomanticTransition} from './fomantic/transition.ts';
import {initFomanticDimmer} from './fomantic/dimmer.ts';
import {svg} from '../svg.ts';
import {initFomanticTab} from './fomantic/tab.ts';
export const fomanticMobileScreen = window.matchMedia('only screen and (max-width: 767.98px)');
export function initGiteaFomantic() {
// our extensions
$.fn.fomanticExt = {};
// Silence fomantic's error logging when tabs are used without a target content element
$.fn.tab.settings.silent = true;
// By default, use "exact match" for full text search
$.fn.dropdown.settings.fullTextSearch = 'exact';
// Do not use "cursor: pointer" for dropdown labels
@ -27,6 +26,7 @@ export function initGiteaFomantic() {
initFomanticTransition();
initFomanticDimmer();
initFomanticTab();
initFomanticApiPatch();
// Use the patches to improve accessibility, these patches are designed to be as independent as possible, make it easy to modify or remove in the future.

View File

@ -0,0 +1,24 @@
import $ from 'jquery';
import {queryElemSiblings} from '../../utils/dom.ts';
export function initFomanticTab() {
$.fn.tab = function (this: any, arg0: any) {
const autoTabActivation = arg0?.autoTabActivation;
for (const elBtn of this) {
const tabName = elBtn.getAttribute('data-tab');
if (!tabName) continue;
elBtn.addEventListener('click', () => {
const elTab = document.querySelector(`.ui.tab[data-tab="${tabName}"]`);
queryElemSiblings(elTab, `.ui.tab`, (el) => el.classList.remove('active'));
queryElemSiblings(elBtn, `[data-tab]`, (el) => el.classList.remove('active'));
elBtn.classList.add('active');
elTab.classList.add('active');
});
if (autoTabActivation && elBtn.classList.contains('active')) {
const elTab = elBtn.querySelector(`.ui.tab[data-tab="${tabName}"]`);
elTab.classList.add('active');
}
}
return this;
};
}