linear-react-components-ui 1.0.10-beta.0 → 1.0.10-beta.2
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/lib/form/Field.d.ts +5 -0
- package/lib/form/Field.js +17 -10
- package/lib/form/FieldArray.d.ts +5 -0
- package/lib/form/FieldNumber.d.ts +5 -0
- package/lib/form/FieldPeriod.d.ts +5 -0
- package/lib/form/helpers.d.ts +5 -0
- package/lib/form/index.d.ts +5 -0
- package/lib/form/types.d.ts +8 -0
- package/lib/form/withFieldHOC.d.ts +5 -0
- package/lib/form/withFormSecurity.d.ts +5 -0
- package/lib/icons/helper.d.ts +12 -0
- package/lib/icons/helper.js +12 -0
- package/lib/inputs/select/simple/index.js +4 -4
- package/lib/inputs/select/types.d.ts +6 -5
- package/package.json +1 -1
package/lib/form/Field.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { IFieldProps } from './types.js';
|
|
3
|
+
import '../inputs/select/types.js';
|
|
4
|
+
import '../@types/DataCombo.js';
|
|
5
|
+
import '../@types/PermissionAttr.js';
|
|
6
|
+
import '../inputs/base/types.js';
|
|
7
|
+
import '../@types/Period.js';
|
|
3
8
|
|
|
4
9
|
declare const _default: React__default.ForwardRefExoticComponent<IFieldProps & React__default.RefAttributes<HTMLElement>>;
|
|
5
10
|
|
package/lib/form/Field.js
CHANGED
|
@@ -19,12 +19,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
19
19
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
20
20
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
21
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
-
var
|
|
22
|
+
var getEvents = function getEvents(_ref) {
|
|
23
23
|
var name = _ref.name,
|
|
24
24
|
validators = _ref.validators,
|
|
25
25
|
_onBlur = _ref.onBlur,
|
|
26
26
|
handlerFieldValidade = _ref.handlerFieldValidade,
|
|
27
|
-
validatorFromComponent = _ref.validatorFromComponent
|
|
27
|
+
validatorFromComponent = _ref.validatorFromComponent,
|
|
28
|
+
handlerFieldChange = _ref.handlerFieldChange,
|
|
29
|
+
_onChange = _ref.onChange;
|
|
28
30
|
if (!(validators || validatorFromComponent || _onBlur)) return {};
|
|
29
31
|
var validatorsArray = (0, _helpers.getValidatorsArray)(validators, validatorFromComponent);
|
|
30
32
|
return {
|
|
@@ -33,6 +35,13 @@ var getOnBlurEvent = function getOnBlurEvent(_ref) {
|
|
|
33
35
|
handlerFieldValidade(name, e.target.value, validatorsArray);
|
|
34
36
|
}
|
|
35
37
|
if (_onBlur) _onBlur(e);
|
|
38
|
+
},
|
|
39
|
+
onChange: function onChange(e) {
|
|
40
|
+
if (validatorsArray && e.target && handlerFieldValidade) {
|
|
41
|
+
handlerFieldValidade(name, e.target.value, validatorsArray);
|
|
42
|
+
}
|
|
43
|
+
if (handlerFieldChange) handlerFieldChange(e);
|
|
44
|
+
if (_onChange) _onChange(e);
|
|
36
45
|
}
|
|
37
46
|
};
|
|
38
47
|
};
|
|
@@ -65,7 +74,7 @@ var getCustomProps = function getCustomProps(props, setValidatorFromComponent) {
|
|
|
65
74
|
};
|
|
66
75
|
var Field = function Field(props) {
|
|
67
76
|
var handlerFieldChange = props.handlerFieldChange,
|
|
68
|
-
|
|
77
|
+
onChange = props.onChange;
|
|
69
78
|
var _useState = (0, _react.useState)(undefined),
|
|
70
79
|
_useState2 = _slicedToArray(_useState, 2),
|
|
71
80
|
validatorFromComponent = _useState2[0],
|
|
@@ -77,18 +86,16 @@ var Field = function Field(props) {
|
|
|
77
86
|
handlerSetValidatorFromComponent(validatorFromComponent);
|
|
78
87
|
}
|
|
79
88
|
}, [validatorFromComponent]);
|
|
80
|
-
return /*#__PURE__*/_react.default.createElement(props.component, _extends({}, props,
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement(props.component, _extends({}, props, getEvents({
|
|
81
90
|
name: props.name,
|
|
82
91
|
validators: props.validators,
|
|
83
92
|
onBlur: props.onBlur,
|
|
84
93
|
validatorFromComponent: validatorFromComponent,
|
|
85
|
-
handlerFieldValidade: props.handlerFieldValidade ? props.handlerFieldValidade : function () {}
|
|
94
|
+
handlerFieldValidade: props.handlerFieldValidade ? props.handlerFieldValidade : function () {},
|
|
95
|
+
handlerFieldChange: handlerFieldChange,
|
|
96
|
+
onChange: onChange
|
|
86
97
|
}), getCustomProps(props, setValidatorFromComponent), {
|
|
87
|
-
errorMessages: (0, _helpers.getErrorMessages)(props)
|
|
88
|
-
onChange: function onChange(e) {
|
|
89
|
-
if (handlerFieldChange) handlerFieldChange(e);
|
|
90
|
-
if (_onChange) _onChange(e);
|
|
91
|
-
}
|
|
98
|
+
errorMessages: (0, _helpers.getErrorMessages)(props)
|
|
92
99
|
}));
|
|
93
100
|
};
|
|
94
101
|
var _default = (0, _withFieldHOC.default)(Field);
|
package/lib/form/FieldArray.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { IFieldArrayProps } from './types.js';
|
|
3
|
+
import '../inputs/select/types.js';
|
|
4
|
+
import '../@types/DataCombo.js';
|
|
5
|
+
import '../@types/PermissionAttr.js';
|
|
6
|
+
import '../inputs/base/types.js';
|
|
7
|
+
import '../@types/Period.js';
|
|
3
8
|
|
|
4
9
|
declare const _default: React__default.ForwardRefExoticComponent<IFieldArrayProps & React__default.RefAttributes<HTMLElement>>;
|
|
5
10
|
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { IFieldProps } from './types.js';
|
|
3
|
+
import '../inputs/select/types.js';
|
|
4
|
+
import '../@types/DataCombo.js';
|
|
5
|
+
import '../@types/PermissionAttr.js';
|
|
6
|
+
import '../inputs/base/types.js';
|
|
7
|
+
import '../@types/Period.js';
|
|
3
8
|
|
|
4
9
|
declare const _default: React__default.ForwardRefExoticComponent<IFieldProps & React__default.RefAttributes<HTMLElement>>;
|
|
5
10
|
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { IFieldPeriodProps } from './types.js';
|
|
3
|
+
import '../inputs/select/types.js';
|
|
4
|
+
import '../@types/DataCombo.js';
|
|
5
|
+
import '../@types/PermissionAttr.js';
|
|
6
|
+
import '../inputs/base/types.js';
|
|
7
|
+
import '../@types/Period.js';
|
|
3
8
|
|
|
4
9
|
declare const _default: React__default.ForwardRefExoticComponent<IFieldPeriodProps & React__default.RefAttributes<HTMLElement>>;
|
|
5
10
|
|
package/lib/form/helpers.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { FormContextProps, IWithFieldContext, IGetErrorMessagesParams, Validator } from './types.js';
|
|
3
|
+
import '../inputs/select/types.js';
|
|
4
|
+
import '../@types/DataCombo.js';
|
|
5
|
+
import '../@types/PermissionAttr.js';
|
|
6
|
+
import '../inputs/base/types.js';
|
|
7
|
+
import '../@types/Period.js';
|
|
3
8
|
|
|
4
9
|
declare const securityBeforeUnload = "securityBeforeUnload";
|
|
5
10
|
declare const FormContext: React__default.Context<FormContextProps>;
|
package/lib/form/index.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ export { default as FieldNumber } from './FieldNumber.js';
|
|
|
3
3
|
export { default as FieldArray } from './FieldArray.js';
|
|
4
4
|
import { IFormProps } from './types.js';
|
|
5
5
|
import 'react';
|
|
6
|
+
import '../inputs/select/types.js';
|
|
7
|
+
import '../@types/DataCombo.js';
|
|
8
|
+
import '../@types/PermissionAttr.js';
|
|
9
|
+
import '../inputs/base/types.js';
|
|
10
|
+
import '../@types/Period.js';
|
|
6
11
|
|
|
7
12
|
declare const Form: ({ submitOnPressEnterKey, dataSource, securityBeforeUnload, handlerReset, handlerSubmit, handlerValidates, style, customClass, securityTitle, securityText, onDataChange, onValidateForm, externalFieldErrors, onSubmit, skeletonize, disabled, children, }: IFormProps) => JSX.Element;
|
|
8
13
|
|
package/lib/form/types.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { ChangeEvent, ReactNode, CSSProperties, ComponentType, MouseEventHandler } from 'react';
|
|
2
|
+
import { AllOptions } from '../inputs/select/types.js';
|
|
3
|
+
import '../@types/DataCombo.js';
|
|
4
|
+
import '../@types/PermissionAttr.js';
|
|
5
|
+
import '../inputs/base/types.js';
|
|
6
|
+
import '../@types/Period.js';
|
|
2
7
|
|
|
3
8
|
type Validator = (value: string) => string | undefined;
|
|
4
9
|
type PeriodValidator = (value: {
|
|
@@ -58,6 +63,8 @@ interface IFieldProps extends WithFieldProps {
|
|
|
58
63
|
descriptionKey?: string;
|
|
59
64
|
showClearButton?: boolean;
|
|
60
65
|
gridLayout?: string;
|
|
66
|
+
allOptions?: AllOptions;
|
|
67
|
+
searchNotFoundText?: string;
|
|
61
68
|
}
|
|
62
69
|
interface CustomEvent {
|
|
63
70
|
target: {
|
|
@@ -154,6 +161,7 @@ interface IEventParams {
|
|
|
154
161
|
data?: object;
|
|
155
162
|
validators?: Validator | Validator[];
|
|
156
163
|
onBlur?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
164
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
157
165
|
onKeyDown?: (event: CustomKeyboardEvent) => void;
|
|
158
166
|
handlerFieldValidade?: (name: string, value: string, validatorsArray: Validator[] | Validator) => void;
|
|
159
167
|
handlerFieldChange?: (event: ChangeEvent<HTMLInputElement> | CustomKeyboardEvent) => void;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { WithFieldProps } from './types.js';
|
|
3
|
+
import '../inputs/select/types.js';
|
|
4
|
+
import '../@types/DataCombo.js';
|
|
5
|
+
import '../@types/PermissionAttr.js';
|
|
6
|
+
import '../inputs/base/types.js';
|
|
7
|
+
import '../@types/Period.js';
|
|
3
8
|
|
|
4
9
|
declare const withFieldHOC: <ComponentProps extends WithFieldProps>(WrappedComponent: React__default.ComponentType<ComponentProps>) => React__default.ForwardRefExoticComponent<React__default.PropsWithoutRef<ComponentProps> & React__default.RefAttributes<HTMLElement>>;
|
|
5
10
|
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
import { IFormSecurityContext, IWithFormSecurity } from './types.js';
|
|
3
|
+
import '../inputs/select/types.js';
|
|
4
|
+
import '../@types/DataCombo.js';
|
|
5
|
+
import '../@types/PermissionAttr.js';
|
|
6
|
+
import '../inputs/base/types.js';
|
|
7
|
+
import '../@types/Period.js';
|
|
3
8
|
|
|
4
9
|
declare const FormSecurityContext: React__default.Context<IFormSecurityContext>;
|
|
5
10
|
declare const withFormSecurity: <ComponentProps extends IWithFormSecurity>(WrappedComponent: React__default.ComponentType<ComponentProps>) => (props: ComponentProps) => JSX.Element;
|
package/lib/icons/helper.d.ts
CHANGED
|
@@ -563,6 +563,18 @@ declare const _default: {
|
|
|
563
563
|
viewbox: string;
|
|
564
564
|
paths: string[];
|
|
565
565
|
};
|
|
566
|
+
cash3: {
|
|
567
|
+
viewbox: string;
|
|
568
|
+
paths: string[];
|
|
569
|
+
};
|
|
570
|
+
wallet: {
|
|
571
|
+
viewbox: string;
|
|
572
|
+
paths: string[];
|
|
573
|
+
};
|
|
574
|
+
stackEmpty: {
|
|
575
|
+
viewbox: string;
|
|
576
|
+
paths: string[];
|
|
577
|
+
};
|
|
566
578
|
};
|
|
567
579
|
|
|
568
580
|
export { _default as default };
|
package/lib/icons/helper.js
CHANGED
|
@@ -568,6 +568,18 @@ var _default = {
|
|
|
568
568
|
records: {
|
|
569
569
|
viewbox: '0 0 16 16',
|
|
570
570
|
paths: ['M13.75 4h-0.75v-0.75c0-0.689-0.561-1.25-1.25-1.25h-0.75v-0.75c0-0.689-0.561-1.25-1.25-1.25h-7.5c-0.689 0-1.25 0.561-1.25 1.25v9.5c0 0.689 0.561 1.25 1.25 1.25h0.75v0.75c0 0.689 0.561 1.25 1.25 1.25h0.75v0.75c0 0.689 0.561 1.25 1.25 1.25h7.5c0.689 0 1.25-0.561 1.25-1.25v-9.5c0-0.689-0.561-1.25-1.25-1.25zM2.25 11c-0.138 0-0.25-0.113-0.25-0.25v-9.5c0-0.137 0.112-0.25 0.25-0.25h7.5c0.137 0 0.25 0.113 0.25 0.25v0.75h-5.75c-0.689 0-1.25 0.561-1.25 1.25v7.75h-0.75zM4.25 13c-0.138 0-0.25-0.113-0.25-0.25v-9.5c0-0.138 0.112-0.25 0.25-0.25h7.5c0.137 0 0.25 0.112 0.25 0.25v0.75h-5.75c-0.689 0-1.25 0.561-1.25 1.25v7.75h-0.75zM14 14.75c0 0.137-0.113 0.25-0.25 0.25h-7.5c-0.138 0-0.25-0.113-0.25-0.25v-9.5c0-0.138 0.112-0.25 0.25-0.25h7.5c0.137 0 0.25 0.112 0.25 0.25v9.5z']
|
|
571
|
+
},
|
|
572
|
+
cash3: {
|
|
573
|
+
viewbox: '0 0 17 16',
|
|
574
|
+
paths: ['9h1v1h-1v-1z', 'M0 6v9h17v-9h-17zM3 14h-2v-2h1v1h1v1zM3 8h-1v1h-1v-2h2v1zM10.5 10c0.276 0 0.5 0.224 0.5 0.5v2c0 0.276-0.224 0.5-0.5 0.5h-1.5v0.5c0 0.276-0.224 0.5-0.5 0.5s-0.5-0.224-0.5-0.5v-0.5h-1.5c-0.276 0-0.5-0.224-0.5-0.5s0.224-0.5 0.5-0.5h1.5v-1h-1.5c-0.276 0-0.5-0.224-0.5-0.5v-2c0-0.276 0.224-0.5 0.5-0.5h1.5v-0.5c0-0.276 0.224-0.5 0.5-0.5s0.5 0.224 0.5 0.5v0.5h1.5c0.276 0 0.5 0.224 0.5 0.5s-0.224 0.5-0.5 0.5h-1.5v1h1.5zM16 14h-2v-1h1v-1h1v2zM16 9h-1v-1h-1v-1h2v2z', 'M9 11h1v1h-1v-1z', 'M1 4h15v1.5h-15v-1.5z', 'M2 2h13v1.5h-13v-1.5z']
|
|
575
|
+
},
|
|
576
|
+
wallet: {
|
|
577
|
+
viewbox: '0 0 17 16',
|
|
578
|
+
paths: ['M15 2h-13c-1.105 0-2 0.895-2 2v10c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1v-1h1c0.55 0 1-0.45 1-1v-9c0-0.55-0.45-1-1-1zM1 6h0.5v1h-0.5v-1zM1 8h0.5v1h-0.5v-1zM1 10h0.5v1h-0.5v-1zM1 12h0.5v1h-0.5v-1zM2 14h-1v-0.5h1v0.5zM2 5.5h-1v-0.5h1v0.5zM4 14h-1v-0.5h1v0.5zM4 5.5h-1v-0.5h1v0.5zM6 14h-1v-0.5h1v0.5zM6 5.5h-1v-0.5h1v0.5zM8 14h-1v-0.5h1v0.5zM8 5.5h-1v-0.5h1v0.5zM10 14h-1v-0.5h1v0.5zM12 14h-1v-0.5h1v0.5zM15 7h-4v3h4v1.998c-0.001 0.001-0.001 0.001-0.002 0.002h-0.998v-1h-4v-5h4v-1c0-0.55-0.45-1-1-1h-12c0-0.551 0.449-1 1-1h12.998c0.001 0.001 0.001 0.001 0.002 0.002v3.998zM13 8.5c0 0.276-0.224 0.5-0.5 0.5s-0.5-0.224-0.5-0.5 0.224-0.5 0.5-0.5 0.5 0.224 0.5 0.5z']
|
|
579
|
+
},
|
|
580
|
+
stackEmpty: {
|
|
581
|
+
viewbox: '0 0 16 16',
|
|
582
|
+
paths: ['M16 13v-12h-11v1.155l-2.619 0.368 0.17 1.211-2.551 0.732 3.308 11.535 10.189-2.921 0.558-0.079h1.945zM6 2h9v10h-9v-10zM5 3.070v9.93h2.543l-2.721 0.382-1.418-10.088 1.595-0.224zM3.929 14.879l-2.808-9.793 1.558-0.447 1.373 9.766 2.997-0.421-3.119 0.894z']
|
|
571
583
|
}
|
|
572
584
|
};
|
|
573
585
|
exports.default = _default;
|
|
@@ -163,9 +163,9 @@ var SimpleSelect = function SimpleSelect(props) {
|
|
|
163
163
|
setDropdownWidth(dropdownWidthFocus);
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
|
-
var onBlur = function onBlur(
|
|
166
|
+
var onBlur = function onBlur() {
|
|
167
167
|
if (props.onBlur) {
|
|
168
|
-
var event = getSelectEvent(
|
|
168
|
+
var event = getSelectEvent(selected);
|
|
169
169
|
props.onBlur(event);
|
|
170
170
|
}
|
|
171
171
|
if (!insideComponent) {
|
|
@@ -228,14 +228,14 @@ var SimpleSelect = function SimpleSelect(props) {
|
|
|
228
228
|
var newCurrent = null;
|
|
229
229
|
if (value) {
|
|
230
230
|
newCurrent = dataSourceWithAllOptions.find(function (i) {
|
|
231
|
-
|
|
231
|
+
var _i$idKey;
|
|
232
|
+
return value && ((_i$idKey = i[idKey]) === null || _i$idKey === void 0 ? void 0 : _i$idKey.toString().toLowerCase()) === (value === null || value === void 0 ? void 0 : value.toString().toLowerCase());
|
|
232
233
|
});
|
|
233
234
|
setValueFromProps(value);
|
|
234
235
|
} else if (dataSourceWithAllOptions.length > 0 && selectFirstOnEnter) {
|
|
235
236
|
newCurrent = dataSourceWithAllOptions[0];
|
|
236
237
|
}
|
|
237
238
|
setSelected(newCurrent);
|
|
238
|
-
setInputText(newCurrent ? newCurrent[descriptionKey] : '');
|
|
239
239
|
}
|
|
240
240
|
}, [dataSourceWithAllOptions.length, value]);
|
|
241
241
|
(0, _react.useEffect)(function () {
|
|
@@ -4,6 +4,10 @@ import { CustomInputEvent } from '../base/types.js';
|
|
|
4
4
|
import 'react';
|
|
5
5
|
import '../../@types/Period.js';
|
|
6
6
|
|
|
7
|
+
type AllOptions = {
|
|
8
|
+
idValue?: number | null;
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
7
11
|
interface ISimpleSelectProps {
|
|
8
12
|
idKey: string;
|
|
9
13
|
descriptionKey: string;
|
|
@@ -40,10 +44,7 @@ interface ISimpleSelectProps {
|
|
|
40
44
|
required?: boolean;
|
|
41
45
|
autoFocus?: boolean;
|
|
42
46
|
onFocus?: () => void;
|
|
43
|
-
allOptions?:
|
|
44
|
-
idValue?: number | null;
|
|
45
|
-
label: string;
|
|
46
|
-
};
|
|
47
|
+
allOptions?: AllOptions;
|
|
47
48
|
}
|
|
48
49
|
interface ISelectFieldProps extends Omit<ISimpleSelectProps, 'idKey' | 'descriptionKey'> {
|
|
49
50
|
multiple?: boolean;
|
|
@@ -90,4 +91,4 @@ interface ISelectedsMultipleProps {
|
|
|
90
91
|
handleOnUnselect: (id: string) => void;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
export { IMultipleSelectProps, ISelectFieldProps, ISelectedsMultipleProps, ISimpleSelectProps };
|
|
94
|
+
export { AllOptions, IMultipleSelectProps, ISelectFieldProps, ISelectedsMultipleProps, ISimpleSelectProps };
|