linear-react-components-ui 1.0.10-beta.1 → 1.0.10-beta.10
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/demo/06c001f4d19c06397d470bb43ff3fe49.png +0 -0
- package/demo/270084ef02ed3bddc3f735fd91ee3cae.png +0 -0
- package/demo/882f8e819d18f5f2dc08d23ebd28a7d5.png +0 -0
- package/demo/bundle.js +2 -0
- package/demo/bundle.js.LICENSE.txt +65 -0
- package/demo/cbc3b4bd6342c551db7afafe26dc458c.jpg +0 -0
- package/demo/edc9476523b940deab91951066981a31.png +0 -0
- package/demo/fb44e7c36db6d95bb85a745d4f060fb2.png +0 -0
- package/demo/fonts/Roboto-Black.woff +0 -0
- package/demo/fonts/Roboto-Black.woff2 +0 -0
- package/demo/fonts/Roboto-Bold.woff +0 -0
- package/demo/fonts/Roboto-Bold.woff2 +0 -0
- package/demo/fonts/Roboto-Light.woff +0 -0
- package/demo/fonts/Roboto-Light.woff2 +0 -0
- package/demo/fonts/Roboto-Medium.woff +0 -0
- package/demo/fonts/Roboto-Medium.woff2 +0 -0
- package/demo/fonts/Roboto-Regular.woff +0 -0
- package/demo/fonts/Roboto-Regular.woff2 +0 -0
- package/demo/fonts/Roboto-Thin.woff +0 -0
- package/demo/fonts/Roboto-Thin.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-Black.woff +0 -0
- package/demo/fonts/TitilliumWeb-Black.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-Bold.woff +0 -0
- package/demo/fonts/TitilliumWeb-Bold.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-ExtraLight.woff +0 -0
- package/demo/fonts/TitilliumWeb-ExtraLight.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-Light.woff +0 -0
- package/demo/fonts/TitilliumWeb-Light.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-Regular.woff +0 -0
- package/demo/fonts/TitilliumWeb-Regular.woff2 +0 -0
- package/demo/fonts/TitilliumWeb-SemiBold.woff +0 -0
- package/demo/fonts/TitilliumWeb-SemiBold.woff2 +0 -0
- package/demo/index.html +1 -0
- package/lib/@types/Align.d.ts +2 -1
- package/lib/assets/styles/drawers.scss +9 -0
- package/lib/assets/styles/table.scss +30 -0
- package/lib/buttons/DefaultButton.js +13 -4
- package/lib/buttons/types.d.ts +2 -1
- package/lib/dialog/Alert.d.ts +1 -0
- package/lib/dialog/Custom.d.ts +1 -0
- package/lib/dialog/Error.d.ts +1 -0
- package/lib/dialog/Information.d.ts +1 -0
- package/lib/dialog/Question.d.ts +1 -0
- package/lib/dialog/Warning.d.ts +1 -0
- package/lib/dialog/base/Content.d.ts +1 -0
- package/lib/dialog/base/Footer.d.ts +1 -0
- package/lib/dialog/base/Header.d.ts +1 -0
- package/lib/dialog/base/index.d.ts +1 -0
- package/lib/dialog/form/index.d.ts +1 -0
- package/lib/dialog/index.d.ts +1 -0
- package/lib/dialog/types.d.ts +2 -1
- package/lib/drawer/Drawer.d.ts +1 -1
- package/lib/drawer/Drawer.js +22 -2
- package/lib/drawer/types.d.ts +1 -0
- package/lib/form/Field.d.ts +6 -0
- package/lib/form/Field.js +20 -12
- package/lib/form/FieldArray.d.ts +6 -0
- package/lib/form/FieldNumber.d.ts +6 -0
- package/lib/form/FieldPeriod.d.ts +6 -0
- package/lib/form/helpers.d.ts +6 -0
- package/lib/form/index.d.ts +8 -1
- package/lib/form/index.js +9 -1
- package/lib/form/types.d.ts +10 -0
- package/lib/form/withFieldHOC.d.ts +6 -0
- package/lib/form/withFormSecurity.d.ts +6 -0
- package/lib/form/withFormSecurity.js +2 -1
- package/lib/index.d.ts +1 -0
- package/lib/inputs/base/InputTextBase.d.ts +1 -0
- package/lib/inputs/base/InputTextBase.js +10 -2
- package/lib/inputs/base/helpers.d.ts +2 -1
- package/lib/inputs/base/types.d.ts +2 -1
- package/lib/inputs/date/Dialog.d.ts +1 -0
- package/lib/inputs/date/Dropdown.d.ts +1 -0
- package/lib/inputs/date/helpers.d.ts +1 -0
- package/lib/inputs/date/index.d.ts +1 -0
- package/lib/inputs/date/types.d.ts +1 -0
- package/lib/inputs/file/DefaultFile.d.ts +1 -0
- package/lib/inputs/file/DragDropFile.d.ts +1 -0
- package/lib/inputs/file/File.d.ts +1 -0
- package/lib/inputs/file/FileButtonSettings.d.ts +1 -0
- package/lib/inputs/file/helpers.d.ts +1 -0
- package/lib/inputs/file/index.d.ts +1 -0
- package/lib/inputs/file/types.d.ts +1 -0
- package/lib/inputs/inputHOC.d.ts +1 -0
- package/lib/inputs/mask/BaseMask.d.ts +1 -0
- package/lib/inputs/mask/Cnpj.d.ts +1 -0
- package/lib/inputs/mask/Cpf.d.ts +1 -0
- package/lib/inputs/mask/Phone.d.ts +1 -0
- package/lib/inputs/mask/ZipCode.d.ts +1 -0
- package/lib/inputs/mask/helpers.d.ts +1 -0
- package/lib/inputs/mask/imaskHOC.d.ts +1 -0
- package/lib/inputs/mask/index.d.ts +1 -0
- package/lib/inputs/mask/types.d.ts +2 -1
- package/lib/inputs/multiSelect/ActionButtons.d.ts +2 -1
- package/lib/inputs/multiSelect/ActionButtons.js +4 -1
- package/lib/inputs/multiSelect/Dropdown.d.ts +1 -0
- package/lib/inputs/multiSelect/Dropdown.js +1 -1
- package/lib/inputs/multiSelect/helper.d.ts +8 -6
- package/lib/inputs/multiSelect/helper.js +5 -1
- package/lib/inputs/multiSelect/index.d.ts +1 -0
- package/lib/inputs/multiSelect/index.js +5 -2
- package/lib/inputs/multiSelect/types.d.ts +12 -3
- package/lib/inputs/number/BaseNumber.d.ts +1 -0
- package/lib/inputs/number/Currency.d.ts +1 -0
- package/lib/inputs/number/Decimal.d.ts +1 -0
- package/lib/inputs/number/index.d.ts +1 -0
- package/lib/inputs/number/types.d.ts +1 -1
- package/lib/inputs/period/Dialog.d.ts +1 -0
- package/lib/inputs/period/Dropdown.d.ts +1 -0
- package/lib/inputs/period/PeriodList.d.ts +1 -0
- package/lib/inputs/period/helper.d.ts +1 -0
- package/lib/inputs/period/index.d.ts +1 -0
- package/lib/inputs/period/index.js +8 -8
- package/lib/inputs/period/types.d.ts +3 -2
- package/lib/inputs/search/index.d.ts +1 -0
- package/lib/inputs/select/ActionButtons.d.ts +1 -0
- package/lib/inputs/select/Dropdown.d.ts +1 -0
- package/lib/inputs/select/Dropdown.js +1 -1
- package/lib/inputs/select/helper.d.ts +5 -9
- package/lib/inputs/select/helper.js +11 -2
- package/lib/inputs/select/index.d.ts +1 -0
- package/lib/inputs/select/index.js +6 -5
- package/lib/inputs/select/multiple/Selecteds.d.ts +1 -0
- package/lib/inputs/select/multiple/Selecteds.js +1 -1
- package/lib/inputs/select/multiple/index.d.ts +1 -0
- package/lib/inputs/select/multiple/index.js +13 -10
- package/lib/inputs/select/simple/index.d.ts +1 -0
- package/lib/inputs/select/simple/index.js +8 -7
- package/lib/inputs/select/types.d.ts +28 -12
- package/lib/inputs/text/index.d.ts +1 -0
- package/lib/inputs/text/types.d.ts +1 -1
- package/lib/inputs/textarea/index.d.ts +1 -0
- package/lib/inputs/textarea/types.d.ts +1 -0
- package/lib/inputs/types.d.ts +5 -3
- package/lib/table/Row.js +20 -3
- package/lib/table/types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ import '../../@types/ColorStyles.js';
|
|
|
5
5
|
import '../../@types/Period.js';
|
|
6
6
|
import '../../@types/PermissionAttr.js';
|
|
7
7
|
import '../base/types.js';
|
|
8
|
+
import '../../@types/Align.js';
|
|
8
9
|
|
|
9
10
|
declare const PeriodList: ({ selected, handleOnSelect }: IPeriodListProps) => JSX.Element;
|
|
10
11
|
|
|
@@ -5,6 +5,7 @@ import '../../@types/ColorStyles.js';
|
|
|
5
5
|
import '../../@types/Period.js';
|
|
6
6
|
import '../../@types/PermissionAttr.js';
|
|
7
7
|
import '../base/types.js';
|
|
8
|
+
import '../../@types/Align.js';
|
|
8
9
|
|
|
9
10
|
declare const getCalendarDropdownStyle: ({ topPosition, leftPosition, width }: {
|
|
10
11
|
topPosition: number | string;
|
|
@@ -42,11 +42,11 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
42
42
|
height: '350px'
|
|
43
43
|
} : _props$dialogSize,
|
|
44
44
|
calendarColorStyle = props.calendarColorStyle;
|
|
45
|
-
var _useState = (0, _react.useState)(props.value && props.value.
|
|
45
|
+
var _useState = (0, _react.useState)(props.value && props.value.initial ? (0, _moment.default)(props.value.initial) : undefined),
|
|
46
46
|
_useState2 = _slicedToArray(_useState, 2),
|
|
47
47
|
valueInitial = _useState2[0],
|
|
48
48
|
setValueInitial = _useState2[1];
|
|
49
|
-
var _useState3 = (0, _react.useState)(props.value && props.value.
|
|
49
|
+
var _useState3 = (0, _react.useState)(props.value && props.value.final ? (0, _moment.default)(props.value.final) : undefined),
|
|
50
50
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
51
51
|
valueFinal = _useState4[0],
|
|
52
52
|
setValueFinal = _useState4[1];
|
|
@@ -119,10 +119,10 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
119
119
|
}
|
|
120
120
|
}, [valueInitial, valueFinal]);
|
|
121
121
|
(0, _react.useEffect)(function () {
|
|
122
|
-
if (props.value) {
|
|
122
|
+
if (props.value && !((0, _moment.default)(props.value.initial).isSame(valueInitial) || (0, _moment.default)(props.value.final).isSame(valueFinal))) {
|
|
123
123
|
var _props$value = props.value,
|
|
124
|
-
valueInitialProp = _props$value.
|
|
125
|
-
valueFinalProp = _props$value.
|
|
124
|
+
valueInitialProp = _props$value.initial,
|
|
125
|
+
valueFinalProp = _props$value.final;
|
|
126
126
|
var newValueInitial;
|
|
127
127
|
var newValueFinal;
|
|
128
128
|
if ((0, _moment.default)(valueInitialProp, 'YYYY-MM-DD', true).isValid()) {
|
|
@@ -134,7 +134,7 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
134
134
|
setValueInitial(newValueInitial);
|
|
135
135
|
setValueFinal(newValueFinal);
|
|
136
136
|
}
|
|
137
|
-
}, [(_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.
|
|
137
|
+
}, [(_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.initial, (_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.final]);
|
|
138
138
|
var openCalendar = function openCalendar() {
|
|
139
139
|
setShowCalendar(true);
|
|
140
140
|
setShowPeriodSelection(false);
|
|
@@ -162,7 +162,7 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
164
|
var setValue = function setValue(e, value) {
|
|
165
|
-
var
|
|
165
|
+
var shouldOpenDropdown = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
166
166
|
var changingAux = e ? e.target.name : '';
|
|
167
167
|
var dateObj = (0, _moment.default)(value, 'DD/MM/YYYY');
|
|
168
168
|
if (changingAux === 'valueInitial') {
|
|
@@ -170,7 +170,7 @@ var PeriodPicker = function PeriodPicker(props) {
|
|
|
170
170
|
} else {
|
|
171
171
|
setValueFinal(dateObj);
|
|
172
172
|
}
|
|
173
|
-
if (changingAux === 'valueInitial' && !valueFinal &&
|
|
173
|
+
if (changingAux === 'valueInitial' && !valueFinal && shouldOpenDropdown) {
|
|
174
174
|
var _inputFinalRef$curren;
|
|
175
175
|
if (valueFinal) setChanging(valueFinal);
|
|
176
176
|
setShowCalendar(false);
|
|
@@ -4,6 +4,7 @@ import { ColorStyles } from '../../@types/ColorStyles.js';
|
|
|
4
4
|
import { Period } from '../../@types/Period.js';
|
|
5
5
|
import { PermissionAttr } from '../../@types/PermissionAttr.js';
|
|
6
6
|
import { CustomInputEvent } from '../base/types.js';
|
|
7
|
+
import '../../@types/Align.js';
|
|
7
8
|
|
|
8
9
|
type DateTypes = 'today' | 'week' | 'lastweek' | 'last15' | 'month' | 'lastmonth';
|
|
9
10
|
interface IPeriodOptions {
|
|
@@ -29,8 +30,8 @@ interface IPeriodDropdownProps {
|
|
|
29
30
|
interface IPeriodPickerProps {
|
|
30
31
|
label?: string;
|
|
31
32
|
value?: {
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
initial?: Moment | string;
|
|
34
|
+
final?: Moment | string;
|
|
34
35
|
};
|
|
35
36
|
customClassForLabel?: string;
|
|
36
37
|
labelUppercase?: boolean;
|
|
@@ -118,7 +118,7 @@ var Dropdown = function Dropdown(props) {
|
|
|
118
118
|
}
|
|
119
119
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
120
120
|
className: "label"
|
|
121
|
-
}, item[descriptionKey])));
|
|
121
|
+
}, typeof descriptionKey === 'string' ? item[descriptionKey] : descriptionKey(item))));
|
|
122
122
|
}), dataCombo && dataCombo.length === 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
123
123
|
className: "notfound"
|
|
124
124
|
}, searchNotFoundText)));
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import { DataCombo } from '../../@types/DataCombo.js';
|
|
2
1
|
import { IDropdownSelectProps } from '../types.js';
|
|
2
|
+
import { GetSimpleFilteredParams, GetMultipleFilteredParams } from './types.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '../../@types/PermissionAttr.js';
|
|
5
|
+
import '../../@types/DataCombo.js';
|
|
5
6
|
import '../base/types.js';
|
|
7
|
+
import '../../@types/Align.js';
|
|
6
8
|
import '../../@types/Period.js';
|
|
7
9
|
import '../../drawer/types.js';
|
|
8
10
|
import '../../@types/Position.js';
|
|
9
11
|
|
|
10
12
|
declare const contentClass: (props: IDropdownSelectProps) => string;
|
|
11
13
|
declare const getDropdownItemCssClass: (selected: boolean, disabled: boolean, striped: boolean) => string;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
descriptionKey: string;
|
|
15
|
-
inputText: string;
|
|
16
|
-
currents: DataCombo[];
|
|
17
|
-
}
|
|
18
|
-
declare const getFilteredSimpleDataCombo: ({ dataSource, descriptionKey, inputText, }: Omit<GetFilteredParams, 'currents'>) => any[];
|
|
19
|
-
declare const getFilteredMultipleDataCombo: ({ dataSource, inputText, descriptionKey, currents, }: GetFilteredParams) => any[];
|
|
14
|
+
declare const getFilteredSimpleDataCombo: ({ dataSource, descriptionKey, inputText, }: Omit<GetSimpleFilteredParams, 'currents'>) => any[];
|
|
15
|
+
declare const getFilteredMultipleDataCombo: ({ dataSource, inputText, descriptionKey, currents, }: GetMultipleFilteredParams) => any[];
|
|
20
16
|
declare const returnDropdownDynamicStyles: ({ selectFieldRef, dropdownMaxHeight, dropdownRef }: IDropdownSelectProps) => {
|
|
21
17
|
maxHeight: number;
|
|
22
18
|
top: number;
|
|
@@ -21,7 +21,12 @@ var getFilteredSimpleDataCombo = function getFilteredSimpleDataCombo(_ref) {
|
|
|
21
21
|
descriptionKey = _ref.descriptionKey,
|
|
22
22
|
inputText = _ref.inputText;
|
|
23
23
|
return dataSource && dataSource.filter(function (item) {
|
|
24
|
-
|
|
24
|
+
var _descriptionKey;
|
|
25
|
+
if (typeof descriptionKey === 'string') {
|
|
26
|
+
var _item$descriptionKey;
|
|
27
|
+
return ((_item$descriptionKey = item[descriptionKey]) === null || _item$descriptionKey === void 0 ? void 0 : _item$descriptionKey.toLowerCase().indexOf(inputText === null || inputText === void 0 ? void 0 : inputText.toString().toLowerCase())) > -1;
|
|
28
|
+
}
|
|
29
|
+
return ((_descriptionKey = descriptionKey(item)) === null || _descriptionKey === void 0 ? void 0 : _descriptionKey.toLowerCase().indexOf(inputText === null || inputText === void 0 ? void 0 : inputText.toString().toLowerCase())) > -1;
|
|
25
30
|
});
|
|
26
31
|
};
|
|
27
32
|
exports.getFilteredSimpleDataCombo = getFilteredSimpleDataCombo;
|
|
@@ -31,7 +36,11 @@ var getFilteredMultipleDataCombo = function getFilteredMultipleDataCombo(_ref2)
|
|
|
31
36
|
descriptionKey = _ref2.descriptionKey,
|
|
32
37
|
currents = _ref2.currents;
|
|
33
38
|
return dataSource.filter(function (item) {
|
|
34
|
-
|
|
39
|
+
var _descriptionKey2;
|
|
40
|
+
if (typeof descriptionKey === 'string') {
|
|
41
|
+
return item[descriptionKey].toLowerCase().indexOf(inputText === null || inputText === void 0 ? void 0 : inputText.toString().toLowerCase()) > -1 && !currents.includes(item);
|
|
42
|
+
}
|
|
43
|
+
return ((_descriptionKey2 = descriptionKey(item)) === null || _descriptionKey2 === void 0 ? void 0 : _descriptionKey2.toLowerCase().indexOf(inputText === null || inputText === void 0 ? void 0 : inputText.toString().toLowerCase())) > -1 && !currents.includes(item);
|
|
35
44
|
});
|
|
36
45
|
};
|
|
37
46
|
exports.getFilteredMultipleDataCombo = getFilteredMultipleDataCombo;
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _simple = _interopRequireDefault(require("./simple"));
|
|
9
8
|
var _multiple = _interopRequireDefault(require("./multiple"));
|
|
10
9
|
require("../../assets/styles/select.scss");
|
|
11
10
|
var _gridlayout = _interopRequireDefault(require("../../gridlayout"));
|
|
11
|
+
var _simple = _interopRequireDefault(require("./simple"));
|
|
12
12
|
var _excluded = ["gridLayout", "multiple", "value"];
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -19,15 +19,16 @@ var SelectField = function SelectField(props) {
|
|
|
19
19
|
multiple = props.multiple,
|
|
20
20
|
value = props.value,
|
|
21
21
|
newProps = _objectWithoutProperties(props, _excluded);
|
|
22
|
-
var component = multiple ? /*#__PURE__*/_react.default.createElement(_multiple.default, _extends({
|
|
22
|
+
var component = multiple ? /*#__PURE__*/_react.default.createElement(_multiple.default, _extends({}, newProps, {
|
|
23
23
|
dataSource: props.dataSource ? props.dataSource : [],
|
|
24
24
|
idKey: props.idKey ? props.idKey : '',
|
|
25
|
+
value: Array.isArray(value) ? value : undefined,
|
|
25
26
|
descriptionKey: props.descriptionKey ? props.descriptionKey : ''
|
|
26
|
-
}
|
|
27
|
+
})) : /*#__PURE__*/_react.default.createElement(_simple.default, _extends({}, newProps, {
|
|
27
28
|
idKey: props.idKey ? props.idKey : '',
|
|
28
|
-
value: value,
|
|
29
|
+
value: !Array.isArray(value) ? value : undefined,
|
|
29
30
|
descriptionKey: props.descriptionKey ? props.descriptionKey : ''
|
|
30
|
-
}
|
|
31
|
+
}));
|
|
31
32
|
if (gridLayout !== undefined) {
|
|
32
33
|
return /*#__PURE__*/_react.default.createElement(_gridlayout.default, {
|
|
33
34
|
customClass: "-withinput",
|
|
@@ -15,7 +15,7 @@ var Selecteds = function Selecteds(_ref) {
|
|
|
15
15
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
16
16
|
className: "selecteditem",
|
|
17
17
|
key: "selected-".concat(selected[idKey])
|
|
18
|
-
}, selected[descriptionKey], /*#__PURE__*/_react.default.createElement("span", {
|
|
18
|
+
}, typeof descriptionKey === 'string' ? selected[descriptionKey] : descriptionKey(selected), /*#__PURE__*/_react.default.createElement("span", {
|
|
19
19
|
className: "close",
|
|
20
20
|
role: "button",
|
|
21
21
|
tabIndex: -1,
|
|
@@ -50,7 +50,7 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
50
50
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
51
51
|
selected = _useState6[0],
|
|
52
52
|
setSelected = _useState6[1];
|
|
53
|
-
var _useState7 = (0, _react.useState)(
|
|
53
|
+
var _useState7 = (0, _react.useState)([]),
|
|
54
54
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
55
55
|
inputValue = _useState8[0],
|
|
56
56
|
setInputValue = _useState8[1];
|
|
@@ -79,6 +79,7 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
79
79
|
var dropdownRef = (0, _react.useRef)(null);
|
|
80
80
|
var selectWrapper = (0, _react.useRef)();
|
|
81
81
|
var gridElRef = (0, _react.useRef)();
|
|
82
|
+
var descriptionKeyIsString = typeof descriptionKey === 'string';
|
|
82
83
|
var onScreenResize = function onScreenResize() {
|
|
83
84
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
84
85
|
};
|
|
@@ -104,12 +105,12 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
104
105
|
if (remoteSearch) {
|
|
105
106
|
if (props.onSearch) props.onSearch(filteredValue);
|
|
106
107
|
setOpened(true);
|
|
107
|
-
setInputValue(filteredValue);
|
|
108
|
+
setInputValue([filteredValue]);
|
|
108
109
|
} else {
|
|
109
110
|
var dataComboFilter = dataSource;
|
|
110
|
-
if (filteredValue
|
|
111
|
+
if (filteredValue.length > 0) {
|
|
111
112
|
dataComboFilter = (0, _helper.getFilteredMultipleDataCombo)({
|
|
112
|
-
inputText: filteredValue,
|
|
113
|
+
inputText: [filteredValue],
|
|
113
114
|
dataSource: dataSource,
|
|
114
115
|
descriptionKey: descriptionKey,
|
|
115
116
|
currents: currents
|
|
@@ -119,7 +120,7 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
119
120
|
setDataCombo(dataComboFilter);
|
|
120
121
|
setOpened(true);
|
|
121
122
|
if (selectedFilter) setSelected(selectedFilter);
|
|
122
|
-
setInputValue(filteredValue);
|
|
123
|
+
setInputValue([filteredValue]);
|
|
123
124
|
}
|
|
124
125
|
};
|
|
125
126
|
var onSelect = function onSelect(select) {
|
|
@@ -127,7 +128,7 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
127
128
|
var currentsSelect = [].concat(_toConsumableArray(currents), [select]);
|
|
128
129
|
setCurrents(currentsSelect);
|
|
129
130
|
setDataCombo(dataSource);
|
|
130
|
-
setInputValue(
|
|
131
|
+
setInputValue([]);
|
|
131
132
|
setOpened(false);
|
|
132
133
|
if (props.onSelect) setSelected(props.onSelect(currentsSelect.map(function (i) {
|
|
133
134
|
return i[idKey];
|
|
@@ -171,12 +172,14 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
171
172
|
} else {
|
|
172
173
|
index = dataSource && index === 0 ? dataSource.length - 1 : index - 1;
|
|
173
174
|
}
|
|
174
|
-
if (dataSource && dataSource.length
|
|
175
|
-
|
|
175
|
+
if (dataSource && dataSource.length) {
|
|
176
|
+
if (descriptionKeyIsString && dataSource[index][descriptionKey]) {
|
|
177
|
+
setInputValue(dataSource[index][descriptionKey]);
|
|
178
|
+
} else if (!descriptionKeyIsString) setInputValue([descriptionKey(dataSource[index])]);
|
|
176
179
|
}
|
|
177
180
|
if (dataSource) setSelected(dataSource[index]);
|
|
178
181
|
} else if (e.keyCode === constants.keyCodes.BACKSPACE) {
|
|
179
|
-
if (inputValue ===
|
|
182
|
+
if (inputValue.length === 0) {
|
|
180
183
|
var currentsKeyDown = _lodash.default.dropRight(currents);
|
|
181
184
|
setCurrents(currentsKeyDown);
|
|
182
185
|
if (props.onSelect) props.onSelect(currentsKeyDown.map(function (i) {
|
|
@@ -238,7 +241,7 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
238
241
|
ref: componentRef,
|
|
239
242
|
className: "select-component"
|
|
240
243
|
}, /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
|
|
241
|
-
value: inputValue,
|
|
244
|
+
value: inputValue.toString(),
|
|
242
245
|
readOnly: shouldBeReadOnly(),
|
|
243
246
|
onFocus: function onFocus() {
|
|
244
247
|
_onFocus();
|
|
@@ -55,7 +55,8 @@ var SimpleSelect = function SimpleSelect(props) {
|
|
|
55
55
|
searchOnDropdown = _props$searchOnDropdo === void 0 ? false : _props$searchOnDropdo,
|
|
56
56
|
_props$allOptions = props.allOptions,
|
|
57
57
|
allOptions = _props$allOptions === void 0 ? undefined : _props$allOptions;
|
|
58
|
-
var
|
|
58
|
+
var descriptionKeyIsString = typeof descriptionKey === 'string';
|
|
59
|
+
var dataSourceWithAllOptions = allOptions ? [(_ref = {}, _defineProperty(_ref, idKey, allOptions.idValue), _defineProperty(_ref, descriptionKeyIsString ? descriptionKey : descriptionKey(allOptions.label), allOptions.label), _ref)].concat(_toConsumableArray(dataSource)) : dataSource;
|
|
59
60
|
var _useState = (0, _react.useState)(dataSourceWithAllOptions),
|
|
60
61
|
_useState2 = _slicedToArray(_useState, 2),
|
|
61
62
|
dataCombo = _useState2[0],
|
|
@@ -140,7 +141,6 @@ var SimpleSelect = function SimpleSelect(props) {
|
|
|
140
141
|
if (dataComboFilter && dataComboFilter.length > 0) selectedFilter = dataComboFilter[0];
|
|
141
142
|
setDataCombo(dataComboFilter);
|
|
142
143
|
}
|
|
143
|
-
onChange(selectedFilter);
|
|
144
144
|
setOpened(true);
|
|
145
145
|
setInputText(valueFilter);
|
|
146
146
|
setSelected(selectedFilter);
|
|
@@ -149,7 +149,7 @@ var SimpleSelect = function SimpleSelect(props) {
|
|
|
149
149
|
if (selectedDropdown === undefined) return;
|
|
150
150
|
setOpened(false);
|
|
151
151
|
setSelected(selectedDropdown);
|
|
152
|
-
setInputText(selectedDropdown[descriptionKey]);
|
|
152
|
+
if (descriptionKeyIsString) setInputText(selectedDropdown[descriptionKey]);else setInputText(descriptionKey(selectedDropdown));
|
|
153
153
|
onChange(selectedDropdown);
|
|
154
154
|
};
|
|
155
155
|
var onOpenClose = function onOpenClose() {
|
|
@@ -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,15 @@ 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 ((_i$idKey = i[idKey]) === null || _i$idKey === void 0 ? void 0 : _i$idKey.toString().toLowerCase()) === 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
|
+
if (descriptionKeyIsString) setInputText(newCurrent ? newCurrent[descriptionKey] : '');else setInputText(newCurrent ? descriptionKey(newCurrent) : '');
|
|
239
240
|
}
|
|
240
241
|
}, [dataSourceWithAllOptions.length, value]);
|
|
241
242
|
(0, _react.useEffect)(function () {
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
+
import { TextAlign } from '../../@types/Align.js';
|
|
1
2
|
import { DataCombo } from '../../@types/DataCombo.js';
|
|
2
3
|
import { PermissionAttr } from '../../@types/PermissionAttr.js';
|
|
3
4
|
import { CustomInputEvent } from '../base/types.js';
|
|
4
5
|
import 'react';
|
|
5
6
|
import '../../@types/Period.js';
|
|
6
7
|
|
|
8
|
+
type AllOptions = {
|
|
9
|
+
idValue?: number | null;
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
type DescriptionKey = string | ((dataSelected: DataCombo) => string);
|
|
7
13
|
interface ISimpleSelectProps {
|
|
8
14
|
idKey: string;
|
|
9
|
-
descriptionKey:
|
|
15
|
+
descriptionKey: DescriptionKey;
|
|
10
16
|
dataSource?: DataCombo[];
|
|
11
17
|
id?: string;
|
|
12
18
|
label?: string;
|
|
13
19
|
placeHolder?: string;
|
|
14
20
|
hint?: string;
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
textAlign?: TextAlign;
|
|
22
|
+
value?: number | string;
|
|
17
23
|
errorMessages?: string[];
|
|
18
24
|
showClearButton?: boolean;
|
|
19
25
|
searchOnDropdown?: boolean;
|
|
@@ -40,17 +46,15 @@ interface ISimpleSelectProps {
|
|
|
40
46
|
required?: boolean;
|
|
41
47
|
autoFocus?: boolean;
|
|
42
48
|
onFocus?: () => void;
|
|
43
|
-
allOptions?:
|
|
44
|
-
idValue?: number | null;
|
|
45
|
-
label: string;
|
|
46
|
-
};
|
|
49
|
+
allOptions?: AllOptions;
|
|
47
50
|
}
|
|
48
|
-
interface ISelectFieldProps extends Omit<ISimpleSelectProps, 'idKey' | 'descriptionKey'> {
|
|
51
|
+
interface ISelectFieldProps extends Omit<ISimpleSelectProps, 'idKey' | 'value' | 'descriptionKey'> {
|
|
49
52
|
multiple?: boolean;
|
|
50
53
|
gridLayout?: string;
|
|
51
|
-
descriptionKey?:
|
|
54
|
+
descriptionKey?: DescriptionKey;
|
|
52
55
|
idKey?: string;
|
|
53
56
|
dataSource?: DataCombo[];
|
|
57
|
+
value?: number | number[] | string | string[];
|
|
54
58
|
showClearButton?: boolean;
|
|
55
59
|
searchOnDropdown?: boolean;
|
|
56
60
|
searchNotFoundText?: string;
|
|
@@ -65,9 +69,10 @@ interface ISelectFieldProps extends Omit<ISimpleSelectProps, 'idKey' | 'descript
|
|
|
65
69
|
autoFocus?: boolean;
|
|
66
70
|
disabled?: boolean;
|
|
67
71
|
required?: boolean;
|
|
72
|
+
onSelect?: (data?: string | string[]) => DataCombo;
|
|
68
73
|
}
|
|
69
74
|
interface IMultipleSelectProps extends Omit<ISimpleSelectProps, 'idKey' | 'value' | 'descriptionKey'> {
|
|
70
|
-
descriptionKey:
|
|
75
|
+
descriptionKey: DescriptionKey;
|
|
71
76
|
idKey: string;
|
|
72
77
|
dataSource: DataCombo[];
|
|
73
78
|
searchNotFoundText?: string;
|
|
@@ -85,9 +90,20 @@ interface IMultipleSelectProps extends Omit<ISimpleSelectProps, 'idKey' | 'value
|
|
|
85
90
|
}
|
|
86
91
|
interface ISelectedsMultipleProps {
|
|
87
92
|
idKey: string;
|
|
88
|
-
descriptionKey:
|
|
93
|
+
descriptionKey: DescriptionKey;
|
|
89
94
|
currents: DataCombo[];
|
|
90
95
|
handleOnUnselect: (id: string) => void;
|
|
91
96
|
}
|
|
97
|
+
interface GetFilteredParams {
|
|
98
|
+
dataSource: DataCombo[];
|
|
99
|
+
descriptionKey: DescriptionKey;
|
|
100
|
+
currents: DataCombo[];
|
|
101
|
+
}
|
|
102
|
+
interface GetSimpleFilteredParams extends GetFilteredParams {
|
|
103
|
+
inputText: number | string;
|
|
104
|
+
}
|
|
105
|
+
interface GetMultipleFilteredParams extends GetFilteredParams {
|
|
106
|
+
inputText: number[] | string[];
|
|
107
|
+
}
|
|
92
108
|
|
|
93
|
-
export { IMultipleSelectProps, ISelectFieldProps, ISelectedsMultipleProps, ISimpleSelectProps };
|
|
109
|
+
export { AllOptions, DescriptionKey, GetFilteredParams, GetMultipleFilteredParams, GetSimpleFilteredParams, IMultipleSelectProps, ISelectFieldProps, ISelectedsMultipleProps, ISimpleSelectProps };
|
|
@@ -3,6 +3,7 @@ import { PermissionAttr } from '../../@types/PermissionAttr.js';
|
|
|
3
3
|
import { IBaseProps, CustomInputEvent } from '../base/types.js';
|
|
4
4
|
import { WithTooltipProps } from '../../internals/types.js';
|
|
5
5
|
import 'react';
|
|
6
|
+
import '../../@types/Align.js';
|
|
6
7
|
import '../../@types/Position.js';
|
|
7
8
|
|
|
8
9
|
type CommonProperties = Pick<WithTooltipProps, 'tooltip' | 'tooltipPosition' | 'tooltipWidth'>;
|
|
@@ -18,7 +19,6 @@ interface ITextField extends IBaseProps, CommonProperties {
|
|
|
18
19
|
leftElements?: JSX.Element | JSX.Element[];
|
|
19
20
|
rightElements?: JSX.Element | JSX.Element[];
|
|
20
21
|
permissionAttr?: PermissionAttr;
|
|
21
|
-
textAlign?: string;
|
|
22
22
|
gridLayout?: string;
|
|
23
23
|
}
|
|
24
24
|
|
package/lib/inputs/types.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ import { PermissionAttr, OnDenied } from '../@types/PermissionAttr.js';
|
|
|
3
3
|
import { DataCombo } from '../@types/DataCombo.js';
|
|
4
4
|
import { IBaseProps, CustomInputEvent } from './base/types.js';
|
|
5
5
|
import { IDrawerProps } from '../drawer/types.js';
|
|
6
|
+
import { TextAlign } from '../@types/Align.js';
|
|
6
7
|
import '../@types/Period.js';
|
|
7
8
|
import '../@types/Position.js';
|
|
8
9
|
|
|
10
|
+
type DescriptionKey = string | ((dataSelected: DataCombo) => string);
|
|
9
11
|
interface IAdvancedFilterProps extends Omit<IDrawerProps, 'content'> {
|
|
10
12
|
onStateChange?: (value?: boolean) => void;
|
|
11
13
|
headerTitle?: string;
|
|
@@ -16,7 +18,7 @@ interface ISearchProps extends IBaseProps {
|
|
|
16
18
|
onReset?: (event?: CustomInputEvent) => void;
|
|
17
19
|
onChange?: (event?: CustomInputEvent) => void;
|
|
18
20
|
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
19
|
-
textAlign?:
|
|
21
|
+
textAlign?: TextAlign;
|
|
20
22
|
disabled?: boolean;
|
|
21
23
|
readOnly?: boolean;
|
|
22
24
|
value?: string;
|
|
@@ -87,7 +89,7 @@ interface IMaskHOCProps {
|
|
|
87
89
|
customClass?: string;
|
|
88
90
|
customClassForInputContent?: string;
|
|
89
91
|
customClassForLabel?: string;
|
|
90
|
-
textAlign?:
|
|
92
|
+
textAlign?: TextAlign;
|
|
91
93
|
onBlur?: (e: CustomInputEvent) => void;
|
|
92
94
|
leftElements?: JSX.Element | JSX.Element[];
|
|
93
95
|
rounded?: boolean;
|
|
@@ -98,7 +100,7 @@ interface IMaskHOCProps {
|
|
|
98
100
|
}
|
|
99
101
|
interface IDropdownSelectProps {
|
|
100
102
|
idKey: string;
|
|
101
|
-
descriptionKey:
|
|
103
|
+
descriptionKey: DescriptionKey;
|
|
102
104
|
dropdownWidth: number;
|
|
103
105
|
showClearButton?: boolean;
|
|
104
106
|
handleOnSelect: (item?: DataCombo) => void;
|
package/lib/table/Row.js
CHANGED
|
@@ -21,7 +21,14 @@ var Row = function Row(props) {
|
|
|
21
21
|
onMouseEnter = props.onMouseEnter,
|
|
22
22
|
onMouseLeave = props.onMouseLeave,
|
|
23
23
|
_props$rowBorder = props.rowBorder,
|
|
24
|
-
rowBorder = _props$rowBorder === void 0 ? true : _props$rowBorder
|
|
24
|
+
rowBorder = _props$rowBorder === void 0 ? true : _props$rowBorder,
|
|
25
|
+
divider = props.divider,
|
|
26
|
+
dividerTitle = props.dividerTitle,
|
|
27
|
+
dividerStyle = props.dividerStyle,
|
|
28
|
+
_props$dividerColor = props.dividerColor,
|
|
29
|
+
dividerColor = _props$dividerColor === void 0 ? 'info' : _props$dividerColor,
|
|
30
|
+
_props$dividerColSpan = props.dividerColSpan,
|
|
31
|
+
dividerColSpan = _props$dividerColSpan === void 0 ? 2 : _props$dividerColSpan;
|
|
25
32
|
var _useContext = (0, _react.useContext)(_helpers.default),
|
|
26
33
|
selectedRowId = _useContext.selectedRowId,
|
|
27
34
|
handleSelectRow = _useContext.handleSelectRow,
|
|
@@ -41,7 +48,7 @@ var Row = function Row(props) {
|
|
|
41
48
|
};
|
|
42
49
|
return /*#__PURE__*/_react.default.createElement(_helpers.RowContext.Provider, {
|
|
43
50
|
value: contextValues
|
|
44
|
-
}, /*#__PURE__*/_react.default.createElement("tr", {
|
|
51
|
+
}, !divider ? /*#__PURE__*/_react.default.createElement("tr", {
|
|
45
52
|
onMouseEnter: onMouseEnter,
|
|
46
53
|
onMouseLeave: onMouseLeave,
|
|
47
54
|
className: "trow ".concat(customClass, " ").concat(rowId && selectedRowId === rowId ? '-selected' : ''),
|
|
@@ -54,7 +61,17 @@ var Row = function Row(props) {
|
|
|
54
61
|
style: _extends({}, style, {
|
|
55
62
|
height: height
|
|
56
63
|
})
|
|
57
|
-
}, children)
|
|
64
|
+
}, children) : /*#__PURE__*/_react.default.createElement("tr", {
|
|
65
|
+
className: "trow trow-divider"
|
|
66
|
+
}, vertical ? /*#__PURE__*/_react.default.createElement("th", {
|
|
67
|
+
colSpan: dividerColSpan,
|
|
68
|
+
className: "-divider -".concat(dividerColor),
|
|
69
|
+
style: dividerStyle
|
|
70
|
+
}, dividerTitle || '') : /*#__PURE__*/_react.default.createElement("td", {
|
|
71
|
+
colSpan: dividerColSpan,
|
|
72
|
+
className: "-divider -".concat(dividerColor),
|
|
73
|
+
style: dividerStyle
|
|
74
|
+
}, dividerTitle || '')));
|
|
58
75
|
};
|
|
59
76
|
var _default = Row;
|
|
60
77
|
exports.default = _default;
|
package/lib/table/types.d.ts
CHANGED
|
@@ -49,6 +49,11 @@ interface ITableRowProps extends Pick<TableHTMLAttributes<HTMLTableRowElement>,
|
|
|
49
49
|
textAlign?: string;
|
|
50
50
|
displayContent?: 'always' | 'never' | 'onRowHover';
|
|
51
51
|
visible?: boolean;
|
|
52
|
+
divider?: boolean;
|
|
53
|
+
dividerTitle?: string;
|
|
54
|
+
dividerColor?: 'primary' | 'danger' | 'info' | 'success' | 'warning';
|
|
55
|
+
dividerColSpan?: number;
|
|
56
|
+
dividerStyle?: CSSProperties;
|
|
52
57
|
}
|
|
53
58
|
interface ITableContext {
|
|
54
59
|
bodyScrollable?: boolean;
|