@hisptz/react-ui
Version:
A collection of reusable complex DHIS2 react ui components.
189 lines (181 loc) • 5.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.WithAllowedFuturePeriods = exports.SingleSelection = exports.SelectedPeriods = exports.SelectedDateRangePeriod = exports.ExcludedRelativePeriodTypes = exports.ExcludedPeriodTypes = exports.ExcludedFixedPeriodTypes = exports.Ethiopian = exports.Default = exports.DateRange = void 0;
var _react = _interopRequireDefault(require("react"));
var _calendar = require("./components/CalendarSpecificPeriodDimension/constants/calendar");
var _index = _interopRequireDefault(require("./index"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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); }
const Template = (args, context) => /*#__PURE__*/_react.default.createElement(_index.default, _extends({}, args, context));
const Default = Template.bind({});
exports.Default = Default;
Default.args = {
onSelect: _ref => {
let {
items
} = _ref;
console.log(items);
},
selectedPeriods: [],
excludedPeriodTypes: [],
calendar: _calendar.CalendarTypes.GREGORIAN
};
const Ethiopian = Template.bind({});
exports.Ethiopian = Ethiopian;
Ethiopian.args = {
onSelect: _ref2 => {
let {
items
} = _ref2;
console.log(items);
},
selectedPeriods: [],
excludedPeriodTypes: [],
calendar: _calendar.CalendarTypes.ETHIOPIAN
};
const ExcludedFixedPeriodTypes = Template.bind({});
exports.ExcludedFixedPeriodTypes = ExcludedFixedPeriodTypes;
ExcludedFixedPeriodTypes.args = {
onSelect: _ref3 => {
let {
items
} = _ref3;
console.log(items);
},
selectedPeriods: [],
excludedPeriodTypes: [],
calendar: _calendar.CalendarTypes.GREGORIAN,
excludeFixedPeriods: true
};
const ExcludedRelativePeriodTypes = Template.bind({});
exports.ExcludedRelativePeriodTypes = ExcludedRelativePeriodTypes;
ExcludedRelativePeriodTypes.args = {
onSelect: _ref4 => {
let {
items
} = _ref4;
console.log(items);
},
selectedPeriods: [],
excludedPeriodTypes: [],
calendar: _calendar.CalendarTypes.GREGORIAN,
excludeRelativePeriods: true
};
const ExcludedPeriodTypes = Template.bind({});
exports.ExcludedPeriodTypes = ExcludedPeriodTypes;
ExcludedPeriodTypes.args = {
onSelect: _ref5 => {
let {
items
} = _ref5;
console.log(items);
},
selectedPeriods: [],
excludedPeriodTypes: ["RelativeWeek", "RelativeMonth", "Monthly", "Weekly"],
calendar: _calendar.CalendarTypes.GREGORIAN
};
const SingleSelection = Template.bind({});
exports.SingleSelection = SingleSelection;
SingleSelection.args = {
onSelect: _ref6 => {
let {
items
} = _ref6;
console.log(items);
},
selectedPeriods: [],
excludedPeriodTypes: ["RelativeWeek", "RelativeMonth", "Monthly", "Weekly"],
calendar: _calendar.CalendarTypes.GREGORIAN
};
const SelectedDateRangePeriod = Template.bind({});
exports.SelectedDateRangePeriod = SelectedDateRangePeriod;
SelectedDateRangePeriod.args = {
onSelect: _ref7 => {
let {
items
} = _ref7;
console.log(items);
},
enableDateRange: true,
selectedPeriods: [{
startDate: "2022-01-01",
endDate: "2022-12-31",
type: "RANGE"
}],
excludedPeriodTypes: [],
calendar: _calendar.CalendarTypes.GREGORIAN
};
const SelectedPeriods = Template.bind({});
exports.SelectedPeriods = SelectedPeriods;
SelectedPeriods.args = {
onSelect: _ref8 => {
let {
items
} = _ref8;
console.log(items);
},
enableDateRange: true,
selectedPeriods: [{
id: "202209",
name: "September 2022"
}],
excludedPeriodTypes: [],
calendar: _calendar.CalendarTypes.GREGORIAN
};
const WithAllowedFuturePeriods = Template.bind({});
exports.WithAllowedFuturePeriods = WithAllowedFuturePeriods;
WithAllowedFuturePeriods.args = {
onSelect: _ref9 => {
let {
items
} = _ref9;
console.log(items);
},
enableDateRange: true,
selectedPeriods: [{
id: "202209",
name: "September 2022"
}],
allowFuturePeriods: false,
excludedPeriodTypes: [],
calendar: _calendar.CalendarTypes.GREGORIAN
};
const DateRange = Template.bind({});
exports.DateRange = DateRange;
DateRange.args = {
onSelect: _ref10 => {
let {
items
} = _ref10;
console.log(items);
},
enableDateRange: true,
selectedPeriods: [],
excludedPeriodTypes: [],
calendar: _calendar.CalendarTypes.GREGORIAN,
defaultInputType: "dateRange"
};
var _default = {
title: "Components/Period Selector",
component: _index.default,
argTypes: {
selectedPeriods: {
control: "array"
},
calendar: {
control: "radio",
options: [_calendar.CalendarTypes.GREGORIAN, _calendar.CalendarTypes.ETHIOPIAN]
}
},
decorators: [Story => {
return /*#__PURE__*/_react.default.createElement("div", {
style: {
width: "100%",
height: "100%"
}
}, /*#__PURE__*/_react.default.createElement(Story, null));
}]
};
exports.default = _default;