@pnp/spfx-controls-react
Version:
Reusable React controls for SharePoint Framework solutions
49 lines • 2.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var ReactDOM = tslib_1.__importStar(require("react-dom"));
var sp_core_library_1 = require("@microsoft/sp-core-library");
var sp_listview_extensibility_1 = require("@microsoft/sp-listview-extensibility");
var TestForm_1 = tslib_1.__importDefault(require("./components/TestForm"));
var LOG_SOURCE = 'TestFormCustomizer';
var TestFormCustomizer = /** @class */ (function (_super) {
tslib_1.__extends(TestFormCustomizer, _super);
function TestFormCustomizer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._onSave = function () {
// You MUST call this.formSaved() after you save the form.
_this.formSaved();
};
_this._onClose = function () {
// You MUST call this.formClosed() after you close the form.
_this.formClosed();
};
return _this;
}
TestFormCustomizer.prototype.onInit = function () {
// Add your custom initialization to this method. The framework will wait
// for the returned promise to resolve before rendering the form.
sp_core_library_1.Log.info(LOG_SOURCE, 'Activated TestFormCustomizer with properties:');
sp_core_library_1.Log.info(LOG_SOURCE, JSON.stringify(this.properties, undefined, 2));
return Promise.resolve();
};
TestFormCustomizer.prototype.render = function () {
// Use this method to perform your custom rendering.
var testForm = React.createElement(TestForm_1.default, {
context: this.context,
displayMode: this.displayMode,
onSave: this._onSave,
onClose: this._onClose
});
ReactDOM.render(testForm, this.domElement);
};
TestFormCustomizer.prototype.onDispose = function () {
// This method should be used to free any resources that were allocated during rendering.
ReactDOM.unmountComponentAtNode(this.domElement);
_super.prototype.onDispose.call(this);
};
return TestFormCustomizer;
}(sp_listview_extensibility_1.BaseFormCustomizer));
exports.default = TestFormCustomizer;
//# sourceMappingURL=TestFormCustomizer.js.map