ywana-core8 0.0.285 → 0.0.288

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 CHANGED
@@ -267,6 +267,8 @@ var CheckBox = function CheckBox(props) {
267
267
  onChange = props.onChange;
268
268
 
269
269
  function change(event) {
270
+ event.stopPropagation();
271
+ event.preventDefault();
270
272
  var value = event.target.checked;
271
273
  if (onChange) onChange(id, value);
272
274
  }
@@ -1447,7 +1449,9 @@ var DataTable = function DataTable(props) {
1447
1449
  }
1448
1450
 
1449
1451
  function select(row, event) {
1450
- if (onRowSelection) onRowSelection(row, event);
1452
+ if (event.target.id !== "checked") {
1453
+ if (onRowSelection) onRowSelection(row, event);
1454
+ }
1451
1455
  }
1452
1456
 
1453
1457
  function sort(dragged, dropped) {
@@ -4177,7 +4181,7 @@ var CollectionAdder = function CollectionAdder(_ref11) {
4177
4181
  * Create Content Dialog
4178
4182
  */
4179
4183
 
4180
- var CreateContentDialog$1 = function CreateContentDialog(_ref) {
4184
+ var CreateContentDialog = function CreateContentDialog(_ref) {
4181
4185
  var label = _ref.label,
4182
4186
  type = _ref.type,
4183
4187
  _ref$value = _ref.value,
@@ -4351,101 +4355,6 @@ var EditContentDialog = function EditContentDialog(_ref) {
4351
4355
  }));
4352
4356
  };
4353
4357
 
4354
- /**
4355
- * Create Content Dialog
4356
- */
4357
-
4358
- var CreateContentDialog = function CreateContentDialog(_ref) {
4359
- var label = _ref.label,
4360
- type = _ref.type,
4361
- validator = _ref.validator,
4362
- onOK = _ref.onOK,
4363
- _ref$onActionClose = _ref.onActionClose,
4364
- onActionClose = _ref$onActionClose === void 0 ? true : _ref$onActionClose;
4365
- var site = React.useContext(SiteContext);
4366
-
4367
- var _useState = React.useState({}),
4368
- form = _useState[0],
4369
- setForm = _useState[1];
4370
-
4371
- var _useState2 = React.useState(false),
4372
- isValid = _useState2[0],
4373
- setValid = _useState2[1];
4374
-
4375
- var _useState3 = React.useState([]),
4376
- errors = _useState3[0],
4377
- setErrors = _useState3[1];
4378
-
4379
- function change(form, validForm) {
4380
- setForm(form);
4381
-
4382
- if (validator) {
4383
- var _validator = validator(form),
4384
- validation = _validator.validation,
4385
- _validator$errors = _validator.errors,
4386
- _errors = _validator$errors === void 0 ? [] : _validator$errors;
4387
-
4388
- setValid(validForm && validation);
4389
- setErrors(_errors);
4390
- } else {
4391
- setValid(validForm);
4392
- }
4393
- }
4394
-
4395
- function onAction(action) {
4396
- if (action === 'OK' && onOK) onOK(form);
4397
- if (action === 'CLOSE' || onActionClose === true) site.closeDialog();
4398
- }
4399
-
4400
- function isRequired(field) {
4401
- var _field$required = field.required,
4402
- required = _field$required === void 0 ? false : _field$required;
4403
- return required;
4404
- }
4405
-
4406
- function isOptional(field) {
4407
- var _field$creation = field.creation,
4408
- creation = _field$creation === void 0 ? false : _field$creation;
4409
- return creation;
4410
- }
4411
-
4412
- var actions = /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, /*#__PURE__*/React__default["default"].createElement(Button, {
4413
- label: "CLOSE",
4414
- action: function action() {
4415
- return onAction("CLOSE");
4416
- }
4417
- }), /*#__PURE__*/React__default["default"].createElement(Button, {
4418
- label: "OK",
4419
- action: function action() {
4420
- return onAction("OK");
4421
- },
4422
- disabled: !isValid,
4423
- raised: true
4424
- }));
4425
- var title = /*#__PURE__*/React__default["default"].createElement(Text, {
4426
- use: "headline6"
4427
- }, label);
4428
- var content = new Content(type, form);
4429
- return /*#__PURE__*/React__default["default"].createElement(Dialog, {
4430
- title: title,
4431
- open: true,
4432
- onAction: onAction,
4433
- actions: actions
4434
- }, /*#__PURE__*/React__default["default"].createElement(ContentForm, {
4435
- content: content,
4436
- filter: function filter(field) {
4437
- return isRequired(field) || isOptional(field);
4438
- },
4439
- onChange: change
4440
- }), errors.map(function (error) {
4441
- return /*#__PURE__*/React__default["default"].createElement(Text, {
4442
- use: "overline",
4443
- tag: "div",
4444
- className: "error"
4445
- }, error);
4446
- }));
4447
- };
4448
-
4449
4358
  /**
4450
4359
  * Collection Page
4451
4360
  */
@@ -5241,7 +5150,7 @@ var TablePage = function TablePage(props) {
5241
5150
  }
5242
5151
  };
5243
5152
 
5244
- site.openDialog( /*#__PURE__*/React__default["default"].createElement(CreateContentDialog$1, {
5153
+ site.openDialog( /*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
5245
5154
  label: "Crear " + name,
5246
5155
  type: schema,
5247
5156
  onOK: onOK,
@@ -5890,7 +5799,7 @@ exports.CollectionPage = CollectionPage;
5890
5799
  exports.Content = Content;
5891
5800
  exports.ContentEditor = ContentEditor;
5892
5801
  exports.ContentForm = ContentForm;
5893
- exports.CreateContentDialog = CreateContentDialog$1;
5802
+ exports.CreateContentDialog = CreateContentDialog;
5894
5803
  exports.DataTable = DataTable;
5895
5804
  exports.Dialog = Dialog;
5896
5805
  exports.DropDown = DropDown;