Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

auto-views

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-views - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

lib/components/auto-form/form-entry.d.ts

4

lib/components/auto-form/auto-form.d.ts
/// <reference types="react" />
import * as React from 'react';
import { SchemaRepository } from "./schema-repo";
import { SchemaProperty, SchemaRepository } from "./schema-repo";
export interface AutoFormProps extends React.HTMLAttributes<HTMLFormElement> {

@@ -21,3 +21,3 @@ repo: SchemaRepository;

private renderChildren();
private makeComponent(property, key);
}
export declare function makeFormEntry(formData: any, displayMode: DisplayMode): (property: SchemaProperty, key: string) => JSX.Element;

@@ -23,2 +23,3 @@ "use strict";

var schema_repo_1 = require("./schema-repo");
var form_entry_1 = require("./form-entry");
var DisplayMode;

@@ -44,5 +45,3 @@ (function (DisplayMode) {

function AutoForm(props) {
var _this = _super.call(this, props) || this;
_this.makeComponent = _this.makeComponent.bind(_this);
return _this;
return _super.call(this, props) || this;
}

@@ -58,26 +57,14 @@ AutoForm.prototype.render = function () {

else {
return this.props.repo.mapOverProperties(this.props.schemaId, this.makeComponent);
return this.props.repo.mapOverProperties(this.props.schemaId, makeFormEntry(this.props.formData, this.props.displayMode));
}
};
AutoForm.prototype.makeComponent = function (property, key) {
var formEntryProps = (_a = {
type: property.type
},
_a['data-automation-id'] = fieldValueSelector(key),
_a);
var value = this.props.formData[key];
if (value) {
formEntryProps['value'] = value;
}
var comp = (this.props.displayMode == DisplayMode.Edit) ?
React.createElement("input", __assign({}, formEntryProps)) :
React.createElement("label", __assign({}, formEntryProps));
return React.createElement("div", null,
React.createElement("label", { "data-automation-id": fieldLabelSelector(key) }, property.title),
comp);
var _a;
};
return AutoForm;
}(React.Component));
exports.AutoForm = AutoForm;
function makeFormEntry(formData, displayMode) {
return function (property, key) {
return React.createElement(form_entry_1.Entry, { "data-automation-id": form_entry_1.entrySelector(key), entryKey: key, title: property.title, displayMode: displayMode, type: property.type, value: formData[key] });
};
}
exports.makeFormEntry = makeFormEntry;
//# sourceMappingURL=auto-form.js.map
{
"name": "auto-views",
"version": "0.0.12",
"version": "0.0.13",
"description": "Common, fully-tested, strictly-typed, Wix-styled, auto views library",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc