@steroidsjs/core 3.0.0-beta.46 → 3.0.0-beta.48

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.
@@ -19730,6 +19730,479 @@
19730
19730
  }
19731
19731
  ]
19732
19732
  },
19733
+ "ITimeRangeFieldProps": {
19734
+ "name": "ITimeRangeFieldProps",
19735
+ "moduleName": "ui/form/TimeRangeField/TimeRangeField",
19736
+ "title": "",
19737
+ "description": "",
19738
+ "tags": {},
19739
+ "defaultProps": null,
19740
+ "extends": [
19741
+ "IDateInputStateInput",
19742
+ "Omit<IFieldWrapperInputProps",
19743
+ "'attribute'>",
19744
+ "IUiComponent"
19745
+ ],
19746
+ "properties": [
19747
+ {
19748
+ "name": "attribute",
19749
+ "decorators": [],
19750
+ "description": "Аттрибут (название) поля в форме",
19751
+ "required": false,
19752
+ "type": "string",
19753
+ "example": "'isVisible'"
19754
+ },
19755
+ {
19756
+ "name": "attributeFrom",
19757
+ "decorators": [],
19758
+ "description": "Аттрибут (название) поля в форме",
19759
+ "required": false,
19760
+ "type": "string",
19761
+ "example": "'fromTime'"
19762
+ },
19763
+ {
19764
+ "name": "attributeTo",
19765
+ "decorators": [],
19766
+ "description": "Аттрибут (название) поля в форме",
19767
+ "required": false,
19768
+ "type": "string",
19769
+ "example": "'toTime'"
19770
+ },
19771
+ {
19772
+ "name": "className",
19773
+ "decorators": [],
19774
+ "description": "Дополнительный CSS-класс для элемента отображения",
19775
+ "required": false,
19776
+ "type": "string",
19777
+ "example": null
19778
+ },
19779
+ {
19780
+ "name": "date",
19781
+ "decorators": [],
19782
+ "description": "",
19783
+ "required": false,
19784
+ "type": "any",
19785
+ "example": null
19786
+ },
19787
+ {
19788
+ "name": "dateInUTC",
19789
+ "decorators": [],
19790
+ "description": "Задано ли значение даты в часовом поясе UTC\n(пример: с бэкенда приходит дата в UTC, но нужно отбразить ее в локальном времени.\nВ этом случае dateInUTC = true, а useUTC = false)",
19791
+ "required": false,
19792
+ "type": "boolean",
19793
+ "example": null
19794
+ },
19795
+ {
19796
+ "name": "disabled",
19797
+ "decorators": [],
19798
+ "description": "Переводит элемент в состояние \"не активен\"",
19799
+ "required": false,
19800
+ "type": "boolean",
19801
+ "example": "true"
19802
+ },
19803
+ {
19804
+ "name": "displayFormat",
19805
+ "decorators": [],
19806
+ "description": "Формат даты показываемый пользователю",
19807
+ "required": false,
19808
+ "type": "string",
19809
+ "example": "DD.MM.YYYY"
19810
+ },
19811
+ {
19812
+ "name": "errors",
19813
+ "decorators": [],
19814
+ "description": "Ошибки в поле",
19815
+ "required": false,
19816
+ "type": "string[]",
19817
+ "example": "['Error text']"
19818
+ },
19819
+ {
19820
+ "name": "fieldLayoutClassName",
19821
+ "decorators": [],
19822
+ "description": "Дополнительный CSS-класс для обертки FieldLayout",
19823
+ "required": false,
19824
+ "type": "string",
19825
+ "example": null
19826
+ },
19827
+ {
19828
+ "name": "hint",
19829
+ "decorators": [],
19830
+ "description": "Подсказка, которая отобразится рядом с полем",
19831
+ "required": false,
19832
+ "type": "string",
19833
+ "example": "'Only english letters'"
19834
+ },
19835
+ {
19836
+ "name": "icon",
19837
+ "decorators": [],
19838
+ "description": "Иконка, отображаемая в правой части поля",
19839
+ "required": false,
19840
+ "type": "string | boolean",
19841
+ "example": "calendar-day"
19842
+ },
19843
+ {
19844
+ "name": "id",
19845
+ "decorators": [],
19846
+ "description": "Input ID для связи поля с label",
19847
+ "required": false,
19848
+ "type": "string",
19849
+ "example": null
19850
+ },
19851
+ {
19852
+ "name": "input",
19853
+ "decorators": [],
19854
+ "description": "Свойства поля props.input",
19855
+ "required": false,
19856
+ "type": "{name: string, onChange: {}, value: any}",
19857
+ "example": null
19858
+ },
19859
+ {
19860
+ "name": "inputProps",
19861
+ "decorators": [],
19862
+ "description": "Свойства, передаваемые для поля во view",
19863
+ "required": false,
19864
+ "type": "Record",
19865
+ "example": null
19866
+ },
19867
+ {
19868
+ "name": "inputPropsFrom",
19869
+ "decorators": [],
19870
+ "description": "Свойства для input элемента from",
19871
+ "required": false,
19872
+ "type": "any",
19873
+ "example": null
19874
+ },
19875
+ {
19876
+ "name": "inputPropsTo",
19877
+ "decorators": [],
19878
+ "description": "Свойства для input элемента to",
19879
+ "required": false,
19880
+ "type": "any",
19881
+ "example": null
19882
+ },
19883
+ {
19884
+ "name": "isRenderWithoutFieldLayout",
19885
+ "decorators": [],
19886
+ "description": "Возможность отрендерить поле без обертки в компонент FieldLayout",
19887
+ "required": false,
19888
+ "type": "boolean",
19889
+ "example": null
19890
+ },
19891
+ {
19892
+ "name": "label",
19893
+ "decorators": [],
19894
+ "description": "Название поля либо отмена отображение поля (false)",
19895
+ "required": false,
19896
+ "type": "any",
19897
+ "example": "'Visible'"
19898
+ },
19899
+ {
19900
+ "name": "model",
19901
+ "decorators": [],
19902
+ "description": "Модель с полями формы",
19903
+ "required": false,
19904
+ "type": "any",
19905
+ "example": "{attributes: [{attribute: 'category', field: 'DropDownField'}]}"
19906
+ },
19907
+ {
19908
+ "name": "onChange",
19909
+ "decorators": [],
19910
+ "description": "Дополнительная функция, срабатывающая при изменении props.input",
19911
+ "required": false,
19912
+ "type": "{}",
19913
+ "example": null
19914
+ },
19915
+ {
19916
+ "name": "pickerProps",
19917
+ "decorators": [],
19918
+ "description": "Свойства для компонента DayPickerInput",
19919
+ "required": false,
19920
+ "type": "any",
19921
+ "example": "{dayPickerProps: {showWeekNumbers: true}}"
19922
+ },
19923
+ {
19924
+ "name": "placeholder",
19925
+ "decorators": [],
19926
+ "description": "Placeholder подсказка",
19927
+ "required": false,
19928
+ "type": "any",
19929
+ "example": "Your text..."
19930
+ },
19931
+ {
19932
+ "name": "prefix",
19933
+ "decorators": [],
19934
+ "description": "Префикс, который добавится к аттрибуту (названию) поля в форме",
19935
+ "required": false,
19936
+ "type": "string | boolean",
19937
+ "example": null
19938
+ },
19939
+ {
19940
+ "name": "required",
19941
+ "decorators": [],
19942
+ "description": "Обязательное ли поле? Если true, то к названию будет добавлен\nмодификатор 'required' - красная звездочка (по умолчанию)",
19943
+ "required": false,
19944
+ "type": "boolean",
19945
+ "example": "true"
19946
+ },
19947
+ {
19948
+ "name": "showRemove",
19949
+ "decorators": [],
19950
+ "description": "Показывать при наведении на поле иконку для сброса значения поля в начальное состояние",
19951
+ "required": false,
19952
+ "type": "boolean",
19953
+ "example": null
19954
+ },
19955
+ {
19956
+ "name": "size",
19957
+ "decorators": [],
19958
+ "description": "Размер поля",
19959
+ "required": false,
19960
+ "type": "string",
19961
+ "example": null
19962
+ },
19963
+ {
19964
+ "name": "style",
19965
+ "decorators": [],
19966
+ "description": "Объект CSS стилей",
19967
+ "required": false,
19968
+ "type": "CSSProperties",
19969
+ "example": "{width: '45%'}"
19970
+ },
19971
+ {
19972
+ "name": "timePanelViewProps",
19973
+ "decorators": [],
19974
+ "description": "Свойства для компонента панели времени",
19975
+ "required": false,
19976
+ "type": "any",
19977
+ "example": null
19978
+ },
19979
+ {
19980
+ "name": "useUTC",
19981
+ "decorators": [],
19982
+ "description": "Приводить значение даты к часовому поясу UTC\n(пример: с бэкенда приходит дата в какой-либо временной зоне (не UTC), но нужно отбразить ее\nв часовом поясе UTC. В этом случае dateInUTC = false, а useUTC = true)",
19983
+ "required": false,
19984
+ "type": "boolean",
19985
+ "example": null
19986
+ },
19987
+ {
19988
+ "name": "value",
19989
+ "decorators": [],
19990
+ "description": "Значение для поля",
19991
+ "required": false,
19992
+ "type": "any",
19993
+ "example": null
19994
+ },
19995
+ {
19996
+ "name": "valueFormat",
19997
+ "decorators": [],
19998
+ "description": "Формат даты отправляемый на сервер",
19999
+ "required": false,
20000
+ "type": "string",
20001
+ "example": "YYYY-MM-DD"
20002
+ },
20003
+ {
20004
+ "name": "view",
20005
+ "decorators": [],
20006
+ "description": "Переопределение view React компонента для кастомизации отображения",
20007
+ "required": false,
20008
+ "type": "React.ReactNode | {}",
20009
+ "example": "MyCustomView"
20010
+ },
20011
+ {
20012
+ "name": "viewProps",
20013
+ "decorators": [],
20014
+ "description": "Свойства для view компонента",
20015
+ "required": false,
20016
+ "type": "Record",
20017
+ "example": null
20018
+ }
20019
+ ]
20020
+ },
20021
+ "ITimeRangeFieldViewProps": {
20022
+ "name": "ITimeRangeFieldViewProps",
20023
+ "moduleName": "ui/form/TimeRangeField/TimeRangeField",
20024
+ "title": "",
20025
+ "description": "",
20026
+ "tags": {},
20027
+ "defaultProps": null,
20028
+ "extends": [
20029
+ "IDateInputStateOutput",
20030
+ "Pick<ITimeRangeFieldProps",
20031
+ "'size' | 'errors' | 'showRemove' | 'className' | 'timePanelViewProps' | 'disabled' | 'style' | 'icon'>",
20032
+ "Omit<IFieldWrapperOutputProps",
20033
+ "'input'>"
20034
+ ],
20035
+ "properties": [
20036
+ {
20037
+ "name": "className",
20038
+ "decorators": [],
20039
+ "description": "Дополнительный CSS-класс для элемента отображения",
20040
+ "required": false,
20041
+ "type": "string",
20042
+ "example": null
20043
+ },
20044
+ {
20045
+ "name": "componentId",
20046
+ "decorators": [],
20047
+ "description": "Id компонента",
20048
+ "required": false,
20049
+ "type": "string",
20050
+ "example": null
20051
+ },
20052
+ {
20053
+ "name": "disabled",
20054
+ "decorators": [],
20055
+ "description": "Переводит элемент в состояние \"не активен\"",
20056
+ "required": false,
20057
+ "type": "boolean",
20058
+ "example": "true"
20059
+ },
20060
+ {
20061
+ "name": "errors",
20062
+ "decorators": [],
20063
+ "description": "Ошибки в поле",
20064
+ "required": false,
20065
+ "type": "string[]",
20066
+ "example": "['Error text']"
20067
+ },
20068
+ {
20069
+ "name": "errorsFrom",
20070
+ "decorators": [],
20071
+ "description": "",
20072
+ "required": false,
20073
+ "type": "string[]",
20074
+ "example": null
20075
+ },
20076
+ {
20077
+ "name": "errorsTo",
20078
+ "decorators": [],
20079
+ "description": "",
20080
+ "required": false,
20081
+ "type": "string[]",
20082
+ "example": null
20083
+ },
20084
+ {
20085
+ "name": "formId",
20086
+ "decorators": [],
20087
+ "description": "Id формы",
20088
+ "required": false,
20089
+ "type": "string",
20090
+ "example": null
20091
+ },
20092
+ {
20093
+ "name": "icon",
20094
+ "decorators": [],
20095
+ "description": "Иконка, отображаемая в правой части поля",
20096
+ "required": false,
20097
+ "type": "string | boolean",
20098
+ "example": "calendar-day"
20099
+ },
20100
+ {
20101
+ "name": "inputFrom",
20102
+ "decorators": [],
20103
+ "description": "",
20104
+ "required": false,
20105
+ "type": "any",
20106
+ "example": null
20107
+ },
20108
+ {
20109
+ "name": "inputProps",
20110
+ "decorators": [],
20111
+ "description": "Свойства для поля во view",
20112
+ "required": true,
20113
+ "type": "{name: string, onChange: {}, value: any}",
20114
+ "example": null
20115
+ },
20116
+ {
20117
+ "name": "inputTo",
20118
+ "decorators": [],
20119
+ "description": "",
20120
+ "required": false,
20121
+ "type": "any",
20122
+ "example": null
20123
+ },
20124
+ {
20125
+ "name": "isOpened",
20126
+ "decorators": [],
20127
+ "description": "Показать или скрыть выпадающую панель",
20128
+ "required": false,
20129
+ "type": "boolean",
20130
+ "example": null
20131
+ },
20132
+ {
20133
+ "name": "onClear",
20134
+ "decorators": [],
20135
+ "description": "Функция очищает значение поля",
20136
+ "required": false,
20137
+ "type": "{}",
20138
+ "example": null
20139
+ },
20140
+ {
20141
+ "name": "onClose",
20142
+ "decorators": [],
20143
+ "description": "Функция закрывает выпадающую панель",
20144
+ "required": false,
20145
+ "type": "{}",
20146
+ "example": null
20147
+ },
20148
+ {
20149
+ "name": "onNow",
20150
+ "decorators": [],
20151
+ "description": "Функция возвращает текущее значение времени (дата + время)",
20152
+ "required": false,
20153
+ "type": "{}",
20154
+ "example": null
20155
+ },
20156
+ {
20157
+ "name": "showRemove",
20158
+ "decorators": [],
20159
+ "description": "Показывать при наведении на поле иконку для сброса значения поля в начальное состояние",
20160
+ "required": false,
20161
+ "type": "boolean",
20162
+ "example": null
20163
+ },
20164
+ {
20165
+ "name": "size",
20166
+ "decorators": [],
20167
+ "description": "Размер поля",
20168
+ "required": false,
20169
+ "type": "string",
20170
+ "example": null
20171
+ },
20172
+ {
20173
+ "name": "style",
20174
+ "decorators": [],
20175
+ "description": "Объект CSS стилей",
20176
+ "required": false,
20177
+ "type": "CSSProperties",
20178
+ "example": "{width: '45%'}"
20179
+ },
20180
+ {
20181
+ "name": "timePanelFromViewProps",
20182
+ "decorators": [],
20183
+ "description": "",
20184
+ "required": true,
20185
+ "type": "ITimePanelViewProps",
20186
+ "example": null
20187
+ },
20188
+ {
20189
+ "name": "timePanelToViewProps",
20190
+ "decorators": [],
20191
+ "description": "",
20192
+ "required": true,
20193
+ "type": "ITimePanelViewProps",
20194
+ "example": null
20195
+ },
20196
+ {
20197
+ "name": "timePanelViewProps",
20198
+ "decorators": [],
20199
+ "description": "Свойства для компонента панели времени",
20200
+ "required": false,
20201
+ "type": "any",
20202
+ "example": null
20203
+ }
20204
+ ]
20205
+ },
19733
20206
  "IBooleanFormatterProps": {
19734
20207
  "name": "IBooleanFormatterProps",
19735
20208
  "moduleName": "ui/format/BooleanFormatter/BooleanFormatter",
@@ -23227,7 +23700,9 @@
23227
23700
  "description": "Компонент для выбора количества элементов в списке",
23228
23701
  "tags": {},
23229
23702
  "defaultProps": null,
23230
- "extends": [],
23703
+ "extends": [
23704
+ "IUiComponent"
23705
+ ],
23231
23706
  "properties": [
23232
23707
  {
23233
23708
  "name": "attribute",
@@ -23237,6 +23712,14 @@
23237
23712
  "type": "string",
23238
23713
  "example": "pageSize"
23239
23714
  },
23715
+ {
23716
+ "name": "buttonProps",
23717
+ "decorators": [],
23718
+ "description": "Свойства для кнопок пагинации",
23719
+ "required": false,
23720
+ "type": "IButtonProps",
23721
+ "example": null
23722
+ },
23240
23723
  {
23241
23724
  "name": "className",
23242
23725
  "decorators": [],
@@ -23293,6 +23776,14 @@
23293
23776
  "type": "number[]",
23294
23777
  "example": "[2, 3, 4]"
23295
23778
  },
23779
+ {
23780
+ "name": "style",
23781
+ "decorators": [],
23782
+ "description": "Объект CSS стилей",
23783
+ "required": false,
23784
+ "type": "CSSProperties",
23785
+ "example": "{width: '45%'}"
23786
+ },
23296
23787
  {
23297
23788
  "name": "view",
23298
23789
  "decorators": [],
@@ -23322,6 +23813,14 @@
23322
23813
  "type": "string",
23323
23814
  "example": "pageSize"
23324
23815
  },
23816
+ {
23817
+ "name": "buttonProps",
23818
+ "decorators": [],
23819
+ "description": "Свойства для кнопок пагинации",
23820
+ "required": false,
23821
+ "type": "IButtonProps",
23822
+ "example": null
23823
+ },
23325
23824
  {
23326
23825
  "name": "className",
23327
23826
  "decorators": [],
@@ -23351,7 +23850,7 @@
23351
23850
  "decorators": [],
23352
23851
  "description": "",
23353
23852
  "required": true,
23354
- "type": "{isActive: boolean, label: string | number, size: number}[]",
23853
+ "type": "{id: number, label: string | number}[]",
23355
23854
  "example": null
23356
23855
  },
23357
23856
  {
@@ -23394,6 +23893,14 @@
23394
23893
  "type": "number[]",
23395
23894
  "example": "[2, 3, 4]"
23396
23895
  },
23896
+ {
23897
+ "name": "style",
23898
+ "decorators": [],
23899
+ "description": "Объект CSS стилей",
23900
+ "required": false,
23901
+ "type": "CSSProperties",
23902
+ "example": "{width: '45%'}"
23903
+ },
23397
23904
  {
23398
23905
  "name": "view",
23399
23906
  "decorators": [],
@@ -27032,6 +27539,13 @@
27032
27539
  "description": "",
27033
27540
  "tags": {}
27034
27541
  },
27542
+ "ui/form/TimeRangeField/TimeRangeField": {
27543
+ "name": "default",
27544
+ "moduleName": "ui/form/TimeRangeField/TimeRangeField",
27545
+ "title": "",
27546
+ "description": "",
27547
+ "tags": {}
27548
+ },
27035
27549
  "ui/format/BooleanFormatter/BooleanFormatter": {
27036
27550
  "name": "default",
27037
27551
  "moduleName": "ui/format/BooleanFormatter/BooleanFormatter",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "3.0.0-beta.46",
3
+ "version": "3.0.0-beta.48",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
@@ -25,6 +25,9 @@
25
25
  "watch": "tsc -p tsconfig-debug.json"
26
26
  },
27
27
  "dependencies": {
28
+ "@maskito/core": "^0.12.1",
29
+ "@maskito/kit": "^0.12.1",
30
+ "@maskito/react": "^0.12.1",
28
31
  "axios": "^0.21.1",
29
32
  "connected-react-router": "^6.9.3",
30
33
  "domready": "^1.0.8",
@@ -47,7 +50,6 @@
47
50
  "react-grid-gallery": "^0.4.8",
48
51
  "react-helmet": "^6.1.0",
49
52
  "react-image-crop": "^9.0.2",
50
- "react-input-mask": "^3.0.0-alpha.2",
51
53
  "react-redux": "^8.0.5",
52
54
  "react-router": "^5.2.0",
53
55
  "react-router-dom": "^5.2.0",
@@ -1,6 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import { ChangeEventHandler, ReactNode } from 'react';
3
+ import { MaskitoOptions } from '@maskito/core';
3
4
  import { IFieldWrapperInputProps, IFieldWrapperOutputProps } from '../Field/fieldWrapper';
5
+ export declare const MASK_PRESETS: {
6
+ date: MaskitoOptions;
7
+ phone: {
8
+ mask: (string | RegExp)[];
9
+ };
10
+ card: {
11
+ mask: any[];
12
+ };
13
+ };
4
14
  type IElementInputType = 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week' | string;
5
15
  export interface IBaseFieldProps extends IFieldWrapperInputProps, IUiComponent {
6
16
  /**
@@ -53,13 +63,19 @@ export interface IInputFieldProps extends IBaseFieldProps {
53
63
  addonAfter?: ReactNode | string;
54
64
  /**
55
65
  * Конфигурация маски
56
- * @example { mask: '+7 (999) 999-99-99' }
66
+ * @example: {
67
+ mask: [
68
+ ...Array(4).fill(/\d/),
69
+ '-',
70
+ ...Array(4).fill(/\d/),
71
+ '-',
72
+ ...Array(4).fill(/\d/),
73
+ '-',
74
+ ...Array(4).fill(/\d/),
75
+ ],
76
+ }
57
77
  */
58
- maskProps?: {
59
- mask?: string;
60
- maskPlaceholder?: string;
61
- alwaysShowMask?: boolean;
62
- };
78
+ maskOptions?: MaskitoOptions;
63
79
  /**
64
80
  * Пользовательская иконка svg или название иконки
65
81
  */
@@ -78,6 +94,8 @@ export interface IInputFieldViewProps extends IInputFieldProps, IFieldWrapperOut
78
94
  onFocus?: (e: Event | React.FocusEvent) => void;
79
95
  onBlur?: (e: Event | React.FocusEvent) => void;
80
96
  onMouseDown?: (e: Event | React.MouseEvent) => void;
97
+ maskedInputRef?: React.RefCallback<HTMLElement>;
98
+ defaultValue?: string;
81
99
  }
82
100
  declare const _default: import("../Field/fieldWrapper").FieldWrapperComponent<IInputFieldProps>;
83
101
  export default _default;
@@ -33,17 +33,48 @@ var __importStar = (this && this.__importStar) || function (mod) {
33
33
  __setModuleDefault(result, mod);
34
34
  return result;
35
35
  };
36
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
37
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
38
+ if (ar || !(i in from)) {
39
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
40
+ ar[i] = from[i];
41
+ }
42
+ }
43
+ return to.concat(ar || Array.prototype.slice.call(from));
44
+ };
36
45
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
46
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
47
  };
