Migrate frontend to pnpm+parcel with JS modules
This commit is contained in:
parent
4d8b7d6e62
commit
0b8fbea6c3
30 changed files with 2289 additions and 404 deletions
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
6
static/bootstrap/css/bootstrap.min.css
vendored
6
static/bootstrap/css/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
7
static/bootstrap/js/bootstrap.bundle.min.js
vendored
7
static/bootstrap/js/bootstrap.bundle.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,52 +0,0 @@
|
|||
$(document).ready(function() {
|
||||
$(".toggle-dark-mode").on("click", function() {
|
||||
var currentState = $("html").attr("data-bs-theme");
|
||||
|
||||
var newState = "dark";
|
||||
if (currentState === "dark") {
|
||||
newState = "light";
|
||||
}
|
||||
|
||||
setColorMode(newState);
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
var currentState = $("html").attr("data-bs-theme");
|
||||
var storedState = localStorage.getItem("color-mode");
|
||||
|
||||
if (storedState && storedState !== currentState) {
|
||||
return setColorMode(storedState);
|
||||
}
|
||||
|
||||
if (currentState === "auto") {
|
||||
var newState = "light";
|
||||
if (
|
||||
window.matchMedia &&
|
||||
window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
) {
|
||||
newState = "dark";
|
||||
}
|
||||
|
||||
return setColorMode(newState);
|
||||
}
|
||||
});
|
||||
|
||||
function setColorMode(color) {
|
||||
if (color == "dark") {
|
||||
$(".toggle-dark-mode").children("i").removeClass("bi-moon");
|
||||
$(".toggle-dark-mode").children("i").addClass("bi-sun");
|
||||
} else {
|
||||
$(".toggle-dark-mode").children("i").removeClass("bi-sun");
|
||||
$(".toggle-dark-mode").children("i").addClass("bi-moon");
|
||||
}
|
||||
|
||||
$("html").attr("data-bs-theme", color);
|
||||
localStorage.setItem("color-mode", color);
|
||||
$.post("/set-color-mode", {color_mode: color});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
||||
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
|
||||
});
|
||||
2
static/jquery/jquery.min.js
vendored
2
static/jquery/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1842,27 +1842,27 @@ SOFTWARE.
|
|||
|
||||
|
||||
```
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019-present Fenny and Contributors
|
||||
|
||||
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.
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019-present Fenny and Contributors
|
||||
|
||||
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.
|
||||
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
img#header-logo {
|
||||
width: 89px;
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
#login-card {
|
||||
margin: auto;
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
.dashboard-tile {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.user-photo {
|
||||
background-color: #555;
|
||||
color: #fff;
|
||||
display: inline-block;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
border-radius: 50%;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.item-click {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.text-bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.table-responsive th,
|
||||
.table-responsive td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
199
static/search.js
199
static/search.js
|
|
@ -1,199 +0,0 @@
|
|||
$(document).ready(function() {
|
||||
$("#search").on("click", function() {
|
||||
search();
|
||||
});
|
||||
|
||||
$("#advanced").on("click", function() {
|
||||
if ($(this).data("state") === "true") {
|
||||
$(this).find("i").removeClass("bi-arrow-up");
|
||||
$(this).find("i").addClass("bi-arrow-down");
|
||||
$("#advanced-section").addClass("d-none");
|
||||
$(this).data("state", "false");
|
||||
} else {
|
||||
$(this).find("i").removeClass("bi-arrow-down");
|
||||
$(this).find("i").addClass("bi-arrow-up");
|
||||
$("#advanced-section").removeClass("d-none");
|
||||
$(this).data("state", "true");
|
||||
}
|
||||
});
|
||||
|
||||
$("#reset-search").on("click", function() {
|
||||
$("#search-json").val("");
|
||||
$("#search-page").val("1");
|
||||
$("#search-form").submit();
|
||||
});
|
||||
|
||||
$("#search-container").on("change", ".field-select", function() {
|
||||
var lastField = $(this).attr("data-last-field");
|
||||
var isInitial = $(this).attr("data-is-initial");
|
||||
var initialValue = $(this).attr("data-initial-value");
|
||||
|
||||
var field = $(this).val();
|
||||
if (field == "") {
|
||||
$(this).parents(".row").remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((lastField === undefined || lastField.length === 0) && (isInitial === undefined || isInitial !== "yes")) {
|
||||
createFieldSelection();
|
||||
}
|
||||
|
||||
$(this).attr("data-last-field", field);
|
||||
|
||||
$(this).parents(".row").find(".end-col").find("input").remove();
|
||||
$(this).parents(".row").find(".end-col").find("select").remove();
|
||||
|
||||
$(elem).parents(".row").find(".end-col").append($("<input>", {
|
||||
class: "form-control",
|
||||
type: "text",
|
||||
disabled: true,
|
||||
}));
|
||||
|
||||
var elem = $(this);
|
||||
$.getJSON("/fields/" + field, function(data) {
|
||||
$(this).parents(".row").find(".end-col").find("input").remove();
|
||||
|
||||
if (data.FieldType === "list") {
|
||||
var select = $("<select>", {
|
||||
class: "form-select",
|
||||
"data-optional-field": field,
|
||||
"data-search-type": "int"
|
||||
});
|
||||
$(elem).parents(".row").find(".end-col").append(select);
|
||||
|
||||
for (const [_, value] of Object.entries(data.List.ListItems)) {
|
||||
$(select).append($("<option>", {
|
||||
value: value.ID,
|
||||
text: value.Value
|
||||
}));
|
||||
}
|
||||
} else if (data.FieldType === "number") {
|
||||
$(elem).parents(".row").find(".end-col").append($("<input>", {
|
||||
class: "form-control",
|
||||
type: "number",
|
||||
"data-optional-field": field,
|
||||
"data-search-type": "int"
|
||||
}));
|
||||
} else if (data.FieldType === "date") {
|
||||
$(elem).parents(".row").find(".end-col").append($("<input>", {
|
||||
class: "form-control",
|
||||
type: "date",
|
||||
"data-optional-field": field
|
||||
}));
|
||||
} else {
|
||||
$(elem).parents(".row").find(".end-col").append($("<input>", {
|
||||
class: "form-control",
|
||||
type: "text",
|
||||
"data-optional-field": field
|
||||
}));
|
||||
}
|
||||
|
||||
if (initialValue !== undefined && initialValue.length > 0) {
|
||||
$(elem).parents(".row").find("[data-optional-field]").val(initialValue);
|
||||
$(elem).attr("data-initial-value", null);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#search-container").on("keyup", "input[type=text]", function(e) {
|
||||
if (e.keyCode === 13) {
|
||||
search();
|
||||
}
|
||||
});
|
||||
|
||||
var json = $("#search-json").val();
|
||||
if (json.length > 0) {
|
||||
var searchData = JSON.parse(json);
|
||||
|
||||
for (const [key, value] of Object.entries(searchData)) {
|
||||
if (key === "advanced") {
|
||||
if (value) $("#advanced").trigger("click");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key === "fields") {
|
||||
for (const [field_id, field_values] of Object.entries(value)) {
|
||||
for (const field_value of field_values) {
|
||||
createFieldSelection(field_id, field_value);
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if (typeof value === "boolean") {
|
||||
$("[data-search-field=" + key + "]").prop("checked", value);
|
||||
} else {
|
||||
$("[data-search-field=" + key + "]").val(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
createFieldSelection();
|
||||
});
|
||||
|
||||
function createFieldSelection(field, value) {
|
||||
var elem = $("#search-fields-model").clone().appendTo("#search-fields");
|
||||
$(elem).attr("id", null);
|
||||
$(elem).removeClass("d-none");
|
||||
$(elem).addClass("search-fields-count");
|
||||
|
||||
if (field !== undefined && field.length > 0) {
|
||||
$(elem).find(".field-select").attr("data-initial-value", value);
|
||||
$(elem).find(".field-select").attr("data-is-initial", "yes");
|
||||
$(elem).find(".field-select").val(field);
|
||||
$(elem).find(".field-select").trigger("change");
|
||||
}
|
||||
}
|
||||
|
||||
function search() {
|
||||
var advancedSearch = ($("#advanced").data("state") === "true");
|
||||
var searchData = {
|
||||
advanced: advancedSearch
|
||||
};
|
||||
|
||||
$("[data-search-field]").each(function() {
|
||||
var advancedField = $(this).data("search-advanced");
|
||||
if (!advancedSearch && advancedField) {
|
||||
return;
|
||||
}
|
||||
|
||||
var index = $(this).data("search-field");
|
||||
var value = $(this).val();
|
||||
|
||||
if ($(this).data("search-type") === "int") {
|
||||
value = parseInt(value);
|
||||
if (isNaN(value)) return;
|
||||
} else if ($(this).attr("type") === "checkbox") {
|
||||
value = $(this).prop("checked");
|
||||
}
|
||||
|
||||
searchData[index] = value;
|
||||
});
|
||||
|
||||
fields = {}
|
||||
$("[data-optional-field]:not(:disabled)").each(function() {
|
||||
if (!advancedSearch) {
|
||||
return;
|
||||
}
|
||||
|
||||
var index = $(this).attr("data-optional-field");
|
||||
var value = $(this).val();
|
||||
|
||||
if ($(this).data("search-type") === "int") {
|
||||
value = parseInt(value);
|
||||
if (isNaN(value)) return;
|
||||
}
|
||||
|
||||
if (fields[index] !== undefined) {
|
||||
fields[index].push(value);
|
||||
} else {
|
||||
fields[index] = [value];
|
||||
}
|
||||
});
|
||||
searchData["fields"] = fields;
|
||||
|
||||
var json = JSON.stringify(searchData);
|
||||
$("#search-json").val(json);
|
||||
$("#search-page").val("1");
|
||||
$("#search-form").submit();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue