@codeperate/form-builder-react
Advanced tools
@@ -5,5 +5,5 @@ import { CommonWidgetProps } from '../FormBuilder' | ||
| export interface ObjectWidgetProps extends CommonWidgetProps { | ||
| columnClassMap?: Record<number, string> | ||
| } | ||
| export * from './ObjectWidget' |
@@ -24,2 +24,3 @@ import type { Meta, StoryObj } from '@storybook/react' | ||
| widget: StringWidgetFn, | ||
| columns:12, | ||
| props: { | ||
@@ -26,0 +27,0 @@ maxLength: 100, |
@@ -10,3 +10,3 @@ import { memo } from 'react' | ||
| return ( | ||
| <div className="grid des:grid-cols-12 grid-cols-2 gap-4"> | ||
| <div className="grid grid-cols-12 max-md:grid-cols-2 gap-4"> | ||
| { Object.entries(schema.properties ?? {}).map(([key, { columns, widget, label, required, props }]) => ( | ||
@@ -13,0 +13,0 @@ <div className={join('grid content-start', columnClass(columns ?? widget.columns ?? 6))} key={key}> |
+1
-1
| { | ||
| "name": "@codeperate/form-builder-react", | ||
| "private": false, | ||
| "version": "1.0.9", | ||
| "version": "1.0.10", | ||
| "type": "module", | ||
@@ -6,0 +6,0 @@ "module": "./index.ts", |
+20
-14
@@ -1,15 +0,21 @@ | ||
| export type Columns = number | { [key: string]: number, default: number } | ||
| export function columnClass(columns: Columns = 6) { | ||
| if (typeof columns == 'number') { | ||
| const mobileColumns = columns > 3 ? 2 : 1 | ||
| return `des:col-span-${columns} col-span-${mobileColumns}` | ||
| } | ||
| else { | ||
| const str: string[] = [] | ||
| for (const [key, val] of Object.entries(columns)) { | ||
| if (key == 'default') str.push(`col-span-${val}`) | ||
| else str.push(`${key}:col-span-${val}`) | ||
| } | ||
| return str.join(' ') | ||
| } | ||
| const classMap: Record<number, string> = { | ||
| 1: 'col-span-1 max-md:col-span-1', | ||
| 2: 'col-span-2 max-md:col-span-1', | ||
| 3: 'col-span-3 max-md:col-span-1', | ||
| 4: 'col-span-4 max-md:col-span-2', | ||
| 5: 'col-span-5 max-md:col-span-2', | ||
| 6: 'col-span-6 max-md:col-span-2', | ||
| 7: 'col-span-7 max-md:col-span-2', | ||
| 8: 'col-span-8 max-md:col-span-2', | ||
| 9: 'col-span-9 max-md:col-span-2', | ||
| 10: 'col-span-10 max-md:col-span-2', | ||
| 11: 'col-span-11 max-md:col-span-2', | ||
| 12: 'col-span-12 max-md:col-span-2', | ||
| } | ||
| export type Columns = number | string | ||
| export function columnClass(columns: Columns = 6, columnClassMap: Record<number, string> = classMap) { | ||
| if (typeof columns == 'number') | ||
| return columnClassMap[columns]; | ||
| return columns | ||
| } |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
40775
0.71%1186
0.59%0
-100%