@scenid/react-formulator 0.4.4 → 0.5.1

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.
package/dist/index.cjs.js CHANGED
@@ -29,8 +29,7 @@ var utils = require('@material-ui/core/utils');
29
29
  var _MenuItem = require('@material-ui/core/esm/MenuItem');
30
30
  var _Switch = require('@material-ui/core/esm/Switch');
31
31
  var _Checkbox = require('@material-ui/core/esm/Checkbox');
32
- var _Select = require('@material-ui/core/esm/Select');
33
- var _InputLabel = require('@material-ui/core/esm/InputLabel');
32
+ var _ClickAwayListener = require('@material-ui/core/esm/ClickAwayListener');
34
33
  var _Clear = require('@material-ui/icons/esm/Clear');
35
34
  var _Save = require('@material-ui/icons/esm/Save');
36
35
  var _Button = require('@material-ui/core/esm/Button');
@@ -98,8 +97,7 @@ var Chip__default = /*#__PURE__*/_interopDefaultLegacy(Chip);
98
97
  var _MenuItem__default = /*#__PURE__*/_interopDefaultLegacy(_MenuItem);
99
98
  var _Switch__default = /*#__PURE__*/_interopDefaultLegacy(_Switch);
100
99
  var _Checkbox__default = /*#__PURE__*/_interopDefaultLegacy(_Checkbox);
101
- var _Select__default = /*#__PURE__*/_interopDefaultLegacy(_Select);
102
- var _InputLabel__default = /*#__PURE__*/_interopDefaultLegacy(_InputLabel);
100
+ var _ClickAwayListener__default = /*#__PURE__*/_interopDefaultLegacy(_ClickAwayListener);
103
101
  var _Clear__default = /*#__PURE__*/_interopDefaultLegacy(_Clear);
104
102
  var _Save__default = /*#__PURE__*/_interopDefaultLegacy(_Save);
105
103
  var _Button__default = /*#__PURE__*/_interopDefaultLegacy(_Button);
