ywana-core8 0.0.285 → 0.0.286

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.umd.js CHANGED
@@ -4172,7 +4172,7 @@
4172
4172
  * Create Content Dialog
4173
4173
  */
4174
4174
 
4175
- var CreateContentDialog$1 = function CreateContentDialog(_ref) {
4175
+ var CreateContentDialog = function CreateContentDialog(_ref) {
4176
4176
  var label = _ref.label,
4177
4177
  type = _ref.type,
4178
4178
  _ref$value = _ref.value,
@@ -4346,101 +4346,6 @@
4346
4346
  }));
4347
4347
  };
4348
4348
 
4349
- /**
4350
- * Create Content Dialog
4351
- */
4352
-
4353
- var CreateContentDialog = function CreateContentDialog(_ref) {
4354
- var label = _ref.label,
4355
- type = _ref.type,
4356
- validator = _ref.validator,
4357
- onOK = _ref.onOK,
4358
- _ref$onActionClose = _ref.onActionClose,
4359
- onActionClose = _ref$onActionClose === void 0 ? true : _ref$onActionClose;
4360
- var site = React.useContext(SiteContext);
4361
-
4362
- var _useState = React.useState({}),
4363
- form = _useState[0],
4364
- setForm = _useState[1];
4365
-
4366
- var _useState2 = React.useState(false),
4367
- isValid = _useState2[0],
4368
- setValid = _useState2[1];
4369
-
4370
- var _useState3 = React.useState([]),
4371
- errors = _useState3[0],
4372
- setErrors = _useState3[1];
4373
-
4374
- function change(form, validForm) {
4375
- setForm(form);
4376
-
4377
- if (validator) {
4378
- var _validator = validator(form),
4379
- validation = _validator.validation,
4380
- _validator$errors = _validator.errors,
4381
- _errors = _validator$errors === void 0 ? [] : _validator$errors;
4382
-
4383
- setValid(validForm && validation);
4384
- setErrors(_errors);
4385
- } else {
4386
- setValid(validForm);
4387
- }
4388
- }
4389
-
4390
- function onAction(action) {
4391
- if (action === 'OK' && onOK) onOK(form);
4392
- if (action === 'CLOSE' || onActionClose === true) site.closeDialog();
4393
- }
4394
-
4395
- function isRequired(field) {
4396
- var _field$required = field.required,
4397
- required = _field$required === void 0 ? false : _field$required;
4398
- return required;
4399
- }
4400
-
4401
- function isOptional(field) {
4402
- var _field$creation = field.creation,
4403
- creation = _field$creation === void 0 ? false : _field$creation;
4404
- return creation;
4405
- }
4406
-
4407
- var actions = /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, /*#__PURE__*/React__default["default"].createElement(Button, {
4408
- label: "CLOSE",
4409
- action: function action() {
4410
- return onAction("CLOSE");
4411
- }
4412
- }), /*#__PURE__*/React__default["default"].createElement(Button, {
4413
- label: "OK",
4414
- action: function action() {
4415
- return onAction("OK");
4416
- },
4417
- disabled: !isValid,
4418
- raised: true
4419
- }));
4420
- var title = /*#__PURE__*/React__default["default"].createElement(Text, {
4421
- use: "headline6"
4422
- }, label);
4423
- var content = new Content(type, form);
4424
- return /*#__PURE__*/React__default["default"].createElement(Dialog, {
4425
- title: title,
4426
- open: true,
4427
- onAction: onAction,
4428
- actions: actions
4429
- }, /*#__PURE__*/React__default["default"].createElement(ContentForm, {
4430
- content: content,
4431
- filter: function filter(field) {
4432
- return isRequired(field) || isOptional(field);
4433
- },
4434
- onChange: change
4435
- }), errors.map(function (error) {
4436
- return /*#__PURE__*/React__default["default"].createElement(Text, {
4437
- use: "overline",
4438
- tag: "div",
4439
- className: "error"
4440
- }, error);
4441
- }));
4442
- };
4443
-
4444
4349
  /**
4445
4350
  * Collection Page
4446
4351
  */
@@ -5236,7 +5141,7 @@
5236
5141
  }
5237
5142
  };
5238
5143
 
5239
- site.openDialog( /*#__PURE__*/React__default["default"].createElement(CreateContentDialog$1, {
5144
+ site.openDialog( /*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
5240
5145
  label: "Crear " + name,
5241
5146
  type: schema,
5242
5147
  onOK: onOK,
@@ -5885,7 +5790,7 @@
5885
5790
  exports.Content = Content;
5886
5791
  exports.ContentEditor = ContentEditor;
5887
5792
  exports.ContentForm = ContentForm;
5888
- exports.CreateContentDialog = CreateContentDialog$1;
5793
+ exports.CreateContentDialog = CreateContentDialog;
5889
5794
  exports.DataTable = DataTable;
5890
5795
  exports.Dialog = Dialog;
5891
5796
  exports.DropDown = DropDown;