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.cjs +5 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +5 -98
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +5 -98
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +1 -1
- package/src/html/checkbox.js +2 -0
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
|
}
|
@@ -4177,7 +4179,7 @@ var CollectionAdder = function CollectionAdder(_ref11) {
|
|
4177
4179
|
* Create Content Dialog
|
4178
4180
|
*/
|
4179
4181
|
|
4180
|
-
var CreateContentDialog
|
4182
|
+
var CreateContentDialog = function CreateContentDialog(_ref) {
|
4181
4183
|
var label = _ref.label,
|
4182
4184
|
type = _ref.type,
|
4183
4185
|
_ref$value = _ref.value,
|
@@ -4351,101 +4353,6 @@ var EditContentDialog = function EditContentDialog(_ref) {
|
|
4351
4353
|
}));
|
4352
4354
|
};
|
4353
4355
|
|
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
4356
|
/**
|
4450
4357
|
* Collection Page
|
4451
4358
|
*/
|
@@ -5241,7 +5148,7 @@ var TablePage = function TablePage(props) {
|
|
5241
5148
|
}
|
5242
5149
|
};
|
5243
5150
|
|
5244
|
-
site.openDialog( /*#__PURE__*/React__default["default"].createElement(CreateContentDialog
|
5151
|
+
site.openDialog( /*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
5245
5152
|
label: "Crear " + name,
|
5246
5153
|
type: schema,
|
5247
5154
|
onOK: onOK,
|
@@ -5890,7 +5797,7 @@ exports.CollectionPage = CollectionPage;
|
|
5890
5797
|
exports.Content = Content;
|
5891
5798
|
exports.ContentEditor = ContentEditor;
|
5892
5799
|
exports.ContentForm = ContentForm;
|
5893
|
-
exports.CreateContentDialog = CreateContentDialog
|
5800
|
+
exports.CreateContentDialog = CreateContentDialog;
|
5894
5801
|
exports.DataTable = DataTable;
|
5895
5802
|
exports.Dialog = Dialog;
|
5896
5803
|
exports.DropDown = DropDown;
|