39
48
  exports.__esModule = true;
49
+ exports.MASK_PRESETS = void 0;
40
50
  var React = __importStar(require("react"));
41
- var react_input_mask_1 = __importDefault(require("react-input-mask"));
42
51
  var react_1 = require("react");
52
+ var react_2 = require("@maskito/react");
53
+ var kit_1 = require("@maskito/kit");
43
54
  var fieldWrapper_1 = __importDefault(require("../Field/fieldWrapper"));
44
55
  var hooks_1 = require("../../../hooks");
56
+ exports.MASK_PRESETS = {
57
+ date: (0, kit_1.maskitoDateOptionsGenerator)({
58
+ mode: 'dd/mm/yyyy'
59
+ }),
60
+ phone: {
61
+ mask: ['+', '7', ' ', '(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]
62
+ },
63
+ card: {
64
+ mask: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], Array(4).fill(/\d/), true), [
65
+ '-'
66
+ ], false), Array(4).fill(/\d/), true), [
67
+ '-'
68
+ ], false), Array(4).fill(/\d/), true), [
69
+ '-'
70
+ ], false), Array(4).fill(/\d/), true)
71
+ }
72
+ };
45
73
  function InputField(props) {
46
74
  var components = (0, hooks_1.useComponents)();
75
+ var maskedInputRef = (0, react_2.useMaskito)({
76
+ options: props.maskOptions
77
+ });
47
78
  var onClear = React.useCallback(function () { return props.input.onChange(''); }, [props.input]);
48
79
  props.onClear = onClear;
49
80
  var inputProps = (0, react_1.useMemo)(function () {
@@ -54,12 +85,7 @@ function InputField(props) {
54
85
  if (props.type === 'hidden') {
55
86
  return null;
56
87
  }
57
- // react-input-mask HOC for mask
58
- if (props.maskProps) {
59
- var maskOnChange = function (e) { return props.input.onChange(e.target.value); };
60
- return (React.createElement(react_input_mask_1["default"], __assign({}, inputProps, props.maskProps, { onChange: maskOnChange }), components.ui.renderView(props.view || 'form.InputFieldView', __assign(__assign(__assign({}, props), props.viewProps), { inputProps: inputProps, onChange: maskOnChange }))));
61
- }
62
- return components.ui.renderView(props.view || 'form.InputFieldView', __assign(__assign(__assign({}, props), props.viewProps), { inputProps: inputProps }));
88
+ return components.ui.renderView(props.view || 'form.InputFieldView', __assign(__assign(__assign({}, props), props.viewProps), { inputProps: inputProps, maskedInputRef: maskedInputRef }));
63
89
  }
64
90
  InputField.defaultProps = {
65
91
  type: 'text',
@@ -1,7 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { IInputFieldProps } from '../InputField/InputField';
3
- export interface IMaskFieldProps extends IInputFieldProps {
4
- mask?: string;
5
- }
3
+ export type IMaskFieldProps = IInputFieldProps;
6
4
  declare function MaskField(props: IMaskFieldProps): JSX.Element;
7
5
  export default MaskField;
@@ -29,6 +29,6 @@ var react_1 = __importDefault(require("react"));
29
29
  var InputField_1 = __importDefault(require("../InputField/InputField"));
30
30
  function MaskField(props) {
31
31
  var mask = props.mask, maskProps = props.maskProps, inputProps = __rest(props, ["mask", "maskProps"]);
32
- return (react_1["default"].createElement(InputField_1["default"], __assign({}, inputProps, { maskProps: __assign({ mask: mask }, maskProps) })));
32
+ return (react_1["default"].createElement(InputField_1["default"], __assign({}, inputProps, { maskOptions: props.maskOptions })));
33
33
  }
34
34
  exports["default"] = MaskField;
@@ -0,0 +1,53 @@
1
+ import { IDateInputStateInput, IDateInputStateOutput } from '../DateField/useDateInputState';
2
+ import { IFieldWrapperInputProps, IFieldWrapperOutputProps } from '../Field/fieldWrapper';
3
+ import { ITimePanelViewProps } from '../TimeField/TimeField';
4
+ export interface ITimeRangeFieldProps extends IDateInputStateInput, Omit<IFieldWrapperInputProps, 'attribute'>, IUiComponent {
5
+ /**
6
+ * Аттрибут (название) поля в форме
7
+ * @example 'fromTime'
8
+ */
9
+ attributeFrom?: string;
10
+ /**
11
+ * Аттрибут (название) поля в форме
12
+ * @example 'toTime'
13
+ */
14
+ attributeTo?: string;
15
+ /**
16
+ * Свойства для view компонента
17
+ */
18
+ viewProps?: Record<string, unknown>;
19
+ /**
20
+ * Свойства для компонента панели времени
21
+ */
22
+ timePanelViewProps?: any;
23
+ /**
24
+ * Свойства для input элемента from
25
+ */
26
+ inputPropsFrom?: any;
27
+ /**
28
+ * Свойства для input элемента to
29
+ */
30
+ inputPropsTo?: any;
31
+ /**
32
+ * Placeholder подсказка
33
+ * @example Your text...
34
+ */
35
+ placeholder?: any;
36
+ /**
37
+ * Свойства для компонента DayPickerInput
38
+ * @example {dayPickerProps: {showWeekNumbers: true}}
39
+ */
40
+ pickerProps?: any;
41
+ [key: string]: any;
42
+ }
43
+ export interface ITimeRangeFieldViewProps extends IDateInputStateOutput, Pick<ITimeRangeFieldProps, 'size' | 'errors' | 'showRemove' | 'className' | 'timePanelViewProps' | 'disabled' | 'style' | 'icon'>, Omit<IFieldWrapperOutputProps, 'input'> {
44
+ inputFrom?: any;
45
+ inputTo?: any;
46
+ errorsFrom?: string[];
47
+ errorsTo?: string[];
48
+ timePanelFromViewProps: ITimePanelViewProps;
49
+ timePanelToViewProps: ITimePanelViewProps;
50
+ [key: string]: any;
51
+ }
52
+ declare const _default: import("../Field/fieldWrapper").FieldWrapperComponent<ITimeRangeFieldProps>;
53
+ export default _default;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ exports.__esModule = true;
17
+ var react_1 = require("react");
18
+ var hooks_1 = require("../../../hooks");
19
+ var useDateInputState_1 = __importDefault(require("../DateField/useDateInputState"));
20
+ var fieldWrapper_1 = __importDefault(require("../Field/fieldWrapper"));
21
+ var useDateRange_1 = __importDefault(require("../DateField/useDateRange"));
22
+ function TimeRangeField(props) {
23
+ var components = (0, hooks_1.useComponents)();
24
+ // Global onChange (from props)
25
+ var onChange = (0, react_1.useCallback)(function () {
26
+ var _a;
27
+ if (props.onChange) {
28
+ props.onChange.call(null, (_a = {},
29
+ _a[props.attributeFrom] = props.inputFrom.value,
30
+ _a[props.attributeTo] = props.inputTo.value,
31
+ _a));
32
+ }
33
+ }, [props.attributeFrom, props.attributeTo, props.inputFrom.value, props.inputTo.value, props.onChange]);
34
+ // Input 'from'
35
+ var _a = (0, useDateInputState_1["default"])({
36
+ input: props.inputFrom,
37
+ disabled: props.disabled,
38
+ onChange: onChange,
39
+ required: props.required,
40
+ inputProps: props.inputPropsFrom,
41
+ placeholder: props.placeholder,
42
+ valueFormat: props.valueFormat,
43
+ displayFormat: props.displayFormat
44
+ }), onNowFrom = _a.onNow, onCloseFrom = _a.onClose, inputPropsFrom = _a.inputProps, onClearFrom = _a.onClear, isOpenedFrom = _a.isOpened;
45
+ // Input 'to'
46
+ var _b = (0, useDateInputState_1["default"])({
47
+ input: props.inputTo,
48
+ disabled: props.disabled,
49
+ onChange: onChange,
50
+ required: props.required,
51
+ inputProps: props.inputPropsTo,
52
+ placeholder: props.placeholder,
53
+ valueFormat: props.valueFormat,
54
+ displayFormat: props.displayFormat
55
+ }), onNowTo = _b.onNow, onCloseTo = _b.onClose, inputPropsTo = _b.inputProps, onClearTo = _b.onClear, isOpenedTo = _b.isOpened;
56
+ var _c = (0, useDateRange_1["default"])({
57
+ onClearFrom: onClearFrom,
58
+ onCloseTo: onCloseTo,
59
+ onCloseFrom: onCloseFrom,
60
+ onClearTo: onClearTo,
61
+ inputPropsFrom: inputPropsFrom,
62
+ inputPropsTo: inputPropsTo,
63
+ inputFrom: props.inputFrom,
64
+ inputTo: props.inputTo,
65
+ useSmartFocus: true
66
+ }), focus = _c.focus, onClose = _c.onClose, onClear = _c.onClear, extendedInputPropsFrom = _c.extendedInputPropsFrom, extendedInputPropsTo = _c.extendedInputPropsTo;
67
+ var timePanelFromViewProps = (0, react_1.useMemo)(function () { return (__assign({ onNow: onNowFrom, onClose: onCloseFrom, value: inputPropsFrom.value, onSelect: inputPropsFrom.onChange }, props.timePanelViewProps)); }, [inputPropsFrom.onChange, inputPropsFrom.value, onCloseFrom, onNowFrom, props.timePanelViewProps]);
68
+ var timePanelToViewProps = (0, react_1.useMemo)(function () { return (__assign({ onNow: onNowTo, onClose: onCloseTo, value: inputPropsTo.value, onSelect: inputPropsTo.onChange }, props.timePanelViewProps)); }, [inputPropsTo.onChange, inputPropsTo.value, onCloseTo, onNowTo, props.timePanelViewProps]);
69
+ return components.ui.renderView(props.view || 'form.TimeRangeFieldView', __assign(__assign({}, props.viewProps), { onClear: onClear, onClose: onClose, inputPropsFrom: extendedInputPropsFrom, inputPropsTo: extendedInputPropsTo, isOpened: focus === 'from' ? isOpenedFrom : isOpenedTo, style: props.style, errorsFrom: props.errorsFrom, errorsTo: props.errorsTo, timePanelFromViewProps: timePanelFromViewProps, timePanelToViewProps: timePanelToViewProps, size: props.size, icon: props.icon, disabled: props.disabled, showRemove: props.showRemove, className: props.className }));
70
+ }
71
+ TimeRangeField.defaultProps = {
72
+ disabled: false,
73
+ displayFormat: 'HH:mm',
74
+ required: false,
75
+ showRemove: true,
76
+ type: 'text',
77
+ valueFormat: 'HH:mm',
78
+ useUTC: true,
79
+ dateInUTC: false,
80
+ size: 'md',
81
+ icon: true
82
+ };
83
+ exports["default"] = (0, fieldWrapper_1["default"])('TimeRangeField', TimeRangeField, {
84
+ attributeSuffixes: ['from', 'to']
85
+ });
@@ -0,0 +1,2 @@
1
+ import TimeRangeField from './TimeRangeField';
2
+ export default TimeRangeField;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ exports.__esModule = true;
6
+ var TimeRangeField_1 = __importDefault(require("./TimeRangeField"));
7
+ exports["default"] = TimeRangeField_1["default"];