mirror of
https://github.com/Steffo99/bluelib.git
synced 2024-12-22 19:44:21 +00:00
0.11.5
This commit is contained in:
parent
ba939a23a7
commit
2cea4fe992
8 changed files with 85 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"private": false,
|
"private": false,
|
||||||
"name": "bluelib",
|
"name": "bluelib",
|
||||||
"version": "0.11.4",
|
"version": "0.11.5",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"source": "src/index.js",
|
"source": "src/index.js",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|
11
src/components/Layout/HInput.js
Normal file
11
src/components/Layout/HInput.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import style from './HInput.less';
|
||||||
|
|
||||||
|
export default function (props) {
|
||||||
|
return (
|
||||||
|
<label className={style.label}>
|
||||||
|
<div className={style.text}>{this.props.label}</div>
|
||||||
|
<input className={style.input} type={this.props.type} value={this.props.value}
|
||||||
|
onChange={this.props.onChange} disabled={this.props.disabled} name={this.props.name}/>
|
||||||
|
</label>
|
||||||
|
);
|
||||||
|
}
|
21
src/components/Layout/HInput.less
Normal file
21
src/components/Layout/HInput.less
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
@import "../../styles/constants.less";
|
||||||
|
|
||||||
|
.label {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 2px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
flex-grow: 1;
|
||||||
|
max-width: 160px;
|
||||||
|
text-align: right;
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input {
|
||||||
|
margin-left: 4px;
|
||||||
|
flex-grow: 2;
|
||||||
|
}
|
16
src/index.js
16
src/index.js
|
@ -7,6 +7,7 @@ import TablePanel from "./components/Elements/TablePanel";
|
||||||
import Timer from "./components/Elements/Timer";
|
import Timer from "./components/Elements/Timer";
|
||||||
import Todo from "./components/Elements/Todo";
|
import Todo from "./components/Elements/Todo";
|
||||||
|
|
||||||
|
import HInput from "./components/Layout/HInput";
|
||||||
import Split from "./components/Layout/Split";
|
import Split from "./components/Layout/Split";
|
||||||
|
|
||||||
import BLatex from "./components/Rendering/BLatex";
|
import BLatex from "./components/Rendering/BLatex";
|
||||||
|
@ -28,6 +29,10 @@ import useRoyalnetInstanceValidator from "./hooks/useRoyalnetInstanceValidator";
|
||||||
|
|
||||||
import theme from "./styles/theme.less";
|
import theme from "./styles/theme.less";
|
||||||
|
|
||||||
|
import concatClass from "./utils/concatClass";
|
||||||
|
import getEventValue from "./utils/getEventValue";
|
||||||
|
import isString from "./utils/isString";
|
||||||
|
import isValidDate from "./utils/isValidDate";
|
||||||
import stripTabs from "./utils/stripTabs";
|
import stripTabs from "./utils/stripTabs";
|
||||||
import {royalnetApiRequest, RoyalnetApiError} from "./utils/royalnetApiRequest";
|
import {royalnetApiRequest, RoyalnetApiError} from "./utils/royalnetApiRequest";
|
||||||
|
|
||||||
|
@ -41,7 +46,10 @@ export {
|
||||||
TablePanel,
|
TablePanel,
|
||||||
Timer,
|
Timer,
|
||||||
Todo,
|
Todo,
|
||||||
|
|
||||||
|
HInput,
|
||||||
Split,
|
Split,
|
||||||
|
|
||||||
BLatex,
|
BLatex,
|
||||||
Code,
|
Code,
|
||||||
ILatex,
|
ILatex,
|
||||||
|
@ -49,14 +57,22 @@ export {
|
||||||
LatexDisplay,
|
LatexDisplay,
|
||||||
Markdown,
|
Markdown,
|
||||||
PLatex,
|
PLatex,
|
||||||
|
|
||||||
LatexDefaultDisplay,
|
LatexDefaultDisplay,
|
||||||
LatexDefaultInline,
|
LatexDefaultInline,
|
||||||
LatexRenderColor,
|
LatexRenderColor,
|
||||||
RoyalnetInstanceUrl,
|
RoyalnetInstanceUrl,
|
||||||
|
|
||||||
useFormValidator,
|
useFormValidator,
|
||||||
useRoyalnetData,
|
useRoyalnetData,
|
||||||
useRoyalnetInstanceValidator,
|
useRoyalnetInstanceValidator,
|
||||||
|
|
||||||
theme,
|
theme,
|
||||||
|
|
||||||
|
concatClass,
|
||||||
|
getEventValue,
|
||||||
|
isString,
|
||||||
|
isValidDate,
|
||||||
stripTabs,
|
stripTabs,
|
||||||
royalnetApiRequest,
|
royalnetApiRequest,
|
||||||
RoyalnetApiError,
|
RoyalnetApiError,
|
||||||
|
|
25
src/utils/concatClass.js
Normal file
25
src/utils/concatClass.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
export default function concatClass(...args) {
|
||||||
|
let result = "";
|
||||||
|
|
||||||
|
for(let i = 0; i < args.length; i++) {
|
||||||
|
let arg = args[i];
|
||||||
|
if(arg instanceof Array) {
|
||||||
|
result += concatClass(...arg)
|
||||||
|
}
|
||||||
|
else if(typeof arg == "string" || arg instanceof String) {
|
||||||
|
result += arg
|
||||||
|
}
|
||||||
|
else if(arg === null || arg === undefined) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw Error(`Invalid type '${typeof(arg)}' passed to extendableClasses, which only accepts Arrays and Strings.`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i < args.length - 1) {
|
||||||
|
result += " "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
5
src/utils/getEventValue.js
Normal file
5
src/utils/getEventValue.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export default function(f) {
|
||||||
|
return function(event) {
|
||||||
|
return f(event.target.value)
|
||||||
|
}
|
||||||
|
}
|
3
src/utils/isString.js
Normal file
3
src/utils/isString.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export default function(s) {
|
||||||
|
return typeof s === "string" || s instanceof String
|
||||||
|
}
|
3
src/utils/isValidDate.js
Normal file
3
src/utils/isValidDate.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export default function(d) {
|
||||||
|
return d instanceof Date && !isNaN(d.getTime())
|
||||||
|
}
|
Loading…
Reference in a new issue