hrw-certificate-editor
Version:
Design Editor Tools with React.js + ant.design + fabric.js
81 lines • 4.73 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const React = __importStar(require("react"));
const PropTypes = __importStar(require("prop-types"));
const antd_1 = require("antd");
const i18next_1 = __importDefault(require("i18next"));
const NodeDescriptor_1 = __importDefault(require("./configuration/NodeDescriptor"));
const NodeAction_1 = __importDefault(require("./configuration/NodeAction"));
const NodeConfiguration_1 = __importDefault(require("./configuration/NodeConfiguration"));
const common_1 = require("../../components/common");
const flex_1 = require("../../components/flex");
class WorkflowNodeConfigurations extends React.Component {
UNSAFE_componentWillReceiveProps(nextProps) {
if (this.props.selectedItem && nextProps.selectedItem) {
if (this.props.selectedItem.id !== nextProps.selectedItem.id) {
nextProps.form.resetFields();
}
}
}
render() {
const { canvasRef, workflow, selectedItem, form } = this.props;
return (React.createElement(common_1.Scrollbar, null,
React.createElement(antd_1.Form, { layout: "horizontal" }, selectedItem ? (React.createElement(React.Fragment, null,
React.createElement(NodeDescriptor_1.default, { workflow: workflow, selectedItem: selectedItem }),
React.createElement(flex_1.Flex, { flexDirection: "column", style: { margin: '8px 16px' } },
React.createElement(antd_1.Form.Item, { label: i18next_1.default.t('common.name'), colon: false }, form.getFieldDecorator('name', {
initialValue: selectedItem.name,
rules: [
{
required: true,
message: i18next_1.default.t('validation.enter-property', {
arg: i18next_1.default.t('common.name'),
}),
},
],
})(React.createElement(antd_1.Input, { minLength: 0, maxLength: 30, placeholder: i18next_1.default.t('workflow.node-name-required') }))),
React.createElement(antd_1.Form.Item, { label: i18next_1.default.t('common.description'), colon: false }, form.getFieldDecorator('description', {
initialValue: selectedItem.description,
})(React.createElement(antd_1.Input.TextArea, { style: { maxHeight: 200 }, placeholder: i18next_1.default.t('workflow.node-description-required') })))),
React.createElement(antd_1.Divider, null, i18next_1.default.t('workflow.node-configuration')),
React.createElement(flex_1.Flex, { flexDirection: "column", style: { height: '100%', overflowY: 'hidden', margin: '8px 16px' } },
React.createElement(NodeConfiguration_1.default, { canvasRef: canvasRef, form: form, selectedItem: selectedItem, workflow: workflow })),
React.createElement(NodeAction_1.default, { workflow: workflow, selectedItem: selectedItem, canvasRef: canvasRef }))) : null)));
}
}
WorkflowNodeConfigurations.propTypes = {
canvasRef: PropTypes.any,
selectedItem: PropTypes.object,
workflow: PropTypes.object,
descriptors: PropTypes.object,
onChange: PropTypes.func,
};
exports.default = antd_1.Form.create({
onValuesChange: (props, changedValues, allValues) => {
const { onChange, selectedItem } = props;
onChange(selectedItem, changedValues, allValues);
},
})(WorkflowNodeConfigurations);
//# sourceMappingURL=WorkflowNodeConfigurations.js.map