namirasoft-site-react 1.4.531 → 1.4.533

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.
Files changed (154) hide show
  1. package/dist/App.d.ts +1 -1
  2. package/dist/NSBoxBuilder.d.ts +25 -25
  3. package/dist/Validator.d.ts +4 -0
  4. package/dist/Validator.js +23 -0
  5. package/dist/Validator.js.map +1 -1
  6. package/dist/components/NSBanner.d.ts +1 -1
  7. package/dist/components/NSBarAction.d.ts +1 -1
  8. package/dist/components/NSBarAlert.d.ts +1 -1
  9. package/dist/components/NSBarNotification.d.ts +1 -1
  10. package/dist/components/NSBarTitle.d.ts +1 -1
  11. package/dist/components/NSBoxBaseCombo.d.ts +1 -1
  12. package/dist/components/NSBoxBaseLayout.d.ts +1 -1
  13. package/dist/components/NSBoxBaseLayoutRecursive.d.ts +1 -1
  14. package/dist/components/NSBoxBoolean.d.ts +1 -1
  15. package/dist/components/NSBoxBooleans.d.ts +1 -1
  16. package/dist/components/NSBoxColor.d.ts +1 -1
  17. package/dist/components/NSBoxCombo.d.ts +1 -1
  18. package/dist/components/NSBoxDate.d.ts +1 -1
  19. package/dist/components/NSBoxDateRange.d.ts +14 -0
  20. package/dist/components/NSBoxDateRange.js +39 -0
  21. package/dist/components/NSBoxDateRange.js.map +1 -0
  22. package/dist/components/NSBoxDateRangeBase.d.ts +46 -0
  23. package/dist/components/NSBoxDateRangeBase.js +94 -0
  24. package/dist/components/NSBoxDateRangeBase.js.map +1 -0
  25. package/dist/components/NSBoxDateRangeBase.module.css +90 -0
  26. package/dist/components/NSBoxDateTime.d.ts +1 -1
  27. package/dist/components/NSBoxDateTimeRange.d.ts +14 -0
  28. package/dist/components/NSBoxDateTimeRange.js +47 -0
  29. package/dist/components/NSBoxDateTimeRange.js.map +1 -0
  30. package/dist/components/NSBoxDouble.d.ts +1 -1
  31. package/dist/components/NSBoxDuration.d.ts +1 -1
  32. package/dist/components/NSBoxDynamic.d.ts +1 -1
  33. package/dist/components/NSBoxDynamics.d.ts +1 -1
  34. package/dist/components/NSBoxEmail.d.ts +1 -1
  35. package/dist/components/NSBoxEntity.d.ts +1 -1
  36. package/dist/components/NSBoxEnum.d.ts +1 -1
  37. package/dist/components/NSBoxFile.d.ts +1 -1
  38. package/dist/components/NSBoxFilePath.d.ts +1 -1
  39. package/dist/components/NSBoxFont.d.ts +1 -1
  40. package/dist/components/NSBoxIPV4.d.ts +1 -1
  41. package/dist/components/NSBoxIPV4Range.d.ts +1 -1
  42. package/dist/components/NSBoxIPV6.d.ts +1 -1
  43. package/dist/components/NSBoxIPV6Range.d.ts +1 -1
  44. package/dist/components/NSBoxInteger.d.ts +1 -1
  45. package/dist/components/NSBoxMoney.d.ts +1 -1
  46. package/dist/components/NSBoxPhone.d.ts +1 -1
  47. package/dist/components/NSBoxRadio.d.ts +1 -1
  48. package/dist/components/NSBoxSchemaBase.d.ts +1 -1
  49. package/dist/components/NSBoxSchemaVariable.d.ts +1 -1
  50. package/dist/components/NSBoxSearch.d.ts +1 -1
  51. package/dist/components/NSBoxSensitive.d.ts +1 -1
  52. package/dist/components/NSBoxString.d.ts +1 -1
  53. package/dist/components/NSBoxTextArea.d.ts +1 -1
  54. package/dist/components/NSBoxTime.d.ts +1 -1
  55. package/dist/components/NSBoxTimeRange.d.ts +17 -0
  56. package/dist/components/NSBoxTimeRange.js +64 -0
  57. package/dist/components/NSBoxTimeRange.js.map +1 -0
  58. package/dist/components/NSBoxTimeZone.d.ts +7 -7
  59. package/dist/components/NSBoxTimeZone.js +30 -8
  60. package/dist/components/NSBoxTimeZone.js.map +1 -1
  61. package/dist/components/NSBoxURL.d.ts +1 -1
  62. package/dist/components/NSBoxVersion.d.ts +1 -1
  63. package/dist/components/NSButtonBlue.d.ts +1 -1
  64. package/dist/components/NSButtonGreen.d.ts +1 -1
  65. package/dist/components/NSButtonRed.d.ts +1 -1
  66. package/dist/components/NSCard.d.ts +1 -1
  67. package/dist/components/NSCardScreenshot.d.ts +1 -1
  68. package/dist/components/NSChartColumn.d.ts +1 -1
  69. package/dist/components/NSChartDoughnut.d.ts +1 -1
  70. package/dist/components/NSChartPie.d.ts +1 -1
  71. package/dist/components/NSChartRange.d.ts +1 -1
  72. package/dist/components/NSChartTable.d.ts +1 -1
  73. package/dist/components/NSColumn.d.ts +1 -1
  74. package/dist/components/NSCopy.d.ts +1 -1
  75. package/dist/components/NSCopyBox.d.ts +1 -1
  76. package/dist/components/NSDialog.d.ts +1 -1
  77. package/dist/components/NSDialogBox.d.ts +1 -1
  78. package/dist/components/NSDialogBoxDate.d.ts +1 -1
  79. package/dist/components/NSDialogBoxDateTime.d.ts +1 -1
  80. package/dist/components/NSDialogBoxPhone.d.ts +1 -1
  81. package/dist/components/NSDialogBoxString.d.ts +1 -1
  82. package/dist/components/NSDialogDelete.d.ts +1 -1
  83. package/dist/components/NSDialogInfo.d.ts +1 -1
  84. package/dist/components/NSDialogPageSelection.d.ts +2 -2
  85. package/dist/components/NSDownTimer.d.ts +1 -1
  86. package/dist/components/NSDownload.d.ts +1 -1
  87. package/dist/components/NSElectronicCard.d.ts +1 -1
  88. package/dist/components/NSEntityCardBackground.d.ts +1 -1
  89. package/dist/components/NSFilterBox.d.ts +2 -2
  90. package/dist/components/NSFilterBoxItems.d.ts +1 -1
  91. package/dist/components/NSFilterItem.d.ts +1 -1
  92. package/dist/components/NSFooter.d.ts +1 -1
  93. package/dist/components/NSGauge.d.ts +1 -1
  94. package/dist/components/NSGaugeDate.d.ts +1 -1
  95. package/dist/components/NSGaugeNumber.d.ts +1 -1
  96. package/dist/components/NSHeader.d.ts +1 -1
  97. package/dist/components/NSHeaderScreenshot.d.ts +1 -1
  98. package/dist/components/NSID.d.ts +1 -1
  99. package/dist/components/NSInfo.d.ts +1 -1
  100. package/dist/components/NSLabel.d.ts +1 -1
  101. package/dist/components/NSLabelErrorNotifier.d.ts +1 -1
  102. package/dist/components/NSLabelSensitive.d.ts +1 -1
  103. package/dist/components/NSLayout.d.ts +1 -1
  104. package/dist/components/NSLine.d.ts +1 -1
  105. package/dist/components/NSLineText.d.ts +1 -1
  106. package/dist/components/NSLink.d.ts +1 -1
  107. package/dist/components/NSLinkBlue.d.ts +1 -1
  108. package/dist/components/NSLinkGreen.d.ts +1 -1
  109. package/dist/components/NSLinkRed.d.ts +1 -1
  110. package/dist/components/NSListGrouped.d.ts +1 -1
  111. package/dist/components/NSListProduct.d.ts +1 -1
  112. package/dist/components/NSLoading.d.ts +1 -1
  113. package/dist/components/NSMegaMenu.d.ts +1 -1
  114. package/dist/components/NSMenuAction.d.ts +1 -1
  115. package/dist/components/NSMenuButton.d.ts +1 -1
  116. package/dist/components/NSNoData.d.ts +1 -1
  117. package/dist/components/NSPagination.d.ts +1 -1
  118. package/dist/components/NSPanel.d.ts +1 -1
  119. package/dist/components/NSPanelAccordion.d.ts +1 -1
  120. package/dist/components/NSProductSearch.d.ts +1 -1
  121. package/dist/components/NSProgressBar.d.ts +1 -1
  122. package/dist/components/NSRange.d.ts +1 -1
  123. package/dist/components/NSRepeater.d.ts +1 -1
  124. package/dist/components/NSRepeaterNSBoxSchemaVariable.d.ts +1 -1
  125. package/dist/components/NSRepeaterNSTag.d.ts +1 -1
  126. package/dist/components/NSRow.d.ts +1 -1
  127. package/dist/components/NSSection.d.ts +1 -1
  128. package/dist/components/NSSectionCards.d.ts +1 -1
  129. package/dist/components/NSSectionTiles.d.ts +1 -1
  130. package/dist/components/NSSectionTitle.d.ts +1 -1
  131. package/dist/components/NSSpace.d.ts +1 -1
  132. package/dist/components/NSSplitter.d.ts +1 -1
  133. package/dist/components/NSTabPage.d.ts +1 -1
  134. package/dist/components/NSTable.d.ts +1 -1
  135. package/dist/components/NSTag.d.ts +1 -1
  136. package/dist/components/NSTile.d.ts +1 -1
  137. package/dist/components/NSTimelineMonthly.d.ts +1 -1
  138. package/dist/components/NSTitle.d.ts +1 -1
  139. package/dist/formatter/StringFormatter.d.ts +1 -1
  140. package/dist/main.d.ts +4 -0
  141. package/dist/main.js +4 -0
  142. package/dist/main.js.map +1 -1
  143. package/dist/pages/NSImplementing.d.ts +1 -1
  144. package/dist/pages/NSNotFoundPage.d.ts +1 -1
  145. package/dist/pages/NSUpdating.d.ts +1 -1
  146. package/package.json +4 -3
  147. package/src/Validator.ts +24 -0
  148. package/src/components/NSBoxDateRange.tsx +59 -0
  149. package/src/components/NSBoxDateRangeBase.module.css +90 -0
  150. package/src/components/NSBoxDateRangeBase.tsx +189 -0
  151. package/src/components/NSBoxDateTimeRange.tsx +68 -0
  152. package/src/components/NSBoxTimeRange.tsx +94 -0
  153. package/src/components/NSBoxTimeZone.tsx +97 -82
  154. package/src/main.ts +4 -0
package/dist/App.d.ts CHANGED
@@ -10,6 +10,6 @@ interface AppState {
10
10
  export declare class App extends Component<AppProps, AppState> {
11
11
  private repeaterAdd;
12
12
  constructor(props: AppProps);
13
- render(): import("react/jsx-runtime").JSX.Element;
13
+ render(): import("react").JSX.Element;
14
14
  }
15
15
  export {};
@@ -17,7 +17,7 @@ export declare class NSBoxBuilder extends BaseTypeBuilder<React.JSX.Element | nu
17
17
  getValue(checkError?: boolean): any | null;
18
18
  setValue(value: any | null, callback?: () => void): void;
19
19
  protected _toAny(_: AnySchema): null;
20
- protected _toBool(schema: BoolSchema): import("react/jsx-runtime").JSX.Element | null;
20
+ protected _toBool(schema: BoolSchema): import("react").JSX.Element | null;
21
21
  private toInteger;
22
22
  protected _toTinyInt(schema: TinyIntSchema): import("react").JSX.Element | null;
23
23
  protected _toSmallInt(schema: SmallIntSchema): import("react").JSX.Element | null;
@@ -29,28 +29,28 @@ export declare class NSBoxBuilder extends BaseTypeBuilder<React.JSX.Element | nu
29
29
  protected _toDouble(schema: DoubleSchema): import("react").JSX.Element | null;
30
30
  protected _toDecimal(schema: DecimalSchema): import("react").JSX.Element | null;
31
31
  protected _toReal(schema: RealSchema): import("react").JSX.Element | null;
32
- protected _toMoney(schema: MoneySchema): import("react/jsx-runtime").JSX.Element | null;
33
- protected _toString(schema: StringSchema): import("react/jsx-runtime").JSX.Element | null;
34
- protected _toDate(schema: DateSchema): import("react/jsx-runtime").JSX.Element | null;
35
- protected _toTime(schema: TimeSchema): import("react/jsx-runtime").JSX.Element | null;
36
- protected _toDateTime(schema: DateTimeSchema): import("react/jsx-runtime").JSX.Element | null;
37
- protected _toTimeZone(schema: TimeZoneSchema): import("react/jsx-runtime").JSX.Element | null;
38
- protected _toDuration(schema: DurationSchema): import("react/jsx-runtime").JSX.Element | null;
39
- protected _toEmail(schema: EmailSchema): import("react/jsx-runtime").JSX.Element | null;
40
- protected _toPhone(schema: PhoneSchema): import("react/jsx-runtime").JSX.Element | null;
41
- protected _toVersion(schema: VersionSchema): import("react/jsx-runtime").JSX.Element | null;
42
- protected _toIPV4(schema: IPV4Schema): import("react/jsx-runtime").JSX.Element | null;
43
- protected _toIPV6(schema: IPV6Schema): import("react/jsx-runtime").JSX.Element | null;
44
- protected _toIPV4Range(schema: IPV4RangeSchema): import("react/jsx-runtime").JSX.Element | null;
45
- protected _toIPV6Range(schema: IPV6RangeSchema): import("react/jsx-runtime").JSX.Element | null;
46
- protected _toColor(schema: ColorSchema): import("react/jsx-runtime").JSX.Element | null;
47
- protected _toFont(schema: FontSchema): import("react/jsx-runtime").JSX.Element | null;
48
- protected _toFilePath(schema: FilePathSchema): import("react/jsx-runtime").JSX.Element | null;
49
- protected _toURL(schema: URLSchema): import("react/jsx-runtime").JSX.Element | null;
50
- protected _toEnum(schema: EnumSchema): import("react/jsx-runtime").JSX.Element;
51
- protected _toEntity(schema: EntitySchema): import("react/jsx-runtime").JSX.Element;
52
- protected _toArray(schema: ArraySchema, callback: (schema: BaseTypeSchema) => void): import("react/jsx-runtime").JSX.Element | null;
53
- protected _toObject(schema: ObjectSchema, callback: (schema: BaseTypeSchema) => void): import("react/jsx-runtime").JSX.Element | null;
54
- protected _toType(schema: TypeSchema): import("react/jsx-runtime").JSX.Element | null;
55
- protected _toVariable(schema: VariableSchema): import("react/jsx-runtime").JSX.Element | null;
32
+ protected _toMoney(schema: MoneySchema): import("react").JSX.Element | null;
33
+ protected _toString(schema: StringSchema): import("react").JSX.Element | null;
34
+ protected _toDate(schema: DateSchema): import("react").JSX.Element | null;
35
+ protected _toTime(schema: TimeSchema): import("react").JSX.Element | null;
36
+ protected _toDateTime(schema: DateTimeSchema): import("react").JSX.Element | null;
37
+ protected _toTimeZone(schema: TimeZoneSchema): import("react").JSX.Element | null;
38
+ protected _toDuration(schema: DurationSchema): import("react").JSX.Element | null;
39
+ protected _toEmail(schema: EmailSchema): import("react").JSX.Element | null;
40
+ protected _toPhone(schema: PhoneSchema): import("react").JSX.Element | null;
41
+ protected _toVersion(schema: VersionSchema): import("react").JSX.Element | null;
42
+ protected _toIPV4(schema: IPV4Schema): import("react").JSX.Element | null;
43
+ protected _toIPV6(schema: IPV6Schema): import("react").JSX.Element | null;
44
+ protected _toIPV4Range(schema: IPV4RangeSchema): import("react").JSX.Element | null;
45
+ protected _toIPV6Range(schema: IPV6RangeSchema): import("react").JSX.Element | null;
46
+ protected _toColor(schema: ColorSchema): import("react").JSX.Element | null;
47
+ protected _toFont(schema: FontSchema): import("react").JSX.Element | null;
48
+ protected _toFilePath(schema: FilePathSchema): import("react").JSX.Element | null;
49
+ protected _toURL(schema: URLSchema): import("react").JSX.Element | null;
50
+ protected _toEnum(schema: EnumSchema): import("react").JSX.Element;
51
+ protected _toEntity(schema: EntitySchema): import("react").JSX.Element;
52
+ protected _toArray(schema: ArraySchema, callback: (schema: BaseTypeSchema) => void): import("react").JSX.Element | null;
53
+ protected _toObject(schema: ObjectSchema, callback: (schema: BaseTypeSchema) => void): import("react").JSX.Element | null;
54
+ protected _toType(schema: TypeSchema): import("react").JSX.Element | null;
55
+ protected _toVariable(schema: VariableSchema): import("react").JSX.Element | null;
56
56
  }
@@ -8,6 +8,10 @@ export declare class Validator {
8
8
  static getErrorArray<T>(name: string, value: T[], required: boolean, min?: number, max?: number): string | null;
9
9
  static getErrorEmail(name: string, value: string | null | undefined, validator: IValidationProps): string | null;
10
10
  static getErrorDate(name: string, value: string | null | undefined, required: boolean): string | null;
11
+ static getErrorDateRange(name: string, value: {
12
+ from: string;
13
+ to: string;
14
+ } | null | undefined, required: boolean, minDate?: string, maxDate?: string): string | null;
11
15
  static getErrorTime(name: string, value: string | null | undefined, required: boolean): string | null;
12
16
  static getErrorDateTime(name: string, value: Date | null | undefined): string | null;
13
17
  static getErrorDuration(name: string, value: string | null | undefined): string | null;
package/dist/Validator.js CHANGED
@@ -86,6 +86,29 @@ export class Validator {
86
86
  }
87
87
  });
88
88
  }
89
+ static getErrorDateRange(name, value, required, minDate, maxDate) {
90
+ if (required && (!value || !value.from || !value.to))
91
+ return `${name} is required.`;
92
+ if (value === null || value === void 0 ? void 0 : value.from) {
93
+ const fromErr = Validator.getErrorDate(`${name} (from)`, value.from, false);
94
+ if (fromErr)
95
+ return fromErr;
96
+ if (minDate && value.from < minDate)
97
+ return `${name} (from) must not be before ${minDate}.`;
98
+ if (maxDate && value.from > maxDate)
99
+ return `${name} (from) must not be after ${maxDate}.`;
100
+ }
101
+ if (value === null || value === void 0 ? void 0 : value.to) {
102
+ const toErr = Validator.getErrorDate(`${name} (to)`, value.to, false);
103
+ if (toErr)
104
+ return toErr;
105
+ if (minDate && value.to < minDate)
106
+ return `${name} (to) must not be before ${minDate}.`;
107
+ if (maxDate && value.to > maxDate)
108
+ return `${name} (to) must not be after ${maxDate}.`;
109
+ }
110
+ return null;
111
+ }
89
112
  static getErrorTime(name, value, required) {
90
113
  return Validator.getError(name, value, {
91
114
  required,
@@ -1 +1 @@
1
- {"version":3,"file":"Validator.js","sourceRoot":"","sources":["../src/Validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEhH,MAAM,OAAO,SAAS;IAElB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;IACD,MAAM,CAAC,YAAY,CAAC,IAAY,EAAE,KAAgC;QAE9D,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE;YACnC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE;gBACnB,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,UAAU,CAAC,KAAK;aAC1B;SACJ,CAAC,CAAC;IACP,CAAC;IACD,MAAM,CAAC,aAAa,CAAC,IAAY,EAAE,KAAgC;QAE/D,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE;YACnC,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE;gBAE5B,IAAI,KAAK;oBACL,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC;wBAC9B,OAAO,IAAI,IAAI,qCAAqC,IAAI,GAAG,CAAC;gBACpE,OAAO,IAAI,CAAC;YAChB,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -13,4 +13,4 @@ export interface NSBannerProps extends IBaseComponentProps {
13
13
  text: string;
14
14
  }) | null;
15
15
  }
16
- export declare function NSBanner(props: NSBannerProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function NSBanner(props: NSBannerProps): import("react").JSX.Element;
@@ -14,4 +14,4 @@ export declare function isValidMenu(menus?: {
14
14
  [group: string]: NSMenuActionProps[];
15
15
  }): boolean;
16
16
  export declare function isValidAction(props?: NSBarActionProps): boolean;
17
- export declare function NSBarAction(props: NSBarActionProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function NSBarAction(props: NSBarActionProps): import("react").JSX.Element;
@@ -6,4 +6,4 @@ export interface NSBarAlertProps extends IBaseComponentProps {
6
6
  isVisible: () => boolean;
7
7
  onClick?: () => void;
8
8
  }
9
- export declare function NSBarAlert(props: NSBarAlertProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function NSBarAlert(props: NSBarAlertProps): import("react").JSX.Element;
@@ -23,4 +23,4 @@ export declare enum NotificationType {
23
23
  Success = "Success",
24
24
  Error = "Error"
25
25
  }
26
- export declare function NSBarNotification(props: NSBarNotificationPropsInner): import("react/jsx-runtime").JSX.Element;
26
+ export declare function NSBarNotification(props: NSBarNotificationPropsInner): import("react").JSX.Element;
@@ -2,4 +2,4 @@ export interface NSBarTitleProps {
2
2
  title: string;
3
3
  description?: string;
4
4
  }
5
- export declare function NSBarTitle(props: NSBarTitleProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function NSBarTitle(props: NSBarTitleProps): import("react").JSX.Element;
@@ -67,6 +67,6 @@ export declare class NSBoxBaseCombo<Data> extends React.Component<NSBoxBaseCombo
67
67
  private setRows;
68
68
  setDisabled(disabled: boolean): void;
69
69
  componentDidMount(): void;
70
- render(): import("react/jsx-runtime").JSX.Element;
70
+ render(): React.JSX.Element;
71
71
  }
72
72
  export {};
@@ -48,5 +48,5 @@ export declare class NSBoxBaseLayout extends React.Component<NSBoxBaseLayoutProp
48
48
  isNull(): boolean;
49
49
  setNull(checked: boolean): void;
50
50
  setDisabled(disabled: boolean): void;
51
- render(): import("react/jsx-runtime").JSX.Element;
51
+ render(): React.JSX.Element;
52
52
  }
@@ -10,5 +10,5 @@ export declare class NSBoxBaseLayoutRecursive extends React.Component<NSBoxBaseL
10
10
  }, checkError: boolean, handler: () => T | null): T | null;
11
11
  NSBoxBaseLayout_Main: React.RefObject<NSBoxBaseLayout>;
12
12
  setDisabled(disabled: boolean): void;
13
- render(): import("react/jsx-runtime").JSX.Element;
13
+ render(): React.JSX.Element;
14
14
  }
@@ -27,5 +27,5 @@ export declare class NSBoxBoolean extends React.Component<NSBoxBooleanProps, NSB
27
27
  setDisabled(disabled: boolean): void;
28
28
  componentDidUpdate(prevProps: Readonly<NSBoxBooleanProps>): void;
29
29
  componentDidMount(): void;
30
- render(): import("react/jsx-runtime").JSX.Element;
30
+ render(): React.JSX.Element;
31
31
  }
