mirror of
https://github.com/ae-utbm/sith.git
synced 2026-02-16 04:18:17 +00:00
@@ -1,7 +1,7 @@
|
||||
import { limitedChoices } from "#core:alpine/limited-choices";
|
||||
import { alpinePlugin as notificationPlugin } from "#core:utils/notifications";
|
||||
import sort from "@alpinejs/sort";
|
||||
import Alpine from "alpinejs";
|
||||
import { limitedChoices } from "#core:alpine/limited-choices.ts";
|
||||
import { alpinePlugin as notificationPlugin } from "#core:utils/notifications.ts";
|
||||
|
||||
Alpine.plugin([sort, limitedChoices]);
|
||||
Alpine.magic("notifications", notificationPlugin);
|
||||
|
||||
@@ -56,7 +56,7 @@ export function limitedChoices(Alpine: AlpineType) {
|
||||
effect(() => {
|
||||
getMaxChoices((value: string) => {
|
||||
const previousValue = maxChoices;
|
||||
maxChoices = Number.parseInt(value);
|
||||
maxChoices = Number.parseInt(value, 10);
|
||||
if (maxChoices < previousValue) {
|
||||
// The maximum number of selectable items has been lowered.
|
||||
// Some currently selected elements may need to be removed
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { inheritHtmlElement } from "#core:utils/web-components";
|
||||
import TomSelect from "tom-select";
|
||||
import type {
|
||||
RecursivePartial,
|
||||
@@ -7,6 +6,7 @@ import type {
|
||||
TomSettings,
|
||||
} from "tom-select/dist/types/types";
|
||||
import type { escape_html } from "tom-select/dist/types/utils";
|
||||
import { inheritHtmlElement } from "#core:utils/web-components.ts";
|
||||
|
||||
export class AutoCompleteSelectBase extends inheritHtmlElement("select") {
|
||||
static observedAttributes = [
|
||||
@@ -29,7 +29,7 @@ export class AutoCompleteSelectBase extends inheritHtmlElement("select") {
|
||||
) {
|
||||
switch (name) {
|
||||
case "delay": {
|
||||
this.delay = Number.parseInt(newValue) ?? null;
|
||||
this.delay = Number.parseInt(newValue, 10) ?? null;
|
||||
break;
|
||||
}
|
||||
case "placeholder": {
|
||||
@@ -37,11 +37,11 @@ export class AutoCompleteSelectBase extends inheritHtmlElement("select") {
|
||||
break;
|
||||
}
|
||||
case "max": {
|
||||
this.max = Number.parseInt(newValue) ?? null;
|
||||
this.max = Number.parseInt(newValue, 10) ?? null;
|
||||
break;
|
||||
}
|
||||
case "min-characters-for-search": {
|
||||
this.minCharNumberForSearch = Number.parseInt(newValue) ?? 0;
|
||||
this.minCharNumberForSearch = Number.parseInt(newValue, 10) ?? 0;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
import "tom-select/dist/css/tom-select.default.css";
|
||||
import { registerComponent } from "#core:utils/web-components";
|
||||
import type { TomOption } from "tom-select/dist/types/types";
|
||||
import type { escape_html } from "tom-select/dist/types/utils";
|
||||
import {
|
||||
type GroupSchema,
|
||||
type SithFileSchema,
|
||||
type UserProfileSchema,
|
||||
groupSearchGroup,
|
||||
sithfileSearchFiles,
|
||||
userSearchUsers,
|
||||
} from "#openapi";
|
||||
|
||||
import {
|
||||
AjaxSelect,
|
||||
AutoCompleteSelectBase,
|
||||
} from "#core:core/components/ajax-select-base";
|
||||
} from "#core:core/components/ajax-select-base.ts";
|
||||
import { registerComponent } from "#core:utils/web-components.ts";
|
||||
import {
|
||||
type GroupSchema,
|
||||
groupSearchGroup,
|
||||
type SithFileSchema,
|
||||
sithfileSearchFiles,
|
||||
type UserProfileSchema,
|
||||
userSearchUsers,
|
||||
} from "#openapi";
|
||||
|
||||
@registerComponent("autocomplete-select")
|
||||
export class AutoCompleteSelect extends AutoCompleteSelectBase {}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// biome-ignore lint/correctness/noUndeclaredDependencies: shipped by easymde
|
||||
import "codemirror/lib/codemirror.css";
|
||||
import "easymde/src/css/easymde.css";
|
||||
import { inheritHtmlElement, registerComponent } from "#core:utils/web-components";
|
||||
// biome-ignore lint/correctness/noUndeclaredDependencies: Imported by EasyMDE
|
||||
import type CodeMirror from "codemirror";
|
||||
// biome-ignore lint/style/useNamingConvention: This is how they called their namespace
|
||||
import EasyMDE from "easymde";
|
||||
import { inheritHtmlElement, registerComponent } from "#core:utils/web-components.ts";
|
||||
import {
|
||||
type UploadUploadImageErrors,
|
||||
markdownRenderMarkdown,
|
||||
type UploadUploadImageErrors,
|
||||
uploadUploadImage,
|
||||
} from "#openapi";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { inheritHtmlElement, registerComponent } from "#core:utils/web-components";
|
||||
import { inheritHtmlElement, registerComponent } from "#core:utils/web-components.ts";
|
||||
|
||||
/**
|
||||
* Web component used to import css files only once
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { inheritHtmlElement, registerComponent } from "#core:utils/web-components";
|
||||
import { inheritHtmlElement, registerComponent } from "#core:utils/web-components.ts";
|
||||
|
||||
@registerComponent("nfc-input")
|
||||
export class NfcInput extends inheritHtmlElement("input") {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { registerComponent } from "#core:utils/web-components";
|
||||
import { html, render } from "lit-html";
|
||||
import { unsafeHTML } from "lit-html/directives/unsafe-html.js";
|
||||
import { registerComponent } from "#core:utils/web-components.ts";
|
||||
|
||||
@registerComponent("ui-tab")
|
||||
export class Tab extends HTMLElement {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { exportToHtml } from "#core:utils/globals";
|
||||
import { exportToHtml } from "#core:utils/globals.ts";
|
||||
|
||||
exportToHtml("showMenu", () => {
|
||||
const navbar = document.getElementById("navbar-content");
|
||||
|
||||
@@ -26,7 +26,7 @@ function showMore(element: HTMLElement) {
|
||||
const fullContent = element.innerHTML;
|
||||
const clippedContent = clip(
|
||||
element.innerHTML,
|
||||
Number.parseInt(element.getAttribute("show-more") as string),
|
||||
Number.parseInt(element.getAttribute("show-more") as string, 10),
|
||||
{
|
||||
html: true,
|
||||
},
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
type Placement,
|
||||
autoPlacement,
|
||||
computePosition,
|
||||
flip,
|
||||
offset,
|
||||
type Placement,
|
||||
size,
|
||||
} from "@floating-ui/dom";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { exportToHtml } from "#core:utils/globals";
|
||||
// biome-ignore lint/style/noNamespaceImport: this is the recommended way from the documentation
|
||||
// biome-ignore lint/performance/noNamespaceImport: this is the recommended way from the documentation
|
||||
import * as Sentry from "@sentry/browser";
|
||||
import { exportToHtml } from "#core:utils/globals.ts";
|
||||
|
||||
interface LoggedUser {
|
||||
name: string;
|
||||
|
||||
3
core/static/bundled/types/web-nfc.d.ts
vendored
3
core/static/bundled/types/web-nfc.d.ts
vendored
@@ -8,7 +8,6 @@
|
||||
|
||||
// This has been modified to not trigger biome linting
|
||||
|
||||
// biome-ignore lint/correctness/noUnusedVariables: this is the official definition
|
||||
interface Window {
|
||||
// biome-ignore lint/style/useNamingConvention: this is the official API name
|
||||
NDEFMessage: NDEFMessage;
|
||||
@@ -28,7 +27,6 @@ declare interface NDEFMessageInit {
|
||||
// biome-ignore lint/style/useNamingConvention: this is the official API name
|
||||
declare type NDEFRecordDataSource = string | BufferSource | NDEFMessageInit;
|
||||
|
||||
// biome-ignore lint/correctness/noUnusedVariables: this is the official definition
|
||||
interface Window {
|
||||
// biome-ignore lint/style/useNamingConvention: this is the official API name
|
||||
NDEFRecord: NDEFRecord;
|
||||
@@ -74,7 +72,6 @@ declare class NDEFReader extends EventTarget {
|
||||
makeReadOnly: (options?: NDEFMakeReadOnlyOptions) => Promise<void>;
|
||||
}
|
||||
|
||||
// biome-ignore lint/correctness/noUnusedVariables: this is the official definition
|
||||
interface Window {
|
||||
// biome-ignore lint/style/useNamingConvention: this is the official API name
|
||||
NDEFReadingEvent: NDEFReadingEvent;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { History, initialUrlParams, updateQueryString } from "#core:utils/history";
|
||||
import cytoscape, {
|
||||
type ElementDefinition,
|
||||
type NodeSingular,
|
||||
@@ -6,7 +5,8 @@ import cytoscape, {
|
||||
} from "cytoscape";
|
||||
import cxtmenu from "cytoscape-cxtmenu";
|
||||
import klay, { type KlayLayoutOptions } from "cytoscape-klay";
|
||||
import { type UserProfileSchema, familyGetFamilyGraph } from "#openapi";
|
||||
import { History, initialUrlParams, updateQueryString } from "#core:utils/history.ts";
|
||||
import { familyGetFamilyGraph, type UserProfileSchema } from "#openapi";
|
||||
|
||||
cytoscape.use(klay);
|
||||
cytoscape.use(cxtmenu);
|
||||
@@ -200,7 +200,7 @@ document.addEventListener("alpine:init", () => {
|
||||
isZoomEnabled: !isMobile(),
|
||||
|
||||
getInitialDepth(prop: string) {
|
||||
const value = Number.parseInt(initialUrlParams.get(prop));
|
||||
const value = Number.parseInt(initialUrlParams.get(prop), 10);
|
||||
if (Number.isNaN(value) || value < config.depthMin || value > config.depthMax) {
|
||||
return defaultDepth;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { client, type Options } from "#openapi";
|
||||
import type { Client, RequestResult, TDataShape } from "#openapi:client";
|
||||
import { type Options, client } from "#openapi";
|
||||
|
||||
export interface PaginatedResponse<T> {
|
||||
count: number;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { NestedKeyOf } from "#core:utils/types";
|
||||
import type { NestedKeyOf } from "#core:utils/types.ts";
|
||||
|
||||
interface StringifyOptions<T extends object> {
|
||||
/** The columns to include in the resulting CSV. */
|
||||
|
||||
@@ -10,7 +10,6 @@ export function registerComponent(name: string, options?: ElementDefinitionOptio
|
||||
window.customElements.define(name, component, options);
|
||||
} catch (e) {
|
||||
if (e instanceof DOMException) {
|
||||
// biome-ignore lint/suspicious/noConsole: it's handy to troobleshot
|
||||
console.warn(e.message);
|
||||
return;
|
||||
}
|
||||
|
||||
124
core/static/core/js/shorten.min.js
vendored
124
core/static/core/js/shorten.min.js
vendored
@@ -1,124 +0,0 @@
|
||||
// Copyright 2013 Viral Patel and other contributors
|
||||
// http://viralpatel.net
|
||||
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
!(function (e) {
|
||||
e.fn.shorten = function (s) {
|
||||
"use strict";
|
||||
var t = {
|
||||
showChars: 100,
|
||||
minHideChars: 10,
|
||||
ellipsesText: "...",
|
||||
moreText: "more",
|
||||
lessText: "less",
|
||||
onLess: function () {},
|
||||
onMore: function () {},
|
||||
errMsg: null,
|
||||
force: !1,
|
||||
};
|
||||
return (
|
||||
s && e.extend(t, s),
|
||||
(!e(this).data("jquery.shorten") || !!t.force) &&
|
||||
(e(this).data("jquery.shorten", !0),
|
||||
e(document).off("click", ".morelink"),
|
||||
e(document).on(
|
||||
{
|
||||
click: function () {
|
||||
var s = e(this);
|
||||
return (
|
||||
s.hasClass("less")
|
||||
? (s.removeClass("less"),
|
||||
s.html(t.moreText),
|
||||
s
|
||||
.parent()
|
||||
.prev()
|
||||
.animate({}, function () {
|
||||
s.parent().prev().prev().show();
|
||||
})
|
||||
.hide("fast", function () {
|
||||
t.onLess();
|
||||
}))
|
||||
: (s.addClass("less"),
|
||||
s.html(t.lessText),
|
||||
s
|
||||
.parent()
|
||||
.prev()
|
||||
.animate({}, function () {
|
||||
s.parent().prev().prev().hide();
|
||||
})
|
||||
.show("fast", function () {
|
||||
t.onMore();
|
||||
})),
|
||||
!1
|
||||
);
|
||||
},
|
||||
},
|
||||
".morelink",
|
||||
),
|
||||
this.each(function () {
|
||||
var s = e(this),
|
||||
n = s.html();
|
||||
if (s.text().length > t.showChars + t.minHideChars) {
|
||||
var r = n.substr(0, t.showChars);
|
||||
if (r.indexOf("<") >= 0) {
|
||||
for (
|
||||
var a = !1, o = "", i = 0, l = [], h = null, c = 0, f = 0;
|
||||
f <= t.showChars;
|
||||
c++
|
||||
)
|
||||
if (
|
||||
("<" != n[c] ||
|
||||
a ||
|
||||
((a = !0),
|
||||
"/" == (h = n.substring(c + 1, n.indexOf(">", c)))[0]
|
||||
? h != "/" + l[0]
|
||||
? (t.errMsg =
|
||||
"ERROR en HTML: the top of the stack should be the tag that closes")
|
||||
: l.shift()
|
||||
: "br" != h.toLowerCase() && l.unshift(h)),
|
||||
a && ">" == n[c] && (a = !1),
|
||||
a)
|
||||
)
|
||||
o += n.charAt(c);
|
||||
else if ((f++, i <= t.showChars)) (o += n.charAt(c)), i++;
|
||||
else if (l.length > 0) {
|
||||
for (j = 0; j < l.length; j++) o += "</" + l[j] + ">";
|
||||
break;
|
||||
}
|
||||
r = e("<div/>")
|
||||
.html(o + '<span class="ellip">' + t.ellipsesText + "</span>")
|
||||
.html();
|
||||
} else r += t.ellipsesText;
|
||||
var p =
|
||||
'<div class="shortcontent">' +
|
||||
r +
|
||||
'</div><div class="allcontent">' +
|
||||
n +
|
||||
'</div><span><a href="javascript://nop/" class="morelink">' +
|
||||
t.moreText +
|
||||
"</a></span>";
|
||||
s.html(p),
|
||||
s.find(".allcontent").hide(),
|
||||
e(".shortcontent p:last", s).css("margin-bottom", 0);
|
||||
}
|
||||
}))
|
||||
);
|
||||
};
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user