@@ -19715,7 +19713,7 @@ function require_Error () {
19715
19713
 
19716
19714
  var _super2 = _createSuper(ValidationError);
19717
19715
 
19718
- function ValidationError(message, path, validator, options) {
19716
+ function ValidationError(message, path, validator, options, index) {
19719
19717
  var _this2;
19720
19718
 
19721
19719
  (0, _classCallCheck2["default"])(this, ValidationError);
@@ -19723,6 +19721,7 @@ function require_Error () {
19723
19721
  _this2.path = path;
19724
19722
  _this2.validator = validator;
19725
19723
  _this2.options = options;
19724
+ _this2.index = index;
19726
19725
  return _this2;
19727
19726
  }
19728
19727
 
@@ -20280,90 +20279,149 @@ function requireCompiler () {
20280
20279
  return compileTypeDefinition;
20281
20280
  }()
20282
20281
  }, {
20283
- key: "compileField",
20282
+ key: "compileOptions",
20284
20283
  value: function () {
20285
- var _compileField = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(uncompiledField, name) {
20286
- var field, prohibited, required, optional, type, defaultDef;
20284
+ var _compileOptions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(options) {
20285
+ var res;
20287
20286
  return _regenerator["default"].wrap(function _callee9$(_context9) {
20288
20287
  while (1) {
20289
20288
  switch (_context9.prev = _context9.next) {
20289
+ case 0:
20290
+ if (!((0, _helpers.isObject)(options) && options.$ref !== undefined)) {
20291
+ _context9.next = 7;
20292
+ break;
20293
+ }
20294
+
20295
+ _context9.next = 3;
20296
+ return this.resolveRef(options.$ref);
20297
+
20298
+ case 3:
20299
+ res = _context9.sent;
20300
+
20301
+ if (!(0, _helpers.isObject)(res)) {
20302
+ _context9.next = 6;
20303
+ break;
20304
+ }
20305
+
20306
+ return _context9.abrupt("return", Object.keys(res));
20307
+
20308
+ case 6:
20309
+ return _context9.abrupt("return", res);
20310
+
20311
+ case 7:
20312
+ return _context9.abrupt("return", options);
20313
+
20314
+ case 8:
20315
+ case "end":
20316
+ return _context9.stop();
20317
+ }
20318
+ }
20319
+ }, _callee9, this);
20320
+ }));
20321
+
20322
+ function compileOptions(_x12) {
20323
+ return _compileOptions.apply(this, arguments);
20324
+ }
20325
+
20326
+ return compileOptions;
20327
+ }()
20328
+ }, {
20329
+ key: "compileField",
20330
+ value: function () {
20331
+ var _compileField = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(uncompiledField, name) {
20332
+ var field, prohibited, required, optional, type, defaultDef, options;
20333
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
20334
+ while (1) {
20335
+ switch (_context10.prev = _context10.next) {
20290
20336
  case 0:
20291
20337
  field = (0, _helpers.deepCopy)(uncompiledField);
20292
- prohibited = field.prohibited, required = field.required, optional = field.optional, type = field.type, defaultDef = field["default"];
20338
+ prohibited = field.prohibited, required = field.required, optional = field.optional, type = field.type, defaultDef = field["default"], options = field.options;
20293
20339
 
20294
20340
  if (!(type === undefined)) {
20295
- _context9.next = 4;
20341
+ _context10.next = 4;
20296
20342
  break;
20297
20343
  }
20298
20344
 
20299
20345
  throw new _Error.SchemaError("Field \"".concat(name, "\" is missing a type definition"));
20300
20346
 
20301
20347
  case 4:
20302
- _context9.next = 6;
20348
+ _context10.next = 6;
20303
20349
  return this.compileTypeDefinition(type, name);
20304
20350
 
20305
20351
  case 6:
20306
- field.type = _context9.sent;
20352
+ field.type = _context10.sent;
20307
20353
 
20308
20354
  if (!(defaultDef !== undefined)) {
20309
- _context9.next = 11;
20355
+ _context10.next = 11;
20310
20356
  break;
20311
20357
  }
20312
20358
 
20313
- _context9.next = 10;
20359
+ _context10.next = 10;
20314
20360
  return this.compileTypeDefinition(defaultDef, name);
20315
20361
 
20316
20362
  case 10:
20317
- field["default"] = _context9.sent;
20363
+ field["default"] = _context10.sent;
20318
20364
 
20319
20365
  case 11:
20320
- if (!(prohibited !== undefined)) {
20321
- _context9.next = 15;
20366
+ if (!options) {
20367
+ _context10.next = 15;
20322
20368
  break;
20323
20369
  }
20324
20370
 
20325
- _context9.next = 14;
20326
- return this.compileRules(prohibited, name);
20371
+ _context10.next = 14;
20372
+ return this.compileOptions(options);
20327
20373
 
20328
20374
  case 14:
20329
- field.prohibited = _context9.sent;
20375
+ field.options = _context10.sent;
20330
20376
 
20331
20377
  case 15:
20332
- if (!(required !== undefined)) {
20333
- _context9.next = 19;
20378
+ if (!(prohibited !== undefined)) {
20379
+ _context10.next = 19;
20334
20380
  break;
20335
20381
  }
20336
20382
 
20337
- _context9.next = 18;
20338
- return this.compileRules(required, name);
20383
+ _context10.next = 18;
20384
+ return this.compileRules(prohibited, name);
20339
20385
 
20340
20386
  case 18:
20341
- field.required = _context9.sent;
20387
+ field.prohibited = _context10.sent;
20342
20388
 
20343
20389
  case 19:
20344
- if (!(optional !== undefined)) {
20345
- _context9.next = 23;
20390
+ if (!(required !== undefined)) {
20391
+ _context10.next = 23;
20346
20392
  break;
20347
20393
  }
20348
20394
 
20349
- _context9.next = 22;
20350
- return this.compileRules(optional, name);
20395
+ _context10.next = 22;
20396
+ return this.compileRules(required, name);
20351
20397
 
20352
20398
  case 22:
20353
- field.optional = _context9.sent;
20399
+ field.required = _context10.sent;
20354
20400
 
20355
20401
  case 23:
20356
- return _context9.abrupt("return", field);
20402
+ if (!(optional !== undefined)) {
20403
+ _context10.next = 27;
20404
+ break;
20405
+ }
20406
+
20407
+ _context10.next = 26;
20408
+ return this.compileRules(optional, name);
20409
+
20410
+ case 26:
20411
+ field.optional = _context10.sent;
20412
+
20413
+ case 27:
20414
+ return _context10.abrupt("return", field);
20357
20415
 
20358
- case 24:
20416
+ case 28:
20359
20417
  case "end":
20360
- return _context9.stop();
20418
+ return _context10.stop();
20361
20419
  }
20362
20420
  }
20363
- }, _callee9, this);
20421
+ }, _callee10, this);
20364
20422
  }));
