@akin2unde/flowui-core 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +19 -0
- package/dist/index.d.cts +73 -1
- package/dist/index.d.ts +73 -1
- package/dist/index.js +17 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
clampNumber: () => clampNumber,
|
|
23
24
|
createTheme: () => createTheme,
|
|
24
25
|
defaultTheme: () => defaultTheme,
|
|
25
26
|
enabledSelectableDescendants: () => enabledSelectableDescendants,
|
|
@@ -32,6 +33,7 @@ __export(index_exports, {
|
|
|
32
33
|
resolveColorValue: () => resolveColorValue,
|
|
33
34
|
resolveFlowStyle: () => resolveFlowStyle,
|
|
34
35
|
responsiveCSS: () => responsiveCSS,
|
|
36
|
+
sanitizeInputValue: () => sanitizeInputValue,
|
|
35
37
|
selectedTreeModels: () => selectedTreeModels,
|
|
36
38
|
setLocalDayBoundary: () => setLocalDayBoundary,
|
|
37
39
|
themeToCSS: () => themeToCSS
|
|
@@ -519,6 +521,21 @@ function setLocalDayBoundary(value, boundary) {
|
|
|
519
521
|
return `${datePart}T${boundary === "start" ? "00:00" : "23:59"}`;
|
|
520
522
|
}
|
|
521
523
|
|
|
524
|
+
// src/input.ts
|
|
525
|
+
function sanitizeInputValue(value, mode = "text") {
|
|
526
|
+
if (mode === "integer") return value.replace(/[^0-9-]/g, "");
|
|
527
|
+
if (mode === "decimal" || mode === "money") {
|
|
528
|
+
const cleaned = value.replace(/[^0-9.-]/g, "");
|
|
529
|
+
const [whole, ...decimals] = cleaned.split(".");
|
|
530
|
+
return decimals.length ? `${whole}.${decimals.join("")}` : whole;
|
|
531
|
+
}
|
|
532
|
+
if (mode === "alphabet") return value.replace(/[^a-zA-Z\s'-]/g, "");
|
|
533
|
+
return value;
|
|
534
|
+
}
|
|
535
|
+
function clampNumber(value, min, max) {
|
|
536
|
+
return Math.min(max, Math.max(min, value));
|
|
537
|
+
}
|
|
538
|
+
|
|
522
539
|
// src/table-export.ts
|
|
523
540
|
function cellText(row, column) {
|
|
524
541
|
const value = row[column.field];
|
|
@@ -633,6 +650,7 @@ function selectedTreeModels(nodes, values) {
|
|
|
633
650
|
}
|
|
634
651
|
// Annotate the CommonJS export names for ESM import in node:
|
|
635
652
|
0 && (module.exports = {
|
|
653
|
+
clampNumber,
|
|
636
654
|
createTheme,
|
|
637
655
|
defaultTheme,
|
|
638
656
|
enabledSelectableDescendants,
|
|
@@ -645,6 +663,7 @@ function selectedTreeModels(nodes, values) {
|
|
|
645
663
|
resolveColorValue,
|
|
646
664
|
resolveFlowStyle,
|
|
647
665
|
responsiveCSS,
|
|
666
|
+
sanitizeInputValue,
|
|
648
667
|
selectedTreeModels,
|
|
649
668
|
setLocalDayBoundary,
|
|
650
669
|
themeToCSS
|
package/dist/index.d.cts
CHANGED
|
@@ -222,6 +222,10 @@ interface InputProps extends BaseUIProps, TypographyProps, DisableableProps, Rea
|
|
|
222
222
|
name?: string;
|
|
223
223
|
value?: string | number;
|
|
224
224
|
placeholder?: string;
|
|
225
|
+
/** Controls which characters FlowUI accepts without changing the visual input type. */
|
|
226
|
+
inputMode?: "text" | "integer" | "decimal" | "money" | "alphabet";
|
|
227
|
+
/** Currency symbol shown when inputMode is money. */
|
|
228
|
+
currencySymbol?: string;
|
|
225
229
|
type?: "text" | "email" | "password" | "number" | "search" | "tel" | "url" | "date" | "time";
|
|
226
230
|
}
|
|
227
231
|
interface DividerProps extends BaseUIProps {
|
|
@@ -341,6 +345,14 @@ interface TreeProps extends BaseUIProps {
|
|
|
341
345
|
value?: string | number;
|
|
342
346
|
defaultExpanded?: boolean;
|
|
343
347
|
}
|
|
348
|
+
interface TreeDropdownProps extends BaseUIProps, DisableableProps {
|
|
349
|
+
nodes: TreeModel[];
|
|
350
|
+
value?: string | number;
|
|
351
|
+
placeholder?: string;
|
|
352
|
+
searchable?: boolean;
|
|
353
|
+
searchPlaceholder?: string;
|
|
354
|
+
emptyText?: string;
|
|
355
|
+
}
|
|
344
356
|
interface TooltipProps extends BaseUIProps {
|
|
345
357
|
text: string;
|
|
346
358
|
location?: TooltipLocation;
|
|
@@ -426,11 +438,71 @@ interface NotificationProps extends BaseUIProps {
|
|
|
426
438
|
duration?: number;
|
|
427
439
|
dismissible?: boolean;
|
|
428
440
|
}
|
|
441
|
+
interface KnobProps extends BaseUIProps, DisableableProps {
|
|
442
|
+
value?: number;
|
|
443
|
+
min?: number;
|
|
444
|
+
max?: number;
|
|
445
|
+
step?: number;
|
|
446
|
+
size?: number;
|
|
447
|
+
strokeWidth?: number;
|
|
448
|
+
showValue?: boolean;
|
|
449
|
+
valueSuffix?: string;
|
|
450
|
+
color?: ColorValue;
|
|
451
|
+
trackColor?: ColorValue;
|
|
452
|
+
}
|
|
453
|
+
interface OTPInputProps extends BaseUIProps, DisableableProps {
|
|
454
|
+
value?: string;
|
|
455
|
+
length?: number;
|
|
456
|
+
numericOnly?: boolean;
|
|
457
|
+
masked?: boolean;
|
|
458
|
+
name?: string;
|
|
459
|
+
}
|
|
460
|
+
interface PhoneCountry {
|
|
461
|
+
code: string;
|
|
462
|
+
name: string;
|
|
463
|
+
dialCode: string;
|
|
464
|
+
flag?: string;
|
|
465
|
+
}
|
|
466
|
+
interface PhoneNumberValue {
|
|
467
|
+
countryCode: string;
|
|
468
|
+
dialCode: string;
|
|
469
|
+
number: string;
|
|
470
|
+
}
|
|
471
|
+
interface PhoneInputProps extends BaseUIProps, DisableableProps {
|
|
472
|
+
value?: PhoneNumberValue;
|
|
473
|
+
countries: PhoneCountry[];
|
|
474
|
+
searchable?: boolean;
|
|
475
|
+
placeholder?: string;
|
|
476
|
+
name?: string;
|
|
477
|
+
}
|
|
478
|
+
type ChartType = "bar" | "line" | "pie" | "doughnut";
|
|
479
|
+
interface ChartSeries {
|
|
480
|
+
name: string;
|
|
481
|
+
data: number[];
|
|
482
|
+
color?: ColorValue;
|
|
483
|
+
}
|
|
484
|
+
interface ChartData {
|
|
485
|
+
labels: string[];
|
|
486
|
+
series: ChartSeries[];
|
|
487
|
+
}
|
|
488
|
+
interface ChartProps extends BaseUIProps {
|
|
489
|
+
type?: ChartType;
|
|
490
|
+
data: ChartData;
|
|
491
|
+
height?: number;
|
|
492
|
+
showLegend?: boolean;
|
|
493
|
+
showValues?: boolean;
|
|
494
|
+
animated?: boolean;
|
|
495
|
+
}
|
|
429
496
|
|
|
430
497
|
/** Formats a Date for native date/time controls without converting it to UTC. */
|
|
431
498
|
declare function formatLocalDateTime(value: Date, mode?: DateTimeMode): string;
|
|
432
499
|
declare function setLocalDayBoundary(value: string | undefined, boundary: "start" | "end"): string;
|
|
433
500
|
|
|
501
|
+
type FlowInputMode = NonNullable<InputProps["inputMode"]>;
|
|
502
|
+
/** Keeps only characters allowed by the selected FlowUI input mode. */
|
|
503
|
+
declare function sanitizeInputValue(value: string, mode?: FlowInputMode): string;
|
|
504
|
+
declare function clampNumber(value: number, min: number, max: number): number;
|
|
505
|
+
|
|
434
506
|
/** Downloads an Excel-compatible SpreadsheetML workbook without a runtime dependency. */
|
|
435
507
|
declare function exportTableToExcel<T>(data: T[], columns: TableColumn<T>[], fileName?: string): void;
|
|
436
508
|
/** Downloads a compact PDF containing the currently visible table data. */
|
|
@@ -442,4 +514,4 @@ declare function enabledSelectableDescendants(node: TreeModel): TreeModel[];
|
|
|
442
514
|
declare function filterTree(nodes: TreeModel[], query: string): TreeModel[];
|
|
443
515
|
declare function selectedTreeModels(nodes: TreeModel[], values: SelectionValue[]): TreeModel[];
|
|
444
516
|
|
|
445
|
-
export { type AlignValue, type AutocompleteProps, type BadgeProps, type BaseUIProps, type BorderProps, type BreadcrumbItem, type BreadcrumbProps, type BreakpointName, type ButtonGroupProps, type ButtonProps, type CSSLength, type CSSVariableStyle, type CardProps, type CarouselProps, type ColorPalette, type ColorScale, type ColorShade, type ColorValue, type ComponentSize, type ComponentVariant, type DateTimeMode, type DateTimeProps, type DeepPartial, type DialogPosition, type DimensionValue, type DisableableProps, type DividerProps, type DropdownBehaviorProps, type DropdownModel, type FileUploadProps, type FlexContainerProps, type FlexDirection, type FlexItemProps, type FlexWrap, type FlowUIStyle, type FlowUITheme, type FocusableProps, type HStackProps, type IconProps, type ImageProps, type InputProps, type JustifyValue, type LabelProps, type LayoutProps, type ListboxProps, type LoadingProps, type MenuItem, type MultiSelectProps, type NotificationHorizontal, type NotificationProps, type NotificationType, type NotificationVertical, type Orientation, type PaletteColor, type PasswordInputProps, type PopoverProps, type PositionProps, type PositionValue, type RadiusToken, type RadiusValue, type RatingProps, type ReadOnlyProps, type RequiredProps, type ResolvedStyle, type ResponsiveObject, type ResponsiveValue, type SchemeColor, type SelectOption, type SelectionValue, type SliderProps, type SortDirection, type SortState, type SpacingProps, type SpacingToken, type SpacingValue, type StackProps, type StyleResolution, type SwitchProps, type TabItem, type TableColumn, type ThemeColorScheme, type ThemeMode, type TimelineItem, type TimelineProps, type TooltipLocation, type TooltipProps, type TreeModel, type TreeMultiSelectProps, type TreeProps, type TypographyProps, type VStackProps, type VisualProps, createTheme, defaultTheme, enabledSelectableDescendants, exportTableToExcel, exportTableToPdf, filterTree, flattenTree, flowClass, formatLocalDateTime, resolveColorValue, resolveFlowStyle, responsiveCSS, selectedTreeModels, setLocalDayBoundary, themeToCSS };
|
|
517
|
+
export { type AlignValue, type AutocompleteProps, type BadgeProps, type BaseUIProps, type BorderProps, type BreadcrumbItem, type BreadcrumbProps, type BreakpointName, type ButtonGroupProps, type ButtonProps, type CSSLength, type CSSVariableStyle, type CardProps, type CarouselProps, type ChartData, type ChartProps, type ChartSeries, type ChartType, type ColorPalette, type ColorScale, type ColorShade, type ColorValue, type ComponentSize, type ComponentVariant, type DateTimeMode, type DateTimeProps, type DeepPartial, type DialogPosition, type DimensionValue, type DisableableProps, type DividerProps, type DropdownBehaviorProps, type DropdownModel, type FileUploadProps, type FlexContainerProps, type FlexDirection, type FlexItemProps, type FlexWrap, type FlowInputMode, type FlowUIStyle, type FlowUITheme, type FocusableProps, type HStackProps, type IconProps, type ImageProps, type InputProps, type JustifyValue, type KnobProps, type LabelProps, type LayoutProps, type ListboxProps, type LoadingProps, type MenuItem, type MultiSelectProps, type NotificationHorizontal, type NotificationProps, type NotificationType, type NotificationVertical, type OTPInputProps, type Orientation, type PaletteColor, type PasswordInputProps, type PhoneCountry, type PhoneInputProps, type PhoneNumberValue, type PopoverProps, type PositionProps, type PositionValue, type RadiusToken, type RadiusValue, type RatingProps, type ReadOnlyProps, type RequiredProps, type ResolvedStyle, type ResponsiveObject, type ResponsiveValue, type SchemeColor, type SelectOption, type SelectionValue, type SliderProps, type SortDirection, type SortState, type SpacingProps, type SpacingToken, type SpacingValue, type StackProps, type StyleResolution, type SwitchProps, type TabItem, type TableColumn, type ThemeColorScheme, type ThemeMode, type TimelineItem, type TimelineProps, type TooltipLocation, type TooltipProps, type TreeDropdownProps, type TreeModel, type TreeMultiSelectProps, type TreeProps, type TypographyProps, type VStackProps, type VisualProps, clampNumber, createTheme, defaultTheme, enabledSelectableDescendants, exportTableToExcel, exportTableToPdf, filterTree, flattenTree, flowClass, formatLocalDateTime, resolveColorValue, resolveFlowStyle, responsiveCSS, sanitizeInputValue, selectedTreeModels, setLocalDayBoundary, themeToCSS };
|
package/dist/index.d.ts
CHANGED
|
@@ -222,6 +222,10 @@ interface InputProps extends BaseUIProps, TypographyProps, DisableableProps, Rea
|
|
|
222
222
|
name?: string;
|
|
223
223
|
value?: string | number;
|
|
224
224
|
placeholder?: string;
|
|
225
|
+
/** Controls which characters FlowUI accepts without changing the visual input type. */
|
|
226
|
+
inputMode?: "text" | "integer" | "decimal" | "money" | "alphabet";
|
|
227
|
+
/** Currency symbol shown when inputMode is money. */
|
|
228
|
+
currencySymbol?: string;
|
|
225
229
|
type?: "text" | "email" | "password" | "number" | "search" | "tel" | "url" | "date" | "time";
|
|
226
230
|
}
|
|
227
231
|
interface DividerProps extends BaseUIProps {
|
|
@@ -341,6 +345,14 @@ interface TreeProps extends BaseUIProps {
|
|
|
341
345
|
value?: string | number;
|
|
342
346
|
defaultExpanded?: boolean;
|
|
343
347
|
}
|
|
348
|
+
interface TreeDropdownProps extends BaseUIProps, DisableableProps {
|
|
349
|
+
nodes: TreeModel[];
|
|
350
|
+
value?: string | number;
|
|
351
|
+
placeholder?: string;
|
|
352
|
+
searchable?: boolean;
|
|
353
|
+
searchPlaceholder?: string;
|
|
354
|
+
emptyText?: string;
|
|
355
|
+
}
|
|
344
356
|
interface TooltipProps extends BaseUIProps {
|
|
345
357
|
text: string;
|
|
346
358
|
location?: TooltipLocation;
|
|
@@ -426,11 +438,71 @@ interface NotificationProps extends BaseUIProps {
|
|
|
426
438
|
duration?: number;
|
|
427
439
|
dismissible?: boolean;
|
|
428
440
|
}
|
|
441
|
+
interface KnobProps extends BaseUIProps, DisableableProps {
|
|
442
|
+
value?: number;
|
|
443
|
+
min?: number;
|
|
444
|
+
max?: number;
|
|
445
|
+
step?: number;
|
|
446
|
+
size?: number;
|
|
447
|
+
strokeWidth?: number;
|
|
448
|
+
showValue?: boolean;
|
|
449
|
+
valueSuffix?: string;
|
|
450
|
+
color?: ColorValue;
|
|
451
|
+
trackColor?: ColorValue;
|
|
452
|
+
}
|
|
453
|
+
interface OTPInputProps extends BaseUIProps, DisableableProps {
|
|
454
|
+
value?: string;
|
|
455
|
+
length?: number;
|
|
456
|
+
numericOnly?: boolean;
|
|
457
|
+
masked?: boolean;
|
|
458
|
+
name?: string;
|
|
459
|
+
}
|
|
460
|
+
interface PhoneCountry {
|
|
461
|
+
code: string;
|
|
462
|
+
name: string;
|
|
463
|
+
dialCode: string;
|
|
464
|
+
flag?: string;
|
|
465
|
+
}
|
|
466
|
+
interface PhoneNumberValue {
|
|
467
|
+
countryCode: string;
|
|
468
|
+
dialCode: string;
|
|
469
|
+
number: string;
|
|
470
|
+
}
|
|
471
|
+
interface PhoneInputProps extends BaseUIProps, DisableableProps {
|
|
472
|
+
value?: PhoneNumberValue;
|
|
473
|
+
countries: PhoneCountry[];
|
|
474
|
+
searchable?: boolean;
|
|
475
|
+
placeholder?: string;
|
|
476
|
+
name?: string;
|
|
477
|
+
}
|
|
478
|
+
type ChartType = "bar" | "line" | "pie" | "doughnut";
|
|
479
|
+
interface ChartSeries {
|
|
480
|
+
name: string;
|
|
481
|
+
data: number[];
|
|
482
|
+
color?: ColorValue;
|
|
483
|
+
}
|
|
484
|
+
interface ChartData {
|
|
485
|
+
labels: string[];
|
|
486
|
+
series: ChartSeries[];
|
|
487
|
+
}
|
|
488
|
+
interface ChartProps extends BaseUIProps {
|
|
489
|
+
type?: ChartType;
|
|
490
|
+
data: ChartData;
|
|
491
|
+
height?: number;
|
|
492
|
+
showLegend?: boolean;
|
|
493
|
+
showValues?: boolean;
|
|
494
|
+
animated?: boolean;
|
|
495
|
+
}
|
|
429
496
|
|
|
430
497
|
/** Formats a Date for native date/time controls without converting it to UTC. */
|
|
431
498
|
declare function formatLocalDateTime(value: Date, mode?: DateTimeMode): string;
|
|
432
499
|
declare function setLocalDayBoundary(value: string | undefined, boundary: "start" | "end"): string;
|
|
433
500
|
|
|
501
|
+
type FlowInputMode = NonNullable<InputProps["inputMode"]>;
|
|
502
|
+
/** Keeps only characters allowed by the selected FlowUI input mode. */
|
|
503
|
+
declare function sanitizeInputValue(value: string, mode?: FlowInputMode): string;
|
|
504
|
+
declare function clampNumber(value: number, min: number, max: number): number;
|
|
505
|
+
|
|
434
506
|
/** Downloads an Excel-compatible SpreadsheetML workbook without a runtime dependency. */
|
|
435
507
|
declare function exportTableToExcel<T>(data: T[], columns: TableColumn<T>[], fileName?: string): void;
|
|
436
508
|
/** Downloads a compact PDF containing the currently visible table data. */
|
|
@@ -442,4 +514,4 @@ declare function enabledSelectableDescendants(node: TreeModel): TreeModel[];
|
|
|
442
514
|
declare function filterTree(nodes: TreeModel[], query: string): TreeModel[];
|
|
443
515
|
declare function selectedTreeModels(nodes: TreeModel[], values: SelectionValue[]): TreeModel[];
|
|
444
516
|
|
|
445
|
-
export { type AlignValue, type AutocompleteProps, type BadgeProps, type BaseUIProps, type BorderProps, type BreadcrumbItem, type BreadcrumbProps, type BreakpointName, type ButtonGroupProps, type ButtonProps, type CSSLength, type CSSVariableStyle, type CardProps, type CarouselProps, type ColorPalette, type ColorScale, type ColorShade, type ColorValue, type ComponentSize, type ComponentVariant, type DateTimeMode, type DateTimeProps, type DeepPartial, type DialogPosition, type DimensionValue, type DisableableProps, type DividerProps, type DropdownBehaviorProps, type DropdownModel, type FileUploadProps, type FlexContainerProps, type FlexDirection, type FlexItemProps, type FlexWrap, type FlowUIStyle, type FlowUITheme, type FocusableProps, type HStackProps, type IconProps, type ImageProps, type InputProps, type JustifyValue, type LabelProps, type LayoutProps, type ListboxProps, type LoadingProps, type MenuItem, type MultiSelectProps, type NotificationHorizontal, type NotificationProps, type NotificationType, type NotificationVertical, type Orientation, type PaletteColor, type PasswordInputProps, type PopoverProps, type PositionProps, type PositionValue, type RadiusToken, type RadiusValue, type RatingProps, type ReadOnlyProps, type RequiredProps, type ResolvedStyle, type ResponsiveObject, type ResponsiveValue, type SchemeColor, type SelectOption, type SelectionValue, type SliderProps, type SortDirection, type SortState, type SpacingProps, type SpacingToken, type SpacingValue, type StackProps, type StyleResolution, type SwitchProps, type TabItem, type TableColumn, type ThemeColorScheme, type ThemeMode, type TimelineItem, type TimelineProps, type TooltipLocation, type TooltipProps, type TreeModel, type TreeMultiSelectProps, type TreeProps, type TypographyProps, type VStackProps, type VisualProps, createTheme, defaultTheme, enabledSelectableDescendants, exportTableToExcel, exportTableToPdf, filterTree, flattenTree, flowClass, formatLocalDateTime, resolveColorValue, resolveFlowStyle, responsiveCSS, selectedTreeModels, setLocalDayBoundary, themeToCSS };
|
|
517
|
+
export { type AlignValue, type AutocompleteProps, type BadgeProps, type BaseUIProps, type BorderProps, type BreadcrumbItem, type BreadcrumbProps, type BreakpointName, type ButtonGroupProps, type ButtonProps, type CSSLength, type CSSVariableStyle, type CardProps, type CarouselProps, type ChartData, type ChartProps, type ChartSeries, type ChartType, type ColorPalette, type ColorScale, type ColorShade, type ColorValue, type ComponentSize, type ComponentVariant, type DateTimeMode, type DateTimeProps, type DeepPartial, type DialogPosition, type DimensionValue, type DisableableProps, type DividerProps, type DropdownBehaviorProps, type DropdownModel, type FileUploadProps, type FlexContainerProps, type FlexDirection, type FlexItemProps, type FlexWrap, type FlowInputMode, type FlowUIStyle, type FlowUITheme, type FocusableProps, type HStackProps, type IconProps, type ImageProps, type InputProps, type JustifyValue, type KnobProps, type LabelProps, type LayoutProps, type ListboxProps, type LoadingProps, type MenuItem, type MultiSelectProps, type NotificationHorizontal, type NotificationProps, type NotificationType, type NotificationVertical, type OTPInputProps, type Orientation, type PaletteColor, type PasswordInputProps, type PhoneCountry, type PhoneInputProps, type PhoneNumberValue, type PopoverProps, type PositionProps, type PositionValue, type RadiusToken, type RadiusValue, type RatingProps, type ReadOnlyProps, type RequiredProps, type ResolvedStyle, type ResponsiveObject, type ResponsiveValue, type SchemeColor, type SelectOption, type SelectionValue, type SliderProps, type SortDirection, type SortState, type SpacingProps, type SpacingToken, type SpacingValue, type StackProps, type StyleResolution, type SwitchProps, type TabItem, type TableColumn, type ThemeColorScheme, type ThemeMode, type TimelineItem, type TimelineProps, type TooltipLocation, type TooltipProps, type TreeDropdownProps, type TreeModel, type TreeMultiSelectProps, type TreeProps, type TypographyProps, type VStackProps, type VisualProps, clampNumber, createTheme, defaultTheme, enabledSelectableDescendants, exportTableToExcel, exportTableToPdf, filterTree, flattenTree, flowClass, formatLocalDateTime, resolveColorValue, resolveFlowStyle, responsiveCSS, sanitizeInputValue, selectedTreeModels, setLocalDayBoundary, themeToCSS };
|
package/dist/index.js
CHANGED
|
@@ -479,6 +479,21 @@ function setLocalDayBoundary(value, boundary) {
|
|
|
479
479
|
return `${datePart}T${boundary === "start" ? "00:00" : "23:59"}`;
|
|
480
480
|
}
|
|
481
481
|
|
|
482
|
+
// src/input.ts
|
|
483
|
+
function sanitizeInputValue(value, mode = "text") {
|
|
484
|
+
if (mode === "integer") return value.replace(/[^0-9-]/g, "");
|
|
485
|
+
if (mode === "decimal" || mode === "money") {
|
|
486
|
+
const cleaned = value.replace(/[^0-9.-]/g, "");
|
|
487
|
+
const [whole, ...decimals] = cleaned.split(".");
|
|
488
|
+
return decimals.length ? `${whole}.${decimals.join("")}` : whole;
|
|
489
|
+
}
|
|
490
|
+
if (mode === "alphabet") return value.replace(/[^a-zA-Z\s'-]/g, "");
|
|
491
|
+
return value;
|
|
492
|
+
}
|
|
493
|
+
function clampNumber(value, min, max) {
|
|
494
|
+
return Math.min(max, Math.max(min, value));
|
|
495
|
+
}
|
|
496
|
+
|
|
482
497
|
// src/table-export.ts
|
|
483
498
|
function cellText(row, column) {
|
|
484
499
|
const value = row[column.field];
|
|
@@ -592,6 +607,7 @@ function selectedTreeModels(nodes, values) {
|
|
|
592
607
|
return flattenTree(nodes).filter((node) => selected.has(node.value));
|
|
593
608
|
}
|
|
594
609
|
export {
|
|
610
|
+
clampNumber,
|
|
595
611
|
createTheme,
|
|
596
612
|
defaultTheme,
|
|
597
613
|
enabledSelectableDescendants,
|
|
@@ -604,6 +620,7 @@ export {
|
|
|
604
620
|
resolveColorValue,
|
|
605
621
|
resolveFlowStyle,
|
|
606
622
|
responsiveCSS,
|
|
623
|
+
sanitizeInputValue,
|
|
607
624
|
selectedTreeModels,
|
|
608
625
|
setLocalDayBoundary,
|
|
609
626
|
themeToCSS
|