Skip to content

Commit

Permalink
fix problem commonjs problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Foveluy committed Aug 16, 2018
1 parent 298d996 commit 0ea9a50
Show file tree
Hide file tree
Showing 31 changed files with 10,637 additions and 373 deletions.
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test
build
example
docs
src
static
36 changes: 22 additions & 14 deletions dist/example/AddRemove/index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import * as React from 'react';
import { Dragact } from '../../src/lib/dragact';
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var dragact_1 = require("../../src/lib/dragact");
var Words = [
{ content: 'You can do anything, but not everything.' },
{ content: 'Those who dare to fail miserably can achieve greatly.' },
Expand Down Expand Up @@ -95,10 +103,10 @@ var AddRemove = /** @class */ (function (_super) {
React.createElement("h1", { style: { textAlign: 'center' } }, "AddRemove Demo"),
React.createElement("h3", { style: { textAlign: 'center' } }, "\u5728\u8FD9\u4E2A\u5E03\u5C40\u4E2D\uFF0C\u65B0\u589E\u4E00\u4E2A\u5E03\u5C40\uFF0C\u4F1A\u65B0\u52A0\u5165\u4E00\u4E2A\u5E03\u5C40"),
React.createElement("button", { onClick: this.handleClick }, "\u65B0\u589E"),
React.createElement(Dragact, __assign({}, dragactInit), function (item, provided) {
React.createElement(dragact_1.Dragact, __assign({}, dragactInit), function (item, provided) {
return (React.createElement(Card, { item: item, provided: provided, onDelete: _this.hanldeOnDelete }));
})))));
};
return AddRemove;
}(React.Component));
export { AddRemove };
exports.AddRemove = AddRemove;
55 changes: 33 additions & 22 deletions dist/example/HandleLayout/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import * as React from 'react';
import { Dragact } from '../../src/lib/dragact';
import './index.css';
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var dragact_1 = require("../../src/lib/dragact");
require("./index.css");
var Words = [
{ content: 'You can do anything, but not everything.' },
{ content: 'Those who dare to fail miserably can achieve greatly.' },
Expand All @@ -31,20 +39,23 @@ var fakeData = function () {
return Words.map(function (item, index) {
if (index % 4 === 0)
Y++;
return __assign({}, item, { GridX: index % 4 * 4, GridY: Y * 4, w: 4, h: 2, key: index + '' });
return __assign({}, item, { GridX: (index % 4) * 4, GridY: Y * 4, w: 4, h: 2, key: index + '' });
});
};
var Card = function (_a) {
var item = _a.item, provided = _a.provided;
var style = { padding: 5, textAlign: 'center', color: '#595959' };
if (item.key !== '3') {
return (React.createElement("div", __assign({ className: 'layout-Item' }, provided.props, provided.dragHandle),
React.createElement("div", { style: style }, item.content)));
return (React.createElement("div", __assign({ className: "layout-Item" }, provided.props, provided.dragHandle),
React.createElement("div", { style: {
padding: 5,
textAlign: 'center',
color: '#595959'
} }, item.content)));
}
return (React.createElement("div", __assign({ className: 'layout-Item' }, provided.props),
React.createElement("div", { style: style },
return (React.createElement("div", __assign({ className: "layout-Item" }, provided.props),
React.createElement("div", { style: { padding: 5, textAlign: 'center', color: '#595959' } },
item.content,
React.createElement("div", __assign({ className: 'card-handle' }, provided.dragHandle), "\u70B9\u6211\u62D6\u52A8"))));
React.createElement("div", __assign({ className: "card-handle" }, provided.dragHandle), "\u70B9\u6211\u62D6\u52A8"))));
};
var HandleLayout = /** @class */ (function (_super) {
__extends(HandleLayout, _super);
Expand All @@ -66,10 +77,10 @@ var HandleLayout = /** @class */ (function (_super) {
React.createElement("div", { style: { display: 'flex', justifyContent: 'center' } },
React.createElement("div", null,
React.createElement("h1", { style: { textAlign: 'center' } }, "\u62D6\u62FD\u628A\u624B Demo"),
React.createElement(Dragact, __assign({}, dragactInit), function (item, provided) {
React.createElement(dragact_1.Dragact, __assign({}, dragactInit), function (item, provided) {
return React.createElement(Card, { item: item, provided: provided });
})))));
};
return HandleLayout;
}(React.Component));
export { HandleLayout };
exports.HandleLayout = HandleLayout;
36 changes: 22 additions & 14 deletions dist/example/HistoryLayout/HistoryLayout.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import * as React from 'react';
import { Dragact } from '../../src/lib/dragact';
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var dragact_1 = require("../../src/lib/dragact");
var HistoryDragact = /** @class */ (function (_super) {
__extends(HistoryDragact, _super);
function HistoryDragact(props) {
Expand Down Expand Up @@ -116,8 +124,8 @@ var HistoryDragact = /** @class */ (function (_super) {
});
HistoryDragact.prototype.render = function () {
var layout = this.state.layout;
return React.createElement(Dragact, __assign({ ref: this._dragactRefCallback }, this.props, { layout: layout, onDragStart: this.onDragStart, onDragEnd: this.onDragEnd }));
return React.createElement(dragact_1.Dragact, __assign({ ref: this._dragactRefCallback }, this.props, { layout: layout, onDragStart: this.onDragStart, onDragEnd: this.onDragEnd }));
};
return HistoryDragact;
}(React.Component));
export { HistoryDragact };
exports.HistoryDragact = HistoryDragact;
46 changes: 27 additions & 19 deletions dist/example/HistoryLayout/index.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import * as React from 'react';
import { HistoryDragact } from './HistoryLayout';
import { Words } from './largedata';
import './index.css';
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var HistoryLayout_1 = require("./HistoryLayout");
var largedata_1 = require("./largedata");
require("./index.css");
var fakeData = function () {
var Y = 0;
return Words.map(function (item, index) {
return largedata_1.Words.map(function (item, index) {
if (index % 4 === 0)
Y++;
return __assign({}, item, { GridX: index % 4 * 4, GridY: Y * 4, w: 4, h: 3, key: index + '' });
});
};
export var Card = function (_a) {
exports.Card = function (_a) {
var item = _a.item, provided = _a.provided;
return (React.createElement("div", __assign({ className: 'layout-Item' }, provided.props, provided.dragHandle, { style: __assign({}, provided.props.style, { background: "" + (provided.isDragging ? '#eaff8f' : 'white') }) }),
React.createElement("div", { style: { padding: 5, textAlign: 'center', color: '#595959' } },
Expand Down Expand Up @@ -79,12 +87,12 @@ var HistoryDemo = /** @class */ (function (_super) {
_this.drag.clear();
}
} }, "clear"),
React.createElement(HistoryDragact, __assign({}, dragactInit, { placeholder: true, ref: function (n) { return _this.drag = n; }, style: {
React.createElement(HistoryLayout_1.HistoryDragact, __assign({}, dragactInit, { placeholder: true, ref: function (n) { return _this.drag = n; }, style: {
background: '#003A8C'
} }), function (item, provided) {
return React.createElement(Card, { item: item, provided: provided });
return React.createElement(exports.Card, { item: item, provided: provided });
}))));
};
return HistoryDemo;
}(React.Component));
export { HistoryDemo };
exports.HistoryDemo = HistoryDemo;
4 changes: 3 additions & 1 deletion dist/example/HistoryLayout/largedata.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export var Words = [
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Words = [
{ content: 'You can do anything, but not everything.' },
{ content: 'Those who dare to fail miserably can achieve greatly.' },
{ content: 'You miss 100 percent of the shots you never take.' },
Expand Down
42 changes: 25 additions & 17 deletions dist/example/LayoutRestore/index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import * as React from 'react';
import { Dragact } from '../../src/lib/dragact';
import { Card } from '../NormalLayout/index';
import './index.css';
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var dragact_1 = require("../../src/lib/dragact");
var index_1 = require("../NormalLayout/index");
require("./index.css");
var Words = [
{ content: 'You can do anything, but not everything.' },
{ content: 'Those who dare to fail miserably can achieve greatly.' },
Expand Down Expand Up @@ -56,8 +64,8 @@ var LayoutRestore = /** @class */ (function (_super) {
layout: storeLayout ? storeLayout : fakeData(),
placeholder: true
};
return (React.createElement(Dragact, __assign({}, dragactInit, { ref: function (node) { return node ? _this.dragactNode = node : null; }, onDragEnd: _this.handleOnDragEnd }), function (item, provided) {
return React.createElement(Card, { item: item, provided: provided });
return (React.createElement(dragact_1.Dragact, __assign({}, dragactInit, { ref: function (node) { return node ? _this.dragactNode = node : null; }, onDragEnd: _this.handleOnDragEnd }), function (item, provided) {
return React.createElement(index_1.Card, { item: item, provided: provided });
}));
};
return _this;
Expand All @@ -76,4 +84,4 @@ var LayoutRestore = /** @class */ (function (_super) {
};
return LayoutRestore;
}(React.Component));
export { LayoutRestore };
exports.LayoutRestore = LayoutRestore;
Loading

0 comments on commit 0ea9a50

Please sign in to comment.