mandarina-antd 1.7.1 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { OnSortChange } from "./SortButton";
3
+ import { OnFilterChange } from "./ListFilter";
4
+ import { ColumnDef, OnHideColumn, OnResizeStop, Sort } from "./ListVirtualized";
5
+ import { Schema } from "mandarina";
6
+ interface SortableColumnInterface {
7
+ column: ColumnDef;
8
+ sort?: Sort;
9
+ filters: any;
10
+ schema: Schema;
11
+ onSortChange: OnSortChange;
12
+ onFilterChange: OnFilterChange;
13
+ onHideColumn: OnHideColumn;
14
+ onResizeStop: OnResizeStop;
15
+ height: number;
16
+ columnIndex: number;
17
+ }
18
+ export declare const SortableColumn: React.ComponentClass<SortableColumnInterface & import("react-sortable-hoc").SortableElementProps, any>;
19
+ export declare const SortableColumns: React.ComponentClass<any, any>;
20
+ export {};
@@ -0,0 +1,2 @@
1
+ import { EqualityFn } from "memoize-one";
2
+ export declare const equalityFn: EqualityFn;
File without changes
@@ -0,0 +1,16 @@
1
+ declare const AutoField: any;
2
+ declare const ErrorsField: any;
3
+ declare const AutoFields: any;
4
+ declare const ListField: any;
5
+ declare const ListItemField: any;
6
+ declare const NestField: any;
7
+ declare const TableField: any;
8
+ declare const HiddenTableField: any;
9
+ import ActionForm from './ActionForm';
10
+ import ActionButton from './ActionButton';
11
+ import ConfirmActionButton from './ConfirmActionButton';
12
+ import { AuthCreateForm, AuthList, AuthListVirtualized, AuthUpdateForm } from './Auth';
13
+ import { CreateForm, DeleteForm, UpdateForm } from './Forms';
14
+ import { List } from './List/List';
15
+ import { ListVirtualized } from './List/ListVirtualized';
16
+ export { AuthCreateForm, ConfirmActionButton, AuthUpdateForm, AuthListVirtualized, AuthList, List, ListVirtualized, AutoFields, AutoField, ErrorsField, HiddenTableField, ListField, ListItemField, NestField, TableField, ActionForm, ActionButton, DeleteForm, CreateForm, UpdateForm, };
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __assign = (this && this.__assign) || function () {
16
+ __assign = Object.assign || function(t) {
17
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
18
+ s = arguments[i];
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
+ t[p] = s[p];
21
+ }
22
+ return t;
23
+ };
24
+ return __assign.apply(this, arguments);
25
+ };
26
+ var __importStar = (this && this.__importStar) || function (mod) {
27
+ if (mod && mod.__esModule) return mod;
28
+ var result = {};
29
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
30
+ result["default"] = mod;
31
+ return result;
32
+ };
33
+ var __importDefault = (this && this.__importDefault) || function (mod) {
34
+ return (mod && mod.__esModule) ? mod : { "default": mod };
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ var react_1 = __importStar(require("react"));
38
+ var antd_1 = require("antd");
39
+ var BaseField_1 = __importDefault(require("uniforms/BaseField"));
40
+ var NumField_1 = __importDefault(require("uniforms-antd/NumField"));
41
+ var BoolField_1 = __importDefault(require("uniforms-antd/BoolField"));
42
+ var DateField_1 = __importDefault(require("uniforms-antd/DateField"));
43
+ var TextField_1 = __importDefault(require("uniforms-antd/TextField"));
44
+ var SelectField_1 = __importDefault(require("uniforms-antd/SelectField"));
45
+ var RadioField_1 = __importDefault(require("uniforms-antd/RadioField"));
46
+ var ListField_1 = __importDefault(require("./ListField"));
47
+ var NestField_1 = __importDefault(require("./NestField"));
48
+ var TableField_1 = __importDefault(require("./TableField"));
49
+ var invariant_1 = __importDefault(require("invariant"));
50
+ var mandarina_1 = require("mandarina");
51
+ var HiddenField_1 = __importDefault(require("uniforms-antd/HiddenField"));
52
+ var filterDOMProps_1 = __importDefault(require("uniforms/filterDOMProps"));
53
+ filterDOMProps_1.default.register('col', 'loading', 'minCount', 'maxCount', 'fields', 'submitting', 'validating', 'fieldDefinition');
54
+ var CustomAuto = /** @class */ (function (_super) {
55
+ __extends(CustomAuto, _super);
56
+ function CustomAuto() {
57
+ return _super !== null && _super.apply(this, arguments) || this;
58
+ }
59
+ CustomAuto.prototype.getChildContextName = function () {
60
+ return this.context.uniforms.name;
61
+ };
62
+ CustomAuto.prototype.render = function () {
63
+ var props = this.getFieldProps(undefined, { ensureValue: false });
64
+ if (props.component === undefined) {
65
+ if (props.allowedValues) { //todo
66
+ if (props.checkboxes && props.fieldType !== Array) {
67
+ props.component = RadioField_1.default;
68
+ }
69
+ else {
70
+ props.component = SelectField_1.default;
71
+ }
72
+ }
73
+ else {
74
+ switch (true) {
75
+ case /(^id$|\.id$)/.test(this.props.name):
76
+ props.component = HiddenField_1.default;
77
+ break;
78
+ case !!props.query:
79
+ props.component = TableField_1.default;
80
+ break;
81
+ case (Array.isArray(props.fieldType) || props.fieldType === Array):
82
+ props.component = ListField_1.default;
83
+ break;
84
+ case (typeof props.fieldType === 'string' || props.fieldType === Object):
85
+ props.component = NestField_1.default;
86
+ break;
87
+ case props.fieldType === Date:
88
+ props.component = DateField_1.default;
89
+ break;
90
+ case props.fieldType === Number:
91
+ props.component = NumField_1.default;
92
+ break;
93
+ case props.fieldType === mandarina_1.Integer:
94
+ props.component = NumField_1.default;
95
+ break;
96
+ case props.fieldType === String:
97
+ props.component = TextField_1.default;
98
+ break;
99
+ case props.fieldType === Boolean:
100
+ props.component = BoolField_1.default;
101
+ break;
102
+ }
103
+ invariant_1.default(props.component, 'Unsupported field type in: %s', props.name);
104
+ }
105
+ }
106
+ //this.props properties applied directly on AutoField
107
+ //props has a field property with values in the schema
108
+ var mergeProps = __assign(__assign({}, this.props), props.field.form.props);
109
+ if (mergeProps.col === false)
110
+ return react_1.createElement(props.component, mergeProps);
111
+ var col = typeof mergeProps.col !== 'object' ? { span: mergeProps.col || 24 } : mergeProps.col ? __assign({}, mergeProps.col) : { span: 24 };
112
+ return (react_1.default.createElement(antd_1.Col, __assign({}, col, { "data-id": mergeProps.name }), react_1.createElement(props.component, mergeProps)));
113
+ };
114
+ CustomAuto.displayName = 'CustomAutoField';
115
+ return CustomAuto;
116
+ }(BaseField_1.default));
117
+ ;
118
+ exports.default = CustomAuto;
119
+ //# sourceMappingURL=AutoField.js.map
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __assign = (this && this.__assign) || function () {
16
+ __assign = Object.assign || function(t) {
17
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
18
+ s = arguments[i];
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
+ t[p] = s[p];
21
+ }
22
+ return t;
23
+ };
24
+ return __assign.apply(this, arguments);
25
+ };
26
+ var __rest = (this && this.__rest) || function (s, e) {
27
+ var t = {};
28
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
29
+ t[p] = s[p];
30
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
31
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
32
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
33
+ t[p[i]] = s[p[i]];
34
+ }
35
+ return t;
36
+ };
37
+ var __importStar = (this && this.__importStar) || function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
41
+ result["default"] = mod;
42
+ return result;
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ var react_1 = __importStar(require("react"));
49
+ var prop_types_1 = __importDefault(require("prop-types"));
50
+ var filterDOMProps_1 = __importDefault(require("uniforms/filterDOMProps"));
51
+ var AutoField_1 = __importDefault(require("./AutoField"));
52
+ var antd_1 = require("antd");
53
+ var utils_1 = require("mandarina/build/utils");
54
+ var AutoFields = /** @class */ (function (_super) {
55
+ __extends(AutoFields, _super);
56
+ function AutoFields() {
57
+ return _super !== null && _super.apply(this, arguments) || this;
58
+ }
59
+ AutoFields.prototype.componentWillMount = function () {
60
+ var _a = this.context.uniforms, schema = _a.schema, error = _a.error;
61
+ this.fields = this.props.fields || schema.getSubfields();
62
+ var groups = {};
63
+ var groupErrors = [];
64
+ this.fields.forEach(function (field) {
65
+ var _a = schema.getField(field).uniforms, _b = (_a === void 0 ? {} : _a).group, group = _b === void 0 ? 'default' : _b;
66
+ groups[group] = groups[group] || [];
67
+ groups[group].push(field);
68
+ var hasError = !!schema.getError(field, error);
69
+ if (hasError) {
70
+ groupErrors.push(group);
71
+ }
72
+ });
73
+ for (var key in groups) {
74
+ groups[key].sort(function (_a) {
75
+ var _b = _a.uniforms, order = (_b === void 0 ? {} : _b).order;
76
+ return order;
77
+ });
78
+ }
79
+ var groupNames = Object.keys(groups);
80
+ //if (activeKey.length===0) activeKey = [groupNames[0]]
81
+ groupNames.sort(function (groupName) {
82
+ var _a = schema.getField(groups[groupName][0]).uniforms, _b = (_a === void 0 ? {} : _a).order, order = _b === void 0 ? 0 : _b;
83
+ return order;
84
+ });
85
+ this.groups = groups;
86
+ this.groupNames = groupNames;
87
+ };
88
+ AutoFields.prototype.render = function () {
89
+ var _this = this;
90
+ var _a = this.props, autoField = _a.autoField, element = _a.element, fields = _a.fields, _b = _a.omitFields, omitFields = _b === void 0 ? [] : _b, loading = _a.loading, props = __rest(_a, ["autoField", "element", "fields", "omitFields", "loading"]);
91
+ var fieldList = fields || this.fields;
92
+ if (this.groupNames.length > 1)
93
+ return (this.groupNames.map(function (groupName) { return (react_1.default.createElement(antd_1.Row, { key: groupName }, react_1.createElement(element, props, _this.groups[groupName]
94
+ .map(function (field) {
95
+ return react_1.createElement(autoField, { key: field, name: field });
96
+ })))); }));
97
+ var filteredField = fieldList.filter(function (field) { return !omitFields.includes(field); });
98
+ var parents = utils_1.getParentsDot(filteredField);
99
+ return react_1.createElement(element, props, parents
100
+ .map(function (field) {
101
+ var fields = utils_1.getDecendentsDot(filteredField, field);
102
+ if (fields.length > 0) {
103
+ return react_1.createElement(autoField, __assign({ key: field, name: field, fields: fields }, props));
104
+ }
105
+ return react_1.createElement(autoField, __assign({ key: field, name: field }, props));
106
+ }));
107
+ };
108
+ return AutoFields;
109
+ }(react_1.Component));
110
+ AutoFields.contextTypes = AutoField_1.default.contextTypes;
111
+ AutoFields.propTypes = {
112
+ autoField: prop_types_1.default.oneOfType([prop_types_1.default.func, prop_types_1.default.string]),
113
+ element: prop_types_1.default.oneOfType([prop_types_1.default.func, prop_types_1.default.string]),
114
+ fields: prop_types_1.default.arrayOf(prop_types_1.default.string),
115
+ omitFields: prop_types_1.default.arrayOf(prop_types_1.default.string),
116
+ };
117
+ AutoFields.defaultProps = {
118
+ autoField: AutoField_1.default,
119
+ element: 'div',
120
+ };
121
+ filterDOMProps_1.default.register('col', 'props');
122
+ exports.default = AutoFields;
123
+ //# sourceMappingURL=AutoFields.js.map
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ var BaseField_1 = __importDefault(require("uniforms/BaseField"));
29
+ var react_1 = __importDefault(require("react"));
30
+ var filterDOMProps_1 = __importDefault(require("uniforms/filterDOMProps"));
31
+ var nothing_1 = __importDefault(require("uniforms/nothing"));
32
+ var ErrorsField = function (_a, _b) {
33
+ var _c = _b.uniforms, error = _c.error, schema = _c.schema;
34
+ var children = _a.children, props = __rest(_a, ["children"]);
35
+ return (!error && !children) ? nothing_1.default : (react_1.default.createElement("div", __assign({}, filterDOMProps_1.default(props)),
36
+ react_1.default.createElement("div", { style: { clear: 'both' } }),
37
+ children,
38
+ react_1.default.createElement("div", { dataShow: "true", className: "ant-alert ant-alert-error ant-alert-with-description" },
39
+ react_1.default.createElement("i", { className: "anticon anticon-close-circle ant-alert-icon" },
40
+ react_1.default.createElement("svg", { viewBox: "64 64 896 896", className: "", "data-icon": "close-circle", width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true" },
41
+ react_1.default.createElement("path", { d: "M685.4 354.8c0-4.4-3.6-8-8-8l-66 .3L512 465.6l-99.3-118.4-66.1-.3c-4.4 0-8 3.5-8 8 0 1.9.7 3.7 1.9 5.2l130.1 155L340.5 670a8.32 8.32 0 0 0-1.9 5.2c0 4.4 3.6 8 8 8l66.1-.3L512 564.4l99.3 118.4 66 .3c4.4 0 8-3.5 8-8 0-1.9-.7-3.7-1.9-5.2L553.5 515l130.1-155c1.2-1.4 1.8-3.3 1.8-5.2z" }),
42
+ react_1.default.createElement("path", { d: "M512 65C264.6 65 64 265.6 64 513s200.6 448 448 448 448-200.6 448-448S759.4 65 512 65zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }))),
43
+ react_1.default.createElement("ul", null, schema.getErrorMessages(error).map(function (message, index) {
44
+ return react_1.default.createElement("li", { key: index, className: "ant-alert-description" }, message);
45
+ }))),
46
+ react_1.default.createElement("div", { style: { clear: 'both' } })));
47
+ };
48
+ ErrorsField.contextTypes = BaseField_1.default.contextTypes;
49
+ exports.default = ErrorsField;
50
+ //# sourceMappingURL=ErrorsField.js.map
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __assign = (this && this.__assign) || function () {
16
+ __assign = Object.assign || function(t) {
17
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
18
+ s = arguments[i];
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
+ t[p] = s[p];
21
+ }
22
+ return t;
23
+ };
24
+ return __assign.apply(this, arguments);
25
+ };
26
+ var __importDefault = (this && this.__importDefault) || function (mod) {
27
+ return (mod && mod.__esModule) ? mod : { "default": mod };
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ var BaseField_1 = __importDefault(require("uniforms/BaseField"));
31
+ var react_1 = __importDefault(require("react"));
32
+ var filterDOMProps_1 = __importDefault(require("uniforms/filterDOMProps"));
33
+ var nothing_1 = __importDefault(require("uniforms/nothing"));
34
+ var HiddenTableField = /** @class */ (function (_super) {
35
+ __extends(HiddenTableField, _super);
36
+ function HiddenTableField() {
37
+ var _this = _super.apply(this, arguments) || this;
38
+ _this.options = {
39
+ ensureValue: true,
40
+ overrideValue: true
41
+ };
42
+ return _this;
43
+ }
44
+ HiddenTableField.prototype.componentWillReceiveProps = function (_a) {
45
+ var valueDesired = _a.value;
46
+ if (valueDesired === undefined) {
47
+ return;
48
+ }
49
+ var props = this.getFieldProps();
50
+ if (props.value !== valueDesired) {
51
+ props.onChange({ id: valueDesired });
52
+ }
53
+ };
54
+ HiddenTableField.prototype.render = function () {
55
+ var props = this.getFieldProps();
56
+ console.log('HiddenTableField props', props);
57
+ var value = props.value && props.value.id;
58
+ return props.noDOM ? (nothing_1.default) : (react_1.default.createElement("input", __assign({ disabled: props.disabled, id: props.id, name: props.name, ref: props.inputRef, type: "hidden", value: value || '' }, filterDOMProps_1.default(props))));
59
+ };
60
+ HiddenTableField.displayName = 'HiddenTableField';
61
+ return HiddenTableField;
62
+ }(BaseField_1.default));
63
+ exports.default = HiddenTableField;
64
+ //# sourceMappingURL=HiddenTableField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HiddenTableField.js","sourceRoot":"","sources":["../../src/uniforms/HiddenTableField.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAA2C;AAC3C,gDAA0B;AAC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{
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ var __importStar = (this && this.__importStar) || function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
31
+ result["default"] = mod;
32
+ return result;
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ var icon_1 = __importDefault(require("antd/lib/icon"));
36
+ var react_1 = __importStar(require("react"));
37
+ var tooltip_1 = __importDefault(require("antd/lib/tooltip"));
38
+ var connectField_1 = __importDefault(require("uniforms/connectField"));
39
+ var filterDOMProps_1 = __importDefault(require("uniforms/filterDOMProps"));
40
+ var joinName_1 = __importDefault(require("uniforms/joinName"));
41
+ var ListAddField_1 = __importDefault(require("uniforms-antd/ListAddField"));
42
+ var ListItemField_1 = __importDefault(require("./ListItemField"));
43
+ var List = function (_a) {
44
+ var children = _a.children, error = _a.error, errorMessage = _a.errorMessage, info = _a.info, initialCount = _a.initialCount, itemProps = _a.itemProps, label = _a.label, labelCol = _a.labelCol, name = _a.name, showInlineError = _a.showInlineError, value = _a.value, wrapperCol = _a.wrapperCol, fields = _a.fields, _b = _a.showAddField, showAddField = _b === void 0 ? true : _b, addLabel = _a.addLabel, props = __rest(_a, ["children", "error", "errorMessage", "info", "initialCount", "itemProps", "label", "labelCol", "name", "showInlineError", "value", "wrapperCol", "fields", "showAddField", "addLabel"]);
45
+ return react_1.default.createElement("div", __assign({}, filterDOMProps_1.default(props)),
46
+ !!label && (react_1.default.createElement("div", null,
47
+ label,
48
+ !!info && (react_1.default.createElement("span", null,
49
+ "\u00A0",
50
+ react_1.default.createElement(tooltip_1.default, { title: info },
51
+ react_1.default.createElement(icon_1.default, { type: "question-circle-o" })))))),
52
+ !!(error && showInlineError) && (react_1.default.createElement("div", null, errorMessage)),
53
+ children ? (value.map(function (item, index) {
54
+ return react_1.Children.map(children, function (child) {
55
+ return react_1.default.cloneElement(child, {
56
+ key: index,
57
+ index: index,
58
+ label: null,
59
+ name: joinName_1.default(name, child.props.name && child.props.name.replace('$', index)),
60
+ });
61
+ });
62
+ })) : (value.map(function (item, index) {
63
+ return react_1.default.createElement(ListItemField_1.default, __assign({ key: index, index: index, label: null, labelCol: labelCol, name: joinName_1.default(name, index), "data-id": "list-item-" + joinName_1.default(name, index), wrapperCol: wrapperCol, fields: fields }, itemProps));
64
+ })),
65
+ showAddField && react_1.default.createElement("div", { style: { clear: 'both' } },
66
+ react_1.default.createElement(ListAddField_1.default, { name: name + ".$", initialCount: initialCount, size: 'large', className: 'add-button', type: 'primary', shape: 'round', "data-id": "list-add-" + name, style: {} }, addLabel ? addLabel : "Add " + label)),
67
+ react_1.default.createElement("div", { style: { clear: 'both' } }));
68
+ };
69
+ List.defaultProps = {
70
+ style: {
71
+ border: '1px solid #DDD',
72
+ borderRadius: '7px',
73
+ marginBottom: '5px',
74
+ marginTop: '5px',
75
+ padding: '10px'
76
+ }
77
+ };
78
+ exports.default = connectField_1.default(List, { ensureValue: true, includeInChain: false });
79
+ //# sourceMappingURL=ListField.js.map
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
28
+ result["default"] = mod;
29
+ return result;
30
+ };
31
+ var __importDefault = (this && this.__importDefault) || function (mod) {
32
+ return (mod && mod.__esModule) ? mod : { "default": mod };
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ var react_1 = __importStar(require("react"));
36
+ var connectField_1 = __importDefault(require("uniforms/connectField"));
37
+ var joinName_1 = __importDefault(require("uniforms/joinName"));
38
+ var AutoField_1 = __importDefault(require("./AutoField"));
39
+ var ListDelField_1 = __importDefault(require("uniforms-antd/ListDelField"));
40
+ var ListItem = function (_a) {
41
+ var children = _a.children, _b = _a.showListDelField, showListDelField = _b === void 0 ? true : _b, name = _a.name, index = _a.index, props = __rest(_a, ["children", "showListDelField", "name", "index"]);
42
+ return (react_1.default.createElement("div", { style: { width: '100%', clear: 'both', float: "none" } },
43
+ react_1.default.createElement("div", { style: {
44
+ float: 'right',
45
+ marginBottom: '10px',
46
+ marginLeft: '10px',
47
+ marginRight: '6px',
48
+ width: '20px'
49
+ } }, showListDelField && react_1.default.createElement(ListDelField_1.default, { className: "top aligned", name: name, type: "danger" })),
50
+ react_1.default.createElement("div", { style: { marginBottom: '4px', overflow: 'hidden' } },
51
+ react_1.default.createElement("div", { style: { borderBottom: '1px solid #adadad', height: '20px', marginTop: '-4px' } })),
52
+ react_1.default.createElement("div", { style: { width: '100%', clear: 'both' } }, children ? (typeof children === 'function' ?
53
+ react_1.Children.map(children(__assign({ children: children, showListDelField: showListDelField, name: name, index: index }, props)), function (child) {
54
+ return react_1.default.cloneElement(child, {
55
+ index: index,
56
+ name: joinName_1.default(name, child.name),
57
+ label: null
58
+ });
59
+ })
60
+ :
61
+ react_1.Children.map(children, function (child) {
62
+ return react_1.default.cloneElement(child, {
63
+ index: index,
64
+ name: joinName_1.default(name, child.name),
65
+ label: null
66
+ });
67
+ })) : (react_1.default.createElement(AutoField_1.default, __assign({}, __assign({ children: children, showListDelField: showListDelField, name: name, index: index }, props)))))));
68
+ };
69
+ exports.default = connectField_1.default(ListItem, { includeInChain: false, includeParent: true });
70
+ //# sourceMappingURL=ListItemField.js.map
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __assign = (this && this.__assign) || function () {
16
+ __assign = Object.assign || function(t) {
17
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
18
+ s = arguments[i];
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
+ t[p] = s[p];
21
+ }
22
+ return t;
23
+ };
24
+ return __assign.apply(this, arguments);
25
+ };
26
+ var __rest = (this && this.__rest) || function (s, e) {
27
+ var t = {};
28
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
29
+ t[p] = s[p];
30
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
31
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
32
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
33
+ t[p[i]] = s[p[i]];
34
+ }
35
+ return t;
36
+ };
37
+ var __importStar = (this && this.__importStar) || function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
41
+ result["default"] = mod;
42
+ return result;
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ var react_1 = __importStar(require("react"));
49
+ var connectField_1 = __importDefault(require("uniforms/connectField"));
50
+ var filterDOMProps_1 = __importDefault(require("uniforms/filterDOMProps"));
51
+ var injectName_1 = __importDefault(require("uniforms/injectName"));
52
+ var joinName_1 = __importDefault(require("uniforms/joinName"));
53
+ var AutoField_1 = __importDefault(require("./AutoField"));
54
+ var utils_1 = require("mandarina/build/utils");
55
+ var PropTypes = __importStar(require("prop-types"));
56
+ var Nest = /** @class */ (function (_super) {
57
+ __extends(Nest, _super);
58
+ function Nest(props) {
59
+ var _this = _super.call(this, props) || this;
60
+ _this.decendents = {};
61
+ _this.parents = [];
62
+ _this.parents = utils_1.getParentsDot(props.fields);
63
+ _this.parents.forEach(function (parent) {
64
+ _this.decendents[parent] = utils_1.getDecendentsDot(props.fields, parent);
65
+ });
66
+ return _this;
67
+ }
68
+ Nest.prototype.render = function () {
69
+ var _this = this;
70
+ var _a = this.props, children = _a.children, error = _a.error, errorMessage = _a.errorMessage, itemProps = _a.itemProps, label = _a.label, name = _a.name, showInlineError = _a.showInlineError, props = __rest(_a, ["children", "error", "errorMessage", "itemProps", "label", "name", "showInlineError"]);
71
+ return react_1.default.createElement("div", __assign({}, filterDOMProps_1.default(props)),
72
+ label && (react_1.default.createElement("label", null, label)),
73
+ !!(error && showInlineError) && (react_1.default.createElement("div", null, errorMessage)),
74
+ children ? (injectName_1.default(name, children)) : (this.parents.map(function (key) {
75
+ return react_1.default.createElement(AutoField_1.default, __assign({ key: key, name: joinName_1.default(name, key), fields: _this.decendents[key] }, itemProps));
76
+ })));
77
+ };
78
+ return Nest;
79
+ }(react_1.Component));
80
+ Nest.propTypes = {
81
+ children: PropTypes.any,
82
+ error: PropTypes.any,
83
+ errorMessage: PropTypes.any,
84
+ fields: PropTypes.any,
85
+ itemProps: PropTypes.any,
86
+ label: PropTypes.any,
87
+ name: PropTypes.any,
88
+ showInlineError: PropTypes.any
89
+ };
90
+ exports.default = connectField_1.default(Nest, { ensureValue: false, includeInChain: false });
91
+ //# sourceMappingURL=NestField.js.map