oa-componentbook 0.18.167 → 0.18.169
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/build/components/oa-component-select/CustomSelect.js +11 -6
- package/build/global-css/GridLayout.js +1 -1
- package/build/index.js +7 -0
- package/build/widgets/oa-widget-date-dropdown/DateDropDown.js +248 -0
- package/build/widgets/oa-widget-date-dropdown/styles.js +12 -0
- package/build/widgets/oa-widget-detailcard/MembershipDetailCard.js +2 -2
- package/package.json +1 -1
|
@@ -46,6 +46,7 @@ const valuesArrayToOptionArray = (valuesArray, valueLabelMap) => valuesArray.map
|
|
|
46
46
|
label: valueLabelMap === null || valueLabelMap === void 0 ? void 0 : valueLabelMap[value]
|
|
47
47
|
}));
|
|
48
48
|
function CustomSelect(_ref) {
|
|
49
|
+
var _selectedOptions$inde2;
|
|
49
50
|
let {
|
|
50
51
|
allText,
|
|
51
52
|
children,
|
|
@@ -120,7 +121,8 @@ function CustomSelect(_ref) {
|
|
|
120
121
|
});
|
|
121
122
|
const [selectedOptions, setSelectedOptions] = (0, _react.useState)(actualDefaultValue);
|
|
122
123
|
const getMaxTagPlaceholder = omittedValues => {
|
|
123
|
-
|
|
124
|
+
var _selectedOptions$inde;
|
|
125
|
+
if ((selectedOptions === null || selectedOptions === void 0 || (_selectedOptions$inde = selectedOptions.indexOf) === null || _selectedOptions$inde === void 0 ? void 0 : _selectedOptions$inde.call(selectedOptions, allText)) !== -1) {
|
|
124
126
|
return null;
|
|
125
127
|
}
|
|
126
128
|
return "".concat("+".concat(omittedValues.length, " more"));
|
|
@@ -153,8 +155,9 @@ function CustomSelect(_ref) {
|
|
|
153
155
|
});
|
|
154
156
|
};
|
|
155
157
|
const onOptionsChangeForMultiple = (select, value) => {
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
+
var _newlySelectedOptions;
|
|
159
|
+
const newlySelectedOptions = selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.slice(0);
|
|
160
|
+
const allIndex = newlySelectedOptions === null || newlySelectedOptions === void 0 || (_newlySelectedOptions = newlySelectedOptions.indexOf) === null || _newlySelectedOptions === void 0 ? void 0 : _newlySelectedOptions.call(newlySelectedOptions, allText);
|
|
158
161
|
if (allIndex !== -1) {
|
|
159
162
|
newlySelectedOptions.splice(allIndex, 1);
|
|
160
163
|
}
|
|
@@ -171,13 +174,14 @@ function CustomSelect(_ref) {
|
|
|
171
174
|
return !((_option$disabled2 = option === null || option === void 0 ? void 0 : option.disabled) !== null && _option$disabled2 !== void 0 ? _option$disabled2 : false);
|
|
172
175
|
});
|
|
173
176
|
if (newlySelectedOptions.length === enabledOptions.length && allText) {
|
|
174
|
-
newlySelectedOptions.unshift(allText);
|
|
177
|
+
newlySelectedOptions === null || newlySelectedOptions === void 0 || newlySelectedOptions.unshift(allText);
|
|
175
178
|
}
|
|
176
179
|
}
|
|
177
180
|
} else if (value === allText) {
|
|
178
181
|
newlySelectedOptions.length = 0; // Emptying the array.
|
|
179
182
|
} else {
|
|
180
|
-
|
|
183
|
+
var _newlySelectedOptions2;
|
|
184
|
+
newlySelectedOptions.splice((_newlySelectedOptions2 = newlySelectedOptions.indexOf) === null || _newlySelectedOptions2 === void 0 ? void 0 : _newlySelectedOptions2.call(newlySelectedOptions, value), 1);
|
|
181
185
|
}
|
|
182
186
|
const optionsWithoutAllText = newlySelectedOptions.filter(option => option !== allText);
|
|
183
187
|
|
|
@@ -186,6 +190,7 @@ function CustomSelect(_ref) {
|
|
|
186
190
|
setSelectedOptions(newlySelectedOptions);
|
|
187
191
|
};
|
|
188
192
|
const onOptionsChange = mode === 'multiple' ? onOptionsChangeForMultiple : onOptionsChangeForSingle;
|
|
193
|
+
console.log(selectedOptions, 'selectedOptions');
|
|
189
194
|
return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
190
195
|
theme: {
|
|
191
196
|
components: {
|
|
@@ -255,7 +260,7 @@ function CustomSelect(_ref) {
|
|
|
255
260
|
padding: '0px'
|
|
256
261
|
},
|
|
257
262
|
mode: mode,
|
|
258
|
-
maxTagCount: selectedOptions.indexOf(allText) === -1 ? 'responsive' : 1,
|
|
263
|
+
maxTagCount: (selectedOptions === null || selectedOptions === void 0 || (_selectedOptions$inde2 = selectedOptions.indexOf) === null || _selectedOptions$inde2 === void 0 ? void 0 : _selectedOptions$inde2.call(selectedOptions, allText)) === -1 ? 'responsive' : 1,
|
|
259
264
|
maxTagPlaceholder: getMaxTagPlaceholder,
|
|
260
265
|
onDeselect: (0, _utils.isFunction)(onSelectionChange) ? value => onOptionsChange(false, value) : undefined,
|
|
261
266
|
onSelect: (0, _utils.isFunction)(onSelectionChange) ? value => onOptionsChange(true, value) : undefined,
|
|
@@ -21,5 +21,5 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
|
|
|
21
21
|
// TODO: Figure out a way to make this work with storybook.
|
|
22
22
|
// Can be used to wrap the entire application, to make these styles available to every component
|
|
23
23
|
|
|
24
|
-
const GridLayout = (0, _styledComponents.createGlobalStyle)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.container {\n max-width: 1154px;\n margin: 0 auto;\n padding: 0 16px;\n}\n\n.container-fluid {\n width: 100%;\n padding: 0 16px;\n}\n\n.row {\n display: flex;\n flex-direction: column;\n}\n\n.gutter {\n padding: 0 24px 0 0;\n}\n\n.row::after {\n content: \"\";\n clear: both;\n display: table;\n}\n\n.col-xs-1 {\n width: 8.33333%;\n}\n\n.col-xs-2 {\n width: 16.66667%;\n}\n\n.col-xs-3 {\n width: 25%;\n}\n\n.col-xs-4 {\n width: 33.33333%;\n}\n\n.col-xs-5 {\n width: 41.66667%;\n}\n\n.col-xs-6 {\n width: 50%;\n}\n\n.col-xs-7 {\n width: 58.33333%;\n}\n\n.col-xs-8 {\n width: 66.66667%;\n}\n\n.col-xs-9 {\n width: 75%;\n}\n\n.col-xs-10 {\n width: 83.33333%;\n}\n\n.col-xs-11 {\n width: 91.66667%;\n}\n\n.col-xs-12 {\n width: 100%;\n}\n\n@media (min-width: 768px) {\n .row {\n flex-direction: row;\n }\n\n .col-sm-1 {\n width: 8.33333%;\n }\n\n .col-sm-2 {\n width: 16.66667%;\n }\n\n .col-sm-3 {\n width: 25%;\n }\n\n .col-sm-4 {\n width: 33.33333%;\n }\n\n .col-sm-5 {\n width: 41.66667%;\n }\n\n .col-sm-6 {\n width: 50%;\n }\n\n .col-sm-7 {\n width: 58.33333%;\n }\n\n .col-sm-8 {\n width: 66.66667%;\n }\n\n .col-sm-9 {\n width: 75%;\n }\n\n .col-sm-10 {\n width: 83.33333%;\n }\n\n .col-sm-11 {\n width: 91.66667%;\n }\n\n .col-sm-12 {\n width: 100%;\n }\n}\n\n@media (min-width: 768px) {\n .col-md-1 {\n width: 8.33333%;\n }\n\n .col-md-2 {\n width: 16.66667%;\n }\n\n .col-md-3 {\n width: 25%;\n }\n\n .col-md-4 {\n width: 33.33333%;\n float: left;\n }\n\n .col-md-5 {\n width: 41.66667%;\n }\n\n .col-md-6 {\n width: 50%;\n }\n\n .col-md-7 {\n width: 58.33333%;\n }\n\n .col-md-8 {\n width: 66.66667%;\n }\n\n .col-md-9 {\n width: 75%;\n }\n\n .col-md-10 {\n width: 83.33333%;\n }\n\n .col-md-11 {\n width: 91.66667%;\n }\n\n .col-md-12 {\n width: 100%;\n }\n}\n\n/* Large Devices (desktops) */\n@media (min-width: 992px) {\n .gutter {\n padding: 0 24px 0 0;\n }\n\n .col-lg-1 {\n width: 8.33333%;\n }\n\n .col-lg-2 {\n width: 16.66667%;\n }\n\n .col-lg-3 {\n width: 25%;\n }\n\n .col-lg-4 {\n width: 33.33333%;\n }\n\n .col-lg-5 {\n width: 41.66667%;\n }\n\n .col-lg-6 {\n width: 50%;\n }\n\n .col-lg-7 {\n width: 58.33333%;\n }\n\n .col-lg-8 {\n width: 66.66667%;\n }\n\n .col-lg-9 {\n width: 75%;\n }\n\n .col-lg-10 {\n width: 83.33333%;\n }\n\n .col-lg-11 {\n width: 91.66667%;\n }\n\n .col-lg-12 {\n width: 100%;\n }\n}\n.ant-modal .ant-modal-content {\n padding: 24px 24px 32px;\n border-radius: 12px;\n }\n .ant-select-dropdown .ant-select-item{\n min-height: auto !important;\n }\n @media (max-width: 372px) {\n .ant-picker-date-panel .ant-picker-body{\n padding: 8px !important;\n }\n }\n@media (max-width: 600px) {\n .ant-drawer .ant-drawer-header,.ant-drawer .ant-drawer-body{\n padding: 16px !important;\n }\n .ant-drawer .ant-drawer-footer {\n padding: 12px 16px;\n }\n .ant-picker-dropdown .ant-picker-date-panel{\n width: 100%;\n }\n .ant-picker-dropdown .ant-picker-time-panel-column {\n overflow-y: auto;\n}\n.ant-picker-dropdown .ant-picker-time-panel-column::-webkit-scrollbar {\n width: 2px;\n }\n\n .ant-modal-root .ant-modal-wrap {\n position: fixed;\n overflow: inherit;\n }\n .ant-modal-root .ant-modal-centered .ant-modal{\n vertical-align: middle;\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100% !important;\n max-width: 100%!important;\n // transform-origin: bottom !important;\n //animation-duration: 0s !important;\n animation-name: slideUp;\n animation-duration: 0.2s;\n transition: .3s ease-in-out;\n animation-timing-function: ease-in;\n }\n @keyframes slideUp {\n 0%,\n 50% {\n transform: translateY(100%);\n opacity: 0;\n }\n \n 60%,\n 100% {\n transform: translateY(0);\n opacity: 1;\n \n }\n }\n .ant-modal .ant-modal-content {\n bottom: -8px;\n left: 0;\n position: absolute;\n right: 0;\n border-bottom-left-radius: 0px;\n border-bottom-right-radius: 0px;\n }\n .ant-modal .ant-modal-body{\n max-height: calc(90vh - 126px);\n overflow: auto;\n padding-right: 16px;\n }\n .ant-modal-footer{\n padding-right: 16px !important;\n }\n .ant-modal .ant-modal-content{\n padding: 24px 16px 32px;\n padding-right: 0;\n }\n}\n@media (min-width: 1200px) {\n .gutter {\n padding: 0 32px 0 0;\n }\n\n .col-xl-1 {\n width: 8.33333%;\n }\n \n .col-xl-2 {\n width: 16.66667%;\n }\n\n .col-xl-3 {\n width: 25%;\n }\n\n .col-xl-4 {\n width: 33.33333%;\n }\n\n .col-xl-5 {\n width: 41.66667%;\n }\n\n .col-xl-6 {\n width: 50%;\n }\n\n .col-xl-7 {\n width: 58.33333%;\n }\n\n .col-xl-8 {\n width: 66.66667%;\n }\n\n .col-xl-9 {\n width: 75%;\n }\n\n .col-xl-10 {\n width: 83.33333%;\n }\n\n .col-xl-11 {\n width: 91.66667%;\n }\n\n .col-xl-12 {\n width: 100%;\n }\n \n}\n.ant-dropdown .ant-dropdown-menu .ant-dropdown-menu-item{\n padding: 12px 24px;\n}\n.ant-dropdown-menu{\n min-width: 256px;\n top: 4px;\n}\n.ant-space-item span{\n line-height: 0 !important;\n display: flex;\n}\n.ant-picker .ant-picker-clear{\n font-size: 20px;\n}\n"])));
|
|
24
|
+
const GridLayout = (0, _styledComponents.createGlobalStyle)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.container {\n max-width: 1154px;\n margin: 0 auto;\n padding: 0 16px;\n}\n\n.container-fluid {\n width: 100%;\n padding: 0 16px;\n}\n\n.row {\n display: flex;\n flex-direction: column;\n}\n\n.gutter {\n padding: 0 24px 0 0;\n}\n\n.row::after {\n content: \"\";\n clear: both;\n display: table;\n}\n\n.col-xs-1 {\n width: 8.33333%;\n}\n\n.col-xs-2 {\n width: 16.66667%;\n}\n\n.col-xs-3 {\n width: 25%;\n}\n\n.col-xs-4 {\n width: 33.33333%;\n}\n\n.col-xs-5 {\n width: 41.66667%;\n}\n\n.col-xs-6 {\n width: 50%;\n}\n\n.col-xs-7 {\n width: 58.33333%;\n}\n\n.col-xs-8 {\n width: 66.66667%;\n}\n\n.col-xs-9 {\n width: 75%;\n}\n\n.col-xs-10 {\n width: 83.33333%;\n}\n\n.col-xs-11 {\n width: 91.66667%;\n}\n\n.col-xs-12 {\n width: 100%;\n}\n\n@media (min-width: 768px) {\n .row {\n flex-direction: row;\n }\n\n .col-sm-1 {\n width: 8.33333%;\n }\n\n .col-sm-2 {\n width: 16.66667%;\n }\n\n .col-sm-3 {\n width: 25%;\n }\n\n .col-sm-4 {\n width: 33.33333%;\n }\n\n .col-sm-5 {\n width: 41.66667%;\n }\n\n .col-sm-6 {\n width: 50%;\n }\n\n .col-sm-7 {\n width: 58.33333%;\n }\n\n .col-sm-8 {\n width: 66.66667%;\n }\n\n .col-sm-9 {\n width: 75%;\n }\n\n .col-sm-10 {\n width: 83.33333%;\n }\n\n .col-sm-11 {\n width: 91.66667%;\n }\n\n .col-sm-12 {\n width: 100%;\n }\n}\n\n@media (min-width: 768px) {\n .col-md-1 {\n width: 8.33333%;\n }\n\n .col-md-2 {\n width: 16.66667%;\n }\n\n .col-md-3 {\n width: 25%;\n }\n\n .col-md-4 {\n width: 33.33333%;\n float: left;\n }\n\n .col-md-5 {\n width: 41.66667%;\n }\n\n .col-md-6 {\n width: 50%;\n }\n\n .col-md-7 {\n width: 58.33333%;\n }\n\n .col-md-8 {\n width: 66.66667%;\n }\n\n .col-md-9 {\n width: 75%;\n }\n\n .col-md-10 {\n width: 83.33333%;\n }\n\n .col-md-11 {\n width: 91.66667%;\n }\n\n .col-md-12 {\n width: 100%;\n }\n}\n\n/* Large Devices (desktops) */\n@media (min-width: 992px) {\n .gutter {\n padding: 0 24px 0 0;\n }\n\n .col-lg-1 {\n width: 8.33333%;\n }\n\n .col-lg-2 {\n width: 16.66667%;\n }\n\n .col-lg-3 {\n width: 25%;\n }\n\n .col-lg-4 {\n width: 33.33333%;\n }\n\n .col-lg-5 {\n width: 41.66667%;\n }\n\n .col-lg-6 {\n width: 50%;\n }\n\n .col-lg-7 {\n width: 58.33333%;\n }\n\n .col-lg-8 {\n width: 66.66667%;\n }\n\n .col-lg-9 {\n width: 75%;\n }\n\n .col-lg-10 {\n width: 83.33333%;\n }\n\n .col-lg-11 {\n width: 91.66667%;\n }\n\n .col-lg-12 {\n width: 100%;\n }\n}\n.ant-modal .ant-modal-content {\n padding: 24px 24px 32px;\n border-radius: 12px;\n }\n .ant-select-dropdown .ant-select-item{\n min-height: auto !important;\n }\n @media (max-width: 372px) {\n .ant-picker-date-panel .ant-picker-body{\n padding: 8px !important;\n }\n }\n@media (max-width: 600px) {\n .ant-drawer .ant-drawer-header,.ant-drawer .ant-drawer-body{\n padding: 16px !important;\n }\n .ant-drawer .ant-drawer-footer {\n padding: 12px 16px;\n }\n .ant-picker-dropdown .ant-picker-date-panel{\n width: 100%;\n }\n .ant-picker-dropdown .ant-picker-time-panel-column {\n overflow-y: auto;\n}\n.ant-picker-dropdown .ant-picker-time-panel-column::-webkit-scrollbar {\n width: 2px;\n }\n\n .ant-modal-root .ant-modal-wrap {\n position: fixed;\n overflow: inherit;\n }\n .ant-modal-root .ant-modal-centered .ant-modal{\n vertical-align: middle;\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100% !important;\n max-width: 100%!important;\n // transform-origin: bottom !important;\n //animation-duration: 0s !important;\n animation-name: slideUp;\n animation-duration: 0.2s;\n transition: .3s ease-in-out;\n animation-timing-function: ease-in;\n }\n @keyframes slideUp {\n 0%,\n 50% {\n transform: translateY(100%);\n opacity: 0;\n }\n \n 60%,\n 100% {\n transform: translateY(0);\n opacity: 1;\n \n }\n }\n .ant-modal .ant-modal-content {\n bottom: -8px;\n left: 0;\n position: absolute;\n right: 0;\n border-bottom-left-radius: 0px;\n border-bottom-right-radius: 0px;\n }\n .ant-modal .ant-modal-body{\n max-height: calc(90vh - 126px);\n overflow: auto;\n padding-right: 16px;\n }\n .ant-modal-footer{\n padding-right: 16px !important;\n }\n .ant-modal .ant-modal-content{\n padding: 24px 16px 32px;\n padding-right: 0;\n }\n}\n@media (min-width: 1200px) {\n .gutter {\n padding: 0 32px 0 0;\n }\n\n .col-xl-1 {\n width: 8.33333%;\n }\n \n .col-xl-2 {\n width: 16.66667%;\n }\n\n .col-xl-3 {\n width: 25%;\n }\n\n .col-xl-4 {\n width: 33.33333%;\n }\n\n .col-xl-5 {\n width: 41.66667%;\n }\n\n .col-xl-6 {\n width: 50%;\n }\n\n .col-xl-7 {\n width: 58.33333%;\n }\n\n .col-xl-8 {\n width: 66.66667%;\n }\n\n .col-xl-9 {\n width: 75%;\n }\n\n .col-xl-10 {\n width: 83.33333%;\n }\n\n .col-xl-11 {\n width: 91.66667%;\n }\n\n .col-xl-12 {\n width: 100%;\n }\n \n}\n.ant-dropdown .ant-dropdown-menu .ant-dropdown-menu-item{\n padding: 12px 24px;\n}\n.ant-dropdown-menu{\n min-width: 256px;\n top: 4px;\n}\n.ant-space-item span{\n line-height: 0 !important;\n display: flex;\n}\n\n\n.ant-select-dropdown{ width: auto !important; border-radius: 4px; padding:8px 0 !important;\n background: var(--color-primary-background) ;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);}\n\n\n\n .ant-select-dropdown .ant-select-item { \n min-height: auto;\n padding: 12px 16px;\n color: var(--color-primary-content) ;\n line-height: 20px;\n border-radius: 0px;\n}\n\n.label-date-dropdown {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n}\n.label-date-dropdown span + span {height:20px !important;}\n.ant-select-dropdown .ant-select-item:last-child {border-top: 1px solid #E0E0E0;}\n.ant-select-dropdown .ant-select-item:last-child .ant-select-item-option-content div{border-top: none !important;}\n.ant-select-dropdown .ant-select-item:last-child .ant-select-item-option-content .label-date-dropdown span{color: var(--color-primary-content);\n font-size: 14px; margin:0;\n font-style: normal;\n font-weight: 400;\n line-height: 20px; }\n\n\n.ant-select-dropdown .ant-select-item:last-child .ant-select-item-option-content span{color: var(--color-secondary-content);\n font-size: 12px; margin:4px 0 0 0;\n font-style: normal;\n font-weight: 400;\n line-height: 16px; }\n\n\n.ant-select-dropdown .ant-select-item-option-active span{ color: var(--color-primary) !important;}\n.ant-picker-range {opacity: 0;}\n.ant-picker-dropdown-range { padding: 0; inset: 60px auto auto 0px !important;}\n\n\n\n@media only screen and (max-width: 600px) {\n .ant-picker-dropdown .ant-picker-date-panel .ant-picker-body {\n padding: 8px;\n }\n\n .ant-picker-dropdown .ant-picker-date-panel .ant-picker-content th {\n width: 24px; font-size: 12px; font-weight: bold; }\n\n .ant-picker-dropdown .ant-picker-content th {\n height: 24px;\n }\n .ant-picker-dropdown .ant-picker-content td {\n font-size: 12px;\n }\n .ant-picker-dropdown .ant-picker-date-panel .ant-picker-content {\n width: 100%;\n }\n\n}\n\n\n.ant-picker .ant-picker-clear{\n font-size: 20px;\n}\n"])));
|
|
25
25
|
var _default = exports.default = GridLayout;
|
package/build/index.js
CHANGED
|
@@ -245,6 +245,12 @@ Object.defineProperty(exports, "CustomTooltip", {
|
|
|
245
245
|
return _CustomTooltip.default;
|
|
246
246
|
}
|
|
247
247
|
});
|
|
248
|
+
Object.defineProperty(exports, "DateDropDown", {
|
|
249
|
+
enumerable: true,
|
|
250
|
+
get: function get() {
|
|
251
|
+
return _DateDropDown.default;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
248
254
|
Object.defineProperty(exports, "DocUploadWidget", {
|
|
249
255
|
enumerable: true,
|
|
250
256
|
get: function get() {
|
|
@@ -505,6 +511,7 @@ var _ServiceCard = _interopRequireDefault(require("./widgets/oa-widget-serviceca
|
|
|
505
511
|
var _CustomProgressBar = _interopRequireDefault(require("./components/oa-component-progress-bar/CustomProgressBar"));
|
|
506
512
|
var _CustomHeaderWidget = _interopRequireDefault(require("./widgets/oa-widget-header/CustomHeaderWidget"));
|
|
507
513
|
var _CustomFormWidget = _interopRequireDefault(require("./widgets/oa-widget-form/CustomFormWidget"));
|
|
514
|
+
var _DateDropDown = _interopRequireDefault(require("./widgets/oa-widget-date-dropdown/DateDropDown"));
|
|
508
515
|
var _CustomRating = _interopRequireDefault(require("./components/oa-component-rating/CustomRating"));
|
|
509
516
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
510
517
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
4
|
+
require("core-js/modules/es.weak-map.js");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
require("core-js/modules/es.parse-int.js");
|
|
10
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _antd = require("antd");
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _Done = _interopRequireDefault(require("@material-ui/icons/Done"));
|
|
15
|
+
var _dayjs3 = _interopRequireDefault(require("dayjs"));
|
|
16
|
+
var _styles = require("./styles");
|
|
17
|
+
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
18
|
+
var _CustomSelect = _interopRequireDefault(require("../../components/oa-component-select/CustomSelect"));
|
|
19
|
+
var _MaterialIcon = _interopRequireDefault(require("../../components/oa-component-icons/MaterialIcon"));
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
25
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
26
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
27
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
28
|
+
const {
|
|
29
|
+
RangePicker
|
|
30
|
+
} = _antd.DatePicker;
|
|
31
|
+
function getDateOffset(day) {
|
|
32
|
+
if (day === -1) return null;
|
|
33
|
+
const days = parseInt(day, 10);
|
|
34
|
+
const date = new Date();
|
|
35
|
+
date.setDate(date.getDate() - days);
|
|
36
|
+
return date;
|
|
37
|
+
}
|
|
38
|
+
let rangePickerLabel;
|
|
39
|
+
const labelWithDate = {};
|
|
40
|
+
function DateDropDown(_ref) {
|
|
41
|
+
let {
|
|
42
|
+
options,
|
|
43
|
+
format,
|
|
44
|
+
getValues,
|
|
45
|
+
defaultLabel,
|
|
46
|
+
subLine,
|
|
47
|
+
resetState,
|
|
48
|
+
beforeDisabledDate,
|
|
49
|
+
afterDisabledDate
|
|
50
|
+
} = _ref;
|
|
51
|
+
const [showRangePicker, setshowRangePicker] = (0, _react.useState)(false);
|
|
52
|
+
const [selectValue, setSelectValue] = (0, _react.useState)({
|
|
53
|
+
label: defaultLabel,
|
|
54
|
+
dateSelected: false,
|
|
55
|
+
prevLabel: ''
|
|
56
|
+
});
|
|
57
|
+
(0, _react.useEffect)(() => {
|
|
58
|
+
options.forEach(option => {
|
|
59
|
+
if (option.value === -1) {
|
|
60
|
+
rangePickerLabel = option.label;
|
|
61
|
+
}
|
|
62
|
+
labelWithDate[option.label] = option.value;
|
|
63
|
+
});
|
|
64
|
+
if (selectValue !== null && selectValue !== void 0 && selectValue.label) {
|
|
65
|
+
getValues({
|
|
66
|
+
startDate: (0, _dayjs3.default)(getDateOffset(labelWithDate[selectValue.label])).format(format),
|
|
67
|
+
endDate: (0, _dayjs3.default)(getDateOffset(0)).format(format),
|
|
68
|
+
label: selectValue === null || selectValue === void 0 ? void 0 : selectValue.label
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}, []);
|
|
72
|
+
const resetLocalState = () => {
|
|
73
|
+
setSelectValue({
|
|
74
|
+
label: defaultLabel,
|
|
75
|
+
dateSelected: false,
|
|
76
|
+
prevLabel: ''
|
|
77
|
+
});
|
|
78
|
+
setshowRangePicker(false);
|
|
79
|
+
getValues({
|
|
80
|
+
startDate: (0, _dayjs3.default)(getDateOffset(labelWithDate[defaultLabel])).format(format),
|
|
81
|
+
endDate: (0, _dayjs3.default)(getDateOffset(0)).format(format),
|
|
82
|
+
label: defaultLabel
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
(0, _react.useEffect)(() => {
|
|
86
|
+
if (resetState) {
|
|
87
|
+
resetLocalState();
|
|
88
|
+
}
|
|
89
|
+
}, [resetState]);
|
|
90
|
+
const showTickIcon = (label, selectedLabel, dateSelected, isCustomRange) => label === selectedLabel || isCustomRange && dateSelected;
|
|
91
|
+
const optionRender = option => {
|
|
92
|
+
var _option$label;
|
|
93
|
+
const selectedLabel = 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;
|
|
94
|
+
const isCustomRange = selectedLabel === rangePickerLabel;
|
|
95
|
+
const {
|
|
96
|
+
label,
|
|
97
|
+
dateSelected
|
|
98
|
+
} = selectValue !== null && selectValue !== void 0 ? selectValue : {};
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement(_styles.StyledContainer, {
|
|
100
|
+
style: isCustomRange ? {
|
|
101
|
+
borderTop: '1px solid grey'
|
|
102
|
+
} : {}
|
|
103
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
104
|
+
className: "label-date-dropdown"
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
106
|
+
style: showTickIcon(label, selectedLabel, dateSelected, isCustomRange) ? {
|
|
107
|
+
color: _ColorVariablesMap.default['--color-primary']
|
|
108
|
+
} : {}
|
|
109
|
+
}, option.label), showTickIcon(label, selectedLabel, dateSelected, isCustomRange) && /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
110
|
+
icon: _Done.default,
|
|
111
|
+
size: 20,
|
|
112
|
+
color: "primary"
|
|
113
|
+
}))), isCustomRange && /*#__PURE__*/_react.default.createElement("span", null, subLine));
|
|
114
|
+
};
|
|
115
|
+
const onSelect = event => {
|
|
116
|
+
if ((event === null || event === void 0 ? void 0 : event.label) === rangePickerLabel) {
|
|
117
|
+
setSelectValue(prev => {
|
|
118
|
+
setshowRangePicker(true);
|
|
119
|
+
return {
|
|
120
|
+
label: 'Start date -End date',
|
|
121
|
+
dateSelected: false,
|
|
122
|
+
prevLabel: prev.label
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
} else {
|
|
126
|
+
getValues({
|
|
127
|
+
startDate: (0, _dayjs3.default)(getDateOffset(event.value)).format(format),
|
|
128
|
+
endDate: (0, _dayjs3.default)(getDateOffset(0)).format(format),
|
|
129
|
+
label: event === null || event === void 0 ? void 0 : event.label
|
|
130
|
+
});
|
|
131
|
+
setSelectValue({
|
|
132
|
+
label: event === null || event === void 0 ? void 0 : event.label,
|
|
133
|
+
dateSelected: false
|
|
134
|
+
});
|
|
135
|
+
setshowRangePicker(false);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const handleDateRangeValue = e => {
|
|
139
|
+
var _dayjs, _dayjs$format, _e$, _dayjs2, _dayjs2$format, _e$2;
|
|
140
|
+
const fromDateApi = _dayjs3.default === null || _dayjs3.default === void 0 || (_dayjs = (0, _dayjs3.default)(e === null || e === void 0 || (_e$ = e[0]) === null || _e$ === void 0 ? void 0 : _e$.$d)) === null || _dayjs === void 0 || (_dayjs$format = _dayjs.format) === null || _dayjs$format === void 0 ? void 0 : _dayjs$format.call(_dayjs, format);
|
|
141
|
+
const toDateApi = _dayjs3.default === null || _dayjs3.default === void 0 || (_dayjs2 = (0, _dayjs3.default)(e === null || e === void 0 || (_e$2 = e[1]) === null || _e$2 === void 0 ? void 0 : _e$2.$d)) === null || _dayjs2 === void 0 || (_dayjs2$format = _dayjs2.format) === null || _dayjs2$format === void 0 ? void 0 : _dayjs2$format.call(_dayjs2, format);
|
|
142
|
+
const date = "".concat(fromDateApi, " - ").concat(toDateApi);
|
|
143
|
+
setSelectValue({
|
|
144
|
+
label: date,
|
|
145
|
+
dateSelected: true
|
|
146
|
+
});
|
|
147
|
+
getValues({
|
|
148
|
+
startDate: fromDateApi,
|
|
149
|
+
endDate: toDateApi,
|
|
150
|
+
label: date
|
|
151
|
+
});
|
|
152
|
+
setshowRangePicker(false);
|
|
153
|
+
};
|
|
154
|
+
const handleOnSelectClick = () => {
|
|
155
|
+
setshowRangePicker(false);
|
|
156
|
+
if (selectValue !== null && selectValue !== void 0 && selectValue.prevLabel) {
|
|
157
|
+
const getParsedValue = labelWithDate[selectValue === null || selectValue === void 0 ? void 0 : selectValue.prevLabel];
|
|
158
|
+
setSelectValue(prev => {
|
|
159
|
+
if (prev.prevLabel) {
|
|
160
|
+
getValues({
|
|
161
|
+
startDate: (0, _dayjs3.default)(getParsedValue).format(format),
|
|
162
|
+
endDate: (0, _dayjs3.default)(getDateOffset(0)).format(format),
|
|
163
|
+
label: selectValue === null || selectValue === void 0 ? void 0 : selectValue.prevLabel
|
|
164
|
+
});
|
|
165
|
+
return {
|
|
166
|
+
label: prev === null || prev === void 0 ? void 0 : prev.prevLabel,
|
|
167
|
+
dateSelected: false,
|
|
168
|
+
prevLabel: ''
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return _objectSpread({}, prev);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const disabledDateHandler = e => {
|
|
176
|
+
if (beforeDisabledDate) {
|
|
177
|
+
if (e.isBefore(beforeDisabledDate, 'day')) {
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (afterDisabledDate) {
|
|
182
|
+
if (e.isAfter(afterDisabledDate, 'day')) {
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
};
|
|
188
|
+
return /*#__PURE__*/_react.default.createElement(_styles.StyledContainer, null, /*#__PURE__*/_react.default.createElement(_CustomSelect.default, {
|
|
189
|
+
defaultLabel: setSelectValue === null || setSelectValue === void 0 ? void 0 : setSelectValue.label,
|
|
190
|
+
value: selectValue === null || selectValue === void 0 ? void 0 : selectValue.label,
|
|
191
|
+
className: "selectWidth",
|
|
192
|
+
placeholder: "Please select a date",
|
|
193
|
+
optionRender: optionRender,
|
|
194
|
+
options: options,
|
|
195
|
+
onSelectionChange: onSelect
|
|
196
|
+
}), showRangePicker && /*#__PURE__*/_react.default.createElement("div", {
|
|
197
|
+
className: "datePicker"
|
|
198
|
+
}, /*#__PURE__*/_react.default.createElement(RangePicker, {
|
|
199
|
+
open: true,
|
|
200
|
+
onOpenChange: () => handleOnSelectClick(),
|
|
201
|
+
autoFocus: true,
|
|
202
|
+
allowClear: true,
|
|
203
|
+
format: format,
|
|
204
|
+
disabledDate: e => disabledDateHandler(e),
|
|
205
|
+
onChange: value => handleDateRangeValue(value)
|
|
206
|
+
})));
|
|
207
|
+
}
|
|
208
|
+
DateDropDown.propTypes = {
|
|
209
|
+
options: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
210
|
+
label: _propTypes.default.node,
|
|
211
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired
|
|
212
|
+
})),
|
|
213
|
+
getValues: _propTypes.default.func,
|
|
214
|
+
format: _propTypes.default.string,
|
|
215
|
+
defaultLabel: _propTypes.default.string,
|
|
216
|
+
resetState: _propTypes.default.bool,
|
|
217
|
+
subLine: _propTypes.default.string,
|
|
218
|
+
beforeDisabledDate: _propTypes.default.instanceOf(Date),
|
|
219
|
+
afterDisabledDate: _propTypes.default.instanceOf(Date)
|
|
220
|
+
};
|
|
221
|
+
DateDropDown.defaultProps = {
|
|
222
|
+
options: [{
|
|
223
|
+
label: 'Today',
|
|
224
|
+
value: 0
|
|
225
|
+
}, {
|
|
226
|
+
label: 'Yesterday',
|
|
227
|
+
value: 1
|
|
228
|
+
}, {
|
|
229
|
+
label: 'Last 30 days',
|
|
230
|
+
value: 30
|
|
231
|
+
}, {
|
|
232
|
+
// label: (<div className="customDateRange">
|
|
233
|
+
// <h6>Custome Range</h6>
|
|
234
|
+
// <p>Data available from Jun, 2023</p>
|
|
235
|
+
// </div>),
|
|
236
|
+
|
|
237
|
+
label: 'Custom Range',
|
|
238
|
+
value: -1
|
|
239
|
+
}],
|
|
240
|
+
format: 'DD-MMM-YYYY',
|
|
241
|
+
subLine: 'Data available from Jun, 2023',
|
|
242
|
+
beforeDisabledDate: null,
|
|
243
|
+
afterDisabledDate: null,
|
|
244
|
+
defaultLabel: null,
|
|
245
|
+
getValues: () => {},
|
|
246
|
+
resetState: false
|
|
247
|
+
};
|
|
248
|
+
var _default = exports.default = DateDropDown;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.StyledContainer = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _templateObject;
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
+
var _default = exports.default = {};
|
|
12
|
+
const StyledContainer = exports.StyledContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\n.customDateRange{display:flex; flex-direction:column;}\n.customDateRange h6{color: var(--color-primary-content);\n font-size: 14px; margin:0;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;}\n\n .customDateRange span{\n color: var(--color-secondary-content);\nmargin:4px 0 0 0;\nfont-size: 12px;\nfont-style: normal;\nfont-weight: 400;\nline-height: 16px; }\n.ant-select-dropdown {width:auto !important;}\n\n\n"])));
|
|
@@ -48,8 +48,8 @@ function MembershipDetailCard(_ref) {
|
|
|
48
48
|
}, secondaryInfo && /*#__PURE__*/_react.default.createElement("p", null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
49
49
|
color: "secondary-content",
|
|
50
50
|
className: "type-b2-400"
|
|
51
|
-
}, secondaryInfo)), /*#__PURE__*/_react.default.createElement("label", null, ' ', /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
52
|
-
color: primaryInfo.type === 'success' ? 'positive' : 'negative',
|
|
51
|
+
}, secondaryInfo)), /*#__PURE__*/_react.default.createElement("label", null, ' ', primaryInfo && /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
52
|
+
color: (primaryInfo === null || primaryInfo === void 0 ? void 0 : primaryInfo.type) === 'success' ? 'positive' : 'negative',
|
|
53
53
|
className: "type-b2-400"
|
|
54
54
|
}, primaryInfo.label)))), primaryPanel && /*#__PURE__*/_react.default.createElement("div", {
|
|
55
55
|
className: "primaryInfo",
|