"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.ExtendedColumn = void 0;
var _react = _interopRequireDefault(require("react"));
var _designSystem = require("@wix/design-system");
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _react2 = require("@wix/bex-core/react");
var _mobxReactLite = require("mobx-react-lite");
var _ToolbarCollectionContext = require("../ToolbarCollectionContext");
var _datesUtil = require("../../utils/datesUtil");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/ExtendedColumn/ExtendedColumn.tsx";
function _ExtendedColumn(props) {
  var _props$value;
  const {
    dateFormatters
  } = (0, _react2.useWixPatternsContainer)();
  const {
    collectionDataExtension
  } = (0, _ToolbarCollectionContext.useToolbarCollectionContext)();
  switch (props.type) {
    case 'shortText':
      return /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
        size: "small",
        ellipsis: true,
        maxLines: 1,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 21,
          columnNumber: 9
        }
      }, props.value);
    case 'date':
      return /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
        size: "small",
        ellipsis: true,
        maxLines: 1,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 27,
          columnNumber: 9
        }
      }, props.value && dateFormatters.medium.format((0, _datesUtil.getDateWithoutTimezone)(props.value)));
    case 'dateTime':
      return /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
        size: "small",
        ellipsis: true,
        maxLines: 1,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 34,
          columnNumber: 9
        }
      }, props.value && dateFormatters.mediumTime.format(new Date(props.value)));
    case 'checkbox':
      return /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
        align: "center",
        verticalAlign: "middle",
        color: props.value ? 'G10' : 'D10',
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 41,
          columnNumber: 9
        }
      }, props.value ? /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.Confirm, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 46,
          columnNumber: 26
        }
      }) : /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.Minus, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 46,
          columnNumber: 40
        }
      }));
    case 'longText':
      return /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
        size: "small",
        ellipsis: true,
        maxLines: 3,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 51,
          columnNumber: 9
        }
      }, props.value);
    case 'url':
      return /*#__PURE__*/_react.default.createElement(_designSystem.TextButton, {
        as: "a",
        rel: "noopener",
        target: "_blank",
        href: props.value,
        ellipsis: true,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 57,
          columnNumber: 9
        }
      }, props.value);
    case 'files':
      {
        if (!props.value || !collectionDataExtension) {
          return null;
        }
        const files = Array.isArray(props.value) ? props.value : [props.value];
        return /*#__PURE__*/_react.default.createElement(collectionDataExtension.DataExtension.FileCardList, {
          files: files,
          __self: this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 73,
            columnNumber: 9
          }
        });
      }
    case 'dropdown':
      return /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
        size: "small",
        ellipsis: true,
        maxLines: 1,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 78,
          columnNumber: 9
        }
      }, props.value);
    case 'multiSelect':
      return /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
        size: "small",
        ellipsis: true,
        maxLines: 1,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 84,
          columnNumber: 9
        }
      }, (_props$value = props.value) == null ? void 0 : _props$value.join(', '));
    case 'integer':
    case 'decimal':
    default:
      return /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
        size: "small",
        ellipsis: true,
        maxLines: 1,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 92,
          columnNumber: 9
        }
      }, props.value);
  }
}
const ExtendedColumn = exports.ExtendedColumn = (0, _mobxReactLite.observer)(_ExtendedColumn);
//# sourceMappingURL=ExtendedColumn.js.map