@@ -34,5 +34,5 @@ export declare class NSBoxBooleans extends React.Component<NSBoxBooleansProps, N
34
34
  private onChanged;
35
35
  getValues(): string[];
36
36
  setValues(values: string[], callback?: () => void): void;
37
- render(): import("react/jsx-runtime").JSX.Element;
37
+ render(): React.JSX.Element;
38
38
  }
@@ -18,5 +18,5 @@ export declare class NSBoxColor extends React.Component<NSBoxColorProps, NSBoxCo
18
18
  getValue(checkError?: boolean): string | null;
19
19
  setValue(value: string | null, callback?: () => void): void;
20
20
  setDisabled(disabled: boolean): void;
21
- render(): import("react/jsx-runtime").JSX.Element;
21
+ render(): React.JSX.Element;
22
22
  }
@@ -20,5 +20,5 @@ export declare class NSBoxCombo extends React.Component<NSBoxComboProps> impleme
20
20
  setValueAll(values: string[], callback?: () => void): void;
21
21
  setDisabled(disabled: boolean): void;
22
22
  reload(): void;
23
- render(): import("react/jsx-runtime").JSX.Element;
23
+ render(): React.JSX.Element;
24
24
  }
@@ -18,5 +18,5 @@ export declare class NSBoxDate extends React.Component<NSBoxDateProps, NSBoxDate
18
18
  getValue(checkError?: boolean): string | null;
