ywana-core8 0.0.284 → 0.0.287

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
@@ -262,6 +262,8 @@
262
262
  onChange = props.onChange;
263
263
 
264
264
  function change(event) {
265
+ event.stopPropagation();
266
+ event.preventDefault();
265
267
  var value = event.target.checked;
266
268
  if (onChange) onChange(id, value);
267
269
  }
@@ -4172,7 +4174,7 @@
4172
4174
  * Create Content Dialog
4173
4175
  */
4174
4176
 
4175
- var CreateContentDialog$1 = function CreateContentDialog(_ref) {
4177
+ var CreateContentDialog = function CreateContentDialog(_ref) {
4176
4178
  var label = _ref.label,
4177
4179
  type = _ref.type,
4178
4180
  _ref$value = _ref.value,
@@ -4346,101 +4348,6 @@
4346
4348
  }));
4347
4349
  };
4348
4350
 
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
4351
  /**
4445
4352
  * Collection Page
4446
4353
  */
@@ -5236,7 +5143,7 @@
5236
5143
  }
5237
5144
  };
5238
5145
 
5239
- site.openDialog( /*#__PURE__*/React__default["default"].createElement(CreateContentDialog$1, {
5146
+ site.openDialog( /*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
5240
5147
  label: "Crear " + name,
5241
5148
  type: schema,
5242
5149
  onOK: onOK,
@@ -5885,7 +5792,7 @@
5885
5792
  exports.Content = Content;
5886
5793
  exports.ContentEditor = ContentEditor;
5887
5794
  exports.ContentForm = ContentForm;
5888
- exports.CreateContentDialog = CreateContentDialog$1;
5795
+ exports.CreateContentDialog = CreateContentDialog;
5889
5796
  exports.DataTable = DataTable;
5890
5797
  exports.Dialog = Dialog;
5891
5798
  exports.DropDown = DropDown;