oa-componentbook 0.18.177 → 0.18.179
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.
|
@@ -8,11 +8,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
require("core-js/modules/es.parse-int.js");
|
|
10
10
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
12
|
+
require("core-js/modules/es.string.split.js");
|
|
11
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
14
|
var _antd = require("antd");
|
|
13
15
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
16
|
var _Done = _interopRequireDefault(require("@material-ui/icons/Done"));
|
|
15
|
-
var
|
|
17
|
+
var _dayjs4 = _interopRequireDefault(require("dayjs"));
|
|
16
18
|
var _styles = require("./styles");
|
|
17
19
|
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
18
20
|
var _CustomSelect = _interopRequireDefault(require("../../components/oa-component-select/CustomSelect"));
|
|
@@ -63,8 +65,8 @@ function DateDropDown(_ref) {
|
|
|
63
65
|
});
|
|
64
66
|
if (selectValue !== null && selectValue !== void 0 && selectValue.label) {
|
|
65
67
|
getValues({
|
|
66
|
-
startDate: (0,
|
|
67
|
-
endDate: (0,
|
|
68
|
+
startDate: (0, _dayjs4.default)(getDateOffset(labelWithDate[selectValue.label])).format(format),
|
|
69
|
+
endDate: (0, _dayjs4.default)(getDateOffset(0)).format(format),
|
|
68
70
|
label: selectValue === null || selectValue === void 0 ? void 0 : selectValue.label
|
|
69
71
|
});
|
|
70
72
|
}
|
|
@@ -77,8 +79,8 @@ function DateDropDown(_ref) {
|
|
|
77
79
|
});
|
|
78
80
|
setshowRangePicker(false);
|
|
79
81
|
getValues({
|
|
80
|
-
startDate: (0,
|
|
81
|
-
endDate: (0,
|
|
82
|
+
startDate: (0, _dayjs4.default)(getDateOffset(labelWithDate[defaultLabel])).format(format),
|
|
83
|
+
endDate: (0, _dayjs4.default)(getDateOffset(0)).format(format),
|
|
82
84
|
label: defaultLabel
|
|
83
85
|
});
|
|
84
86
|
};
|
|
@@ -87,14 +89,22 @@ function DateDropDown(_ref) {
|
|
|
87
89
|
resetLocalState();
|
|
88
90
|
}
|
|
89
91
|
}, [resetState]);
|
|
90
|
-
const showTickIcon = (
|
|
92
|
+
const showTickIcon = (selectedLabel, allLabel) => {
|
|
93
|
+
var _dayjs, _selectedLabel$split;
|
|
94
|
+
if (selectedLabel && selectedLabel === allLabel) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
if (selectedLabel && ((_dayjs = (0, _dayjs4.default)(selectedLabel === null || selectedLabel === void 0 || (_selectedLabel$split = selectedLabel.split) === null || _selectedLabel$split === void 0 || (_selectedLabel$split = _selectedLabel$split.call(selectedLabel, ' - ')) === null || _selectedLabel$split === void 0 ? void 0 : _selectedLabel$split[0])) === null || _dayjs === void 0 ? void 0 : _dayjs.format(format)) !== 'Invalid Date' && allLabel === rangePickerLabel) {
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
};
|
|
91
102
|
const optionRender = option => {
|
|
92
103
|
var _option$label;
|
|
93
|
-
const
|
|
94
|
-
const isCustomRange =
|
|
104
|
+
const allLabel = option === null || option === void 0 || (_option$label = option.label) === null || _option$label === void 0 || (_option$label = _option$label.props) === null || _option$label === void 0 ? void 0 : _option$label.children;
|
|
105
|
+
const isCustomRange = allLabel === rangePickerLabel;
|
|
95
106
|
const {
|
|
96
|
-
label
|
|
97
|
-
dateSelected
|
|
107
|
+
label
|
|
98
108
|
} = selectValue !== null && selectValue !== void 0 ? selectValue : {};
|
|
99
109
|
return /*#__PURE__*/_react.default.createElement(_styles.StyledContainer, {
|
|
100
110
|
style: isCustomRange ? {
|
|
@@ -103,15 +113,15 @@ function DateDropDown(_ref) {
|
|
|
103
113
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
104
114
|
className: "label-date-dropdown"
|
|
105
115
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
106
|
-
style: showTickIcon(label,
|
|
116
|
+
style: showTickIcon(label, allLabel) ? {
|
|
107
117
|
color: _ColorVariablesMap.default['--color-primary']
|
|
108
118
|
} : {}
|
|
109
|
-
},
|
|
119
|
+
}, allLabel), showTickIcon(label, allLabel) && /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
110
120
|
icon: _Done.default,
|
|
111
121
|
size: 20,
|
|
112
122
|
color: "primary"
|
|
113
123
|
}))), isCustomRange && /*#__PURE__*/_react.default.createElement("span", {
|
|
114
|
-
style: showTickIcon(label,
|
|
124
|
+
style: showTickIcon(label, allLabel) ? {
|
|
115
125
|
color: _ColorVariablesMap.default['--color-primary']
|
|
116
126
|
} : {}
|
|
117
127
|
}, subLine));
|
|
@@ -128,8 +138,8 @@ function DateDropDown(_ref) {
|
|
|
128
138
|
});
|
|
129
139
|
} else {
|
|
130
140
|
getValues({
|
|
131
|
-
startDate: (0,
|
|
132
|
-
endDate: (0,
|
|
141
|
+
startDate: (0, _dayjs4.default)(getDateOffset(event.value)).format(format),
|
|
142
|
+
endDate: (0, _dayjs4.default)(getDateOffset((event === null || event === void 0 ? void 0 : event.value) === 1 ? event.value : 0)).format(format),
|
|
133
143
|
label: event === null || event === void 0 ? void 0 : event.label
|
|
134
144
|
});
|
|
135
145
|
setSelectValue({
|
|
@@ -140,9 +150,9 @@ function DateDropDown(_ref) {
|
|
|
140
150
|
}
|
|
141
151
|
};
|
|
142
152
|
const handleDateRangeValue = e => {
|
|
143
|
-
var
|
|
144
|
-
const fromDateApi =
|
|
145
|
-
const toDateApi =
|
|
153
|
+
var _dayjs2, _dayjs2$format, _e$, _dayjs3, _dayjs3$format, _e$2;
|
|
154
|
+
const fromDateApi = _dayjs4.default === null || _dayjs4.default === void 0 || (_dayjs2 = (0, _dayjs4.default)(e === null || e === void 0 || (_e$ = e[0]) === null || _e$ === void 0 ? void 0 : _e$.$d)) === null || _dayjs2 === void 0 || (_dayjs2$format = _dayjs2.format) === null || _dayjs2$format === void 0 ? void 0 : _dayjs2$format.call(_dayjs2, format);
|
|
155
|
+
const toDateApi = _dayjs4.default === null || _dayjs4.default === void 0 || (_dayjs3 = (0, _dayjs4.default)(e === null || e === void 0 || (_e$2 = e[1]) === null || _e$2 === void 0 ? void 0 : _e$2.$d)) === null || _dayjs3 === void 0 || (_dayjs3$format = _dayjs3.format) === null || _dayjs3$format === void 0 ? void 0 : _dayjs3$format.call(_dayjs3, format);
|
|
146
156
|
const date = "".concat(fromDateApi, " - ").concat(toDateApi);
|
|
147
157
|
setSelectValue({
|
|
148
158
|
label: date,
|
|
@@ -162,8 +172,8 @@ function DateDropDown(_ref) {
|
|
|
162
172
|
setSelectValue(prev => {
|
|
163
173
|
if (prev.prevLabel) {
|
|
164
174
|
getValues({
|
|
165
|
-
startDate: (0,
|
|
166
|
-
endDate: (0,
|
|
175
|
+
startDate: (0, _dayjs4.default)(getParsedValue).format(format),
|
|
176
|
+
endDate: (0, _dayjs4.default)(getDateOffset(0)).format(format),
|
|
167
177
|
label: selectValue === null || selectValue === void 0 ? void 0 : selectValue.prevLabel
|
|
168
178
|
});
|
|
169
179
|
return {
|