@arche-mc2/arche-controls
Version:
We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get
61 lines • 2.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var update = require("react-addons-update");
var _1 = require("./");
var addon_knobs_1 = require("@storybook/addon-knobs");
var stories_1 = require("../../../Common/stories");
var image_1 = require("./image");
exports.default = {
title: 'Components/Inputs/UpDrawing',
decorators: [addon_knobs_1.withKnobs, stories_1.getRootContainer('UpDrawing')],
component: _1.default
};
;
var SimpleDrawing = (function (_super) {
tslib_1.__extends(SimpleDrawing, _super);
function SimpleDrawing(props) {
var _this = _super.call(this, props) || this;
_this.onChange = function (value, e) { };
_this.onDelAll = function (shapes) {
_this.setState({ shapes: [] });
};
_this.onDel = function (shape) {
var _shapes = [];
_this.state.shapes.map(function (value) {
if (value.ref != shape.ref) {
_shapes.push(value);
}
});
_this.setState({ shapes: _shapes });
};
_this.onCrop = function (cropedShape) {
var newState = update(_this.state, {
images: { $push: [cropedShape.dataURL] }
});
_this.setState(newState);
};
_this.onRotate = function (callback) {
};
_this.state = { src: image_1.DATAURL, shapes: [], images: [] };
return _this;
}
SimpleDrawing.prototype.render = function () {
return (React.createElement("div", null,
React.createElement("h3", null, "D\u00E9coupage d'une ordonnance"),
React.createElement("p", null,
"Mise en oeuvre d'une utilisation du composant ",
React.createElement("code", null, "UpDrawing"),
" pour d\u00E9couper une ordonnance :"),
React.createElement(_1.default, { key: "Main Drawing", src: this.state.src, shapes: this.state.shapes, onCrop: this.onCrop, onDel: this.onDel, onDelAll: this.onDelAll, onRotate: this.onRotate, onChange: function (value, event) { console.log(event); console.log(value); } }),
React.createElement("p", null, this.state.images && this.state.images.map(function (value, index) {
return (React.createElement(_1.default, { displayActions: false, src: value, key: "Drawing_" + index }));
}))));
};
return SimpleDrawing;
}(React.PureComponent));
;
exports.General = function () { return (React.createElement("div", { style: { margin: "30px" } },
React.createElement(SimpleDrawing, null))); };
//# sourceMappingURL=index.stories.js.map