namirasoft-site-react 1.4.339 → 1.4.340
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/.dockerignore +86 -86
- package/.env.template +10 -10
- package/Dockerfile +18 -18
- package/config-overrides.js +72 -72
- package/dist/App.css +34 -0
- package/dist/components/NSBanner.module.css +47 -47
- package/dist/components/NSBarAction.module.css +84 -84
- package/dist/components/NSBarAlert.module.css +79 -79
- package/dist/components/NSBarNotification.module.css +34 -34
- package/dist/components/NSBarTitle.module.css +9 -9
- package/dist/components/NSBox.module.css +50 -50
- package/dist/components/NSBoxBaseCombo.module.css +6 -6
- package/dist/components/NSBoxBoolean.module.css +67 -67
- package/dist/components/NSBoxDate.module.css +4 -4
- package/dist/components/NSBoxDateTime.module.css +4 -4
- package/dist/components/NSBoxDuration.module.css +4 -4
- package/dist/components/NSBoxFile.module.css +10 -10
- package/dist/components/NSBoxPhone.module.css +35 -35
- package/dist/components/NSBoxRadio.module.css +33 -33
- package/dist/components/NSBoxSchemaBase.module.css +17 -17
- package/dist/components/NSBoxSchemaVariable.module.css +16 -16
- package/dist/components/NSBoxTextArea.module.css +12 -12
- package/dist/components/NSBoxTime.module.css +4 -4
- package/dist/components/NSButton.module.css +57 -57
- package/dist/components/NSButtonBlue.module.css +4 -4
- package/dist/components/NSButtonGreen.module.css +4 -4
- package/dist/components/NSButtonRed.module.css +4 -4
- package/dist/components/NSCard.module.css +114 -114
- package/dist/components/NSCardScreenshot.module.css +41 -41
- package/dist/components/NSChartColumn.module.css +7 -7
- package/dist/components/NSChartTable.module.css +21 -21
- package/dist/components/NSColumn.module.css +16 -16
- package/dist/components/NSCopyBox.module.css +39 -39
- package/dist/components/NSDialog.module.css +112 -112
- package/dist/components/NSDialogPageSelection.module.css +103 -103
- package/dist/components/NSDownTimer.module.css +55 -55
- package/dist/components/NSDownload.module.css +46 -46
- package/dist/components/NSElectronicCard.module.css +60 -60
- package/dist/components/NSEntityCardBackground.module.css +27 -27
- package/dist/components/NSFilterBox.module.css +56 -56
- package/dist/components/NSFilterItem.module.css +24 -24
- package/dist/components/NSFooter.module.css +134 -134
- package/dist/components/NSHeader.module.css +291 -291
- package/dist/components/NSHeaderScreenshot.module.css +35 -35
- package/dist/components/NSID.js +2 -0
- package/dist/components/NSID.js.map +1 -1
- package/dist/components/NSLabel.module.css +25 -25
- package/dist/components/NSLabelErrorNotifier.module.css +2 -2
- package/dist/components/NSLayout.module.css +14 -14
- package/dist/components/NSLine.module.css +15 -15
- package/dist/components/NSLink.module.css +36 -36
- package/dist/components/NSListGrouped.module.css +69 -69
- package/dist/components/NSLoading.module.css +30 -30
- package/dist/components/NSMenuAction.js +2 -2
- package/dist/components/NSMenuAction.module.css +88 -88
- package/dist/components/NSMenuButton.module.css +44 -44
- package/dist/components/NSNoData.module.css +9 -9
- package/dist/components/NSPagination.module.css +85 -85
- package/dist/components/NSPanel.module.css +19 -19
- package/dist/components/NSPanelAccordion.module.css +4 -4
- package/dist/components/NSRange.module.css +66 -66
- package/dist/components/NSRow.module.css +17 -17
- package/dist/components/NSSection.module.css +4 -4
- package/dist/components/NSSectionCards.module.css +38 -38
- package/dist/components/NSSectionTiles.module.css +10 -10
- package/dist/components/NSTabPage.module.css +59 -59
- package/dist/components/NSTable.module.css +263 -263
- package/dist/components/NSTile.module.css +76 -76
- package/dist/components/NSTimelineMonthly.module.css +71 -71
- package/dist/components/NSTitle.module.css +15 -15
- package/dist/index.css +6 -0
- package/dist/pages/NSNotFoundPage.module.css +18 -18
- package/dist/pages/NSUpdating.module.css +35 -35
- package/package.json +80 -80
- package/public/index.html +38 -38
- package/src/App.css +33 -33
- package/src/App.tsx +131 -131
- package/src/Color.tsx +10 -10
- package/src/CopyToClipboard.ts +6 -6
- package/src/NSBoxBuilder.tsx +914 -914
- package/src/Validator.ts +163 -163
- package/src/components/INSBox.tsx +6 -6
- package/src/components/NSBanner.module.css +47 -47
- package/src/components/NSBanner.tsx +80 -80
- package/src/components/NSBarAction.module.css +84 -84
- package/src/components/NSBarAction.tsx +90 -90
- package/src/components/NSBarAlert.module.css +79 -79
- package/src/components/NSBarAlert.tsx +35 -35
- package/src/components/NSBarNotification.module.css +34 -34
- package/src/components/NSBarNotification.tsx +85 -85
- package/src/components/NSBarTitle.module.css +9 -9
- package/src/components/NSBarTitle.tsx +23 -23
- package/src/components/NSBox.module.css +50 -50
- package/src/components/NSBox.tsx +19 -19
- package/src/components/NSBoxBaseCombo.module.css +6 -6
- package/src/components/NSBoxBaseCombo.tsx +314 -314
- package/src/components/NSBoxBaseLayout.tsx +88 -88
- package/src/components/NSBoxBaseLayoutRecursive.tsx +54 -54
- package/src/components/NSBoxBoolean.module.css +67 -67
- package/src/components/NSBoxBoolean.tsx +119 -119
- package/src/components/NSBoxBooleans.tsx +161 -161
- package/src/components/NSBoxColor.tsx +95 -95
- package/src/components/NSBoxCombo.tsx +91 -91
- package/src/components/NSBoxDate.module.css +4 -4
- package/src/components/NSBoxDate.tsx +90 -90
- package/src/components/NSBoxDateTime.module.css +4 -4
- package/src/components/NSBoxDateTime.tsx +105 -105
- package/src/components/NSBoxDouble.tsx +94 -94
- package/src/components/NSBoxDuration.module.css +4 -4
- package/src/components/NSBoxDuration.tsx +95 -95
- package/src/components/NSBoxDynamic.tsx +67 -67
- package/src/components/NSBoxDynamics.tsx +68 -68
- package/src/components/NSBoxEmail.tsx +98 -98
- package/src/components/NSBoxEntity.tsx +101 -101
- package/src/components/NSBoxEnum.tsx +108 -108
- package/src/components/NSBoxFile.module.css +10 -10
- package/src/components/NSBoxFile.tsx +101 -101
- package/src/components/NSBoxFilePath.tsx +95 -95
- package/src/components/NSBoxFont.tsx +95 -95
- package/src/components/NSBoxIPV4.tsx +95 -95
- package/src/components/NSBoxIPV4Range.tsx +95 -95
- package/src/components/NSBoxIPV6.tsx +92 -92
- package/src/components/NSBoxIPV6Range.tsx +95 -95
- package/src/components/NSBoxInteger.tsx +91 -91
- package/src/components/NSBoxMoney.tsx +95 -95
- package/src/components/NSBoxPassword.tsx +106 -106
- package/src/components/NSBoxPhone.module.css +35 -35
- package/src/components/NSBoxPhone.tsx +107 -107
- package/src/components/NSBoxRadio.module.css +33 -33
- package/src/components/NSBoxRadio.tsx +91 -91
- package/src/components/NSBoxSchemaBase.module.css +17 -17
- package/src/components/NSBoxSchemaBase.tsx +540 -540
- package/src/components/NSBoxSchemaVariable.module.css +16 -16
- package/src/components/NSBoxSchemaVariable.tsx +250 -250
- package/src/components/NSBoxSearch.tsx +97 -97
- package/src/components/NSBoxString.tsx +91 -91
- package/src/components/NSBoxTextArea.module.css +12 -12
- package/src/components/NSBoxTextArea.tsx +98 -98
- package/src/components/NSBoxTime.module.css +4 -4
- package/src/components/NSBoxTime.tsx +93 -93
- package/src/components/NSBoxTimeZone.tsx +95 -95
- package/src/components/NSBoxURL.tsx +104 -104
- package/src/components/NSBoxVersion.tsx +95 -95
- package/src/components/NSButton.module.css +57 -57
- package/src/components/NSButton.tsx +25 -25
- package/src/components/NSButtonBlue.module.css +4 -4
- package/src/components/NSButtonBlue.tsx +19 -19
- package/src/components/NSButtonGreen.module.css +4 -4
- package/src/components/NSButtonGreen.tsx +19 -19
- package/src/components/NSButtonRed.module.css +4 -4
- package/src/components/NSButtonRed.tsx +19 -19
- package/src/components/NSCard.module.css +114 -114
- package/src/components/NSCard.tsx +63 -63
- package/src/components/NSCardScreenshot.module.css +41 -41
- package/src/components/NSCardScreenshot.tsx +31 -31
- package/src/components/NSChartColumn.module.css +7 -7
- package/src/components/NSChartColumn.tsx +106 -106
- package/src/components/NSChartDoughnut.tsx +112 -112
- package/src/components/NSChartPie.tsx +105 -105
- package/src/components/NSChartRange.tsx +14 -14
- package/src/components/NSChartTable.module.css +21 -21
- package/src/components/NSChartTable.tsx +94 -94
- package/src/components/NSColumn.module.css +16 -16
- package/src/components/NSColumn.tsx +24 -24
- package/src/components/NSCopy.tsx +58 -58
- package/src/components/NSCopyBox.module.css +39 -39
- package/src/components/NSCopyBox.tsx +53 -53
- package/src/components/NSDialog.module.css +112 -112
- package/src/components/NSDialog.tsx +61 -61
- package/src/components/NSDialogDelete.tsx +26 -26
- package/src/components/NSDialogInfo.tsx +32 -32
- package/src/components/NSDialogPageSelection.module.css +103 -103
- package/src/components/NSDialogPageSelection.tsx +227 -227
- package/src/components/NSDownTimer.module.css +55 -55
- package/src/components/NSDownTimer.tsx +91 -91
- package/src/components/NSDownload.module.css +46 -46
- package/src/components/NSDownload.tsx +66 -66
- package/src/components/NSElectronicCard.module.css +60 -60
- package/src/components/NSElectronicCard.tsx +46 -46
- package/src/components/NSEntityCardBackground.module.css +27 -27
- package/src/components/NSEntityCardBackground.tsx +36 -36
- package/src/components/NSFilterBox.module.css +56 -56
- package/src/components/NSFilterBox.tsx +506 -506
- package/src/components/NSFilterItem.module.css +24 -24
- package/src/components/NSFilterItem.tsx +27 -27
- package/src/components/NSFooter.module.css +134 -134
- package/src/components/NSFooter.tsx +321 -321
- package/src/components/NSHeader.module.css +291 -291
- package/src/components/NSHeader.tsx +261 -261
- package/src/components/NSHeaderScreenshot.module.css +35 -35
- package/src/components/NSHeaderScreenshot.tsx +39 -39
- package/src/components/NSID.tsx +133 -131
- package/src/components/NSLabel.module.css +25 -25
- package/src/components/NSLabel.tsx +46 -46
- package/src/components/NSLabelErrorNotifier.module.css +2 -2
- package/src/components/NSLabelErrorNotifier.tsx +35 -35
- package/src/components/NSLayout.module.css +14 -14
- package/src/components/NSLayout.tsx +126 -126
- package/src/components/NSLine.module.css +15 -15
- package/src/components/NSLine.tsx +13 -13
- package/src/components/NSLink.module.css +36 -36
- package/src/components/NSLink.tsx +25 -25
- package/src/components/NSLinkBlue.tsx +21 -21
- package/src/components/NSLinkGreen.tsx +12 -12
- package/src/components/NSLinkRed.tsx +12 -12
- package/src/components/NSListGrouped.module.css +69 -69
- package/src/components/NSListGrouped.tsx +106 -106
- package/src/components/NSListProduct.tsx +44 -44
- package/src/components/NSLoading.module.css +30 -30
- package/src/components/NSLoading.tsx +21 -21
- package/src/components/NSMenuAction.module.css +88 -88
- package/src/components/NSMenuAction.tsx +90 -90
- package/src/components/NSMenuButton.module.css +44 -44
- package/src/components/NSMenuButton.tsx +206 -206
- package/src/components/NSNoData.module.css +9 -9
- package/src/components/NSNoData.tsx +24 -24
- package/src/components/NSPagination.module.css +85 -85
- package/src/components/NSPagination.tsx +182 -182
- package/src/components/NSPanel.module.css +19 -19
- package/src/components/NSPanel.tsx +24 -24
- package/src/components/NSPanelAccordion.module.css +4 -4
- package/src/components/NSPanelAccordion.tsx +51 -51
- package/src/components/NSRange.module.css +66 -66
- package/src/components/NSRange.tsx +83 -83
- package/src/components/NSRepeater.tsx +256 -256
- package/src/components/NSRepeaterNSBoxSchemaVariable.tsx +90 -90
- package/src/components/NSRepeaterNSTag.tsx +81 -81
- package/src/components/NSRow.module.css +17 -17
- package/src/components/NSRow.tsx +24 -24
- package/src/components/NSSection.module.css +4 -4
- package/src/components/NSSection.tsx +26 -26
- package/src/components/NSSectionCards.module.css +38 -38
- package/src/components/NSSectionCards.tsx +51 -51
- package/src/components/NSSectionTiles.module.css +10 -10
- package/src/components/NSSectionTiles.tsx +25 -25
- package/src/components/NSSectionTitle.tsx +21 -21
- package/src/components/NSSpace.tsx +28 -28
- package/src/components/NSTabPage.module.css +59 -59
- package/src/components/NSTabPage.tsx +91 -91
- package/src/components/NSTable.module.css +263 -263
- package/src/components/NSTable.tsx +482 -482
- package/src/components/NSTag.tsx +74 -74
- package/src/components/NSTile.module.css +76 -76
- package/src/components/NSTile.tsx +27 -27
- package/src/components/NSTimelineMonthly.module.css +71 -71
- package/src/components/NSTimelineMonthly.tsx +44 -44
- package/src/components/NSTitle.module.css +15 -15
- package/src/components/NSTitle.tsx +19 -19
- package/src/formatter/BackColorFormatter.tsx +23 -23
- package/src/formatter/BaseColumnFormatter.ts +16 -16
- package/src/formatter/BaseURLImageFormatter.tsx +33 -33
- package/src/formatter/BooleanFormatter.ts +22 -22
- package/src/formatter/DateFormatter.ts +21 -21
- package/src/formatter/DateTimeFormatter.ts +21 -21
- package/src/formatter/DurationFormatter.ts +13 -13
- package/src/formatter/EmailFormatter.tsx +21 -21
- package/src/formatter/EnumFormatter.ts +13 -13
- package/src/formatter/FloatFormatter.ts +23 -23
- package/src/formatter/ForeColorFormatter.tsx +24 -24
- package/src/formatter/IDFormatter.tsx +30 -30
- package/src/formatter/IPFormatter.ts +13 -13
- package/src/formatter/IntegerFormatter.ts +23 -23
- package/src/formatter/JsonFormatter.ts +21 -21
- package/src/formatter/MoneyFormatter.ts +30 -30
- package/src/formatter/PhoneFormatter.tsx +21 -21
- package/src/formatter/StringFormatter.tsx +43 -43
- package/src/formatter/TimeFormatter.ts +21 -21
- package/src/formatter/URLFormatter.tsx +21 -21
- package/src/formatter/UnknowFormatter.ts +18 -18
- package/src/index.tsx +7 -7
- package/src/main.ts +222 -222
- package/src/pages/NSNotFoundPage.module.css +18 -18
- package/src/pages/NSNotFoundPage.tsx +11 -11
- package/src/pages/NSUpdating.module.css +35 -35
- package/src/pages/NSUpdating.tsx +32 -32
- package/src/props/IBackgroundPropps.ts +5 -5
- package/src/props/IBaseComponentProps.ts +8 -8
- package/src/props/IHeaderIconProps.ts +10 -10
- package/src/props/IHeaderProps.ts +7 -7
- package/src/props/IImageProps.ts +4 -4
- package/src/props/ILinkProps.ts +5 -5
- package/src/props/IValidationNumberProps.ts +4 -4
- package/src/props/IValidationPrecisionProps.ts +3 -3
- package/src/props/IValidationProps.ts +9 -9
- package/src/props/IValidationRegexProps.ts +4 -4
- package/src/props/IValidationStringProps.ts +4 -4
- package/src/routing/NSNotifier.ts +114 -114
- package/src/routing/NSRouterMaker.tsx +20 -20
- package/src/routing/NSRouterMakerComponent.ts +5 -5
- package/src/routing/NSRouterMakerProps.ts +5 -5
|
@@ -1,541 +1,541 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import Styles from "./NSBoxSchemaBase.module.css";
|
|
4
|
-
|
|
5
|
-
import React, { createRef } from "react";
|
|
6
|
-
import { IBaseComponentProps } from "../props/IBaseComponentProps";
|
|
7
|
-
import { IValidationProps } from "../props/IValidationProps";
|
|
8
|
-
import { IValidationStringProps } from "../props/IValidationStringProps";
|
|
9
|
-
import { safeMenuMenuItem } from "./NSMenuButton";
|
|
10
|
-
import { INSBoxBaseLayoutProps } from "./NSBoxBaseLayout";
|
|
11
|
-
import { INSBox } from "./INSBox";
|
|
12
|
-
import { NSBoxEnum } from "./NSBoxEnum";
|
|
13
|
-
import { AnySchema, ArraySchema, BaseNumberSchema, BasePrecisionSchema, BaseTypeSchema, BaseVariableSchema, BigIntSchema, BoolSchema, ColorSchema, DateSchema, DateTimeSchema, DecimalSchema, DoubleSchema, DurationSchema, EmailSchema, EntitySchema, EnumSchema, FilePathSchema, FloatSchema, FontSchema, IntegerSchema, IPV4RangeSchema, IPV4Schema, IPV6RangeSchema, IPV6Schema, MediumIntSchema, MoneySchema, ObjectSchema, PhoneSchema, RealSchema, SmallIntSchema, StringSchema, TimeSchema, TimeZoneSchema, TinyIntSchema, TypeSchema, URLSchema, VariableSchema, VariableType, VersionSchema } from "namirasoft-schema";
|
|
14
|
-
import { NSBoxBoolean } from "./NSBoxBoolean";
|
|
15
|
-
import { NSRow } from "./NSRow";
|
|
16
|
-
import { NSBoxString } from "./NSBoxString";
|
|
17
|
-
import { NSBoxInteger } from "./NSBoxInteger";
|
|
18
|
-
import { NSBoxBaseLayoutRecursive } from "./NSBoxBaseLayoutRecursive";
|
|
19
|
-
import { NSRepeaterNSBoxSchemaVariable } from "./NSRepeaterNSBoxSchemaVariable";
|
|
20
|
-
import { NSColumn } from "./NSColumn";
|
|
21
|
-
|
|
22
|
-
export interface NSBoxSchemaBaseProps extends IBaseComponentProps, IValidationProps, IValidationStringProps, INSBoxBaseLayoutProps<NSBoxSchemaBase, string>
|
|
23
|
-
{
|
|
24
|
-
name: string;
|
|
25
|
-
depth?: number;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface NSBoxSchemaBaseState
|
|
29
|
-
{
|
|
30
|
-
type: VariableType | null;
|
|
31
|
-
show_details: boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export class NSBoxSchemaBase extends React.Component<NSBoxSchemaBaseProps, NSBoxSchemaBaseState> implements INSBox
|
|
35
|
-
{
|
|
36
|
-
private NSBoxEnum_Type = createRef<NSBoxEnum<VariableType>>();
|
|
37
|
-
private NSBoxString_Name = createRef<NSBoxString>();
|
|
38
|
-
private NSBoxBoolean_Required = createRef<NSBoxBoolean>();
|
|
39
|
-
private NSBoxSchemaBase_ArraySchema = createRef<NSBoxSchemaBase>();
|
|
40
|
-
private NSRepeaterNSBoxSchemaVariable_ObjectFields = createRef<NSRepeaterNSBoxSchemaVariable>();
|
|
41
|
-
private NSBoxInteger_Min = createRef<NSBoxInteger>();
|
|
42
|
-
private NSBoxInteger_Max = createRef<NSBoxInteger>();
|
|
43
|
-
private NSBoxInteger_Precision = createRef<NSBoxInteger>();
|
|
44
|
-
private NSBoxInteger_MinLength = createRef<NSBoxInteger>();
|
|
45
|
-
private NSBoxInteger_MaxLength = createRef<NSBoxInteger>();
|
|
46
|
-
private NSBoxString_Regex = createRef<NSBoxString>();
|
|
47
|
-
private NSBoxString_ValidList = createRef<NSBoxString>();
|
|
48
|
-
private NSBoxString_InalidList = createRef<NSBoxString>();
|
|
49
|
-
private NSBoxString_PlaceHolder = createRef<NSBoxString>();
|
|
50
|
-
NSBoxBaseLayoutRecursive_Main = createRef<NSBoxBaseLayoutRecursive>();
|
|
51
|
-
constructor(props: NSBoxSchemaBaseProps)
|
|
52
|
-
{
|
|
53
|
-
super(props);
|
|
54
|
-
this.state = {
|
|
55
|
-
type: null,
|
|
56
|
-
show_details: false,
|
|
57
|
-
};
|
|
58
|
-
this.isEmpty = this.isEmpty.bind(this);
|
|
59
|
-
this.getError = this.getError.bind(this);
|
|
60
|
-
this.getValue = this.getValue.bind(this);
|
|
61
|
-
this.setValue = this.setValue.bind(this);
|
|
62
|
-
this.onChanged = this.onChanged.bind(this);
|
|
63
|
-
}
|
|
64
|
-
isEmpty(value: BaseTypeSchema | null): boolean
|
|
65
|
-
{
|
|
66
|
-
if (value)
|
|
67
|
-
if (value.type || value.example || value.valids?.length > 0 || value.invalids?.length > 0)
|
|
68
|
-
return false;
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
getError(): string | null
|
|
72
|
-
{
|
|
73
|
-
let ans = this.NSBoxEnum_Type.current?.getError() ||
|
|
74
|
-
this.NSBoxString_Name.current?.getError() ||
|
|
75
|
-
this.NSBoxBoolean_Required.current?.getError() ||
|
|
76
|
-
this.NSBoxSchemaBase_ArraySchema.current?.getError() ||
|
|
77
|
-
this.NSRepeaterNSBoxSchemaVariable_ObjectFields.current?.getError() ||
|
|
78
|
-
this.NSBoxInteger_Min.current?.getError() ||
|
|
79
|
-
this.NSBoxInteger_Max.current?.getError() ||
|
|
80
|
-
this.NSBoxInteger_Precision.current?.getError() ||
|
|
81
|
-
this.NSBoxInteger_MinLength.current?.getError() ||
|
|
82
|
-
this.NSBoxInteger_MaxLength.current?.getError() ||
|
|
83
|
-
this.NSBoxString_Regex.current?.getError() ||
|
|
84
|
-
this.NSBoxString_ValidList.current?.getError() ||
|
|
85
|
-
this.NSBoxString_InalidList.current?.getError() ||
|
|
86
|
-
this.NSBoxString_PlaceHolder.current?.getError();
|
|
87
|
-
return ans ?? null;
|
|
88
|
-
}
|
|
89
|
-
getValue(checkError: boolean = true): BaseTypeSchema | null
|
|
90
|
-
{
|
|
91
|
-
return NSBoxBaseLayoutRecursive.checkGetValue(this, checkError, () =>
|
|
92
|
-
{
|
|
93
|
-
let type = this.NSBoxEnum_Type.current?.getValueEnumOne(VariableType, VariableType.Any, checkError) ?? null;
|
|
94
|
-
let required = this.NSBoxBoolean_Required.current?.getValueBool(checkError) ?? false;
|
|
95
|
-
|
|
96
|
-
let name = this.NSBoxString_Name.current?.getValue(checkError) ?? null;
|
|
97
|
-
let min = this.NSBoxInteger_Min.current?.getValue(checkError) ?? null;
|
|
98
|
-
let max = this.NSBoxInteger_Max.current?.getValue(checkError) ?? null;
|
|
99
|
-
let precision = this.NSBoxInteger_Precision.current?.getValue(checkError) ?? null;
|
|
100
|
-
let min_length = this.NSBoxInteger_MinLength.current?.getValue(checkError) ?? null;
|
|
101
|
-
let max_length = this.NSBoxInteger_MaxLength.current?.getValue(checkError) ?? null;
|
|
102
|
-
let regex = this.NSBoxString_Regex.current?.getValue(checkError) ?? null;
|
|
103
|
-
let schema = this.NSBoxSchemaBase_ArraySchema.current?.getValue(checkError) ?? null;
|
|
104
|
-
let fields = this.NSRepeaterNSBoxSchemaVariable_ObjectFields.current?.getValue(checkError) ?? null;
|
|
105
|
-
let valid_list = this.NSBoxString_ValidList.current?.getValue(checkError)?.split(",") ?? [];
|
|
106
|
-
let invlid_list = this.NSBoxString_InalidList.current?.getValue(checkError)?.split(",") ?? [];
|
|
107
|
-
let place_holder = this.NSBoxString_PlaceHolder.current?.getValue(checkError) ?? undefined;
|
|
108
|
-
let enum_object: { [name: string]: string } = {};
|
|
109
|
-
invlid_list.forEach((v) => enum_object[v] = v);
|
|
110
|
-
|
|
111
|
-
let ans = null;
|
|
112
|
-
if (type)
|
|
113
|
-
{
|
|
114
|
-
switch (type)
|
|
115
|
-
{
|
|
116
|
-
/* VariableType */
|
|
117
|
-
case VariableType.Any:
|
|
118
|
-
ans = new AnySchema(required);
|
|
119
|
-
break;
|
|
120
|
-
case VariableType.Boolean:
|
|
121
|
-
ans = new BoolSchema(required);
|
|
122
|
-
break;
|
|
123
|
-
case VariableType.TinyInt:
|
|
124
|
-
ans = new TinyIntSchema(required, max, min);
|
|
125
|
-
break;
|
|
126
|
-
case VariableType.SmallInt:
|
|
127
|
-
ans = new SmallIntSchema(required, max, min);
|
|
128
|
-
break;
|
|
129
|
-
case VariableType.MediumInt:
|
|
130
|
-
ans = new MediumIntSchema(required, max, min);
|
|
131
|
-
break;
|
|
132
|
-
case VariableType.Integer:
|
|
133
|
-
ans = new IntegerSchema(required, max, min);
|
|
134
|
-
break;
|
|
135
|
-
case VariableType.BigInt:
|
|
136
|
-
ans = new BigIntSchema(required, max, min);
|
|
137
|
-
break;
|
|
138
|
-
case VariableType.Float:
|
|
139
|
-
ans = new FloatSchema(required, max, min, precision);
|
|
140
|
-
break;
|
|
141
|
-
case VariableType.Double:
|
|
142
|
-
ans = new DoubleSchema(required, max, min, precision);
|
|
143
|
-
break;
|
|
144
|
-
case VariableType.Decimal:
|
|
145
|
-
ans = new DecimalSchema(required, max, min, precision);
|
|
146
|
-
break;
|
|
147
|
-
case VariableType.Real:
|
|
148
|
-
ans = new RealSchema(required, max, min, precision);
|
|
149
|
-
break;
|
|
150
|
-
case VariableType.Money:
|
|
151
|
-
ans = new MoneySchema(required, max, min);
|
|
152
|
-
break;
|
|
153
|
-
case VariableType.String:
|
|
154
|
-
ans = new StringSchema(required, min_length, max_length);
|
|
155
|
-
if (regex)
|
|
156
|
-
ans.regex = new RegExp(regex);
|
|
157
|
-
break;
|
|
158
|
-
case VariableType.Date:
|
|
159
|
-
ans = new DateSchema(required);
|
|
160
|
-
break;
|
|
161
|
-
case VariableType.Time:
|
|
162
|
-
ans = new TimeSchema(required);
|
|
163
|
-
break;
|
|
164
|
-
case VariableType.DateTime:
|
|
165
|
-
ans = new DateTimeSchema(required);
|
|
166
|
-
break;
|
|
167
|
-
case VariableType.TimeZone:
|
|
168
|
-
ans = new TimeZoneSchema(required);
|
|
169
|
-
break;
|
|
170
|
-
case VariableType.Duration:
|
|
171
|
-
ans = new DurationSchema(required);
|
|
172
|
-
break;
|
|
173
|
-
case VariableType.Email:
|
|
174
|
-
ans = new EmailSchema(required);
|
|
175
|
-
break;
|
|
176
|
-
case VariableType.Phone:
|
|
177
|
-
ans = new PhoneSchema(required);
|
|
178
|
-
break;
|
|
179
|
-
case VariableType.Version:
|
|
180
|
-
ans = new VersionSchema(required);
|
|
181
|
-
break;
|
|
182
|
-
case VariableType.IPV4:
|
|
183
|
-
ans = new IPV4Schema(required);
|
|
184
|
-
break;
|
|
185
|
-
case VariableType.IPV6:
|
|
186
|
-
ans = new IPV6Schema(required);
|
|
187
|
-
break;
|
|
188
|
-
case VariableType.IPV4Range:
|
|
189
|
-
ans = new IPV4RangeSchema(required);
|
|
190
|
-
break;
|
|
191
|
-
case VariableType.IPV6Range:
|
|
192
|
-
ans = new IPV6RangeSchema(required);
|
|
193
|
-
break;
|
|
194
|
-
case VariableType.Color:
|
|
195
|
-
ans = new ColorSchema(required);
|
|
196
|
-
break;
|
|
197
|
-
case VariableType.Font:
|
|
198
|
-
ans = new FontSchema(required);
|
|
199
|
-
break;
|
|
200
|
-
case VariableType.FilePath:
|
|
201
|
-
ans = new FilePathSchema(required);
|
|
202
|
-
break;
|
|
203
|
-
case VariableType.URL:
|
|
204
|
-
ans = new URLSchema(required);
|
|
205
|
-
break;
|
|
206
|
-
case VariableType.Enum:
|
|
207
|
-
ans = new EnumSchema(name ?? "", required, enum_object);
|
|
208
|
-
break;
|
|
209
|
-
case VariableType.Entity:
|
|
210
|
-
// todo VariableType.Entity
|
|
211
|
-
ans = new EntitySchema(required, "", "", "");
|
|
212
|
-
break;
|
|
213
|
-
case VariableType.Array:
|
|
214
|
-
if (schema)
|
|
215
|
-
ans = new ArraySchema(required, [schema], min, max);
|
|
216
|
-
break;
|
|
217
|
-
case VariableType.Object:
|
|
218
|
-
if (fields)
|
|
219
|
-
ans = new ObjectSchema(name ?? "", required, fields);
|
|
220
|
-
break;
|
|
221
|
-
case VariableType.Type:
|
|
222
|
-
ans = new TypeSchema(required);
|
|
223
|
-
break;
|
|
224
|
-
case VariableType.Variable:
|
|
225
|
-
ans = new VariableSchema(required);
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
228
|
-
if (ans)
|
|
229
|
-
{
|
|
230
|
-
ans.setValid(...valid_list);
|
|
231
|
-
ans.setInvalid(...invlid_list);
|
|
232
|
-
ans.example = place_holder;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
return ans;
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
setValue(value: BaseTypeSchema | null, callback?: () => void): void
|
|
239
|
-
{
|
|
240
|
-
this.NSBoxEnum_Type.current?.setValue(value?.type ?? null, () =>
|
|
241
|
-
{
|
|
242
|
-
this.NSBoxBoolean_Required.current?.setValueBool(value?.required ?? false);
|
|
243
|
-
|
|
244
|
-
let name = null;
|
|
245
|
-
let min = null;
|
|
246
|
-
let max = null;
|
|
247
|
-
let precision = null;
|
|
248
|
-
let min_length = null;
|
|
249
|
-
let max_length = null;
|
|
250
|
-
let regex = null;
|
|
251
|
-
let array_schema = null;
|
|
252
|
-
let object_fields: BaseVariableSchema[] = [];
|
|
253
|
-
let valid_list = null;
|
|
254
|
-
let invlid_list = null;
|
|
255
|
-
let place_holder = null;
|
|
256
|
-
|
|
257
|
-
if (value?.type)
|
|
258
|
-
switch (value?.type)
|
|
259
|
-
{
|
|
260
|
-
/* VariableType */
|
|
261
|
-
case VariableType.Any:
|
|
262
|
-
break;
|
|
263
|
-
case VariableType.Boolean:
|
|
264
|
-
break;
|
|
265
|
-
case VariableType.TinyInt:
|
|
266
|
-
case VariableType.SmallInt:
|
|
267
|
-
case VariableType.MediumInt:
|
|
268
|
-
case VariableType.Integer:
|
|
269
|
-
case VariableType.BigInt:
|
|
270
|
-
{
|
|
271
|
-
let schema = value as BaseNumberSchema;
|
|
272
|
-
min = schema.min;
|
|
273
|
-
max = schema.max;
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
|
-
case VariableType.Float:
|
|
277
|
-
case VariableType.Double:
|
|
278
|
-
case VariableType.Decimal:
|
|
279
|
-
case VariableType.Real:
|
|
280
|
-
case VariableType.Money:
|
|
281
|
-
{
|
|
282
|
-
let schema = value as BasePrecisionSchema;
|
|
283
|
-
min = schema.min;
|
|
284
|
-
max = schema.max;
|
|
285
|
-
precision = schema.precision;
|
|
286
|
-
break;
|
|
287
|
-
}
|
|
288
|
-
case VariableType.String:
|
|
289
|
-
{
|
|
290
|
-
let schema = value as StringSchema;
|
|
291
|
-
min_length = schema.min_length;
|
|
292
|
-
max_length = schema.max_length;
|
|
293
|
-
if (schema.regex)
|
|
294
|
-
regex = schema.regex + "";
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
case VariableType.Date:
|
|
298
|
-
case VariableType.Time:
|
|
299
|
-
case VariableType.DateTime:
|
|
300
|
-
case VariableType.TimeZone:
|
|
301
|
-
case VariableType.Duration:
|
|
302
|
-
case VariableType.Email:
|
|
303
|
-
case VariableType.Phone:
|
|
304
|
-
case VariableType.Version:
|
|
305
|
-
case VariableType.IPV4:
|
|
306
|
-
case VariableType.IPV6:
|
|
307
|
-
case VariableType.IPV4Range:
|
|
308
|
-
case VariableType.IPV6Range:
|
|
309
|
-
case VariableType.Color:
|
|
310
|
-
case VariableType.Font:
|
|
311
|
-
case VariableType.FilePath:
|
|
312
|
-
case VariableType.URL:
|
|
313
|
-
break;
|
|
314
|
-
case VariableType.Enum:
|
|
315
|
-
let schema = value as EnumSchema;
|
|
316
|
-
name = schema.name;
|
|
317
|
-
break;
|
|
318
|
-
case VariableType.Entity:
|
|
319
|
-
// todo VariableType.Entity
|
|
320
|
-
break;
|
|
321
|
-
case VariableType.Array:
|
|
322
|
-
{
|
|
323
|
-
let schema = value as ArraySchema;
|
|
324
|
-
if (schema.items.length > 0)
|
|
325
|
-
array_schema = schema.items[0];
|
|
326
|
-
break;
|
|
327
|
-
}
|
|
328
|
-
case VariableType.Object:
|
|
329
|
-
{
|
|
330
|
-
let schema = value as ObjectSchema;
|
|
331
|
-
name = schema.name;
|
|
332
|
-
object_fields = schema.fields ?? [];
|
|
333
|
-
break;
|
|
334
|
-
}
|
|
335
|
-
case VariableType.Type:
|
|
336
|
-
break;
|
|
337
|
-
case VariableType.Variable:
|
|
338
|
-
break;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
this.NSBoxString_Name.current?.setValue(name);
|
|
342
|
-
this.NSBoxInteger_Min.current?.setValue(min);
|
|
343
|
-
this.NSBoxInteger_Max.current?.setValue(max);
|
|
344
|
-
this.NSBoxInteger_Precision.current?.setValue(precision);
|
|
345
|
-
this.NSBoxInteger_MinLength.current?.setValue(min_length);
|
|
346
|
-
this.NSBoxInteger_MaxLength.current?.setValue(max_length);
|
|
347
|
-
this.NSBoxString_Regex.current?.setValue(regex);
|
|
348
|
-
this.NSBoxSchemaBase_ArraySchema.current?.setValue(array_schema);
|
|
349
|
-
this.NSRepeaterNSBoxSchemaVariable_ObjectFields.current?.setValue(object_fields);
|
|
350
|
-
this.NSBoxString_ValidList.current?.setValue(valid_list);
|
|
351
|
-
this.NSBoxString_InalidList.current?.setValue(invlid_list);
|
|
352
|
-
this.NSBoxString_PlaceHolder.current?.setValue(place_holder);
|
|
353
|
-
|
|
354
|
-
this.props.onChanged?.(this);
|
|
355
|
-
callback?.();
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
private onChanged()
|
|
359
|
-
{
|
|
360
|
-
this.props.onChanged?.(this);
|
|
361
|
-
}
|
|
362
|
-
override render()
|
|
363
|
-
{
|
|
364
|
-
let menu = safeMenuMenuItem(this.props, (items) =>
|
|
365
|
-
{
|
|
366
|
-
items.push({
|
|
367
|
-
title: "Show Detail",
|
|
368
|
-
icon: this.state.show_details ? "https://static.namirasoft.com/image/concept/close/blue.svg" : "https://static.namirasoft.com/image/concept/ellipsis/vertical-blue.svg",
|
|
369
|
-
onClick: () =>
|
|
370
|
-
{
|
|
371
|
-
this.setState({ show_details: !this.state.show_details })
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
});
|
|
375
|
-
|
|
376
|
-
/* VariableType */
|
|
377
|
-
let isNumber = this.state.type && [VariableType.TinyInt, VariableType.SmallInt, VariableType.MediumInt, VariableType.Integer, VariableType.BigInt, VariableType.Float, VariableType.Double, VariableType.Decimal, VariableType.Real, VariableType.Money, VariableType.Array].includes(this.state.type);
|
|
378
|
-
let isPrecision = this.state.type && [VariableType.Float, VariableType.Double, VariableType.Decimal, VariableType.Real, VariableType.Money].includes(this.state.type);
|
|
379
|
-
let hasName = this.state.type && [VariableType.Enum, VariableType.Object].includes(this.state.type);
|
|
380
|
-
|
|
381
|
-
return (
|
|
382
|
-
<NSBoxBaseLayoutRecursive
|
|
383
|
-
ref={this.NSBoxBaseLayoutRecursive_Main}
|
|
384
|
-
{...this.props}
|
|
385
|
-
depth={this.props.depth ?? 0}
|
|
386
|
-
menu={menu}
|
|
387
|
-
>
|
|
388
|
-
<NSRow
|
|
389
|
-
>
|
|
390
|
-
<NSBoxEnum<VariableType>
|
|
391
|
-
ref={this.NSBoxEnum_Type}
|
|
392
|
-
required
|
|
393
|
-
title="Type"
|
|
394
|
-
multiple={false}
|
|
395
|
-
getEnumObject={() => VariableType}
|
|
396
|
-
/* VariableType */
|
|
397
|
-
invalids={[VariableType.Any, ...(this.props.invalids ?? [])]}
|
|
398
|
-
onChanged={(b) =>
|
|
399
|
-
{
|
|
400
|
-
this.setState({ type: b.getValueEnumOne(VariableType, VariableType.Any) });
|
|
401
|
-
this.onChanged();
|
|
402
|
-
}}
|
|
403
|
-
classList={[Styles.ns_box_schema_base_type]}
|
|
404
|
-
/>
|
|
405
|
-
{
|
|
406
|
-
hasName &&
|
|
407
|
-
<NSBoxString
|
|
408
|
-
ref={this.NSBoxString_Name}
|
|
409
|
-
required
|
|
410
|
-
title="Name"
|
|
411
|
-
classList={[Styles.ns_box_schema_base_name]}
|
|
412
|
-
/>
|
|
413
|
-
}
|
|
414
|
-
<NSBoxBoolean
|
|
415
|
-
ref={this.NSBoxBoolean_Required}
|
|
416
|
-
required
|
|
417
|
-
title="Required"
|
|
418
|
-
onChanged={() => this.onChanged()}
|
|
419
|
-
classList={[hasName ? Styles.ns_box_schema_base_required_withname : Styles.ns_box_schema_base_required_withoutname]}
|
|
420
|
-
/>
|
|
421
|
-
</NSRow>
|
|
422
|
-
{
|
|
423
|
-
this.state.type === VariableType.Array &&
|
|
424
|
-
<NSBoxSchemaBase
|
|
425
|
-
ref={this.NSBoxSchemaBase_ArraySchema}
|
|
426
|
-
name={this.props.name}
|
|
427
|
-
required
|
|
428
|
-
title="Array Elements' Schema"
|
|
429
|
-
style={{ width: "100%" }}
|
|
430
|
-
invalids={[VariableType.Any, VariableType.Object, VariableType.Array]}
|
|
431
|
-
depth={(this.props.depth ?? 0) + 1}
|
|
432
|
-
/>
|
|
433
|
-
}
|
|
434
|
-
{
|
|
435
|
-
this.state.type === VariableType.Object &&
|
|
436
|
-
<NSBoxBaseLayoutRecursive
|
|
437
|
-
required
|
|
438
|
-
depth={(this.props.depth ?? 0) + 1}
|
|
439
|
-
title="Fields"
|
|
440
|
-
style={{ width: "100%" }}
|
|
441
|
-
>
|
|
442
|
-
<NSRepeaterNSBoxSchemaVariable
|
|
443
|
-
ref={this.NSRepeaterNSBoxSchemaVariable_ObjectFields}
|
|
444
|
-
name={this.props.name}
|
|
445
|
-
required={this.props.required}
|
|
446
|
-
title={this.props.title}
|
|
447
|
-
item_title="Field"
|
|
448
|
-
style={{ width: "100%" }}
|
|
449
|
-
/>
|
|
450
|
-
</NSBoxBaseLayoutRecursive>
|
|
451
|
-
}
|
|
452
|
-
{
|
|
453
|
-
isNumber &&
|
|
454
|
-
<NSRow
|
|
455
|
-
style={{ display: this.state.show_details ? "" : "none", width: "100%", justifyContent: "left" }}
|
|
456
|
-
>
|
|
457
|
-
<NSBoxInteger
|
|
458
|
-
ref={this.NSBoxInteger_Min}
|
|
459
|
-
required={false}
|
|
460
|
-
title="Min"
|
|
461
|
-
style={{ minWidth: "150px", width: "150px" }}
|
|
462
|
-
/>
|
|
463
|
-
<NSBoxInteger
|
|
464
|
-
ref={this.NSBoxInteger_Max}
|
|
465
|
-
required={false}
|
|
466
|
-
title="Max"
|
|
467
|
-
style={{ minWidth: "150px", width: "150px" }}
|
|
468
|
-
/>
|
|
469
|
-
{
|
|
470
|
-
isPrecision &&
|
|
471
|
-
<NSBoxInteger
|
|
472
|
-
ref={this.NSBoxInteger_Precision}
|
|
473
|
-
required={false}
|
|
474
|
-
title="Precision"
|
|
475
|
-
style={{ minWidth: "150px", width: "150px" }}
|
|
476
|
-
/>
|
|
477
|
-
}
|
|
478
|
-
</NSRow>
|
|
479
|
-
}
|
|
480
|
-
{
|
|
481
|
-
this.state.type === VariableType.String &&
|
|
482
|
-
<NSColumn
|
|
483
|
-
style={{ display: this.state.show_details ? "" : "none", width: "100%" }}
|
|
484
|
-
>
|
|
485
|
-
<NSRow
|
|
486
|
-
style={{ justifyContent: "left" }}
|
|
487
|
-
>
|
|
488
|
-
<NSBoxInteger
|
|
489
|
-
ref={this.NSBoxInteger_MinLength}
|
|
490
|
-
required={false}
|
|
491
|
-
title="Min Length"
|
|
492
|
-
style={{ minWidth: "150px", width: "150px" }}
|
|
493
|
-
/>
|
|
494
|
-
<NSBoxInteger
|
|
495
|
-
ref={this.NSBoxInteger_MaxLength}
|
|
496
|
-
required={false}
|
|
497
|
-
title="Max Length"
|
|
498
|
-
style={{ minWidth: "150px", width: "150px" }}
|
|
499
|
-
/>
|
|
500
|
-
</NSRow>
|
|
501
|
-
<NSBoxString
|
|
502
|
-
ref={this.NSBoxString_Regex}
|
|
503
|
-
required={false}
|
|
504
|
-
title="Regex"
|
|
505
|
-
style={{ width: "100%" }}
|
|
506
|
-
/>
|
|
507
|
-
</NSColumn>
|
|
508
|
-
}
|
|
509
|
-
<div style={{ display: (this.state.type === VariableType.Enum || this.state.show_details) ? "" : "none", width: "100%" }}>
|
|
510
|
-
<NSBoxString
|
|
511
|
-
ref={this.NSBoxString_ValidList}
|
|
512
|
-
required={this.state.type === VariableType.Enum}
|
|
513
|
-
title="Valid List"
|
|
514
|
-
placeholder="Please enter valid list and sperate them via comma."
|
|
515
|
-
style={{ width: "100%" }}
|
|
516
|
-
onChanged={() => this.onChanged()}
|
|
517
|
-
/>
|
|
518
|
-
</div>
|
|
519
|
-
<NSColumn
|
|
520
|
-
style={{ display: this.state.show_details ? "" : "none", width: "100%" }}
|
|
521
|
-
>
|
|
522
|
-
<NSBoxString
|
|
523
|
-
ref={this.NSBoxString_InalidList}
|
|
524
|
-
required={false}
|
|
525
|
-
title="Invalid List"
|
|
526
|
-
placeholder="Please enter invvalid list and sperate them via comma."
|
|
527
|
-
style={{ width: "100%" }}
|
|
528
|
-
onChanged={() => this.onChanged()}
|
|
529
|
-
/>
|
|
530
|
-
<NSBoxString
|
|
531
|
-
ref={this.NSBoxString_PlaceHolder}
|
|
532
|
-
required={false}
|
|
533
|
-
title="Place Holder"
|
|
534
|
-
style={{ width: "100%" }}
|
|
535
|
-
onChanged={() => this.onChanged()}
|
|
536
|
-
/>
|
|
537
|
-
</NSColumn>
|
|
538
|
-
</NSBoxBaseLayoutRecursive>
|
|
539
|
-
);
|
|
540
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import Styles from "./NSBoxSchemaBase.module.css";
|
|
4
|
+
|
|
5
|
+
import React, { createRef } from "react";
|
|
6
|
+
import { IBaseComponentProps } from "../props/IBaseComponentProps";
|
|
7
|
+
import { IValidationProps } from "../props/IValidationProps";
|
|
8
|
+
import { IValidationStringProps } from "../props/IValidationStringProps";
|
|
9
|
+
import { safeMenuMenuItem } from "./NSMenuButton";
|
|
10
|
+
import { INSBoxBaseLayoutProps } from "./NSBoxBaseLayout";
|
|
11
|
+
import { INSBox } from "./INSBox";
|
|
12
|
+
import { NSBoxEnum } from "./NSBoxEnum";
|
|
13
|
+
import { AnySchema, ArraySchema, BaseNumberSchema, BasePrecisionSchema, BaseTypeSchema, BaseVariableSchema, BigIntSchema, BoolSchema, ColorSchema, DateSchema, DateTimeSchema, DecimalSchema, DoubleSchema, DurationSchema, EmailSchema, EntitySchema, EnumSchema, FilePathSchema, FloatSchema, FontSchema, IntegerSchema, IPV4RangeSchema, IPV4Schema, IPV6RangeSchema, IPV6Schema, MediumIntSchema, MoneySchema, ObjectSchema, PhoneSchema, RealSchema, SmallIntSchema, StringSchema, TimeSchema, TimeZoneSchema, TinyIntSchema, TypeSchema, URLSchema, VariableSchema, VariableType, VersionSchema } from "namirasoft-schema";
|
|
14
|
+
import { NSBoxBoolean } from "./NSBoxBoolean";
|
|
15
|
+
import { NSRow } from "./NSRow";
|
|
16
|
+
import { NSBoxString } from "./NSBoxString";
|
|
17
|
+
import { NSBoxInteger } from "./NSBoxInteger";
|
|
18
|
+
import { NSBoxBaseLayoutRecursive } from "./NSBoxBaseLayoutRecursive";
|
|
19
|
+
import { NSRepeaterNSBoxSchemaVariable } from "./NSRepeaterNSBoxSchemaVariable";
|
|
20
|
+
import { NSColumn } from "./NSColumn";
|
|
21
|
+
|
|
22
|
+
export interface NSBoxSchemaBaseProps extends IBaseComponentProps, IValidationProps, IValidationStringProps, INSBoxBaseLayoutProps<NSBoxSchemaBase, string>
|
|
23
|
+
{
|
|
24
|
+
name: string;
|
|
25
|
+
depth?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface NSBoxSchemaBaseState
|
|
29
|
+
{
|
|
30
|
+
type: VariableType | null;
|
|
31
|
+
show_details: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class NSBoxSchemaBase extends React.Component<NSBoxSchemaBaseProps, NSBoxSchemaBaseState> implements INSBox
|
|
35
|
+
{
|
|
36
|
+
private NSBoxEnum_Type = createRef<NSBoxEnum<VariableType>>();
|
|
37
|
+
private NSBoxString_Name = createRef<NSBoxString>();
|
|
38
|
+
private NSBoxBoolean_Required = createRef<NSBoxBoolean>();
|
|
39
|
+
private NSBoxSchemaBase_ArraySchema = createRef<NSBoxSchemaBase>();
|
|
40
|
+
private NSRepeaterNSBoxSchemaVariable_ObjectFields = createRef<NSRepeaterNSBoxSchemaVariable>();
|
|
41
|
+
private NSBoxInteger_Min = createRef<NSBoxInteger>();
|
|
42
|
+
private NSBoxInteger_Max = createRef<NSBoxInteger>();
|
|
43
|
+
private NSBoxInteger_Precision = createRef<NSBoxInteger>();
|
|
44
|
+
private NSBoxInteger_MinLength = createRef<NSBoxInteger>();
|
|
45
|
+
private NSBoxInteger_MaxLength = createRef<NSBoxInteger>();
|
|
46
|
+
private NSBoxString_Regex = createRef<NSBoxString>();
|
|
47
|
+
private NSBoxString_ValidList = createRef<NSBoxString>();
|
|
48
|
+
private NSBoxString_InalidList = createRef<NSBoxString>();
|
|
49
|
+
private NSBoxString_PlaceHolder = createRef<NSBoxString>();
|
|
50
|
+
NSBoxBaseLayoutRecursive_Main = createRef<NSBoxBaseLayoutRecursive>();
|
|
51
|
+
constructor(props: NSBoxSchemaBaseProps)
|
|
52
|
+
{
|
|
53
|
+
super(props);
|
|
54
|
+
this.state = {
|
|
55
|
+
type: null,
|
|
56
|
+
show_details: false,
|
|
57
|
+
};
|
|
58
|
+
this.isEmpty = this.isEmpty.bind(this);
|
|
59
|
+
this.getError = this.getError.bind(this);
|
|
60
|
+
this.getValue = this.getValue.bind(this);
|
|
61
|
+
this.setValue = this.setValue.bind(this);
|
|
62
|
+
this.onChanged = this.onChanged.bind(this);
|
|
63
|
+
}
|
|
64
|
+
isEmpty(value: BaseTypeSchema | null): boolean
|
|
65
|
+
{
|
|
66
|
+
if (value)
|
|
67
|
+
if (value.type || value.example || value.valids?.length > 0 || value.invalids?.length > 0)
|
|
68
|
+
return false;
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
getError(): string | null
|
|
72
|
+
{
|
|
73
|
+
let ans = this.NSBoxEnum_Type.current?.getError() ||
|
|
74
|
+
this.NSBoxString_Name.current?.getError() ||
|
|
75
|
+
this.NSBoxBoolean_Required.current?.getError() ||
|
|
76
|
+
this.NSBoxSchemaBase_ArraySchema.current?.getError() ||
|
|
77
|
+
this.NSRepeaterNSBoxSchemaVariable_ObjectFields.current?.getError() ||
|
|
78
|
+
this.NSBoxInteger_Min.current?.getError() ||
|
|
79
|
+
this.NSBoxInteger_Max.current?.getError() ||
|
|
80
|
+
this.NSBoxInteger_Precision.current?.getError() ||
|
|
81
|
+
this.NSBoxInteger_MinLength.current?.getError() ||
|
|
82
|
+
this.NSBoxInteger_MaxLength.current?.getError() ||
|
|
83
|
+
this.NSBoxString_Regex.current?.getError() ||
|
|
84
|
+
this.NSBoxString_ValidList.current?.getError() ||
|
|
85
|
+
this.NSBoxString_InalidList.current?.getError() ||
|
|
86
|
+
this.NSBoxString_PlaceHolder.current?.getError();
|
|
87
|
+
return ans ?? null;
|
|
88
|
+
}
|
|
89
|
+
getValue(checkError: boolean = true): BaseTypeSchema | null
|
|
90
|
+
{
|
|
91
|
+
return NSBoxBaseLayoutRecursive.checkGetValue(this, checkError, () =>
|
|
92
|
+
{
|
|
93
|
+
let type = this.NSBoxEnum_Type.current?.getValueEnumOne(VariableType, VariableType.Any, checkError) ?? null;
|
|
94
|
+
let required = this.NSBoxBoolean_Required.current?.getValueBool(checkError) ?? false;
|
|
95
|
+
|
|
96
|
+
let name = this.NSBoxString_Name.current?.getValue(checkError) ?? null;
|
|
97
|
+
let min = this.NSBoxInteger_Min.current?.getValue(checkError) ?? null;
|
|
98
|
+
let max = this.NSBoxInteger_Max.current?.getValue(checkError) ?? null;
|
|
99
|
+
let precision = this.NSBoxInteger_Precision.current?.getValue(checkError) ?? null;
|
|
100
|
+
let min_length = this.NSBoxInteger_MinLength.current?.getValue(checkError) ?? null;
|
|
101
|
+
let max_length = this.NSBoxInteger_MaxLength.current?.getValue(checkError) ?? null;
|
|
102
|
+
let regex = this.NSBoxString_Regex.current?.getValue(checkError) ?? null;
|
|
103
|
+
let schema = this.NSBoxSchemaBase_ArraySchema.current?.getValue(checkError) ?? null;
|
|
104
|
+
let fields = this.NSRepeaterNSBoxSchemaVariable_ObjectFields.current?.getValue(checkError) ?? null;
|
|
105
|
+
let valid_list = this.NSBoxString_ValidList.current?.getValue(checkError)?.split(",") ?? [];
|
|
106
|
+
let invlid_list = this.NSBoxString_InalidList.current?.getValue(checkError)?.split(",") ?? [];
|
|
107
|
+
let place_holder = this.NSBoxString_PlaceHolder.current?.getValue(checkError) ?? undefined;
|
|
108
|
+
let enum_object: { [name: string]: string } = {};
|
|
109
|
+
invlid_list.forEach((v) => enum_object[v] = v);
|
|
110
|
+
|
|
111
|
+
let ans = null;
|
|
112
|
+
if (type)
|
|
113
|
+
{
|
|
114
|
+
switch (type)
|
|
115
|
+
{
|
|
116
|
+
/* VariableType */
|
|
117
|
+
case VariableType.Any:
|
|
118
|
+
ans = new AnySchema(required);
|
|
119
|
+
break;
|
|
120
|
+
case VariableType.Boolean:
|
|
121
|
+
ans = new BoolSchema(required);
|
|
122
|
+
break;
|
|
123
|
+
case VariableType.TinyInt:
|
|
124
|
+
ans = new TinyIntSchema(required, max, min);
|
|
125
|
+
break;
|
|
126
|
+
case VariableType.SmallInt:
|
|
127
|
+
ans = new SmallIntSchema(required, max, min);
|
|
128
|
+
break;
|
|
129
|
+
case VariableType.MediumInt:
|
|
130
|
+
ans = new MediumIntSchema(required, max, min);
|
|
131
|
+
break;
|
|
132
|
+
case VariableType.Integer:
|
|
133
|
+
ans = new IntegerSchema(required, max, min);
|
|
134
|
+
break;
|
|
135
|
+
case VariableType.BigInt:
|
|
136
|
+
ans = new BigIntSchema(required, max, min);
|
|
137
|
+
break;
|
|
138
|
+
case VariableType.Float:
|
|
139
|
+
ans = new FloatSchema(required, max, min, precision);
|
|
140
|
+
break;
|
|
141
|
+
case VariableType.Double:
|
|
142
|
+
ans = new DoubleSchema(required, max, min, precision);
|
|
143
|
+
break;
|
|
144
|
+
case VariableType.Decimal:
|
|
145
|
+
ans = new DecimalSchema(required, max, min, precision);
|
|
146
|
+
break;
|
|
147
|
+
case VariableType.Real:
|
|
148
|
+
ans = new RealSchema(required, max, min, precision);
|
|
149
|
+
break;
|
|
150
|
+
case VariableType.Money:
|
|
151
|
+
ans = new MoneySchema(required, max, min);
|
|
152
|
+
break;
|
|
153
|
+
case VariableType.String:
|
|
154
|
+
ans = new StringSchema(required, min_length, max_length);
|
|
155
|
+
if (regex)
|
|
156
|
+
ans.regex = new RegExp(regex);
|
|
157
|
+
break;
|
|
158
|
+
case VariableType.Date:
|
|
159
|
+
ans = new DateSchema(required);
|
|
160
|
+
break;
|
|
161
|
+
case VariableType.Time:
|
|
162
|
+
ans = new TimeSchema(required);
|
|
163
|
+
break;
|
|
164
|
+
case VariableType.DateTime:
|
|
165
|
+
ans = new DateTimeSchema(required);
|
|
166
|
+
break;
|
|
167
|
+
case VariableType.TimeZone:
|
|
168
|
+
ans = new TimeZoneSchema(required);
|
|
169
|
+
break;
|
|
170
|
+
case VariableType.Duration:
|
|
171
|
+
ans = new DurationSchema(required);
|
|
172
|
+
break;
|
|
173
|
+
case VariableType.Email:
|
|
174
|
+
ans = new EmailSchema(required);
|
|
175
|
+
break;
|
|
176
|
+
case VariableType.Phone:
|
|
177
|
+
ans = new PhoneSchema(required);
|
|
178
|
+
break;
|
|
179
|
+
case VariableType.Version:
|
|
180
|
+
ans = new VersionSchema(required);
|
|
181
|
+
break;
|
|
182
|
+
case VariableType.IPV4:
|
|
183
|
+
ans = new IPV4Schema(required);
|
|
184
|
+
break;
|
|
185
|
+
case VariableType.IPV6:
|
|
186
|
+
ans = new IPV6Schema(required);
|
|
187
|
+
break;
|
|
188
|
+
case VariableType.IPV4Range:
|
|
189
|
+
ans = new IPV4RangeSchema(required);
|
|
190
|
+
break;
|
|
191
|
+
case VariableType.IPV6Range:
|
|
192
|
+
ans = new IPV6RangeSchema(required);
|
|
193
|
+
break;
|
|
194
|
+
case VariableType.Color:
|
|
195
|
+
ans = new ColorSchema(required);
|
|
196
|
+
break;
|
|
197
|
+
case VariableType.Font:
|
|
198
|
+
ans = new FontSchema(required);
|
|
199
|
+
break;
|
|
200
|
+
case VariableType.FilePath:
|
|
201
|
+
ans = new FilePathSchema(required);
|
|
202
|
+
break;
|
|
203
|
+
case VariableType.URL:
|
|
204
|
+
ans = new URLSchema(required);
|
|
205
|
+
break;
|
|
206
|
+
case VariableType.Enum:
|
|
207
|
+
ans = new EnumSchema(name ?? "", required, enum_object);
|
|
208
|
+
break;
|
|
209
|
+
case VariableType.Entity:
|
|
210
|
+
// todo VariableType.Entity
|
|
211
|
+
ans = new EntitySchema(required, "", "", "");
|
|
212
|
+
break;
|
|
213
|
+
case VariableType.Array:
|
|
214
|
+
if (schema)
|
|
215
|
+
ans = new ArraySchema(required, [schema], min, max);
|
|
216
|
+
break;
|
|
217
|
+
case VariableType.Object:
|
|
218
|
+
if (fields)
|
|
219
|
+
ans = new ObjectSchema(name ?? "", required, fields);
|
|
220
|
+
break;
|
|
221
|
+
case VariableType.Type:
|
|
222
|
+
ans = new TypeSchema(required);
|
|
223
|
+
break;
|
|
224
|
+
case VariableType.Variable:
|
|
225
|
+
ans = new VariableSchema(required);
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
if (ans)
|
|
229
|
+
{
|
|
230
|
+
ans.setValid(...valid_list);
|
|
231
|
+
ans.setInvalid(...invlid_list);
|
|
232
|
+
ans.example = place_holder;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return ans;
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
setValue(value: BaseTypeSchema | null, callback?: () => void): void
|
|
239
|
+
{
|
|
240
|
+
this.NSBoxEnum_Type.current?.setValue(value?.type ?? null, () =>
|
|
241
|
+
{
|
|
242
|
+
this.NSBoxBoolean_Required.current?.setValueBool(value?.required ?? false);
|
|
243
|
+
|
|
244
|
+
let name = null;
|
|
245
|
+
let min = null;
|
|
246
|
+
let max = null;
|
|
247
|
+
let precision = null;
|
|
248
|
+
let min_length = null;
|
|
249
|
+
let max_length = null;
|
|
250
|
+
let regex = null;
|
|
251
|
+
let array_schema = null;
|
|
252
|
+
let object_fields: BaseVariableSchema[] = [];
|
|
253
|
+
let valid_list = null;
|
|
254
|
+
let invlid_list = null;
|
|
255
|
+
let place_holder = null;
|
|
256
|
+
|
|
257
|
+
if (value?.type)
|
|
258
|
+
switch (value?.type)
|
|
259
|
+
{
|
|
260
|
+
/* VariableType */
|
|
261
|
+
case VariableType.Any:
|
|
262
|
+
break;
|
|
263
|
+
case VariableType.Boolean:
|
|
264
|
+
break;
|
|
265
|
+
case VariableType.TinyInt:
|
|
266
|
+
case VariableType.SmallInt:
|
|
267
|
+
case VariableType.MediumInt:
|
|
268
|
+
case VariableType.Integer:
|
|
269
|
+
case VariableType.BigInt:
|
|
270
|
+
{
|
|
271
|
+
let schema = value as BaseNumberSchema;
|
|
272
|
+
min = schema.min;
|
|
273
|
+
max = schema.max;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
case VariableType.Float:
|
|
277
|
+
case VariableType.Double:
|
|
278
|
+
case VariableType.Decimal:
|
|
279
|
+
case VariableType.Real:
|
|
280
|
+
case VariableType.Money:
|
|
281
|
+
{
|
|
282
|
+
let schema = value as BasePrecisionSchema;
|
|
283
|
+
min = schema.min;
|
|
284
|
+
max = schema.max;
|
|
285
|
+
precision = schema.precision;
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
case VariableType.String:
|
|
289
|
+
{
|
|
290
|
+
let schema = value as StringSchema;
|
|
291
|
+
min_length = schema.min_length;
|
|
292
|
+
max_length = schema.max_length;
|
|
293
|
+
if (schema.regex)
|
|
294
|
+
regex = schema.regex + "";
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
case VariableType.Date:
|
|
298
|
+
case VariableType.Time:
|
|
299
|
+
case VariableType.DateTime:
|
|
300
|
+
case VariableType.TimeZone:
|
|
301
|
+
case VariableType.Duration:
|
|
302
|
+
case VariableType.Email:
|
|
303
|
+
case VariableType.Phone:
|
|
304
|
+
case VariableType.Version:
|
|
305
|
+
case VariableType.IPV4:
|
|
306
|
+
case VariableType.IPV6:
|
|
307
|
+
case VariableType.IPV4Range:
|
|
308
|
+
case VariableType.IPV6Range:
|
|
309
|
+
case VariableType.Color:
|
|
310
|
+
case VariableType.Font:
|
|
311
|
+
case VariableType.FilePath:
|
|
312
|
+
case VariableType.URL:
|
|
313
|
+
break;
|
|
314
|
+
case VariableType.Enum:
|
|
315
|
+
let schema = value as EnumSchema;
|
|
316
|
+
name = schema.name;
|
|
317
|
+
break;
|
|
318
|
+
case VariableType.Entity:
|
|
319
|
+
// todo VariableType.Entity
|
|
320
|
+
break;
|
|
321
|
+
case VariableType.Array:
|
|
322
|
+
{
|
|
323
|
+
let schema = value as ArraySchema;
|
|
324
|
+
if (schema.items.length > 0)
|
|
325
|
+
array_schema = schema.items[0];
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
case VariableType.Object:
|
|
329
|
+
{
|
|
330
|
+
let schema = value as ObjectSchema;
|
|
331
|
+
name = schema.name;
|
|
332
|
+
object_fields = schema.fields ?? [];
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
case VariableType.Type:
|
|
336
|
+
break;
|
|
337
|
+
case VariableType.Variable:
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
this.NSBoxString_Name.current?.setValue(name);
|
|
342
|
+
this.NSBoxInteger_Min.current?.setValue(min);
|
|
343
|
+
this.NSBoxInteger_Max.current?.setValue(max);
|
|
344
|
+
this.NSBoxInteger_Precision.current?.setValue(precision);
|
|
345
|
+
this.NSBoxInteger_MinLength.current?.setValue(min_length);
|
|
346
|
+
this.NSBoxInteger_MaxLength.current?.setValue(max_length);
|
|
347
|
+
this.NSBoxString_Regex.current?.setValue(regex);
|
|
348
|
+
this.NSBoxSchemaBase_ArraySchema.current?.setValue(array_schema);
|
|
349
|
+
this.NSRepeaterNSBoxSchemaVariable_ObjectFields.current?.setValue(object_fields);
|
|
350
|
+
this.NSBoxString_ValidList.current?.setValue(valid_list);
|
|
351
|
+
this.NSBoxString_InalidList.current?.setValue(invlid_list);
|
|
352
|
+
this.NSBoxString_PlaceHolder.current?.setValue(place_holder);
|
|
353
|
+
|
|
354
|
+
this.props.onChanged?.(this);
|
|
355
|
+
callback?.();
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
private onChanged()
|
|
359
|
+
{
|
|
360
|
+
this.props.onChanged?.(this);
|
|
361
|
+
}
|
|
362
|
+
override render()
|
|
363
|
+
{
|
|
364
|
+
let menu = safeMenuMenuItem(this.props, (items) =>
|
|
365
|
+
{
|
|
366
|
+
items.push({
|
|
367
|
+
title: "Show Detail",
|
|
368
|
+
icon: this.state.show_details ? "https://static.namirasoft.com/image/concept/close/blue.svg" : "https://static.namirasoft.com/image/concept/ellipsis/vertical-blue.svg",
|
|
369
|
+
onClick: () =>
|
|
370
|
+
{
|
|
371
|
+
this.setState({ show_details: !this.state.show_details })
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
/* VariableType */
|
|
377
|
+
let isNumber = this.state.type && [VariableType.TinyInt, VariableType.SmallInt, VariableType.MediumInt, VariableType.Integer, VariableType.BigInt, VariableType.Float, VariableType.Double, VariableType.Decimal, VariableType.Real, VariableType.Money, VariableType.Array].includes(this.state.type);
|
|
378
|
+
let isPrecision = this.state.type && [VariableType.Float, VariableType.Double, VariableType.Decimal, VariableType.Real, VariableType.Money].includes(this.state.type);
|
|
379
|
+
let hasName = this.state.type && [VariableType.Enum, VariableType.Object].includes(this.state.type);
|
|
380
|
+
|
|
381
|
+
return (
|
|
382
|
+
<NSBoxBaseLayoutRecursive
|
|
383
|
+
ref={this.NSBoxBaseLayoutRecursive_Main}
|
|
384
|
+
{...this.props}
|
|
385
|
+
depth={this.props.depth ?? 0}
|
|
386
|
+
menu={menu}
|
|
387
|
+
>
|
|
388
|
+
<NSRow
|
|
389
|
+
>
|
|
390
|
+
<NSBoxEnum<VariableType>
|
|
391
|
+
ref={this.NSBoxEnum_Type}
|
|
392
|
+
required
|
|
393
|
+
title="Type"
|
|
394
|
+
multiple={false}
|
|
395
|
+
getEnumObject={() => VariableType}
|
|
396
|
+
/* VariableType */
|
|
397
|
+
invalids={[VariableType.Any, ...(this.props.invalids ?? [])]}
|
|
398
|
+
onChanged={(b) =>
|
|
399
|
+
{
|
|
400
|
+
this.setState({ type: b.getValueEnumOne(VariableType, VariableType.Any) });
|
|
401
|
+
this.onChanged();
|
|
402
|
+
}}
|
|
403
|
+
classList={[Styles.ns_box_schema_base_type]}
|
|
404
|
+
/>
|
|
405
|
+
{
|
|
406
|
+
hasName &&
|
|
407
|
+
<NSBoxString
|
|
408
|
+
ref={this.NSBoxString_Name}
|
|
409
|
+
required
|
|
410
|
+
title="Name"
|
|
411
|
+
classList={[Styles.ns_box_schema_base_name]}
|
|
412
|
+
/>
|
|
413
|
+
}
|
|
414
|
+
<NSBoxBoolean
|
|
415
|
+
ref={this.NSBoxBoolean_Required}
|
|
416
|
+
required
|
|
417
|
+
title="Required"
|
|
418
|
+
onChanged={() => this.onChanged()}
|
|
419
|
+
classList={[hasName ? Styles.ns_box_schema_base_required_withname : Styles.ns_box_schema_base_required_withoutname]}
|
|
420
|
+
/>
|
|
421
|
+
</NSRow>
|
|
422
|
+
{
|
|
423
|
+
this.state.type === VariableType.Array &&
|
|
424
|
+
<NSBoxSchemaBase
|
|
425
|
+
ref={this.NSBoxSchemaBase_ArraySchema}
|
|
426
|
+
name={this.props.name}
|
|
427
|
+
required
|
|
428
|
+
title="Array Elements' Schema"
|
|
429
|
+
style={{ width: "100%" }}
|
|
430
|
+
invalids={[VariableType.Any, VariableType.Object, VariableType.Array]}
|
|
431
|
+
depth={(this.props.depth ?? 0) + 1}
|
|
432
|
+
/>
|
|
433
|
+
}
|
|
434
|
+
{
|
|
435
|
+
this.state.type === VariableType.Object &&
|
|
436
|
+
<NSBoxBaseLayoutRecursive
|
|
437
|
+
required
|
|
438
|
+
depth={(this.props.depth ?? 0) + 1}
|
|
439
|
+
title="Fields"
|
|
440
|
+
style={{ width: "100%" }}
|
|
441
|
+
>
|
|
442
|
+
<NSRepeaterNSBoxSchemaVariable
|
|
443
|
+
ref={this.NSRepeaterNSBoxSchemaVariable_ObjectFields}
|
|
444
|
+
name={this.props.name}
|
|
445
|
+
required={this.props.required}
|
|
446
|
+
title={this.props.title}
|
|
447
|
+
item_title="Field"
|
|
448
|
+
style={{ width: "100%" }}
|
|
449
|
+
/>
|
|
450
|
+
</NSBoxBaseLayoutRecursive>
|
|
451
|
+
}
|
|
452
|
+
{
|
|
453
|
+
isNumber &&
|
|
454
|
+
<NSRow
|
|
455
|
+
style={{ display: this.state.show_details ? "" : "none", width: "100%", justifyContent: "left" }}
|
|
456
|
+
>
|
|
457
|
+
<NSBoxInteger
|
|
458
|
+
ref={this.NSBoxInteger_Min}
|
|
459
|
+
required={false}
|
|
460
|
+
title="Min"
|
|
461
|
+
style={{ minWidth: "150px", width: "150px" }}
|
|
462
|
+
/>
|
|
463
|
+
<NSBoxInteger
|
|
464
|
+
ref={this.NSBoxInteger_Max}
|
|
465
|
+
required={false}
|
|
466
|
+
title="Max"
|
|
467
|
+
style={{ minWidth: "150px", width: "150px" }}
|
|
468
|
+
/>
|
|
469
|
+
{
|
|
470
|
+
isPrecision &&
|
|
471
|
+
<NSBoxInteger
|
|
472
|
+
ref={this.NSBoxInteger_Precision}
|
|
473
|
+
required={false}
|
|
474
|
+
title="Precision"
|
|
475
|
+
style={{ minWidth: "150px", width: "150px" }}
|
|
476
|
+
/>
|
|
477
|
+
}
|
|
478
|
+
</NSRow>
|
|
479
|
+
}
|
|
480
|
+
{
|
|
481
|
+
this.state.type === VariableType.String &&
|
|
482
|
+
<NSColumn
|
|
483
|
+
style={{ display: this.state.show_details ? "" : "none", width: "100%" }}
|
|
484
|
+
>
|
|
485
|
+
<NSRow
|
|
486
|
+
style={{ justifyContent: "left" }}
|
|
487
|
+
>
|
|
488
|
+
<NSBoxInteger
|
|
489
|
+
ref={this.NSBoxInteger_MinLength}
|
|
490
|
+
required={false}
|
|
491
|
+
title="Min Length"
|
|
492
|
+
style={{ minWidth: "150px", width: "150px" }}
|
|
493
|
+
/>
|
|
494
|
+
<NSBoxInteger
|
|
495
|
+
ref={this.NSBoxInteger_MaxLength}
|
|
496
|
+
required={false}
|
|
497
|
+
title="Max Length"
|
|
498
|
+
style={{ minWidth: "150px", width: "150px" }}
|
|
499
|
+
/>
|
|
500
|
+
</NSRow>
|
|
501
|
+
<NSBoxString
|
|
502
|
+
ref={this.NSBoxString_Regex}
|
|
503
|
+
required={false}
|
|
504
|
+
title="Regex"
|
|
505
|
+
style={{ width: "100%" }}
|
|
506
|
+
/>
|
|
507
|
+
</NSColumn>
|
|
508
|
+
}
|
|
509
|
+
<div style={{ display: (this.state.type === VariableType.Enum || this.state.show_details) ? "" : "none", width: "100%" }}>
|
|
510
|
+
<NSBoxString
|
|
511
|
+
ref={this.NSBoxString_ValidList}
|
|
512
|
+
required={this.state.type === VariableType.Enum}
|
|
513
|
+
title="Valid List"
|
|
514
|
+
placeholder="Please enter valid list and sperate them via comma."
|
|
515
|
+
style={{ width: "100%" }}
|
|
516
|
+
onChanged={() => this.onChanged()}
|
|
517
|
+
/>
|
|
518
|
+
</div>
|
|
519
|
+
<NSColumn
|
|
520
|
+
style={{ display: this.state.show_details ? "" : "none", width: "100%" }}
|
|
521
|
+
>
|
|
522
|
+
<NSBoxString
|
|
523
|
+
ref={this.NSBoxString_InalidList}
|
|
524
|
+
required={false}
|
|
525
|
+
title="Invalid List"
|
|
526
|
+
placeholder="Please enter invvalid list and sperate them via comma."
|
|
527
|
+
style={{ width: "100%" }}
|
|
528
|
+
onChanged={() => this.onChanged()}
|
|
529
|
+
/>
|
|
530
|
+
<NSBoxString
|
|
531
|
+
ref={this.NSBoxString_PlaceHolder}
|
|
532
|
+
required={false}
|
|
533
|
+
title="Place Holder"
|
|
534
|
+
style={{ width: "100%" }}
|
|
535
|
+
onChanged={() => this.onChanged()}
|
|
536
|
+
/>
|
|
537
|
+
</NSColumn>
|
|
538
|
+
</NSBoxBaseLayoutRecursive>
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
541
|
}
|