@quintype/components 3.5.1-csv-table.2 → 3.5.1-image-below-fold.1

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/dist/cjs/index.js CHANGED
@@ -17,9 +17,9 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
17
17
  var reactDfp = require('react-dfp');
18
18
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
19
19
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
20
+ var _extends = require('@babel/runtime/helpers/extends');
20
21
  var emptyWebGif = require('empty-web-gif');
21
22
  var quintypeJs = require('quintype-js');
22
- var _extends = require('@babel/runtime/helpers/extends');
23
23
  var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');
24
24
  var classNames = require('classnames');
25
25
  var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
@@ -60,8 +60,8 @@ var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
60
60
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
61
61
  var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
62
62
  var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
63
- var emptyWebGif__default = /*#__PURE__*/_interopDefaultLegacy(emptyWebGif);
64
63
  var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
64
+ var emptyWebGif__default = /*#__PURE__*/_interopDefaultLegacy(emptyWebGif);
65
65
  var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized);
66
66
  var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
67
67
  var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
@@ -1844,6 +1844,66 @@ function hashString(string) {
1844
1844
  return hash;
1845
1845
  }
1846
1846
 
1847
+ function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1848
+
1849
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1850
+ var forceLoadingGumlet = false;
1851
+
1852
+ function loadGumlet() {
1853
+ if (window.GUMLET_CONFIG || window.gumlet || forceLoadingGumlet === true) {
1854
+ return;
1855
+ }
1856
+
1857
+ if (process.env.NODE_ENV == "development") {
1858
+ console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
1859
+ }
1860
+
1861
+ forceLoadingGumlet = true;
1862
+ window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
1863
+ hosts: []
1864
+ };
1865
+ var script = document.createElement("script");
1866
+ script.type = "text/javascript";
1867
+ script.src = "https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js";
1868
+ document.body.appendChild(script);
1869
+ }
1870
+
1871
+ function GumletImage(props) {
1872
+ var slug = props.slug,
1873
+ metadata = props.metadata,
1874
+ aspectRatio = props.aspectRatio,
1875
+ imageCDN = props.imageCDN,
1876
+ imgParams = props.imgParams,
1877
+ reactTag = props.reactTag,
1878
+ className = props.className;
1879
+ var image = new quintypeJs.FocusedImage(slug, metadata);
1880
+ var imageProps = {
1881
+ src: emptyWebGif__default["default"],
1882
+ "data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
1883
+ key: hashString(slug)
1884
+ };
1885
+ var Tag = reactTag || "img";
1886
+ React.useEffect(loadGumlet);
1887
+ console.log("aa--imageProps", imageProps);
1888
+ console.log("aa--props", props);
1889
+ console.log("aa--USED_PARAMS", USED_PARAMS);
1890
+ console.log("aa--omit(props, USED_PARAMS)", omit__default["default"](props, USED_PARAMS));
1891
+ React.useEffect(function () {
1892
+ console.log("aa--imageProps", imageProps);
1893
+ console.log("aa--props", props);
1894
+ console.log("aa--USED_PARAMS", USED_PARAMS);
1895
+ console.log("aa--omit(props, USED_PARAMS)", omit__default["default"](props, USED_PARAMS));
1896
+ }, []);
1897
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Tag, _extends__default["default"]({}, imageProps, omit__default["default"](props, USED_PARAMS), {
1898
+ className: className ? "qt-image ".concat(className) : "qt-image"
1899
+ })), /*#__PURE__*/React__default["default"].createElement("noscript", null, /*#__PURE__*/React__default["default"].createElement("img", {
1900
+ src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread$4(_objectSpread$4({}, imgParams), {}, {
1901
+ w: 1200
1902
+ }))),
1903
+ alt: props.alt || ""
1904
+ })));
1905
+ }
1906
+
1847
1907
  function _createSuper$g(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$g(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
1848
1908
 
1849
1909
  function _isNativeReflectConstruct$g() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -1940,56 +2000,6 @@ ThumborImage.contextTypes = {
1940
2000
  lazyLoadEagerPredicate: propTypes.func
1941
2001
  };
1942
2002
 
1943
- function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1944
-
1945
- function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1946
- var forceLoadingGumlet = false;
1947
-
1948
- function loadGumlet() {
1949
- if (window.GUMLET_CONFIG || window.gumlet || forceLoadingGumlet === true) {
1950
- return;
1951
- }
1952
-
1953
- if (process.env.NODE_ENV == 'development') {
1954
- console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
1955
- }
1956
-
1957
- forceLoadingGumlet = true;
1958
- window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
1959
- hosts: []
1960
- };
1961
- var script = document.createElement('script');
1962
- script.type = 'text/javascript';
1963
- script.src = 'https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js';
1964
- document.body.appendChild(script);
1965
- }
1966
-
1967
- function GumletImage(props) {
1968
- var slug = props.slug,
1969
- metadata = props.metadata,
1970
- aspectRatio = props.aspectRatio,
1971
- imageCDN = props.imageCDN,
1972
- imgParams = props.imgParams,
1973
- reactTag = props.reactTag,
1974
- className = props.className;
1975
- var image = new quintypeJs.FocusedImage(slug, metadata);
1976
- var imageProps = {
1977
- src: emptyWebGif__default["default"],
1978
- "data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
1979
- key: hashString(slug)
1980
- };
1981
- var Tag = reactTag || "img";
1982
- React.useEffect(loadGumlet);
1983
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Tag, _extends__default["default"]({}, imageProps, omit__default["default"](props, USED_PARAMS), {
1984
- className: className ? "qt-image ".concat(className) : 'qt-image'
1985
- })), /*#__PURE__*/React__default["default"].createElement("noscript", null, /*#__PURE__*/React__default["default"].createElement("img", {
1986
- src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread$4(_objectSpread$4({}, imgParams), {}, {
1987
- w: 1200
1988
- }))),
1989
- alt: props.alt || ""
1990
- })));
1991
- }
1992
-
1993
2003
  function mapStateToProps$6(state) {
1994
2004
  return {
1995
2005
  imageCDN: state.qt.config["cdn-image"],
@@ -1998,7 +2008,9 @@ function mapStateToProps$6(state) {
1998
2008
  }
1999
2009
 
2000
2010
  function ResponsiveImageBase(props) {
2001
- if (process.env.NODE_ENV == 'development' && !props.alt && !props.reactTag) {
2011
+ console.log("aa--ResponsiveImageBase-Props", props);
2012
+
2013
+ if (process.env.NODE_ENV == "development" && !props.alt && !props.reactTag) {
2002
2014
  global.console && global.console.warn("Image Found without an alt attribute: ".concat(props.slug));
2003
2015
  }
2004
2016
 
@@ -3118,10 +3130,9 @@ function _createSuper$8(Derived) { var hasNativeReflectConstruct = _isNativeRefl
3118
3130
 
3119
3131
  function _isNativeReflectConstruct$8() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
3120
3132
 
3121
- function TableHeader() {
3122
- var columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
3133
+ function TableHeader(columns) {
3123
3134
  return /*#__PURE__*/React__default["default"].createElement("thead", null, /*#__PURE__*/React__default["default"].createElement("tr", null, columns.map(function (col) {
3124
- return /*#__PURE__*/React__default["default"].createElement("th", null, col);
3135
+ return /*#__PURE__*/React__default["default"].createElement("th", null, col.Header);
3125
3136
  })));
3126
3137
  }
3127
3138
 
@@ -3133,8 +3144,8 @@ function TableView(_ref) {
3133
3144
  return /*#__PURE__*/React__default["default"].createElement("table", {
3134
3145
  className: className
3135
3146
  }, hasHeader && TableHeader(columns), /*#__PURE__*/React__default["default"].createElement("tbody", null, data.map(function (row) {
3136
- return /*#__PURE__*/React__default["default"].createElement("tr", null, row.map(function (item) {
3137
- return /*#__PURE__*/React__default["default"].createElement("td", null, item);
3147
+ return /*#__PURE__*/React__default["default"].createElement("tr", null, columns.map(function (col) {
3148
+ return /*#__PURE__*/React__default["default"].createElement("td", null, row[col.Header]);
3138
3149
  }));
3139
3150
  })));
3140
3151
  }
@@ -3148,7 +3159,6 @@ var Table = /*#__PURE__*/function (_React$Component) {
3148
3159
 
3149
3160
  _classCallCheck__default["default"](this, Table);
3150
3161
 
3151
- // props.data = {content: '', content-type: 'csv'}
3152
3162
  _this = _super.call(this, props);
3153
3163
  _this.state = {
3154
3164
  tableData: []
@@ -3166,8 +3176,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
3166
3176
  'papaparse')); }).then(function (_ref2) {
3167
3177
  var parse = _ref2.parse;
3168
3178
  parse(content, {
3169
- header: false,
3170
- // with header true, the order of columns in table is not guaranteed, so we will handle the case
3179
+ header: _this2.props.hasHeader,
3171
3180
  complete: function complete(results) {
3172
3181
  return _this2._isMounted && _this2.setState({
3173
3182
  tableData: results.data
@@ -3180,9 +3189,7 @@ var Table = /*#__PURE__*/function (_React$Component) {
3180
3189
  key: "componentDidMount",
3181
3190
  value: function componentDidMount() {
3182
3191
  this._isMounted = true;
3183
- this.parseCSVToJson(this.props.data.content); // csv string
3184
-
3185
- console.log("aa--qc-tableData", this.state.tableData);
3192
+ this.parseCSVToJson(this.props.data.content);
3186
3193
  }
3187
3194
  }, {
3188
3195
  key: "componentWillUnmount",
@@ -3192,8 +3199,6 @@ var Table = /*#__PURE__*/function (_React$Component) {
3192
3199
  }, {
3193
3200
  key: "componentWillReceiveProps",
3194
3201
  value: function componentWillReceiveProps(nextProps) {
3195
- console.log("aa--qc-nextProps", nextProps);
3196
-
3197
3202
  if (this.props.data.content !== nextProps.data.content) {
3198
3203
  this.parseCSVToJson(nextProps.data.content);
3199
3204
  }
@@ -3201,21 +3206,25 @@ var Table = /*#__PURE__*/function (_React$Component) {
3201
3206
  }, {
3202
3207
  key: "render",
3203
3208
  value: function render() {
3204
- console.log("aa--qc-tableLength", this.state.tableData.length);
3209
+ var _this3 = this;
3205
3210
 
3206
3211
  if (!this.state.tableData.length > 0) {
3207
3212
  return null;
3208
3213
  }
3209
3214
 
3210
- var _ref3 = this.props.hasHeader ? [this.state.tableData[0], this.state.tableData.slice(1)] : [[], this.state.tableData],
3211
- _ref4 = _slicedToArray__default["default"](_ref3, 2),
3212
- columns = _ref4[0],
3213
- tableData = _ref4[1];
3214
-
3215
+ var columns = Object.keys(this.state.tableData[0]).map(function (header) {
3216
+ return {
3217
+ Header: header,
3218
+ accessor: header,
3219
+ headerStyle: !_this3.props.hasHeader ? {
3220
+ display: "none"
3221
+ } : {}
3222
+ };
3223
+ });
3215
3224
  var className = "story-element-table-".concat(this.props.id);
3216
3225
  return /*#__PURE__*/React__default["default"].createElement(this.props.tableComponent || TableView, {
3217
3226
  hasHeader: this.props.hasHeader,
3218
- data: tableData,
3227
+ data: this.state.tableData,
3219
3228
  columns: columns,
3220
3229
  showPageSizeOptions: false,
3221
3230
  showPageJump: false,
@@ -5,11 +5,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
5
5
 
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7
7
 
8
- import React, { useEffect } from "react";
9
- import emptyWebGif from 'empty-web-gif';
8
+ import omit from "@babel/runtime/helpers/objectWithoutProperties";
9
+ import emptyWebGif from "empty-web-gif";
10
10
  import { FocusedImage } from "quintype-js";
11
+ import React, { useEffect } from "react";
11
12
  import { hashString, USED_PARAMS } from "./image-utils";
12
- import omit from '@babel/runtime/helpers/objectWithoutProperties';
13
13
  var forceLoadingGumlet = false;
14
14
 
15
15
  function loadGumlet() {
@@ -17,7 +17,7 @@ function loadGumlet() {
17
17
  return;
18
18
  }
19
19
 
20
- if (process.env.NODE_ENV == 'development') {
20
+ if (process.env.NODE_ENV == "development") {
21
21
  console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
22
22
  }
23
23
 
@@ -25,9 +25,9 @@ function loadGumlet() {
25
25
  window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
26
26
  hosts: []
27
27
  };
28
- var script = document.createElement('script');
29
- script.type = 'text/javascript';
30
- script.src = 'https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js';
28
+ var script = document.createElement("script");
29
+ script.type = "text/javascript";
30
+ script.src = "https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js";
31
31
  document.body.appendChild(script);
32
32
  }
33
33
 
@@ -47,8 +47,18 @@ export function GumletImage(props) {
47
47
  };
48
48
  var Tag = reactTag || "img";
49
49
  useEffect(loadGumlet);
50
+ console.log("aa--imageProps", imageProps);
51
+ console.log("aa--props", props);
52
+ console.log("aa--USED_PARAMS", USED_PARAMS);
53
+ console.log("aa--omit(props, USED_PARAMS)", omit(props, USED_PARAMS));
54
+ useEffect(function () {
55
+ console.log("aa--imageProps", imageProps);
56
+ console.log("aa--props", props);
57
+ console.log("aa--USED_PARAMS", USED_PARAMS);
58
+ console.log("aa--omit(props, USED_PARAMS)", omit(props, USED_PARAMS));
59
+ }, []);
50
60
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tag, _extends({}, imageProps, omit(props, USED_PARAMS), {
51
- className: className ? "qt-image ".concat(className) : 'qt-image'
61
+ className: className ? "qt-image ".concat(className) : "qt-image"
52
62
  })), /*#__PURE__*/React.createElement("noscript", null, /*#__PURE__*/React.createElement("img", {
53
63
  src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread(_objectSpread({}, imgParams), {}, {
54
64
  w: 1200
@@ -1,8 +1,8 @@
1
- import { connect } from "react-redux";
1
+ import { arrayOf, number, object, string } from "prop-types";
2
2
  import React from "react";
3
- import { ThumborImage } from "./impl/thumbor-image";
4
- import { string, arrayOf, number, object } from 'prop-types';
3
+ import { connect } from "react-redux";
5
4
  import { GumletImage } from "./impl/gumlet-image";
5
+ import { ThumborImage } from "./impl/thumbor-image";
6
6
 
7
7
  function mapStateToProps(state) {
8
8
  return {
@@ -12,7 +12,9 @@ function mapStateToProps(state) {
12
12
  }
13
13
 
14
14
  function ResponsiveImageBase(props) {
15
- if (process.env.NODE_ENV == 'development' && !props.alt && !props.reactTag) {
15
+ console.log("aa--ResponsiveImageBase-Props", props);
16
+
17
+ if (process.env.NODE_ENV == "development" && !props.alt && !props.reactTag) {
16
18
  global.console && global.console.warn("Image Found without an alt attribute: ".concat(props.slug));
17
19
  }
18
20
 
@@ -1,4 +1,3 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
2
  import _createClass from "@babel/runtime/helpers/createClass";
4
3
  import _inherits from "@babel/runtime/helpers/inherits";
@@ -11,10 +10,9 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
11
10
 
12
11
  import React from "react";
13
12
 
14
- function TableHeader() {
15
- var columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
13
+ function TableHeader(columns) {
16
14
  return /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, columns.map(function (col) {
17
- return /*#__PURE__*/React.createElement("th", null, col);
15
+ return /*#__PURE__*/React.createElement("th", null, col.Header);
18
16
  })));
19
17
  }
20
18
 
@@ -26,8 +24,8 @@ export function TableView(_ref) {
26
24
  return /*#__PURE__*/React.createElement("table", {
27
25
  className: className
28
26
  }, hasHeader && TableHeader(columns), /*#__PURE__*/React.createElement("tbody", null, data.map(function (row) {
29
- return /*#__PURE__*/React.createElement("tr", null, row.map(function (item) {
30
- return /*#__PURE__*/React.createElement("td", null, item);
27
+ return /*#__PURE__*/React.createElement("tr", null, columns.map(function (col) {
28
+ return /*#__PURE__*/React.createElement("td", null, row[col.Header]);
31
29
  }));
32
30
  })));
33
31
  }
@@ -41,7 +39,6 @@ export var Table = /*#__PURE__*/function (_React$Component) {
41
39
 
42
40
  _classCallCheck(this, Table);
43
41
 
44
- // props.data = {content: '', content-type: 'csv'}
45
42
  _this = _super.call(this, props);
46
43
  _this.state = {
47
44
  tableData: []
@@ -59,8 +56,7 @@ export var Table = /*#__PURE__*/function (_React$Component) {
59
56
  "papaparse").then(function (_ref2) {
60
57
  var parse = _ref2.parse;
61
58
  parse(content, {
62
- header: false,
63
- // with header true, the order of columns in table is not guaranteed, so we will handle the case
59
+ header: _this2.props.hasHeader,
64
60
  complete: function complete(results) {
65
61
  return _this2._isMounted && _this2.setState({
66
62
  tableData: results.data
@@ -73,9 +69,7 @@ export var Table = /*#__PURE__*/function (_React$Component) {
73
69
  key: "componentDidMount",
74
70
  value: function componentDidMount() {
75
71
  this._isMounted = true;
76
- this.parseCSVToJson(this.props.data.content); // csv string
77
-
78
- console.log("aa--qc-tableData", this.state.tableData);
72
+ this.parseCSVToJson(this.props.data.content);
79
73
  }
80
74
  }, {
81
75
  key: "componentWillUnmount",
@@ -85,8 +79,6 @@ export var Table = /*#__PURE__*/function (_React$Component) {
85
79
  }, {
86
80
  key: "componentWillReceiveProps",
87
81
  value: function componentWillReceiveProps(nextProps) {
88
- console.log("aa--qc-nextProps", nextProps);
89
-
90
82
  if (this.props.data.content !== nextProps.data.content) {
91
83
  this.parseCSVToJson(nextProps.data.content);
92
84
  }
@@ -94,21 +86,25 @@ export var Table = /*#__PURE__*/function (_React$Component) {
94
86
  }, {
95
87
  key: "render",
96
88
  value: function render() {
97
- console.log("aa--qc-tableLength", this.state.tableData.length);
89
+ var _this3 = this;
98
90
 
99
91
  if (!this.state.tableData.length > 0) {
100
92
  return null;
101
93
  }
102
94
 
103
- var _ref3 = this.props.hasHeader ? [this.state.tableData[0], this.state.tableData.slice(1)] : [[], this.state.tableData],
104
- _ref4 = _slicedToArray(_ref3, 2),
105
- columns = _ref4[0],
106
- tableData = _ref4[1];
107
-
95
+ var columns = Object.keys(this.state.tableData[0]).map(function (header) {
96
+ return {
97
+ Header: header,
98
+ accessor: header,
99
+ headerStyle: !_this3.props.hasHeader ? {
100
+ display: "none"
101
+ } : {}
102
+ };
103
+ });
108
104
  var className = "story-element-table-".concat(this.props.id);
109
105
  return /*#__PURE__*/React.createElement(this.props.tableComponent || TableView, {
110
106
  hasHeader: this.props.hasHeader,
111
- data: tableData,
107
+ data: this.state.tableData,
112
108
  columns: columns,
113
109
  showPageSizeOptions: false,
114
110
  showPageJump: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/components",
3
- "version": "3.5.1-csv-table.2",
3
+ "version": "3.5.1-image-below-fold.1",
4
4
  "description": "Components to help build Quintype Node.js apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",