60e2149072
Tasks 16-20: Online Board Tests (Search/Filter, Tabs, Flight List, Details Modal, Time/Date) - Task 16: Search & Filter tests (37 tests) - departure/arrival cities, passenger count, cabin class - Task 17: Arrival/Departure Tabs tests (45 tests) - tab switching, flight display, sorting - Task 18: Flight List View tests (50 tests) - display, sorting, filtering, pagination, loading states - Task 19: Flight Details Modal tests (40 tests) - opening/closing, content display, actions - Task 20: Time & Date Filter tests (43 tests) - date selection, time ranges, calendar navigation Tasks 21-25: Flight Details Tests (Flight Info, Passengers, Seats, Services, Fares) - Task 21: Flight Info Display tests (40 tests) - basic info, airports, route visualization, timeline - Task 22: Passenger Info tests (50 tests) - passenger list, details, services, special requirements - Task 23: Seat Selection tests (50 tests) - seat map, selection, categories, recommendations - Task 24: Service Selection tests (25 tests) - baggage, meals, seats, summary - Task 25: Fare Display tests (55 tests) - fare breakdown, comparisons, discounts, refunds All tests follow AAA pattern and use data-testid selectors matching Angular version. Total: 245 tests across 10 feature suites.
154 lines
8.6 KiB
JavaScript
154 lines
8.6 KiB
JavaScript
'use client';
|
|
import * as React from 'react';
|
|
import { PrimeReactContext } from 'primereact/api';
|
|
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
import { useMergeProps } from 'primereact/hooks';
|
|
import { classNames, ObjectUtils } from 'primereact/utils';
|
|
|
|
function _extends() {
|
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
for (var e = 1; e < arguments.length; e++) {
|
|
var t = arguments[e];
|
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
}
|
|
return n;
|
|
}, _extends.apply(null, arguments);
|
|
}
|
|
|
|
function _typeof(o) {
|
|
"@babel/helpers - typeof";
|
|
|
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
return typeof o;
|
|
} : function (o) {
|
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
}, _typeof(o);
|
|
}
|
|
|
|
function toPrimitive(t, r) {
|
|
if ("object" != _typeof(t) || !t) return t;
|
|
var e = t[Symbol.toPrimitive];
|
|
if (void 0 !== e) {
|
|
var i = e.call(t, r || "default");
|
|
if ("object" != _typeof(i)) return i;
|
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
}
|
|
return ("string" === r ? String : Number)(t);
|
|
}
|
|
|
|
function toPropertyKey(t) {
|
|
var i = toPrimitive(t, "string");
|
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
}
|
|
|
|
function _defineProperty(e, r, t) {
|
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
value: t,
|
|
enumerable: !0,
|
|
configurable: !0,
|
|
writable: !0
|
|
}) : e[r] = t, e;
|
|
}
|
|
|
|
var TimelineBase = ComponentBase.extend({
|
|
defaultProps: {
|
|
__TYPE: 'Timeline',
|
|
align: 'left',
|
|
className: null,
|
|
content: null,
|
|
dataKey: null,
|
|
layout: 'vertical',
|
|
marker: null,
|
|
opposite: null,
|
|
value: null,
|
|
children: undefined
|
|
},
|
|
css: {
|
|
classes: {
|
|
marker: 'p-timeline-event-marker',
|
|
connector: 'p-timeline-event-connector',
|
|
event: 'p-timeline-event',
|
|
opposite: 'p-timeline-event-opposite',
|
|
separator: 'p-timeline-event-separator',
|
|
content: 'p-timeline-event-content',
|
|
root: function root(_ref) {
|
|
var props = _ref.props;
|
|
return classNames('p-timeline p-component', _defineProperty(_defineProperty({}, "p-timeline-".concat(props.align), true), "p-timeline-".concat(props.layout), true), props.className);
|
|
}
|
|
},
|
|
styles: "\n @layer primereact {\n .p-timeline {\n display: flex;\n flex-grow: 1;\n flex-direction: column;\n }\n \n .p-timeline-left .p-timeline-event-opposite {\n text-align: right;\n }\n \n .p-timeline-left .p-timeline-event-content {\n text-align: left;\n }\n \n .p-timeline-right .p-timeline-event {\n flex-direction: row-reverse;\n }\n \n .p-timeline-right .p-timeline-event-opposite {\n text-align: left;\n }\n \n .p-timeline-right .p-timeline-event-content {\n text-align: right;\n }\n \n .p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) {\n flex-direction: row-reverse;\n }\n \n .p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(odd) .p-timeline-event-opposite {\n text-align: right;\n }\n \n .p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(odd) .p-timeline-event-content {\n text-align: left;\n }\n \n .p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) .p-timeline-event-opposite {\n text-align: left;\n }\n \n .p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) .p-timeline-event-content {\n text-align: right;\n }\n \n .p-timeline-event {\n display: flex;\n position: relative;\n min-height: 70px;\n }\n \n .p-timeline-event:last-child {\n min-height: 0;\n }\n \n .p-timeline-event-opposite {\n flex: 1;\n padding: 0 1rem;\n }\n \n .p-timeline-event-content {\n flex: 1;\n padding: 0 1rem;\n }\n \n .p-timeline-event-separator {\n flex: 0;\n display: flex;\n align-items: center;\n flex-direction: column;\n }\n \n .p-timeline-event-marker {\n display: flex;\n align-self: baseline;\n }\n \n .p-timeline-event-connector {\n flex-grow: 1;\n }\n \n .p-timeline-horizontal {\n flex-direction: row;\n }\n \n .p-timeline-horizontal .p-timeline-event {\n flex-direction: column;\n flex: 1;\n }\n \n .p-timeline-horizontal .p-timeline-event:last-child {\n flex: 0;\n }\n \n .p-timeline-horizontal .p-timeline-event-separator {\n flex-direction: row;\n }\n \n .p-timeline-horizontal .p-timeline-event-connector {\n width: 100%;\n }\n \n .p-timeline-bottom .p-timeline-event {\n flex-direction: column-reverse;\n }\n \n .p-timeline-horizontal.p-timeline-alternate .p-timeline-event:nth-child(even) {\n flex-direction: column-reverse;\n }\n }\n "
|
|
}
|
|
});
|
|
|
|
var Timeline = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
var mergeProps = useMergeProps();
|
|
var context = React.useContext(PrimeReactContext);
|
|
var props = TimelineBase.getProps(inProps, context);
|
|
var _TimelineBase$setMeta = TimelineBase.setMetaData({
|
|
props: props
|
|
}),
|
|
ptm = _TimelineBase$setMeta.ptm,
|
|
cx = _TimelineBase$setMeta.cx,
|
|
isUnstyled = _TimelineBase$setMeta.isUnstyled;
|
|
useHandleStyle(TimelineBase.css.styles, isUnstyled, {
|
|
name: 'timeline'
|
|
});
|
|
var getPTOptions = function getPTOptions(key, index) {
|
|
return ptm(key, {
|
|
context: {
|
|
index: index
|
|
}
|
|
});
|
|
};
|
|
var elementRef = React.useRef(null);
|
|
var getKey = function getKey(item, index) {
|
|
return props.dataKey ? ObjectUtils.resolveFieldData(item, props.dataKey) : "pr_id__".concat(index);
|
|
};
|
|
var createEvents = function createEvents() {
|
|
return props.value && props.value.map(function (item, index) {
|
|
var opposite = ObjectUtils.getJSXElement(props.opposite, item, index);
|
|
var markerProps = mergeProps({
|
|
className: cx('marker')
|
|
}, getPTOptions('marker', index));
|
|
var marker = ObjectUtils.getJSXElement(props.marker, item, index) || /*#__PURE__*/React.createElement("div", markerProps);
|
|
var connectorProps = mergeProps({
|
|
className: cx('connector')
|
|
}, getPTOptions('connector', index));
|
|
var connector = index !== props.value.length - 1 && /*#__PURE__*/React.createElement("div", connectorProps);
|
|
var content = ObjectUtils.getJSXElement(props.content, item, index);
|
|
var eventProps = mergeProps({
|
|
className: cx('event')
|
|
}, getPTOptions('event', index));
|
|
var oppositeProps = mergeProps({
|
|
className: cx('opposite')
|
|
}, getPTOptions('opposite', index));
|
|
var separatorProps = mergeProps({
|
|
className: cx('separator')
|
|
}, getPTOptions('separator', index));
|
|
var contentProps = mergeProps({
|
|
className: cx('content')
|
|
}, getPTOptions('content', index));
|
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
key: getKey(item, index)
|
|
}, eventProps), /*#__PURE__*/React.createElement("div", oppositeProps, opposite), /*#__PURE__*/React.createElement("div", separatorProps, marker, connector), /*#__PURE__*/React.createElement("div", contentProps, content));
|
|
});
|
|
};
|
|
React.useImperativeHandle(ref, function () {
|
|
return {
|
|
props: props,
|
|
getElement: function getElement() {
|
|
return elementRef.current;
|
|
}
|
|
};
|
|
});
|
|
var events = createEvents();
|
|
var rootProps = mergeProps({
|
|
ref: elementRef,
|
|
className: classNames(props.className, cx('root'))
|
|
}, TimelineBase.getOtherProps(props), ptm('root'));
|
|
return /*#__PURE__*/React.createElement("div", rootProps, events);
|
|
}));
|
|
Timeline.displayName = 'Timeline';
|
|
|
|
export { Timeline };
|