@dartech/arsenal-ui 1.4.9 → 1.4.11

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/index.js CHANGED
@@ -214,6 +214,20 @@ const AlertDialog = ({
214
214
  });
215
215
  };
216
216
 
217
+ const defaultDefinitionArrayValue = {
218
+ code: '',
219
+ name: '',
220
+ version: 0,
221
+ properties: []
222
+ };
223
+ const defaultDefinitionObjectValue = {
224
+ code: '',
225
+ name: '',
226
+ version: 0,
227
+ properties: {}
228
+ };
229
+ const DEFAULT_REQUIRED_ERROR_TEXT = 'Please, fill this field';
230
+
217
231
  /**
218
232
  * Material UI `TextField` controlled component. Used with react-hook-form
219
233
  * @category Forms
@@ -230,15 +244,16 @@ const ControlInput = _a => {
230
244
  disabled = false,
231
245
  textarea = false,
232
246
  hideErrorMessage = false,
233
- onChange: customOnChange
247
+ onChange: customOnChange,
248
+ requiredErrorText = ''
234
249
  } = _a,
235
- textFieldProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "textarea", "hideErrorMessage", "onChange"]);
250
+ textFieldProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "textarea", "hideErrorMessage", "onChange", "requiredErrorText"]);
236
251
  const _c = useController({
237
252
  name,
238
253
  control,
239
254
  defaultValue,
240
255
  rules: {
241
- required: required && 'Please, fill this field',
256
+ required: required ? requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false,
242
257
  validate
243
258
  }
244
259
  }),
@@ -331,9 +346,10 @@ const ControlDebouncedInput = _a => {
331
346
  disabled = false,
332
347
  textarea = false,
333
348
  hideErrorMessage = false,
334
- onChange: customOnChange
349
+ onChange: customOnChange,
350
+ requiredErrorText = ''
335
351
  } = _a,
336
- textFieldProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "textarea", "hideErrorMessage", "onChange"]);
352
+ textFieldProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "textarea", "hideErrorMessage", "onChange", "requiredErrorText"]);
337
353
  const {
338
354
  field: {
339
355
  ref,
@@ -347,7 +363,7 @@ const ControlDebouncedInput = _a => {
347
363
  control,
348
364
  defaultValue,
349
365
  rules: {
350
- required: required && 'Please, fill this field',
366
+ required: required ? requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false,
351
367
  validate
352
368
  }
353
369
  });
@@ -417,15 +433,16 @@ const ControlSelect = _a => {
417
433
  onChange: customOnChange,
418
434
  labelKey,
419
435
  valueKey,
420
- options = []
436
+ options = [],
437
+ requiredErrorText = ''
421
438
  } = _a,
422
- textFieldProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "hideErrorMessage", "onChange", "labelKey", "valueKey", "options"]);
439
+ textFieldProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "hideErrorMessage", "onChange", "labelKey", "valueKey", "options", "requiredErrorText"]);
423
440
  const _c = useController({
424
441
  name,
425
442
  control,
426
443
  defaultValue,
427
444
  rules: {
428
- required: required && 'Please, fill this field',
445
+ required: required ? requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false,
429
446
  validate
430
447
  }
431
448
  }),
@@ -599,14 +616,15 @@ const ControlRadio = ({
599
616
  validate,
600
617
  onChange: customOnChange,
601
618
  row,
602
- radioProps
619
+ radioProps,
620
+ requiredErrorText: _requiredErrorText = ''
603
621
  }) => {
604
622
  const _a = useController({
605
623
  name,
606
624
  control,
607
625
  defaultValue,
608
626
  rules: {
609
- required: required && 'Please, fill this field',
627
+ required: required ? _requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false,
610
628
  validate
611
629
  }
612
630
  }),
@@ -712,15 +730,16 @@ const ControlAutocomplete = _a => {
712
730
  multiple,
713
731
  textFieldProps = {},
714
732
  disableCloseOnSelect,
715
- useStringValue
733
+ useStringValue,
734
+ requiredErrorText = ''
716
735
  } = _a,
717
- autocompleteProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "hideErrorMessage", "onChange", "labelKey", "valueKey", "options", "multiple", "textFieldProps", "disableCloseOnSelect", "useStringValue"]);
736
+ autocompleteProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "hideErrorMessage", "onChange", "labelKey", "valueKey", "options", "multiple", "textFieldProps", "disableCloseOnSelect", "useStringValue", "requiredErrorText"]);
718
737
  const _b = useController({
719
738
  name,
720
739
  control,
721
740
  defaultValue: defaultValue || (multiple ? [] : null),
722
741
  rules: {
723
- required: required && 'Please, fill this field',
742
+ required: required ? requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false,
724
743
  validate
725
744
  }
726
745
  }),
@@ -808,15 +827,16 @@ function ControlQueryAutocomplete(_a) {
808
827
  onChange,
809
828
  queryFunction,
810
829
  validate,
811
- itemQueryFunction
830
+ itemQueryFunction,
831
+ requiredErrorText = ''
812
832
  } = _a,
813
- autocompleteProps = __rest(_a, ["name", "label", "control", "required", "searchBy", "labelKey", "multiple", "disabled", "valueKey", "sortBy", "hideErrorMessage", "disableCloseOnSelect", "textFieldProps", "onChange", "queryFunction", "validate", "itemQueryFunction"]);
833
+ autocompleteProps = __rest(_a, ["name", "label", "control", "required", "searchBy", "labelKey", "multiple", "disabled", "valueKey", "sortBy", "hideErrorMessage", "disableCloseOnSelect", "textFieldProps", "onChange", "queryFunction", "validate", "itemQueryFunction", "requiredErrorText"]);
814
834
  const _b = useController({
815
835
  control,
816
836
  name,
817
837
  defaultValue: multiple ? [] : null,
818
838
  rules: {
819
- required: required && 'Please, fill this field',
839
+ required: required ? requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false,
820
840
  validate
821
841
  }
822
842
  }),
@@ -1045,14 +1065,15 @@ const ControlAceEditor = /*#__PURE__*/forwardRef((_a, ref) => {
1045
1065
  hideErrorMessage = false,
1046
1066
  fontSize = 16,
1047
1067
  validate = true,
1048
- parseValue
1068
+ parseValue,
1069
+ requiredErrorText = ''
1049
1070
  } = _a,
1050
- otherProps = __rest(_a, ["control", "name", "mode", "label", "width", "height", "readOnly", "required", "validateJson", "hideErrorMessage", "fontSize", "validate", "parseValue"]);
1071
+ otherProps = __rest(_a, ["control", "name", "mode", "label", "width", "height", "readOnly", "required", "validateJson", "hideErrorMessage", "fontSize", "validate", "parseValue", "requiredErrorText"]);
1051
1072
  const _b = useController({
1052
1073
  control,
1053
1074
  name,
1054
1075
  rules: {
1055
- required: required && 'Please, fill this field',
1076
+ required: required ? requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false,
1056
1077
  validate: val => {
1057
1078
  if (val && validateJson && typeof val === 'string') {
1058
1079
  try {
@@ -1897,15 +1918,16 @@ const ControlNumberInput = _a => {
1897
1918
  hideErrorMessage = false,
1898
1919
  onChange: customOnChange,
1899
1920
  decimal = false,
1900
- valueAsNumber = true
1921
+ valueAsNumber = true,
1922
+ requiredErrorText = ''
1901
1923
  } = _a,
1902
- textFieldProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "hideErrorMessage", "onChange", "decimal", "valueAsNumber"]);
1924
+ textFieldProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "hideErrorMessage", "onChange", "decimal", "valueAsNumber", "requiredErrorText"]);
1903
1925
  const _c = useController({
1904
1926
  name,
1905
1927
  control,
1906
1928
  defaultValue,
1907
1929
  rules: {
1908
- required: required && 'Please, fill this field',
1930
+ required: required ? requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false,
1909
1931
  validate: val => {
1910
1932
  if (val === null || val === 0) return true;
1911
1933
  if (decimal && !floatsOnly.test(val) || /^-*0+$/.test(val)) {
@@ -2053,9 +2075,10 @@ const ControlDate = _a => {
2053
2075
  label,
2054
2076
  format: format$1 = DATE_DEFAULT_FORMAT,
2055
2077
  hideErrorMessage = false,
2056
- textFieldProps = {}
2078
+ textFieldProps = {},
2079
+ requiredErrorText = ''
2057
2080
  } = _a,
2058
- datePickerProps = __rest(_a, ["control", "name", "required", "label", "format", "hideErrorMessage", "textFieldProps"]);
2081
+ datePickerProps = __rest(_a, ["control", "name", "required", "label", "format", "hideErrorMessage", "textFieldProps", "requiredErrorText"]);
2059
2082
  const [localFormat, setLocalFormat] = useState(DATE_DEFAULT_FORMAT);
2060
2083
  const {
2061
2084
  field,
@@ -2066,7 +2089,7 @@ const ControlDate = _a => {
2066
2089
  control,
2067
2090
  name,
2068
2091
  rules: {
2069
- required: required && 'Please, fill this field',
2092
+ required: required ? requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false,
2070
2093
  validate: val => {
2071
2094
  console.log('DATE', val);
2072
2095
  if (val === '' || isMatch(val, localFormat)) {
@@ -2133,9 +2156,10 @@ const ControlDateTime = _a => {
2133
2156
  label,
2134
2157
  format: format$1 = DATE_TIME_DEFAULT_FORMAT,
2135
2158
  hideErrorMessage = false,
2136
- textFieldProps
2159
+ textFieldProps,
2160
+ requiredErrorText = ''
2137
2161
  } = _a,
2138
- dateTimePickerProps = __rest(_a, ["control", "name", "required", "label", "format", "hideErrorMessage", "textFieldProps"]);
2162
+ dateTimePickerProps = __rest(_a, ["control", "name", "required", "label", "format", "hideErrorMessage", "textFieldProps", "requiredErrorText"]);
2139
2163
  const [localFormat, setLocalFormat] = useState();
2140
2164
  const {
2141
2165
  field,
@@ -2146,7 +2170,7 @@ const ControlDateTime = _a => {
2146
2170
  control,
2147
2171
  name,
2148
2172
  rules: {
2149
- required: required && 'Please, fill this field',
2173
+ required: required ? requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false,
2150
2174
  validate: val => {
2151
2175
  if (isMatch(val, localFormat)) {
2152
2176
  return true;
@@ -2205,13 +2229,14 @@ const ControlTime = ({
2205
2229
  required,
2206
2230
  label,
2207
2231
  format: _format = TIME_DEFAULT_FORMAT,
2208
- hideErrorMessage: _hideErrorMessage = false
2232
+ hideErrorMessage: _hideErrorMessage = false,
2233
+ requiredErrorText: _requiredErrorText = ''
2209
2234
  }) => {
2210
2235
  const _a = useController({
2211
2236
  control,
2212
2237
  name,
2213
2238
  rules: {
2214
- required: required && 'Please, fill this field',
2239
+ required: required ? _requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false,
2215
2240
  validate: val => {
2216
2241
  if (isMatch(val, _format)) {
2217
2242
  return true;
@@ -2552,14 +2577,15 @@ const ControlPhoneInput = _a => {
2552
2577
  label,
2553
2578
  required,
2554
2579
  mask = '+7 (799) 999 99 99',
2580
+ requiredErrorText = '',
2555
2581
  inputMaskProps
2556
2582
  } = _a,
2557
- textFieldProps = __rest(_a, ["control", "name", "label", "required", "mask", "inputMaskProps"]);
2583
+ textFieldProps = __rest(_a, ["control", "name", "label", "required", "mask", "requiredErrorText", "inputMaskProps"]);
2558
2584
  return jsx(Controller, {
2559
2585
  control: control,
2560
2586
  name: name,
2561
2587
  rules: {
2562
- required: required && 'Please, fill this field',
2588
+ required: required ? requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false,
2563
2589
  validate: val => {
2564
2590
  if (!/(\+7\s\(\d{3}\)\s)(\d{3}\s\d{2})(\s\d{2})/.test(val)) {
2565
2591
  return 'Incorrect phone number format';
@@ -3000,6 +3026,7 @@ function TableInner({
3000
3026
  pagination = true,
3001
3027
  loading = false,
3002
3028
  onRowClick,
3029
+ emptyDataText,
3003
3030
  verticalAlign = 'middle'
3004
3031
  }, ref) {
3005
3032
  const {
@@ -3053,7 +3080,7 @@ function TableInner({
3053
3080
  })
3054
3081
  })
3055
3082
  }), jsx(TableBody, {
3056
- children: rows.map((row, index) => jsx(TableRow, Object.assign({
3083
+ children: rows.length ? rows.map((row, index) => jsx(TableRow, Object.assign({
3057
3084
  hover: true,
3058
3085
  onClick: onRowClick ? () => onRowClick(row) : row.onClick,
3059
3086
  sx: {
@@ -3068,7 +3095,18 @@ function TableInner({
3068
3095
  }, {
3069
3096
  children: column.renderCell ? column.renderCell(row, index) : row[column.id]
3070
3097
  }), idx))
3071
- }), index))
3098
+ }), index)) : jsx(TableRow, Object.assign({
3099
+ sx: {
3100
+ verticalAlign
3101
+ }
3102
+ }, {
3103
+ children: jsx(TableCell, Object.assign({
3104
+ align: "center",
3105
+ colSpan: columns.length
3106
+ }, {
3107
+ children: emptyDataText !== null && emptyDataText !== void 0 ? emptyDataText : 'Нет данных'
3108
+ }))
3109
+ }))
3072
3110
  }), pagination || children ? jsx(TableFooter, {
3073
3111
  children: jsxs(TableRow, {
3074
3112
  children: [children && jsx(TableCell, Object.assign({
@@ -3080,7 +3118,7 @@ function TableInner({
3080
3118
  }
3081
3119
  }, {
3082
3120
  children: children
3083
- })), pagination && rows.length && jsx(MuiTablePagination, {
3121
+ })), pagination && !!rows.length ? jsx(MuiTablePagination, {
3084
3122
  rowsPerPageOptions: [5, 10, 25],
3085
3123
  count: totalCount,
3086
3124
  rowsPerPage: +size,
@@ -3090,7 +3128,7 @@ function TableInner({
3090
3128
  },
3091
3129
  onPageChange: (_, page) => onPageChange(page),
3092
3130
  onRowsPerPageChange: event => onSizeChange(+event.target.value)
3093
- })]
3131
+ }) : null]
3094
3132
  })
3095
3133
  }) : null]
3096
3134
  }))]
@@ -3693,7 +3731,9 @@ const StringValueField = ({
3693
3731
  name,
3694
3732
  label,
3695
3733
  required,
3696
- restrictedValues
3734
+ restrictedValues,
3735
+ requiredErrorText: _requiredErrorText = '',
3736
+ requiredSelectErrorText: _requiredSelectErrorText = ''
3697
3737
  }) => {
3698
3738
  const {
3699
3739
  field: {
@@ -3707,7 +3747,7 @@ const StringValueField = ({
3707
3747
  control,
3708
3748
  name,
3709
3749
  rules: {
3710
- required: required && (Array.isArray(restrictedValues) && restrictedValues.length ? 'Please, select a value' : 'Please, fill this field')
3750
+ required: required ? Array.isArray(restrictedValues) && restrictedValues.length ? _requiredSelectErrorText || 'Please, select a value' : _requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT : false
3711
3751
  // pattern: validate && urlValidator,
3712
3752
  }
3713
3753
  });
@@ -4074,7 +4114,8 @@ const ControlPropertyFiller = ({
4074
4114
  title,
4075
4115
  entityReferenceDefinitionSources,
4076
4116
  entityReferenceValueComponent,
4077
- fileReferenceValueComponent
4117
+ fileReferenceValueComponent,
4118
+ requiredErrorText: _requiredErrorText = ''
4078
4119
  }) => {
4079
4120
  // const { control, clearErrors, setValue, watch } = useFormContext();
4080
4121
  const {
@@ -4092,7 +4133,7 @@ const ControlPropertyFiller = ({
4092
4133
  defaultValue: property.defaultValue,
4093
4134
  rules: {
4094
4135
  validate: val => {
4095
- if (required && val === null) return 'Please, fill this field';
4136
+ if (required && val === null) return _requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT;
4096
4137
  return true;
4097
4138
  }
4098
4139
  }
@@ -4370,7 +4411,8 @@ const ControlMultiplePropertyFiller = ({
4370
4411
  title,
4371
4412
  entityReferenceDefinitionSources,
4372
4413
  entityReferenceValueComponent,
4373
- fileReferenceValueComponent
4414
+ fileReferenceValueComponent,
4415
+ requiredErrorText: _requiredErrorText = ''
4374
4416
  }) => {
4375
4417
  var _a;
4376
4418
  const [selectTouched, setSelectTouched] = useState(false);
@@ -4390,7 +4432,7 @@ const ControlMultiplePropertyFiller = ({
4390
4432
  defaultValue: (_a = property.defaultValue) !== null && _a !== void 0 ? _a : [],
4391
4433
  rules: {
4392
4434
  validate: val => {
4393
- if (required && !val) return 'Please, fill this field';
4435
+ if (required && !val) return _requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT;
4394
4436
  return true;
4395
4437
  }
4396
4438
  }
@@ -5817,7 +5859,8 @@ const PropertyFiller = ({
5817
5859
  title,
5818
5860
  entityReferenceDefinitionSources,
5819
5861
  entityReferenceValueComponent,
5820
- fileReferenceValueComponent
5862
+ fileReferenceValueComponent,
5863
+ requiredErrorText: _requiredErrorText = ''
5821
5864
  }) => {
5822
5865
  const {
5823
5866
  control,
@@ -5837,7 +5880,7 @@ const PropertyFiller = ({
5837
5880
  control,
5838
5881
  rules: {
5839
5882
  validate: val => {
5840
- if (required && val === null) return 'Please, fill this field';
5883
+ if (required && val === null) return _requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT;
5841
5884
  return true;
5842
5885
  }
5843
5886
  }
@@ -6110,7 +6153,8 @@ const MultiplePropertyFiller = ({
6110
6153
  title,
6111
6154
  entityReferenceDefinitionSources,
6112
6155
  entityReferenceValueComponent,
6113
- fileReferenceValueComponent
6156
+ fileReferenceValueComponent,
6157
+ requiredErrorText: _requiredErrorText = ''
6114
6158
  }) => {
6115
6159
  var _a;
6116
6160
  const [selectTouched, setSelectTouched] = useState(false);
@@ -6135,7 +6179,7 @@ const MultiplePropertyFiller = ({
6135
6179
  defaultValue: (_a = property.defaultValue) !== null && _a !== void 0 ? _a : [],
6136
6180
  rules: {
6137
6181
  validate: val => {
6138
- if (required && !val) return 'Please, fill this field';
6182
+ if (required && !val) return _requiredErrorText || DEFAULT_REQUIRED_ERROR_TEXT;
6139
6183
  return true;
6140
6184
  }
6141
6185
  }
@@ -7658,17 +7702,4 @@ const Breadcrumbs = ({
7658
7702
  }));
7659
7703
  };
7660
7704
 
7661
- const defaultDefinitionArrayValue = {
7662
- code: '',
7663
- name: '',
7664
- version: 0,
7665
- properties: []
7666
- };
7667
- const defaultDefinitionObjectValue = {
7668
- code: '',
7669
- name: '',
7670
- version: 0,
7671
- properties: {}
7672
- };
7673
-
7674
- export { AlertDialog, BackButton, Breadcrumbs, ContentLayout, ControlAceEditor, ControlArrayInput, ControlAutocomplete, ControlCheckbox, ControlDate, ControlDateTime, ControlDebouncedInput, ControlInput, ControlNumberInput, ControlPeriodInput, ControlPhoneInput, ControlQueryAutocomplete, ControlRadio, ControlSelect, ControlSwitch, ControlTime, CopyButton, CreateDefinition, CreatePropertiesList, CreatePropertiesListContext, CreatePropertyFormFields, DATE_DEFAULT_FORMAT, DATE_TIME_DEFAULT_FORMAT, DefinitionFiller, DefinitionValueView, InfoItem, JsonModalView, JsonPathPicker, JsonView, Loader, MenuIcon, MultiplePropertyFiller, PropertyFiller, PropertyType, PropertyValueField, RoundingMode, RouteTabs, Sidebar, SimpleTable, Status, StepperView, TIME_DEFAULT_FORMAT, TabPanel, Table, TableAction, TableActionCell, ViewPropertiesList, ViewProperty, capitalize, deepParseJson, defaultDefinitionArrayValue, defaultDefinitionObjectValue, digitsOnly, floatsOnly, formatDefinitionData, formatTableRowValue, getDemPropertyDateFormat, getEntityStarterValue, getJsonStringValue, getMultiplePropertyFillOptions, getSinglePropertyFillOptions, isDateType, isExpression, isPropertyValueEmpty, propertiesArrayToObject, propertiesObjectToArray, removeArrayItem, safeParseJson, sortArrayOfObjects, theme, useDebounce, useToggle, validateJson };
7705
+ export { AlertDialog, BackButton, Breadcrumbs, ContentLayout, ControlAceEditor, ControlArrayInput, ControlAutocomplete, ControlCheckbox, ControlDate, ControlDateTime, ControlDebouncedInput, ControlInput, ControlNumberInput, ControlPeriodInput, ControlPhoneInput, ControlQueryAutocomplete, ControlRadio, ControlSelect, ControlSwitch, ControlTime, CopyButton, CreateDefinition, CreatePropertiesList, CreatePropertiesListContext, CreatePropertyFormFields, DATE_DEFAULT_FORMAT, DATE_TIME_DEFAULT_FORMAT, DEFAULT_REQUIRED_ERROR_TEXT, DefinitionFiller, DefinitionValueView, InfoItem, JsonModalView, JsonPathPicker, JsonView, Loader, MenuIcon, MultiplePropertyFiller, PropertyFiller, PropertyType, PropertyValueField, RoundingMode, RouteTabs, Sidebar, SimpleTable, Status, StepperView, TIME_DEFAULT_FORMAT, TabPanel, Table, TableAction, TableActionCell, ViewPropertiesList, ViewProperty, capitalize, deepParseJson, defaultDefinitionArrayValue, defaultDefinitionObjectValue, digitsOnly, floatsOnly, formatDefinitionData, formatTableRowValue, getDemPropertyDateFormat, getEntityStarterValue, getJsonStringValue, getMultiplePropertyFillOptions, getSinglePropertyFillOptions, isDateType, isExpression, isPropertyValueEmpty, propertiesArrayToObject, propertiesObjectToArray, removeArrayItem, safeParseJson, sortArrayOfObjects, theme, useDebounce, useToggle, validateJson };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -10,3 +10,4 @@ export declare const defaultDefinitionObjectValue: {
10
10
  version: number;
11
11
  properties: {};
12
12
  };
13
+ export declare const DEFAULT_REQUIRED_ERROR_TEXT = "Please, fill this field";
@@ -15,6 +15,7 @@ export interface ControlAceEditorProps {
15
15
  validate?: boolean;
16
16
  hideErrorMessage?: boolean;
17
17
  parseValue?: boolean;
18
+ requiredErrorText?: string;
18
19
  [key: string]: unknown;
19
20
  }
20
21
  export declare const ControlAceEditor: import("react").ForwardRefExoticComponent<Omit<ControlAceEditorProps, "ref"> & import("react").RefAttributes<ReactCodeMirrorRef>>;
@@ -61,10 +61,11 @@ export type ControlAutocompleteProps = Omit<AutocompleteProps<unknown, boolean,
61
61
  options: string[] | unknown[];
62
62
  textFieldProps?: TextFieldProps;
63
63
  useStringValue?: boolean;
64
+ requiredErrorText?: string;
64
65
  };
65
66
  /**
66
67
  * Material UI `Autocomplete` controlled component. Used with react-hook-form
67
68
  * @category Forms
68
69
  */
69
- export declare const ControlAutocomplete: ({ control, validate, name, label, required, defaultValue, disabled, hideErrorMessage, onChange: customOnChange, labelKey, valueKey, options, multiple, textFieldProps, disableCloseOnSelect, useStringValue, ...autocompleteProps }: ControlAutocompleteProps) => JSX.Element;
70
+ export declare const ControlAutocomplete: ({ control, validate, name, label, required, defaultValue, disabled, hideErrorMessage, onChange: customOnChange, labelKey, valueKey, options, multiple, textFieldProps, disableCloseOnSelect, useStringValue, requiredErrorText, ...autocompleteProps }: ControlAutocompleteProps) => JSX.Element;
70
71
  export default ControlAutocomplete;
@@ -11,6 +11,7 @@ type ControlQueryAutocompleteProps<T> = Omit<ControlAutocompleteProps, 'options'
11
11
  sortBy?: string;
12
12
  queryFunction: (params: PaginateParams) => Promise<PaginateData<T>>;
13
13
  itemQueryFunction?: (valueKey: string) => Promise<T>;
14
+ requiredErrorText?: string;
14
15
  };
15
- export declare function ControlQueryAutocomplete<T>({ name, label, control, required, searchBy, labelKey, multiple, disabled, valueKey, sortBy, hideErrorMessage, disableCloseOnSelect, textFieldProps, onChange, queryFunction, validate, itemQueryFunction, ...autocompleteProps }: ControlQueryAutocompleteProps<T>): JSX.Element;
16
+ export declare function ControlQueryAutocomplete<T>({ name, label, control, required, searchBy, labelKey, multiple, disabled, valueKey, sortBy, hideErrorMessage, disableCloseOnSelect, textFieldProps, onChange, queryFunction, validate, itemQueryFunction, requiredErrorText, ...autocompleteProps }: ControlQueryAutocompleteProps<T>): JSX.Element;
16
17
  export default ControlQueryAutocomplete;
@@ -16,6 +16,7 @@ type ControlDateProps = Partial<DatePickerProps<unknown, unknown>> & {
16
16
  format?: string;
17
17
  hideErrorMessage?: boolean;
18
18
  textFieldProps?: TextFieldProps;
19
+ requiredErrorText?: string;
19
20
  };
20
- export declare const ControlDate: ({ control, name, required, label, format, hideErrorMessage, textFieldProps, ...datePickerProps }: ControlDateProps) => JSX.Element;
21
+ export declare const ControlDate: ({ control, name, required, label, format, hideErrorMessage, textFieldProps, requiredErrorText, ...datePickerProps }: ControlDateProps) => JSX.Element;
21
22
  export default ControlDate;
@@ -16,6 +16,7 @@ type dateTimePickerProps = Partial<DateTimePickerProps<unknown, unknown>> & {
16
16
  format?: string;
17
17
  hideErrorMessage?: boolean;
18
18
  textFieldProps?: TextFieldProps;
19
+ requiredErrorText?: string;
19
20
  };
20
- export declare const ControlDateTime: ({ control, name, required, label, format, hideErrorMessage, textFieldProps, ...dateTimePickerProps }: dateTimePickerProps) => JSX.Element;
21
+ export declare const ControlDateTime: ({ control, name, required, label, format, hideErrorMessage, textFieldProps, requiredErrorText, ...dateTimePickerProps }: dateTimePickerProps) => JSX.Element;
21
22
  export default ControlDateTime;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { ControlInputProps } from './ControlInput';
3
- export declare const ControlDebouncedInput: ({ control, validate, name, label, required, defaultValue, disabled, textarea, hideErrorMessage, onChange: customOnChange, ...textFieldProps }: ControlInputProps) => JSX.Element;
3
+ export declare const ControlDebouncedInput: ({ control, validate, name, label, required, defaultValue, disabled, textarea, hideErrorMessage, onChange: customOnChange, requiredErrorText, ...textFieldProps }: ControlInputProps) => JSX.Element;
4
4
  export default ControlDebouncedInput;
@@ -50,10 +50,14 @@ export type ControlInputProps = TextFieldProps & {
50
50
  * Custom onChange functionƒ
51
51
  */
52
52
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
53
+ /**
54
+ * Set required error text
55
+ */
56
+ requiredErrorText?: string;
53
57
  };
54
58
  /**
55
59
  * Material UI `TextField` controlled component. Used with react-hook-form
56
60
  * @category Forms
57
61
  */
58
- export declare const ControlInput: ({ control, validate, name, label, required, defaultValue, disabled, textarea, hideErrorMessage, onChange: customOnChange, ...textFieldProps }: ControlInputProps) => JSX.Element;
62
+ export declare const ControlInput: ({ control, validate, name, label, required, defaultValue, disabled, textarea, hideErrorMessage, onChange: customOnChange, requiredErrorText, ...textFieldProps }: ControlInputProps) => JSX.Element;
59
63
  export default ControlInput;
@@ -50,6 +50,10 @@ type Props = TextFieldProps & {
50
50
  * Set value as number
51
51
  */
52
52
  valueAsNumber?: boolean;
53
+ /**
54
+ * Set required error text
55
+ */
56
+ requiredErrorText?: string;
53
57
  };
54
- export declare const ControlNumberInput: ({ control, validate, name, label, required, defaultValue, disabled, hideErrorMessage, onChange: customOnChange, decimal, valueAsNumber, ...textFieldProps }: Props) => JSX.Element;
58
+ export declare const ControlNumberInput: ({ control, validate, name, label, required, defaultValue, disabled, hideErrorMessage, onChange: customOnChange, decimal, valueAsNumber, requiredErrorText, ...textFieldProps }: Props) => JSX.Element;
55
59
  export default ControlNumberInput;
@@ -8,7 +8,8 @@ type Props = TextFieldProps & {
8
8
  required?: boolean;
9
9
  mask?: string;
10
10
  label?: ReactNode;
11
+ requiredErrorText?: string;
11
12
  inputMaskProps?: InputMaskProps;
12
13
  };
13
- export declare const ControlPhoneInput: ({ control, name, label, required, mask, inputMaskProps, ...textFieldProps }: Props) => JSX.Element;
14
+ export declare const ControlPhoneInput: ({ control, name, label, required, mask, requiredErrorText, inputMaskProps, ...textFieldProps }: Props) => JSX.Element;
14
15
  export default ControlPhoneInput;
@@ -60,10 +60,11 @@ export interface ControlRadioProps {
60
60
  valueKey?: string;
61
61
  row?: boolean;
62
62
  radioProps?: RadioProps;
63
+ requiredErrorText?: string;
63
64
  }
64
65
  /**
65
66
  * Material UI `Radio` controlled component. Used with react-hook-form
66
67
  * @category Forms
67
68
  */
68
- export declare const ControlRadio: ({ name, label, values, control, required, defaultValue, disabled, hideErrorMessage, labelKey, valueKey, validate, onChange: customOnChange, row, radioProps }: ControlRadioProps) => JSX.Element;
69
+ export declare const ControlRadio: ({ name, label, values, control, required, defaultValue, disabled, hideErrorMessage, labelKey, valueKey, validate, onChange: customOnChange, row, radioProps, requiredErrorText, }: ControlRadioProps) => JSX.Element;
69
70
  export default ControlRadio;
@@ -58,10 +58,14 @@ export type ControlSelectProps = TextFieldProps & {
58
58
  * Select options
59
59
  */
60
60
  options: string[] | unknown[];
61
+ /**
62
+ * Set required error text
63
+ */
64
+ requiredErrorText?: string;
61
65
  };
62
66
  /**
63
67
  * Material UI `Select` controlled component. Used with react-hook-form
64
68
  * @category Forms
65
69
  */
66
- export declare const ControlSelect: ({ control, validate, name, label, required, defaultValue, disabled, hideErrorMessage, onChange: customOnChange, labelKey, valueKey, options, ...textFieldProps }: ControlSelectProps) => JSX.Element;
70
+ export declare const ControlSelect: ({ control, validate, name, label, required, defaultValue, disabled, hideErrorMessage, onChange: customOnChange, labelKey, valueKey, options, requiredErrorText, ...textFieldProps }: ControlSelectProps) => JSX.Element;
67
71
  export default ControlSelect;
@@ -13,6 +13,7 @@ type Props = {
13
13
  label?: ReactNode;
14
14
  format?: string;
15
15
  hideErrorMessage?: boolean;
16
+ requiredErrorText?: string;
16
17
  };
17
- export declare const ControlTime: ({ control, name, required, label, format, hideErrorMessage, }: Props) => JSX.Element;
18
+ export declare const ControlTime: ({ control, name, required, label, format, hideErrorMessage, requiredErrorText, }: Props) => JSX.Element;
18
19
  export default ControlTime;
@@ -20,6 +20,7 @@ type Props = {
20
20
  fileReferenceValueComponent?: React.ElementType<{
21
21
  name: string;
22
22
  }>;
23
+ requiredErrorText?: string;
23
24
  };
24
- export declare const ControlMultiplePropertyFiller: ({ control, property, name, useExpression, required, label, title, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: Props) => JSX.Element;
25
+ export declare const ControlMultiplePropertyFiller: ({ control, property, name, useExpression, required, label, title, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, requiredErrorText, }: Props) => JSX.Element;
25
26
  export default ControlMultiplePropertyFiller;
@@ -20,6 +20,7 @@ export type ControlPropertyFillerProps = {
20
20
  fileReferenceValueComponent?: React.ElementType<{
21
21
  name: string;
22
22
  }>;
23
+ requiredErrorText?: string;
23
24
  };
24
- export declare const ControlPropertyFiller: ({ control, property, name, useExpression, label, required, title, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: ControlPropertyFillerProps) => JSX.Element;
25
+ export declare const ControlPropertyFiller: ({ control, property, name, useExpression, label, required, title, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, requiredErrorText, }: ControlPropertyFillerProps) => JSX.Element;
25
26
  export default ControlPropertyFiller;
@@ -18,6 +18,7 @@ type Props = {
18
18
  fileReferenceValueComponent?: React.ElementType<{
19
19
  name: string;
20
20
  }>;
21
+ requiredErrorText?: string;
21
22
  };
22
- export declare const MultiplePropertyFiller: ({ property, name, useExpression, required, label, title, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: Props) => JSX.Element;
23
+ export declare const MultiplePropertyFiller: ({ property, name, useExpression, required, label, title, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, requiredErrorText }: Props) => JSX.Element;
23
24
  export default MultiplePropertyFiller;
@@ -6,6 +6,7 @@ export type PropertyFillerProps = {
6
6
  useExpression?: boolean;
7
7
  label?: string;
8
8
  required?: boolean;
9
+ requiredErrorText?: string;
9
10
  title?: string;
10
11
  entityReferenceDefinitionSources?: {
11
12
  label: string;
@@ -19,5 +20,5 @@ export type PropertyFillerProps = {
19
20
  name: string;
20
21
  }>;
21
22
  };
22
- export declare const PropertyFiller: ({ property, name, useExpression, label, required, title, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: PropertyFillerProps) => JSX.Element;
23
+ export declare const PropertyFiller: ({ property, name, useExpression, label, required, title, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, requiredErrorText }: PropertyFillerProps) => JSX.Element;
23
24
  export default PropertyFiller;
@@ -7,6 +7,8 @@ type Props = {
7
7
  required?: boolean;
8
8
  restrictedValues?: string[];
9
9
  urlValidate?: boolean;
10
+ requiredErrorText?: string;
11
+ requiredSelectErrorText?: string;
10
12
  };
11
- declare const StringValueField: ({ control, name, label, required, restrictedValues, }: Props) => JSX.Element;
13
+ declare const StringValueField: ({ control, name, label, required, restrictedValues, requiredErrorText, requiredSelectErrorText, }: Props) => JSX.Element;
12
14
  export default StringValueField;
@@ -9,8 +9,9 @@ interface Props<T> {
9
9
  onRowClick?: (row: Row<T>) => void;
10
10
  children?: ReactNode;
11
11
  verticalAlign?: 'top' | 'middle' | 'bottom' | 'sub' | 'baseline';
12
+ emptyDataText?: string;
12
13
  }
13
- declare function TableInner<T>({ columns, rows, totalCount, children, pagination, loading, onRowClick, verticalAlign }: Props<T>, ref: ForwardedRef<HTMLTableElement>): JSX.Element;
14
+ declare function TableInner<T>({ columns, rows, totalCount, children, pagination, loading, onRowClick, emptyDataText, verticalAlign }: Props<T>, ref: ForwardedRef<HTMLTableElement>): JSX.Element;
14
15
  export declare const SimpleTable: <T>(props: Props<T> & {
15
16
  ref?: ForwardedRef<HTMLTableElement>;
16
17
  }) => ReturnType<typeof TableInner>;