19
19
  setValue(value: string | null, callback?: () => void): void;
20
20
  setDisabled(disabled: boolean): void;
21
- render(): import("react/jsx-runtime").JSX.Element;
21
+ render(): React.JSX.Element;
22
22
  }
@@ -0,0 +1,14 @@
1
+ import { NSBoxDateRangeBase, NSBoxDateRangeBaseProps } from './NSBoxDateRangeBase';
2
+ export interface NSBoxDateRangeProps extends NSBoxDateRangeBaseProps<NSBoxDateRange> {
3
+ }
4
+ export declare class NSBoxDateRange extends NSBoxDateRangeBase<NSBoxDateRangeProps> {
5
+ protected getFormat(): string;
6
+ getError(): string | null;
7
+ protected getBuiltinPresets(): {
8
+ label: string;
9
+ title: string;
10
+ from: string;
11
+ to: string;
12
+ }[];
13
+ protected renderPicker(): import("react").JSX.Element;
14
+ }
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { DatePicker } from 'antd';
4
+ import dayjs from 'dayjs';
5
+ import { TimeOperation } from 'namirasoft-core';
6
+ import { Validator } from '../Validator';
7
+ import StylesNSBox from './NSBox.module.css';
8
+ import { NSBoxDateRangeBase } from './NSBoxDateRangeBase';
9
+ import Styles from './NSBoxDateRangeBase.module.css';
10
+ export class NSBoxDateRange extends NSBoxDateRangeBase {
11
+ getFormat() { return 'YYYY-MM-DD'; }
12
+ getError() {
13
+ const fmt = this.getFormat();
14
+ const minDate = this.props.minDate ? TimeOperation.format(this.props.minDate, fmt) : undefined;
15
+ const maxDate = this.props.maxDate ? TimeOperation.format(this.props.maxDate, fmt) : undefined;
16
+ return Validator.getErrorDateRange(this.props.title, this.state.value, this.props.required, minDate, maxDate);
17
+ }
18
+ getBuiltinPresets() {
19
+ const fmt = this.getFormat();
20
+ const now = new Date();
21
+ const to = TimeOperation.format(now, fmt);
22
+ return [
23
+ { label: '1D', title: 'Last 1 Day', from: TimeOperation.format(TimeOperation.daysAgo(1, now), fmt), to },
24
+ { label: '2D', title: 'Last 2 Days', from: TimeOperation.format(TimeOperation.daysAgo(2, now), fmt), to },
25
+ { label: '1W', title: 'Last 1 Week', from: TimeOperation.format(TimeOperation.weeksAgo(1, now), fmt), to },
26
+ { label: '1M', title: 'Last 1 Month', from: TimeOperation.format(TimeOperation.monthsAgo(1, now), fmt), to },
27
+ { label: '3M', title: 'Last 3 Months', from: TimeOperation.format(TimeOperation.monthsAgo(3, now), fmt), to },
28
+ ];
29
+ }
30
+ renderPicker() {
31
+ return (_jsx(DatePicker.RangePicker, { className: `${StylesNSBox.ns_box_input} ${Styles.ns_picker}`, variant: "borderless", value: this.toDayjsValue(), format: this.getFormat(), minDate: this.props.minDate ? dayjs(this.props.minDate) : undefined, maxDate: this.props.maxDate ? dayjs(this.props.maxDate) : undefined, onChange: (_, dateStrings) => {
32
+ if ((dateStrings === null || dateStrings === void 0 ? void 0 : dateStrings[0]) && (dateStrings === null || dateStrings === void 0 ? void 0 : dateStrings[1]))
33
+ this.setValue({ from: dateStrings[0], to: dateStrings[1] });
34
+ else
35
+ this.setValue(null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AC5D,OAAO,EAAC,YAAY,EACpB,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,EAC1B,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,EACxB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,EACnE,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,EACnE,QAAQ,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE;gBAEzB,IAAI,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,CAAC,CAAC,MAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,CAAC,CAAC,CAAA;oBACpC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;;oBAE5D,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC,GACH,CACL,CAAC;IACN,CAAC;CACJ"}
@@ -0,0 +1,46 @@
1
+ import type { Dayjs } from 'dayjs';
2
+ import { Component } from 'react';
3
+ import { IBaseComponentProps } from '../props/IBaseComponentProps';
4
+ import { IValidationProps } from '../props/IValidationProps';
5
+ import { INSBox } from './INSBox';
6
+ import { INSBoxBaseLayoutProps, NSBoxBaseLayout } from './NSBoxBaseLayout';
7
+ export interface NSBoxDateRangeValue {
8
+ from: string;
9
+ to: string;
10
+ }
11
+ export interface NSBoxDateRangePreset {
12
+ shortName: string;
13
+ title?: string;
14
+ getFrom: () => Date;
15
+ getTo: () => Date;
16
+ }
17
+ export interface NSBoxDateRangeBaseProps<TBox> extends IBaseComponentProps, IValidationProps, INSBoxBaseLayoutProps<TBox, NSBoxDateRangeValue> {
18
+ minDate?: Date;
19
+ maxDate?: Date;
20
+ preset?: boolean;
21
+ presets?: NSBoxDateRangePreset[];
22
+ }
23
+ export interface NSBoxDateRangeBaseState {
24
+ value: NSBoxDateRangeValue | null;
25
+ }
26
+ export declare abstract class NSBoxDateRangeBase<TProps extends NSBoxDateRangeBaseProps<any>> extends Component<TProps, NSBoxDateRangeBaseState> implements INSBox {
27
+ NSBoxBaseLayout_Main: import("react").RefObject<NSBoxBaseLayout>;
28
+ constructor(props: TProps);
29
+ isEmpty(value: NSBoxDateRangeValue): boolean;
30
+ abstract getError(): string | null;
31
+ getValue(checkError?: boolean): NSBoxDateRangeValue | null;
32
+ setValue(value: NSBoxDateRangeValue | null, callback?: () => void): void;
33
+ setDisabled(disabled: boolean): void;
34
+ protected abstract getFormat(): string;
35
+ protected abstract getBuiltinPresets(): {
36
+ label: string;
37
+ title: string;
38
+ from: string;
39
+ to: string;
40
+ }[];
41
+ protected abstract renderPicker(): React.ReactNode;
42
+ protected toDayjsValue(): [Dayjs, Dayjs] | null;
43
+ private isInRange;
44
+ private renderPresets;
45
+ render(): import("react").JSX.Element;
46
+ }
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import dayjs from 'dayjs';
4
+ import { TimeOperation } from 'namirasoft-core';
5
+ import { Component, createRef } from 'react';
6
+ import { NSBoxBaseLayout } from './NSBoxBaseLayout';
7
+ import Styles from './NSBoxDateRangeBase.module.css';
8
+ import { safeMenuMenuItem } from './NSMenuButton';
9
+ export class NSBoxDateRangeBase extends Component {
10
+ constructor(props) {
11
+ var _a;
12
+ super(props);
13
+ this.NSBoxBaseLayout_Main = createRef();
14
+ this.state = { value: (_a = props.defaultValue) !== null && _a !== void 0 ? _a : null };
15
+ this.isEmpty = this.isEmpty.bind(this);
16
+ this.getError = this.getError.bind(this);
17
+ this.getValue = this.getValue.bind(this);
18
+ this.setValue = this.setValue.bind(this);
19
+ }
20
+ isEmpty(value) {
21
+ return !value || !value.from || !value.to;
22
+ }
23
+ getValue(checkError = true) {
24
+ var _a;
25
+ if (this.props.nullable)
26
+ if ((_a = this.NSBoxBaseLayout_Main.current) === null || _a === void 0 ? void 0 : _a.isNull())
27
+ return null;
28
+ return NSBoxBaseLayout.checkGetValue(this, checkError, () => this.state.value);
29
+ }
30
+ setValue(value, callback) {
31
+ var _a;
32
+ if (this.props.nullable)
33
+ (_a = this.NSBoxBaseLayout_Main.current) === null || _a === void 0 ? void 0 : _a.setNull(value == null);
34
+ this.setState({ value }, () => {
35
+ var _a, _b;
36
+ (_b = (_a = this.props).onChanged) === null || _b === void 0 ? void 0 : _b.call(_a, this);
37
+ callback === null || callback === void 0 ? void 0 : callback();
38
+ });
39
+ }
40
+ setDisabled(disabled) {
41
+ var _a;
42
+ (_a = this.NSBoxBaseLayout_Main.current) === null || _a === void 0 ? void 0 : _a.setDisabled(disabled);
43
+ }
44
+ toDayjsValue() {
45
+ const { value } = this.state;
46
+ if (!(value === null || value === void 0 ? void 0 : value.from) || !(value === null || value === void 0 ? void 0 : value.to))
47
+ return null;
48
+ return [dayjs(value.from), dayjs(value.to)];
49
+ }
50
+ isInRange(from, to) {
51
+ const fmt = this.getFormat();
52
+ const { minDate, maxDate } = this.props;
53
+ if (minDate && from < TimeOperation.format(minDate, fmt))
54
+ return false;
55
+ if (maxDate && to > TimeOperation.format(maxDate, fmt))
56
+ return false;
57
+ return true;
58
+ }
59
+ renderPresets() {
60
+ const { preset, presets: customPresets } = this.props;
61
+ const builtinPresets = preset
62
+ ? this.getBuiltinPresets().filter(p => this.isInRange(p.from, p.to))
63
+ : [];
64
+ const resolvedCustom = (customPresets !== null && customPresets !== void 0 ? customPresets : [])
65
+ .map(p => ({
66
+ shortName: p.shortName,
67
+ title: p.title,
68
+ from: TimeOperation.format(p.getFrom(), this.getFormat()),
69
+ to: TimeOperation.format(p.getTo(), this.getFormat()),
70
+ }))
71
+ .filter(p => this.isInRange(p.from, p.to));
72
+ const showDivider = builtinPresets.length > 0 && resolvedCustom.length > 0;
73
+ return (_jsxs("div", { className: Styles.ns_preset_container, children: [builtinPresets.map(p => {
74
+ var _a, _b;
75
+ const isActive = ((_a = this.state.value) === null || _a === void 0 ? void 0 : _a.from) === p.from && ((_b = this.state.value) === null || _b === void 0 ? void 0 : _b.to) === p.to;
76
+ return (_jsx("button", { type: "button", title: p.title, className: `${Styles.ns_preset_btn} ${isActive ? Styles.ns_preset_btn_active : ''}`, onClick: () => this.setValue({ from: p.from, to: p.to }), children: p.label }, p.label));
77
+ }), showDivider && _jsx("div", { className: Styles.ns_preset_divider }), resolvedCustom.map(p => {
78
+ var _a, _b;
79
+ const isActive = ((_a = this.state.value) === null || _a === void 0 ? void 0 : _a.from) === p.from && ((_b = this.state.value) === null || _b === void 0 ? void 0 : _b.to) === p.to;
80
+ return (_jsx("button", { type: "button", title: p.title, className: `${Styles.ns_preset_btn} ${isActive ? Styles.ns_preset_btn_active : ''}`, onClick: () => this.setValue({ from: p.from, to: p.to }), children: p.shortName }, p.shortName));
81
+ })] }));
82
+ }
83
+ render() {
84
+ let menu = safeMenuMenuItem(this.props, () => { });
85
+ if (!menu.builtin.copy)
86
+ menu.builtin.copy = {
87
+ enabled: true,
88
+ getValue: () => this.state.value ? `${this.state.value.from} to ${this.state.value.to}` : '',
89
+ };
90
+ const showPresets = this.props.preset || (this.props.presets && this.props.presets.length > 0);
91
+ return (_jsxs(NSBoxBaseLayout, Object.assign({ ref: this.NSBoxBaseLayout_Main }, this.props, { menu: menu, getValue: () => this.state.value ? `${this.state.value.from} - ${this.state.value.to}` : null, children: [_jsx("div", { className: Styles.ns_wrapper, children: this.renderPicker() }), showPresets && this.renderPresets()] })));
92
+ }
93
+ }
94
+ //# sourceMappingURL=NSBoxDateRangeBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NSBoxDateRangeBase.js","sourceRoot":"","sources":["../../src/components/NSBoxDateRangeBase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Y,EAAE,GAClB,EACL,WAAW,IAAI,IAAI,CAAC,aAAa,EAAE,KACtB,CACrB,CAAC;IACN,CAAC;CACJ"}
@@ -0,0 +1,90 @@
1
+ .ns_wrapper {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: 100%;
5
+ }
6
+
7
+ .ns_preset_container {
8
+ display: flex;
9
+ align-items: center;
10
+ flex-wrap: nowrap;
11
+ margin: 0 0.5rem 0.5rem;
12
+ border: 1px solid #d9d9d9;
13
+ border-radius: 6px;
14
+ overflow-x: auto;
15
+ overflow-y: hidden;
16
+ background: white;
17
+ scrollbar-width: thin;
18
+ scrollbar-color: #d9d9d9 transparent;
19
+ }
20
+
21
+ .ns_preset_container::-webkit-scrollbar {
22
+ height: 3px;
23
+ }
24
+
25
+ .ns_preset_container::-webkit-scrollbar-track {
26
+ background: transparent;
27
+ }
28
+
29
+ .ns_preset_container::-webkit-scrollbar-thumb {
30
+ background: #d9d9d9;
31
+ border-radius: 3px;
32
+ }
33
+
34
+ .ns_preset_container::-webkit-scrollbar-thumb:hover {
35
+ background: #bfbfbf;
36
+ }
37
+
38
+ .ns_preset_divider {
39
+ width: 1px;
40
+ height: 20px;
41
+ background: #d9d9d9;
42
+ flex-shrink: 0;
43
+ }
44
+
45
+ .ns_preset_btn {
46
+ flex-shrink: 0;
47
+ padding: 4px 10px;
48
+ border: none;
49
+ background: transparent;
50
+ color: #595959;
51
+ cursor: pointer;
52
+ font-size: 12px;
53
+ font-weight: 500;
54
+ font-family: inherit;
55
+ transition: color 0.15s, background 0.15s;
56
+ white-space: nowrap;
57
+ line-height: 1.4;
58
+ }
59
+
60
+ .ns_preset_btn:hover {
61
+ color: #4096ff;
62
+ background: #f0f5ff;
63
+ }
64
+
65
+ .ns_preset_btn_active {
66
+ color: #4096ff;
67
+ background: #e6f4ff;
68
+ }
69
+
70
+ .ns_picker {
71
+ padding: 0 8px 0 12px !important;
72
+ background-color: white !important;
73
+ cursor: pointer;
74
+ }
75
+
76
+ .ns_picker:focus-within {
77
+ border-color: rgba(0, 0, 0, 1) !important;
78
+ outline: solid 1px #4096ff !important;
79
+ box-shadow: none !important;
80
+ }
81
+
82
+ .ns_picker :global(.ant-picker-input > input) {
83
+ font-size: 16px;
84
+ font-weight: 400;
85
+ color: #141B5C;
86
+ }
87
+
88
+ .ns_picker :global(.ant-picker-active-bar) {
89
+ background: #4096ff;
90
+ }
@@ -18,5 +18,5 @@ export declare class NSBoxDateTime extends React.Component<NSBoxDateTimeProps, N
18
18
  getValue(checkError?: boolean): Date | null;
19
19
  setValue(value: Date | string | null, callback?: () => void): void;
20
20
  setDisabled(disabled: boolean): void;
21
- render(): import("react/jsx-runtime").JSX.Element;
21
+ render(): React.JSX.Element;
22
22
  }
@@ -0,0 +1,14 @@
1
+ import { NSBoxDateRangeBase, NSBoxDateRangeBaseProps } from './NSBoxDateRangeBase';
2
+ export interface NSBoxDateTimeRangeProps extends NSBoxDateRangeBaseProps<NSBoxDateTimeRange> {
3
+ }
4
+ export declare class NSBoxDateTimeRange extends NSBoxDateRangeBase<NSBoxDateTimeRangeProps> {
5
+ protected getFormat(): string;
6
+ getError(): string | null;
7
+ protected getBuiltinPresets(): {
8
+ label: string;
9
+ title: string;
10
+ from: string;
11
+ to: string;
12
+ }[];
13
+ protected renderPicker(): import("react").JSX.Element;
14
+ }
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { DatePicker } from 'antd';
4
+ import dayjs from 'dayjs';
5
+ import { TimeOperation } from 'namirasoft-core';
6
+ import StylesNSBox from './NSBox.module.css';
7
+ import { NSBoxDateRangeBase } from './NSBoxDateRangeBase';
8
+ import Styles from './NSBoxDateRangeBase.module.css';
9
+ export class NSBoxDateTimeRange extends NSBoxDateRangeBase {
10
+ getFormat() { return 'YYYY-MM-DD HH:mm:ss'; }
11
+ getError() {
12
+ const fmt = this.getFormat();
13
+ const { title, required } = this.props;
14
+ const { value } = this.state;
15
+ if (required && (!value || !value.from || !value.to))
16
+ return `${title} is required.`;
17
+ const minDate = this.props.minDate ? TimeOperation.format(this.props.minDate, fmt) : undefined;
18
+ const maxDate = this.props.maxDate ? TimeOperation.format(this.props.maxDate, fmt) : undefined;
19
+ if (minDate && (value === null || value === void 0 ? void 0 : value.from) && value.from < minDate)
20
+ return `${title} (from) must not be before ${minDate}.`;
21
+ if (maxDate && (value === null || value === void 0 ? void 0 : value.to) && value.to > maxDate)
22
+ return `${title} (to) must not be after ${maxDate}.`;
23
+ return null;
24
+ }
25
+ getBuiltinPresets() {
26
+ const fmt = this.getFormat();
27
+ const now = new Date();
28
+ now.setSeconds(0, 0);
29
+ const to = TimeOperation.format(now, fmt);
30
+ return [
31
+ { label: '1H', title: 'Last 1 Hour', from: TimeOperation.format(TimeOperation.hoursAgo(1, now), fmt), to },
32
+ { label: '6H', title: 'Last 6 Hours', from: TimeOperation.format(TimeOperation.hoursAgo(6, now), fmt), to },
33
+ { label: '12H', title: 'Last 12 Hours', from: TimeOperation.format(TimeOperation.hoursAgo(12, now), fmt), to },
34
+ { label: '1D', title: 'Last 1 Day', from: TimeOperation.format(TimeOperation.daysAgo(1, now), fmt), to },
35
+ { label: '1W', title: 'Last 1 Week', from: TimeOperation.format(TimeOperation.weeksAgo(1, now), fmt), to },
36
+ ];
37
+ }
38
+ renderPicker() {
39
+ return (_jsx(DatePicker.RangePicker, { className: `${StylesNSBox.ns_box_input} ${Styles.ns_picker}`, variant: "borderless", showTime: true, value: this.toDayjsValue(), format: this.getFormat(), minDate: this.props.minDate ? dayjs(this.props.minDate) : undefined, maxDate: this.props.maxDate ? dayjs(this.props.maxDate) : undefined, onChange: (_, dateStrings) => {
40
+ if ((dateStrings === null || dateStrings === void 0 ? void 0 : dateStrings[0]) && (dateStrings === null || dateStrings === void 0 ? void 0 : dateStrings[1]))
41
+ this.setValue({ from: dateStrings[0], to: dateStrings[1] });
42
+ else
43
+ this.setValue(null);
44
+ } }));
45
+ }
46
+ }
47
+ //# sourceMappingURL=NSBoxDateTimeRange.js.map