20365
20423
 
20366
- function compileField(_x12, _x13) {
20424
+ function compileField(_x13, _x14) {
20367
20425
  return _compileField.apply(this, arguments);
20368
20426
  }
20369
20427
 
@@ -20372,135 +20430,135 @@ function requireCompiler () {
20372
20430
  }, {
20373
20431
  key: "compileCatalog",
20374
20432
  value: function () {
20375
- var _compileCatalog = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(uncompiledCatalog) {
20433
+ var _compileCatalog = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(uncompiledCatalog) {
20376
20434
  var _this2 = this;
20377
20435
 
20378
20436
  var catalog, result;
20379
- return _regenerator["default"].wrap(function _callee12$(_context12) {
20437
+ return _regenerator["default"].wrap(function _callee13$(_context13) {
20380
20438
  while (1) {
20381
- switch (_context12.prev = _context12.next) {
20439
+ switch (_context13.prev = _context13.next) {
20382
20440
  case 0:
20383
20441
  catalog = (0, _helpers.deepCopy)(uncompiledCatalog);
20384
20442
 
20385
20443
  if ((0, _helpers.isObject)(catalog)) {
20386
- _context12.next = 3;
20444
+ _context13.next = 3;
20387
20445
  break;
20388
20446
  }
20389
20447
 
20390
20448
  throw new _Error.SchemaError("Invalid type of \"".concat((0, _typeof2["default"])(catalog), "\" for catalog."));
20391
20449
 
20392
20450
  case 3:
20393
- _context12.next = 5;
20451
+ _context13.next = 5;
20394
20452
  return Promise.all(Object.entries(catalog).map( /*#__PURE__*/function () {
20395
- var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(e) {
20396
- return _regenerator["default"].wrap(function _callee11$(_context11) {
20453
+ var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(e) {
20454
+ return _regenerator["default"].wrap(function _callee12$(_context12) {
20397
20455
  while (1) {
20398
- switch (_context11.prev = _context11.next) {
20456
+ switch (_context12.prev = _context12.next) {
20399
20457
  case 0:
20400
20458
  if (!(0, _helpers.isObject)(e[1])) {
20401
- _context11.next = 2;
20459
+ _context12.next = 2;
20402
20460
  break;
20403
20461
  }
20404
20462
 
20405
- return _context11.abrupt("return", (0, _defineProperty2["default"])({}, e[0], e[1]));
20463
+ return _context12.abrupt("return", (0, _defineProperty2["default"])({}, e[0], e[1]));
20406
20464
 
20407
20465
  case 2:
20408
20466
  if (Array.isArray(e[1])) {
20409
- _context11.next = 4;
20467
+ _context12.next = 4;
20410
20468
  break;
20411
20469
  }
20412
20470
 
20413
20471
  throw new _Error.SchemaError("Invalid type of \"".concat((0, _typeof2["default"])(e[1]), "\" for catalog at path \"").concat(e[0], "\"."));
20414
20472
 
20415
20473
  case 4:
20416
- _context11.t0 = _defineProperty2["default"];
20417
- _context11.t1 = {};
20418
- _context11.t2 = e[0];
20419
- _context11.next = 9;
20474
+ _context12.t0 = _defineProperty2["default"];
20475
+ _context12.t1 = {};
20476
+ _context12.t2 = e[0];
20477
+ _context12.next = 9;
20420
20478
  return Promise.all(e[1].map( /*#__PURE__*/function () {
20421
- var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(ee) {
20479
+ var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(ee) {
20422
20480
  var res;
20423
- return _regenerator["default"].wrap(function _callee10$(_context10) {
20481
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
20424
20482
  while (1) {
20425
- switch (_context10.prev = _context10.next) {
20483
+ switch (_context11.prev = _context11.next) {
20426
20484
  case 0:
20427
20485
  if ((0, _helpers.isObject)(ee)) {
20428
- _context10.next = 2;
20486
+ _context11.next = 2;
20429
20487
  break;
20430
20488
  }
20431
20489
 
20432
- return _context10.abrupt("return", ee);
20490
+ return _context11.abrupt("return", ee);
20433
20491
 
20434
20492
  case 2:
20435
20493
  if (!(ee.$ref === undefined)) {
20436
- _context10.next = 4;
20494
+ _context11.next = 4;
20437
20495
  break;
20438
20496
  }
20439
20497
 
20440
20498
  throw new _Error.SchemaError("Objects inside a catalog Array need to define a $ref at path \"".concat(e[0], "\"."));
20441
20499
 
20442
20500
  case 4:
20443
- _context10.next = 6;
20501
+ _context11.next = 6;
20444
20502
  return _this2.resolveRef(ee.$ref);
20445
20503
 
20446
20504
  case 6:
20447
- res = _context10.sent;
20505
+ res = _context11.sent;
20448
20506
 
20449
20507
  if (!(0, _helpers.isObject)(res)) {
20450
- _context10.next = 9;
20508
+ _context11.next = 9;
20451
20509
  break;
20452
20510
  }
20453
20511
 
20454
- return _context10.abrupt("return", Object.keys(res));
20512
+ return _context11.abrupt("return", Object.keys(res));
20455
20513
 
20456
20514
  case 9:
20457
- return _context10.abrupt("return", res);
20515
+ return _context11.abrupt("return", res);
20458
20516
 
20459
20517
  case 10:
20460
20518
  case "end":
20461
- return _context10.stop();
20519
+ return _context11.stop();
20462
20520
  }
20463
20521
  }
20464
- }, _callee10);
20522
+ }, _callee11);
20465
20523
  }));
20466
20524
 
20467
- return function (_x16) {
20525
+ return function (_x17) {
20468
20526
  return _ref8.apply(this, arguments);
20469
20527
  };
20470
20528
  }()));
20471
20529
 
20472
20530
  case 9:
20473
- _context11.t3 = _context11.sent;
20474
- return _context11.abrupt("return", (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t3));
20531
+ _context12.t3 = _context12.sent;
20532
+ return _context12.abrupt("return", (0, _context12.t0)(_context12.t1, _context12.t2, _context12.t3));
20475
20533
 
20476
20534
  case 11:
20477
20535
  case "end":
20478
- return _context11.stop();
20536
+ return _context12.stop();
20479
20537
  }
20480
20538
  }
20481
- }, _callee11);
20539
+ }, _callee12);
20482
20540
  }));
20483
20541
 
20484
- return function (_x15) {
20542
+ return function (_x16) {
20485
20543
  return _ref6.apply(this, arguments);
20486
20544
  };
20487
20545
  }()));
20488
20546
 
20489
20547
  case 5:
20490
- result = _context12.sent;
20491
- return _context12.abrupt("return", result.reduce(function (l, r) {
20548
+ result = _context13.sent;
20549
+ return _context13.abrupt("return", result.reduce(function (l, r) {
20492
20550
  return _objectSpread(_objectSpread({}, l), r);
20493
20551
  }, {}));
20494
20552
 
20495
20553
  case 7:
20496
20554
  case "end":
20497
- return _context12.stop();
20555
+ return _context13.stop();
20498
20556
  }
20499
20557
  }
20500
- }, _callee12);
20558
+ }, _callee13);
20501
20559
  }));
20502
20560
 
20503
- function compileCatalog(_x14) {
20561
+ function compileCatalog(_x15) {
20504
20562
  return _compileCatalog.apply(this, arguments);
20505
20563
  }
20506
20564
 
@@ -20509,16 +20567,16 @@ function requireCompiler () {
20509
20567
  }, {
20510
20568
  key: "process",
20511
20569
  value: function () {
20512
- var _process = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(schemaArg, resolver) {
20570
+ var _process = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(schemaArg, resolver) {
20513
20571
  var schema, catalog, properties, fieldNames, i, name, field;
20514
- return _regenerator["default"].wrap(function _callee13$(_context13) {
20572
+ return _regenerator["default"].wrap(function _callee14$(_context14) {
20515
20573
  while (1) {
20516
- switch (_context13.prev = _context13.next) {
20574
+ switch (_context14.prev = _context14.next) {
20517
20575
  case 0:
20518
20576
  this.resolver = resolver;
20519
20577
 
20520
20578
  if ((0, _helpers.isObject)(schemaArg)) {
20521
- _context13.next = 3;
20579
+ _context14.next = 3;
20522
20580
  break;
20523
20581
  }
20524
20582
 
@@ -20531,15 +20589,15 @@ function requireCompiler () {
20531
20589
  catalog = schema.catalog, properties = schema.properties;
20532
20590
 
20533
20591
  if (!(catalog !== undefined)) {
20534
- _context13.next = 11;
20592
+ _context14.next = 11;
20535
20593
  break;
20536
20594
  }
20537
20595
 
20538
- _context13.next = 10;
20596
+ _context14.next = 10;
20539
20597
  return this.compileCatalog(catalog);
20540
20598
 
20541
20599
  case 10:
20542
- schema.catalog = _context13.sent;
20600
+ schema.catalog = _context14.sent;
20543
20601
 
20544
20602
  case 11:
20545
20603
  fieldNames = Object.keys(properties);
@@ -20547,35 +20605,35 @@ function requireCompiler () {
20547
20605
 
20548
20606
  case 13:
20549
20607
  if (!(i < fieldNames.length)) {
20550
- _context13.next = 22;
20608
+ _context14.next = 22;
20551
20609
  break;
20552
20610
  }
20553
20611
 
20554
20612
  name = fieldNames[i];
20555
20613
  field = properties[name];
20556
- _context13.next = 18;
20614
+ _context14.next = 18;
20557
20615
  return this.compileField(field, name);
20558
20616
 
20559
20617
  case 18:
20560
- properties[name] = _context13.sent;
20618
+ properties[name] = _context14.sent;
20561
20619
 
20562
20620
  case 19:
20563
20621
  i++;
20564
- _context13.next = 13;
20622
+ _context14.next = 13;
20565
20623
  break;
20566
20624
 
20567
20625
  case 22:
20568
- return _context13.abrupt("return", schema);
20626
+ return _context14.abrupt("return", schema);
20569
20627
 
20570
20628
  case 23:
20571
20629
  case "end":
20572
- return _context13.stop();
20630
+ return _context14.stop();
20573
20631
  }
20574
20632
  }
20575
- }, _callee13, this);
20633
+ }, _callee14, this);
20576
20634
  }));
20577
20635
 
20578
- function process(_x17, _x18) {
20636
+ function process(_x18, _x19) {
20579
20637
  return _process.apply(this, arguments);
20580
20638
  }
20581
20639
 
@@ -28390,24 +28448,36 @@ function requireValidator () {
28390
28448
  }
28391
28449
  }, {
28392
28450
  key: "validateType",
28393
- value: function validateType(name, field, value, otherFields) {
28451
+ value: function validateType(name, field, value, otherFields, index) {
28394
28452
  var type = field.type,
28395
28453
  validator = field.validator,
28396
28454
  options = field.options;
28397
28455
 
28456
+ if (type === 'array' && validator && Array.isArray(value)) {
28457
+ for (var i = 0; i < value.length; i++) {
28458
+ this.validateType(name, {
28459
+ type: 'string',
28460
+ validator: validator,
28461
+ options: options
28462
+ }, value[i], otherFields, i);
28463
+ }
28464
+
28465
+ return true;
28466
+ }
28467
+
28398
28468
  if (validator === undefined) {
28399
- if (type === undefined) throw new _Error.SchemaError("Invalid type definition \"".concat(type, "\" at path \"").concat(name, "\"."));
28469
+ if (type === undefined) throw new _Error.SchemaError("Invalid type definition \"".concat(type, "\" at path \"").concat(name).concat(index ? "[".concat(index, "]") : '', "\"."));
28400
28470
 
28401
28471
  if (this.validateBaseType(type, value) === false) {
28402
- if (Array.isArray(type)) throw new _Error.ValidationError("\"".concat(value, "\" is not valid for \"").concat(name, "\""), name, 'enum', type);else throw new _Error.ValidationError("\"".concat(value, "\" is not of type \"").concat(type, "\""), name, type);
28472
+ if (Array.isArray(type)) throw new _Error.ValidationError("invalid value for \"".concat(name).concat(index ? "[".concat(index, "]") : '', "\""), name, 'enum', type, index);else throw new _Error.ValidationError("value is not of type \"".concat(type, "\" in \"").concat(name).concat(index ? "[".concat(index, "]") : '', "\""), name, type, index);
28403
28473
  }
28404
28474
  } else {
28405
28475
  var func = _TypeValidator["default"]["is".concat(validator)];
28406
28476
 
28407
- if (typeof func !== 'function') throw new _Error.SchemaError("Unknown validator \"".concat(validator, "\" at path \"").concat(name, "\"."));
28477
+ if (typeof func !== 'function') throw new _Error.SchemaError("Unknown validator \"".concat(validator, "\" at path \"").concat(name).concat(index ? "[".concat(index, "]") : '', "\"."));
28408
28478
 
28409
28479
  if (func(String(value), options, otherFields) === false) {
28410
- throw new _Error.ValidationError('invalid', name, validator, options);
28480
+ throw new _Error.ValidationError('invalid', name, validator, options, index);
28411
28481
  }
28412
28482
  }
28413
28483
 
@@ -28494,12 +28564,14 @@ function requireValidator () {
28494
28564
  this.validateType(name, schema[name], value, data);
28495
28565
  } catch (e) {
28496
28566
  if (!(e instanceof _Error.ValidationError)) throw e;
28497
- return new FieldResult(name, data[name], undefined, isProhibited, isRequired, isOptional, true, [{
28567
+ var errorEntry = {
28498
28568
  message: e.message,
28499
28569
  path: e.path,
28500
28570
  validator: e.validator,
28501
28571
  options: e.options
28502
- }]);
28572
+ };
28573
+ if (e.index) errorEntry.index = e.index;
28574
+ return new FieldResult(name, data[name], undefined, isProhibited, isRequired, isOptional, true, [errorEntry]);
28503
28575
  }
28504
28576
 
28505
28577
  return new FieldResult(name, data[name], this.castType(name, type, value), isProhibited, isRequired, isOptional);
@@ -32132,8 +32204,9 @@ var getValue$1 = function getValue(value, catalog) {
32132
32204
  var FormRepeater = function FormRepeater(_ref) {
32133
32205
  var variant = _ref.variant,
32134
32206
  name = _ref.name,
32207
+ label = _ref.label,
32135
32208
  value = _ref.value,
32136
- catalog = _ref.catalog,
32209
+ options = _ref.options,
32137
32210
  onChange = _ref.onChange;
32138
32211
 
32139
32212
  var _useState = React.useState(value || []),
@@ -32151,6 +32224,11 @@ var FormRepeater = function FormRepeater(_ref) {
32151
32224
  inputValue = _useState6[0],
32152
32225
  setInputValue = _useState6[1];
32153
32226
 
32227
+ var _useState7 = React.useState(''),
32228
+ _useState8 = _slicedToArray(_useState7, 2),
32229
+ catalogSelectValue = _useState8[0],
32230
+ setCatalogSelectValue = _useState8[1];
32231
+
32154
32232
  var handleEntryAdd = function handleEntryAdd() {
32155
32233
  if (inputValue.length > 0) {
32156
32234
  setEntries([].concat(_toConsumableArray(entries), [inputValue]));
@@ -32161,6 +32239,7 @@ var FormRepeater = function FormRepeater(_ref) {
32161
32239
  var handleCancelNewEntry = function handleCancelNewEntry() {
32162
32240
  setInEdit(false);
32163
32241
  setInputValue('');
32242
+ setCatalogSelectValue('');
32164
32243
  };
32165
32244
 
32166
32245
  var handleEntryDel = function handleEntryDel(delIndex) {
@@ -32181,15 +32260,23 @@ var FormRepeater = function FormRepeater(_ref) {
32181
32260
  }, [entries]);
32182
32261
  var blockedOptions = [];
32183
32262
 
32184
- if (catalog) {
32185
- blockedOptions = Object.entries(catalog).filter(function (e) {
32186
- return value.includes(e[0]);
32263
+ if (options) {
32264
+ blockedOptions = Object.entries(options).filter(function (e) {
32265
+ return Array.isArray(value) && value.includes(e[0]);
32187
32266
  }).map(function (e) {
32188
32267
  return e[0];
32189
32268
  });
32190
32269
  }
32191
32270
 
32192
- return /*#__PURE__*/React__default["default"].createElement(_Box__default["default"], null, /*#__PURE__*/React__default["default"].createElement(_List__default["default"], {
32271
+ return /*#__PURE__*/React__default["default"].createElement(_Box__default["default"], null, /*#__PURE__*/React__default["default"].createElement(_Typography__default["default"], {
32272
+ variant: "body1"
32273
+ }, label), (!entries || (entries === null || entries === void 0 ? void 0 : entries.length) === 0) && /*#__PURE__*/React__default["default"].createElement(_Box__default["default"], {
32274
+ mt: 1,
32275
+ pl: 2
32276
+ }, /*#__PURE__*/React__default["default"].createElement(_Typography__default["default"], {
32277
+ variant: "body2",
32278
+ color: "textSecondary"
32279
+ }, "Keine Eintr\xE4ge vorhanden")), /*#__PURE__*/React__default["default"].createElement(_List__default["default"], {
32193
32280
  dense: true
32194
32281
  }, entries.map(function (entry, index) {
32195
32282
  return (
@@ -32198,7 +32285,7 @@ var FormRepeater = function FormRepeater(_ref) {
32198
32285
  React__default["default"].createElement(_ListItem__default["default"], {
32199
32286
  key: "entry-".concat(index)
32200
32287
  }, /*#__PURE__*/React__default["default"].createElement(_ListItemText__default["default"], {
32201
- primary: getValue$1(entry, catalog)
32288
+ primary: getValue$1(entry, options)
32202
32289
  }), /*#__PURE__*/React__default["default"].createElement(_ListItemSecondaryAction__default["default"], null, /*#__PURE__*/React__default["default"].createElement(_IconButton__default["default"], {
32203
32290
  edge: "end",
32204
32291
  "aria-label": "delete",
@@ -32216,10 +32303,16 @@ var FormRepeater = function FormRepeater(_ref) {
32216
32303
  onClick: function onClick() {
32217
32304
  return setInEdit(true);
32218
32305
  }
32219
- }, "Eintrag hinzuf\xFCgen")), inEdit && !catalog && /*#__PURE__*/React__default["default"].createElement(_Box__default["default"], {
32306
+ }, "Eintr\xE4ge hinzuf\xFCgen")), inEdit && !options && /*#__PURE__*/React__default["default"].createElement(_Box__default["default"], {
32220
32307
  width: "100%",
32221
32308
  display: "flex",
32222
32309
  alignItems: "center"
32310
+ }, /*#__PURE__*/React__default["default"].createElement(_ClickAwayListener__default["default"], {
32311
+ onClickAway: function onClickAway() {
32312
+ if (inputValue === '') {
32313
+ setInEdit(false);
32314
+ }
32315
+ }
32223
32316
  }, /*#__PURE__*/React__default["default"].createElement(_FormControl__default["default"], {
32224
32317
  variant: "filled",
32225
32318
  fullWidth: true
@@ -32251,22 +32344,24 @@ var FormRepeater = function FormRepeater(_ref) {
32251
32344
  onChange: function onChange(e) {
32252
32345
  return setInputValue(e.target.value);
32253
32346
  }
32254
- }))), inEdit && catalog && /*#__PURE__*/React__default["default"].createElement(_Box__default["default"], {
32347
+ })))), inEdit && options && /*#__PURE__*/React__default["default"].createElement(_Box__default["default"], {
32255
32348
  width: "100%",
32256
32349
  display: "flex",
32257
32350
  alignItems: "center"
32258
32351
  }, /*#__PURE__*/React__default["default"].createElement(_FormControl__default["default"], {
32259
32352
  variant: "filled",
32260
32353
  fullWidth: true
32261
- }, /*#__PURE__*/React__default["default"].createElement(_InputLabel__default["default"], null, "Neuer Eintrag"), /*#__PURE__*/React__default["default"].createElement(_Select__default["default"], {
32262
- defaultValue: "please-select",
32354
+ }, /*#__PURE__*/React__default["default"].createElement(_TextField__default["default"], {
32355
+ label: "Eintrag ausw\xE4hlen",
32356
+ select: true,
32357
+ variant: variant,
32358
+ value: catalogSelectValue,
32359
+ onBlur: handleCancelNewEntry,
32263
32360
  onChange: function onChange(e) {
32264
- return setEntries([].concat(_toConsumableArray(entries), [e.target.value]));
32361
+ setCatalogSelectValue('');
32362
+ setEntries([].concat(_toConsumableArray(entries), [e.target.value]));
32265
32363
  }
32266
- }, /*#__PURE__*/React__default["default"].createElement(_MenuItem__default["default"], {
32267
- value: "please-select",
32268
- disabled: true
32269
- }, "Eintrag hinzuf\xFCgen"), Object.entries(catalog).sort(function (a, b) {
32364
+ }, Object.entries(options).sort(function (a, b) {
32270
32365
  return a[1].localeCompare(b[1]);
32271
32366
  }).map(function (e) {
32272
32367
  return /*#__PURE__*/React__default["default"].createElement(_MenuItem__default["default"], {
@@ -32279,9 +32374,10 @@ var FormRepeater = function FormRepeater(_ref) {
32279
32374
 
32280
32375
  FormRepeater.propTypes = {
32281
32376
  variant: PropTypes__default["default"].oneOf(['standard', 'filled', 'outlined']),
32282
- name: PropTypes__default["default"].string.isRequired,
32377
+ name: PropTypes__default["default"].string,
32378
+ label: PropTypes__default["default"].string,
32283
32379
  value: PropTypes__default["default"].any,
32284
- catalog: PropTypes__default["default"].object,
32380
+ options: PropTypes__default["default"].object,
32285
32381
  onChange: PropTypes__default["default"].func.isRequired
32286
32382
  };
32287
32383
 
@@ -76092,11 +76188,22 @@ var FormulatorFormSection = /*#__PURE__*/function (_React$Component) {
76092
76188
  var mapEntry = isRender ? renderComponentMap[field] : componentMap[mapKey];
76093
76189
  var component = mapEntry,
76094
76190
  props = {};
76191
+ console.log(schema.properties, fieldEntry);
76192
+
76193
+ if (mapKey === 'array' && schema.properties[fieldEntry].options) {
76194
+ props.options = schema.properties[fieldEntry].options.reduce(function (l, r) {
76195
+ var _translations$fieldEn;
76196
+
76197
+ return _objectSpread$1(_objectSpread$1({}, l), {}, _defineProperty({}, r, (translations === null || translations === void 0 ? void 0 : (_translations$fieldEn = translations[fieldEntry]) === null || _translations$fieldEn === void 0 ? void 0 : _translations$fieldEn[r]) || r));
76198
+ }, {});
76199
+ }
76095
76200
 
76096
76201
  if (mapKey === 'select') {
76097
76202
  props.options = type.map(function (value) {
76203
+ var _translations$field;
76204
+
76098
76205
  return {
76099
- label: translations[field] && translations[field][value] || value,
76206
+ label: (translations === null || translations === void 0 ? void 0 : (_translations$field = translations.field) === null || _translations$field === void 0 ? void 0 : _translations$field.value) || value,
76100
76207
  value: value
76101
76208
  };
76102
76209
  });