added format command and added trailing commas to reduce conflicts

This commit is contained in:
dswbx
2025-02-26 20:06:03 +01:00
parent 88b5359f1c
commit 7743f71a11
414 changed files with 3622 additions and 3610 deletions

View File

@@ -52,7 +52,7 @@ const tests = {
JsonSchemaFormReactTest,
JsonSchemaForm3,
FormyTest,
HtmlFormTest
HtmlFormTest,
} as const;
export default function TestRoutes() {

View File

@@ -5,7 +5,7 @@ import {
IconChevronUp,
IconCirclesRelation,
IconSettings,
IconUser
IconUser,
} from "@tabler/icons-react";
import { useState } from "react";
import { TbDots } from "react-icons/tb";
@@ -23,7 +23,7 @@ const Item = ({
toggle,
ActiveIcon = IconChevronUp,
children,
renderHeaderRight
renderHeaderRight,
}: {
title: string;
open: boolean;
@@ -38,12 +38,12 @@ const Item = ({
"flex flex-col flex-animate overflow-hidden",
open
? "flex-open border-b border-b-muted"
: "flex-initial cursor-pointer hover:bg-primary/5"
: "flex-initial cursor-pointer hover:bg-primary/5",
)}
>
<div
className={twMerge(
"flex flex-row border-muted border-b h-14 py-4 pr-4 pl-2 items-center gap-2"
"flex flex-row border-muted border-b h-14 py-4 pr-4 pl-2 items-center gap-2",
)}
onClick={toggle}
>
@@ -55,7 +55,7 @@ const Item = ({
<div
className={twMerge(
"overflow-y-scroll transition-all",
open ? " flex-grow" : "h-0 opacity-0"
open ? " flex-grow" : "h-0 opacity-0",
)}
>
<div className="flex flex-col gap-5 p-4 ">{children}</div>
@@ -77,8 +77,8 @@ export default function AppShellAccordionsTest() {
<Dropdown
items={[
{
label: "Settings"
}
label: "Settings",
},
]}
position="bottom-end"
>

View File

@@ -57,7 +57,7 @@ function CustomUserAvatarDropzone() {
wrapperRef,
inputProps,
state: { files, isOver, isOverAccepted, showPlaceholder },
actions: { openFileInput }
actions: { openFileInput },
} = Media.useDropzone();
const file = files[0];

View File

@@ -12,7 +12,7 @@ import {
type UseFormReturn,
useController,
useFieldArray,
useForm
useForm,
} from "react-hook-form";
import { TbChevronDown, TbChevronUp, TbGripVertical, TbTrash } from "react-icons/tb";
import { Button } from "../../../components/buttons/Button";
@@ -26,21 +26,21 @@ const fieldSchema = Type.Union(
{
type: Type.Const(type),
name: StringIdentifier,
config: Type.Optional(schema)
config: Type.Optional(schema),
},
{
additionalProperties: false
}
)
)
additionalProperties: false,
},
),
),
);
const schema = Type.Object({
fields: Type.Array(fieldSchema)
fields: Type.Array(fieldSchema),
});
const fieldSchema2 = Type.Object({
type: StringEnum(Object.keys(fieldSchemas)),
name: StringIdentifier
name: StringIdentifier,
});
function specificFieldSchema(type: keyof typeof fieldSchemas) {
@@ -50,7 +50,7 @@ function specificFieldSchema(type: keyof typeof fieldSchemas) {
"required",
"fillable",
"hidden",
"virtual"
"virtual",
]);
}
@@ -62,19 +62,19 @@ export default function EntityFieldsForm() {
handleSubmit,
watch,
register,
setValue
setValue,
} = useForm({
mode: "onTouched",
resolver: typeboxResolver(schema),
defaultValues: {
fields: [{ type: "text", name: "", config: {} }],
sort: { by: "-1", dir: "asc" }
}
sort: { by: "-1", dir: "asc" },
},
});
const defaultType = Object.keys(fieldSchemas)[0];
const { fields, append, prepend, remove, swap, move, insert, update } = useFieldArray({
control, // control props comes from useForm (optional: if you are using FormProvider)
name: "fields" // unique name for your Field Array
name: "fields", // unique name for your Field Array
});
function handleAppend() {
@@ -113,16 +113,16 @@ function EntityFieldForm({ update, index, value }) {
register,
handleSubmit,
control,
formState: { errors }
formState: { errors },
} = useForm({
mode: "onBlur",
resolver: typeboxResolver(
Type.Object({
type: StringEnum(Object.keys(fieldSchemas)),
name: Type.String({ minLength: 1, maxLength: 3 })
})
name: Type.String({ minLength: 1, maxLength: 3 }),
}),
),
defaultValues: value
defaultValues: value,
});
function handleUpdate({ id, ...data }) {
@@ -153,19 +153,19 @@ function EntityFieldController({
control,
defaultValue,
rules,
shouldUnregister
shouldUnregister,
}: UseControllerProps & {
index: number;
}) {
const {
field: { value, onChange: fieldOnChange, ...field },
fieldState
fieldState,
} = useController({
name,
control,
defaultValue,
rules,
shouldUnregister
shouldUnregister,
});
return <div>field</div>;
@@ -176,7 +176,7 @@ function EntityField({
index,
form: { watch, register, setValue, getValues, control },
remove,
defaultType
defaultType,
}: {
field: FieldArrayWithId;
index: number;

View File

@@ -6,7 +6,7 @@ export default function FlowFormTest() {
const [data, setData] = useState(null);
const task = new FetchTask("Fetch Something", {
url: "https://jsonplaceholder.typicode.com/todos/1",
method: "{{ input.mode }}"
method: "{{ input.mode }}",
});
return (

View File

@@ -9,7 +9,7 @@ import {
IconPlayerPlay,
IconPlus,
IconTrash,
IconWorld
IconWorld,
} from "@tabler/icons-react";
import { useState } from "react";
import { TbPlayerPlayFilled } from "react-icons/tb";
@@ -30,9 +30,9 @@ const TRIGGERS = {
mode: "sync",
method: "GET",
response_type: "json",
path: "/trigger_http"
}
}
path: "/trigger_http",
},
},
};
const TASKS = {
@@ -41,9 +41,9 @@ const TASKS = {
params: {
method: "GET",
headers: [],
url: "https://jsonplaceholder.typicode.com/todos/1"
}
}
url: "https://jsonplaceholder.typicode.com/todos/1",
},
},
};
export default function FlowsTest() {
@@ -63,7 +63,7 @@ const NodeHeader = ({
iconProps,
rightSection,
initialValue,
onChange
onChange,
}: {
Icon: React.FC<any>;
iconProps?: ElementProps<"svg">;
@@ -100,7 +100,7 @@ const TriggerComponent = () => {
data={[
{ label: "Manual", value: "manual" },
{ label: "HTTP", value: "http" },
{ label: "Event", value: "event", disabled: true }
{ label: "Event", value: "event", disabled: true },
]}
/>
<SegmentedControl
@@ -108,7 +108,7 @@ const TriggerComponent = () => {
defaultValue="async"
data={[
{ label: "Async", value: "async" },
{ label: "Sync", value: "sync" }
{ label: "Sync", value: "sync" },
]}
/>
</div>
@@ -134,7 +134,7 @@ const TriggerComponent = () => {
data={[
{ label: "JSON", value: "json" },
{ label: "HTML", value: "html" },
{ label: "Text", value: "text" }
{ label: "Text", value: "text" },
]}
/>
</div>

View File

@@ -13,7 +13,7 @@ const validator = new TypeboxValidator();
const schema = Type.Object({
name: Type.String(),
age: Type.Optional(Type.Number())
age: Type.Optional(Type.Number()),
});
export default function JsonSchemaFormReactTest() {

View File

@@ -9,7 +9,7 @@ import {
FormContextOverride,
FormDebug,
ObjectField,
useFormError
useFormError,
} from "ui/components/form/json-schema-form";
import { Scrollable } from "ui/layouts/AppShell/AppShell";
@@ -20,16 +20,16 @@ const schema2 = {
age: { type: "number" },
gender: {
type: "string",
enum: ["male", "female", "uni"]
enum: ["male", "female", "uni"],
},
deep: {
type: "object",
properties: {
nested: { type: "string" }
}
}
nested: { type: "string" },
},
},
},
required: ["age"]
required: ["age"],
} as const satisfies JSONSchema;
const authSchema = {
@@ -38,8 +38,8 @@ const authSchema = {
what: {
type: "array",
items: {
type: "string"
}
type: "string",
},
},
jwt: {
type: "object",
@@ -47,16 +47,16 @@ const authSchema = {
fields: {
type: "array",
items: {
type: "string"
}
}
}
}
}
type: "string",
},
},
},
},
},
} as const satisfies JSONSchema;
const formOptions = {
debug: true
debug: true,
};
export default function JsonSchemaForm3() {
@@ -314,7 +314,7 @@ const ss = {
interested: { type: "boolean" },
bla: {
type: "string",
enum: ["small", "medium", "large"]
enum: ["small", "medium", "large"],
},
password: { type: "string", format: "password" },
birthdate: { type: "string", format: "date" },
@@ -323,18 +323,18 @@ const ss = {
tags: {
type: "array",
items: {
type: "string"
}
type: "string",
},
},
config: {
type: "object",
properties: {
min: { type: "number" }
}
}
min: { type: "number" },
},
},
},
required: ["name"],
additionalProperties: false
additionalProperties: false,
} as const satisfies JSONSchema;
function CustomMediaForm() {

View File

@@ -16,12 +16,12 @@ export default function JsonFormTest() {
name: {
type: "string",
title: "Name",
minLength: 3
minLength: 3,
},
variants: {
anyOf: [{ type: "string" }, { type: "number" }]
}
}
anyOf: [{ type: "string" }, { type: "number" }],
},
},
};
const ref = useRef<JsonSchemaFormRef>(null);

