index.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. var __extends = (this && this.__extends) || (function () {
  2. var extendStatics = Object.setPrototypeOf ||
  3. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5. return function (d, b) {
  6. extendStatics(d, b);
  7. function __() { this.constructor = d; }
  8. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9. };
  10. })();
  11. import * as React from "react";
  12. import * as ReactDOM from "react-dom";
  13. import { LayoutDemo } from './NormalLayout/index';
  14. import { SortedTableWithStatic } from "./StaticWidget/index";
  15. import { LayoutRestore } from "./LayoutRestore/index";
  16. import { HandleLayout } from "./HandleLayout/index";
  17. // import { AddRemove } from "./AddRemove/index";
  18. import { Mobile } from "./mobileLayout/index";
  19. import './index.css';
  20. var DemoMap = {
  21. normalLayout: React.createElement(LayoutDemo, null),
  22. // SortedTable: <SortedTable />,
  23. StaticHeader: React.createElement(SortedTableWithStatic, null),
  24. LayoutRestore: React.createElement(LayoutRestore, null),
  25. HandleLayout: React.createElement(HandleLayout, null),
  26. // AddRemove: <AddRemove />,
  27. Mobile: React.createElement(Mobile, null)
  28. };
  29. var DemoDispatcher = /** @class */ (function (_super) {
  30. __extends(DemoDispatcher, _super);
  31. function DemoDispatcher() {
  32. var _this = _super !== null && _super.apply(this, arguments) || this;
  33. _this.state = {
  34. demo: React.createElement(LayoutDemo, null)
  35. };
  36. _this.handleLayoutChange = function (demoName) {
  37. _this.setState({
  38. demo: DemoMap[demoName]
  39. });
  40. };
  41. return _this;
  42. }
  43. DemoDispatcher.prototype.render = function () {
  44. var _this = this;
  45. return (React.createElement("div", null,
  46. React.createElement("div", null, "\u5207\u6362 Demos"),
  47. React.createElement("div", { className: 'demo-button-layout' },
  48. React.createElement("button", { onClick: function () { return _this.handleLayoutChange('normalLayout'); } }, "\u666E\u901A\u5E03\u5C40"),
  49. React.createElement("button", { onClick: function () { return _this.handleLayoutChange('StaticHeader'); } }, "\u9759\u6001\u7EC4\u4EF6"),
  50. React.createElement("button", { onClick: function () { return _this.handleLayoutChange('LayoutRestore'); } }, "\u5B58\u50A8\u5E03\u5C40"),
  51. React.createElement("button", { onClick: function () { return _this.handleLayoutChange('HandleLayout'); } }, "\u62D6\u62FD\u628A\u624B"),
  52. React.createElement("button", { onClick: function () { return _this.handleLayoutChange('Mobile'); } }, "\u79FB\u52A8\u7AEF")),
  53. this.state.demo));
  54. };
  55. return DemoDispatcher;
  56. }(React.Component));
  57. React.createElement(DemoDispatcher, null);
  58. ReactDOM.render(React.createElement(DemoDispatcher, null), document.getElementById('root'));
  59. document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);