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.cjs CHANGED
@@ -4177,7 +4177,7 @@ var CollectionAdder = function CollectionAdder(_ref11) {
4177
4177
  * Create Content Dialog
4178
4178
  */
4179
4179
 
4180
- var CreateContentDialog$1 = function CreateContentDialog(_ref) {
4180
+ var CreateContentDialog = function CreateContentDialog(_ref) {
4181
4181
  var label = _ref.label,
4182
4182
  type = _ref.type,
4183
4183
  _ref$value = _ref.value,
@@ -4351,101 +4351,6 @@ var EditContentDialog = function EditContentDialog(_ref) {
4351
4351
  }));
4352
4352
  };
4353
4353
 
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
4354
  /**
4450
4355
  * Collection Page
4451
4356
  */
@@ -5241,7 +5146,7 @@ var TablePage = function TablePage(props) {
5241
5146
  }
5242
5147
  };
5243
5148
 
5244
- site.openDialog( /*#__PURE__*/React__default["default"].createElement(CreateContentDialog$1, {
5149
+ site.openDialog( /*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
5245
5150
  label: "Crear " + name,
5246
5151
  type: schema,
5247
5152
  onOK: onOK,
@@ -5890,7 +5795,7 @@ exports.CollectionPage = CollectionPage;
5890
5795
  exports.Content = Content;
5891
5796
  exports.ContentEditor = ContentEditor;
5892
5797
  exports.ContentForm = ContentForm;
5893
- exports.CreateContentDialog = CreateContentDialog$1;
5798
+ exports.CreateContentDialog = CreateContentDialog;
5894
5799
  exports.DataTable = DataTable;
5895
5800
  exports.Dialog = Dialog;
5896
5801
  exports.DropDown = DropDown;