View File

@@ -9,52 +9,52 @@ const schema: Schema = {
anyOf: [
{
title: "String",
type: "string"
type: "string",
},
{
title: "Number",
type: "number"
type: "number",
},
{
title: "Boolean",
type: "boolean"
}
]
type: "boolean",
},
],
},
numeric: {
anyOf: [
{
title: "Number",
type: "number"
type: "number",
},
{
title: "Datetime",
type: "string",
format: "date-time"
format: "date-time",
},
{
title: "Date",
type: "string",
format: "date"
format: "date",
},
{
title: "Time",
type: "string",
format: "time"
}
]
format: "time",
},
],
},
boolean: {
title: "Boolean",
type: "boolean"
}
type: "boolean",
},
},
type: "object",
properties: {
operand: {
enum: ["$and", "$or"],
default: "$and",
type: "string"
type: "string",
},
conditions: {
type: "array",
@@ -64,10 +64,10 @@ const schema: Schema = {
operand: {
enum: ["$and", "$or"],
default: "$and",
type: "string"
type: "string",
},
key: {
type: "string"
type: "string",
},
operator: {
type: "array",
@@ -78,30 +78,30 @@ const schema: Schema = {
type: "object",
properties: {
$eq: {
$ref: "#/definitions/primitive"
}
$ref: "#/definitions/primitive",
},
},
required: ["$eq"]
required: ["$eq"],
},
{
title: "Lower than",
type: "object",
properties: {
$lt: {
$ref: "#/definitions/numeric"
}
$ref: "#/definitions/numeric",
},
},
required: ["$lt"]
required: ["$lt"],
},
{
title: "Greather than",
type: "object",
properties: {
$gt: {
$ref: "#/definitions/numeric"
}
$ref: "#/definitions/numeric",
},
},
required: ["$gt"]
required: ["$gt"],
},
{
title: "Between",
@@ -110,13 +110,13 @@ const schema: Schema = {
$between: {
type: "array",
items: {
$ref: "#/definitions/numeric"
$ref: "#/definitions/numeric",
},
minItems: 2,
maxItems: 2
}
maxItems: 2,
},
},
required: ["$between"]
required: ["$between"],
},
{
title: "In",
@@ -125,23 +125,23 @@ const schema: Schema = {
$in: {
type: "array",
items: {
$ref: "#/definitions/primitive"
$ref: "#/definitions/primitive",
},
minItems: 1
}
}
}
]
minItems: 1,
},
},
},
],
},
minItems: 1
}
minItems: 1,
},
},
required: ["key", "operator"]
required: ["key", "operator"],
},
minItems: 1
}
minItems: 1,
},
},
required: ["operand", "conditions"]
required: ["operand", "conditions"],
};
export default function QueryJsonFormTest() {

View File

@@ -5,7 +5,7 @@ import { useForm } from "react-hook-form";
const schema = Type.Object({
example: Type.Optional(Type.String()),
exampleRequired: Type.String({ minLength: 2 })
exampleRequired: Type.String({ minLength: 2 }),
});
export default function ReactHookErrors() {
@@ -13,9 +13,9 @@ export default function ReactHookErrors() {
register,
handleSubmit,
watch,
formState: { errors }
formState: { errors },
} = useForm({
resolver: typeboxResolver(schema)
resolver: typeboxResolver(schema),
});
const onSubmit = (data) => console.log(data);

View File

@@ -2,7 +2,7 @@ import { ReactFlow } from "@xyflow/react";
const initialNodes = [
{ id: "1", position: { x: 0, y: 0 }, data: { label: "1" } },
{ id: "2", position: { x: 0, y: 100 }, data: { label: "2" } }
{ id: "2", position: { x: 0, y: 100 }, data: { label: "2" } },
];
const initialEdges = [{ id: "e1-2", source: "1", target: "2" }];

View File

@@ -23,50 +23,50 @@ const uiSchema = {
jwt: {
basepath: {
"ui:options": {
label: false
}
label: false,
},
},
fields: {
"ui:options": {
label: false,
orderable: false
}
}
orderable: false,
},
},
},
strategies: {
additionalProperties: {
"ui:widget": "select",
type: {
"ui:widget": "hidden"
}
"ui:widget": "hidden",
},
},
type: {
"ui:widget": "hidden"
}
}
"ui:widget": "hidden",
},
},
},
server: {
cors: {
allow_methods: {
"ui:widget": "checkboxes"
"ui:widget": "checkboxes",
},
allow_headers: {
"ui:options": {
orderable: false
}
}
}
orderable: false,
},
},
},
},
media: {
adapter: {
"ui:options": {
label: false
label: false,
},
type: {
"ui:widget": "hidden"
}
}
}
"ui:widget": "hidden",
},
},
},
};
export default function SchemaTest() {
@@ -81,7 +81,7 @@ export default function SchemaTest() {
key: tab,
schema: schema[tab],
uiSchema: uiSchema[tab] || {},
config: app.config[tab]
config: app.config[tab],
};
console.log("current", current);

View File

@@ -5,7 +5,7 @@ import {
type DraggableRubric,
type DraggableStateSnapshot,
Droppable,
type DroppableProps
type DroppableProps,
} from "@hello-pangea/dnd";
import { useListState } from "@mantine/hooks";
import { IconGripVertical } from "@tabler/icons-react";
@@ -24,7 +24,7 @@ export default function SortableTest() {
{ id: "N", name: "Nitrogen" },
{ id: "Y", name: "Yttrium" },
{ id: "Ba", name: "Barium" },
{ id: "Ce", name: "Cerium" }
{ id: "Ce", name: "Cerium" },
]}
onReordered={(...args) => console.log("reordered", args)}
onChange={(data) => console.log("changed", data)}
@@ -54,7 +54,7 @@ export function SortableList({
renderItem,
dndProps = { droppableId: "sortable-list", direction: "vertical" },
onReordered,
onChange
onChange,
}: SortableListProps) {
const [state, handlers] = useListState(data);

View File

@@ -16,7 +16,7 @@ function SwaggerUI() {
// @ts-ignore
window.ui = window.SwaggerUIBundle({
url: "http://localhost:28623/api/system/openapi.json",
dom_id: "#swagger-ui"
dom_id: "#swagger-ui",
});
}
};

View File

@@ -19,7 +19,7 @@ export default function SWRAndAPI() {
const [text, setText] = useState("");
const { data, ...r } = useApiQuery((api) => api.data.readOne("comments", 1), {
refine: (data) => data.data,
revalidateOnFocus: true
revalidateOnFocus: true,
});
const comment = data ? data : null;

View File

@@ -16,7 +16,7 @@ export default function SwrAndDataApi() {
function QueryMutateDataApi() {
const { mutate } = useEntityMutate("comments");
const { data, ...r } = useEntityQuery("comments", undefined, {
limit: 2
limit: 2,
});
return (
@@ -48,7 +48,7 @@ function QueryMutateDataApi() {
function QueryDataApi() {
const { data, update, ...r } = useEntityQuery("comments", undefined, {
sort: { by: "id", dir: "asc" },
limit: 3
limit: 3,
});
return (