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.
@@ -4169,7 +4169,7 @@ var CollectionAdder = function CollectionAdder(_ref11) {
4169
4169
  * Create Content Dialog
4170
4170
  */
4171
4171
 
4172
- var CreateContentDialog$1 = function CreateContentDialog(_ref) {
4172
+ var CreateContentDialog = function CreateContentDialog(_ref) {
4173
4173
  var label = _ref.label,
4174
4174
  type = _ref.type,
4175
4175
  _ref$value = _ref.value,
@@ -4343,101 +4343,6 @@ var EditContentDialog = function EditContentDialog(_ref) {
4343
4343
  }));
4344
4344
  };
4345
4345
 
4346
- /**
4347
- * Create Content Dialog
4348
- */
4349
-
4350
- var CreateContentDialog = function CreateContentDialog(_ref) {
4351
- var label = _ref.label,
4352
- type = _ref.type,
4353
- validator = _ref.validator,
4354
- onOK = _ref.onOK,
4355
- _ref$onActionClose = _ref.onActionClose,
4356
- onActionClose = _ref$onActionClose === void 0 ? true : _ref$onActionClose;
4357
- var site = useContext(SiteContext);
4358
-
4359
- var _useState = useState({}),
4360
- form = _useState[0],
4361
- setForm = _useState[1];
4362
-
4363
- var _useState2 = useState(false),
4364
- isValid = _useState2[0],
4365
- setValid = _useState2[1];
4366
-
4367
- var _useState3 = useState([]),
4368
- errors = _useState3[0],
4369
- setErrors = _useState3[1];
4370
-
4371
- function change(form, validForm) {
4372
- setForm(form);
4373
-
4374
- if (validator) {
4375
- var _validator = validator(form),
4376
- validation = _validator.validation,
4377
- _validator$errors = _validator.errors,
4378
- _errors = _validator$errors === void 0 ? [] : _validator$errors;
4379
-
4380
- setValid(validForm && validation);
4381
- setErrors(_errors);
4382
- } else {
4383
- setValid(validForm);
4384
- }
4385
- }
4386
-
4387
- function onAction(action) {
4388
- if (action === 'OK' && onOK) onOK(form);
4389
- if (action === 'CLOSE' || onActionClose === true) site.closeDialog();
4390
- }
4391
-
4392
- function isRequired(field) {
4393
- var _field$required = field.required,
4394
- required = _field$required === void 0 ? false : _field$required;
4395
- return required;
4396
- }
4397
-
4398
- function isOptional(field) {
4399
- var _field$creation = field.creation,
4400
- creation = _field$creation === void 0 ? false : _field$creation;
4401
- return creation;
4402
- }
4403
-
4404
- var actions = /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Button, {
4405
- label: "CLOSE",
4406
- action: function action() {
4407
- return onAction("CLOSE");
4408
- }
4409
- }), /*#__PURE__*/React.createElement(Button, {
4410
- label: "OK",
4411
- action: function action() {
4412
- return onAction("OK");
4413
- },
4414
- disabled: !isValid,
4415
- raised: true
4416
- }));
4417
- var title = /*#__PURE__*/React.createElement(Text, {
4418
- use: "headline6"
4419
- }, label);
4420
- var content = new Content(type, form);
4421
- return /*#__PURE__*/React.createElement(Dialog, {
4422
- title: title,
4423
- open: true,
4424
- onAction: onAction,
4425
- actions: actions
4426
- }, /*#__PURE__*/React.createElement(ContentForm, {
4427
- content: content,
4428
- filter: function filter(field) {
4429
- return isRequired(field) || isOptional(field);
4430
- },
4431
- onChange: change
4432
- }), errors.map(function (error) {
4433
- return /*#__PURE__*/React.createElement(Text, {
4434
- use: "overline",
4435
- tag: "div",
4436
- className: "error"
4437
- }, error);
4438
- }));
4439
- };
4440
-
4441
4346
  /**
4442
4347
  * Collection Page
4443
4348
  */
@@ -5233,7 +5138,7 @@ var TablePage = function TablePage(props) {
5233
5138
  }
5234
5139
  };
5235
5140
 
5236
- site.openDialog( /*#__PURE__*/React.createElement(CreateContentDialog$1, {
5141
+ site.openDialog( /*#__PURE__*/React.createElement(CreateContentDialog, {
5237
5142
  label: "Crear " + name,
5238
5143
  type: schema,
5239
5144
  onOK: onOK,
@@ -5870,5 +5775,5 @@ var isFunction = function isFunction(value) {
5870
5775
  return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
5871
5776
  };
5872
5777
 
5873
- export { Avatar, Button, CheckBox, Chip, Chips, CircularProgress, CollectionContext, CollectionEditor$1 as CollectionEditor, CollectionPage, Content, ContentEditor, ContentForm, CreateContentDialog$1 as CreateContentDialog, DataTable, Dialog, DropDown, EditContentDialog, FORMATS, FieldEditor, Form, HTTPClient, Header, Icon, Kanban, KanbanCard, KanbanColumn, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, Page, PageContext, PageProvider, Planner, Property, RadioButton, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, TEXTFORMATS, TYPES, Tab, TabbedContentEditor, TableEditor, TablePage, Tabs, Text, TextArea, TextField, Thumbnail, TokenField, Tooltip, Tree, TreeItem, TreeNode, TreededContentEditor, UploadArea, UploadDialog, UploadFile, Uploader, View, Viewer, WaitScreen, isFunction };
5778
+ export { Avatar, Button, CheckBox, Chip, Chips, CircularProgress, CollectionContext, CollectionEditor$1 as CollectionEditor, CollectionPage, Content, ContentEditor, ContentForm, CreateContentDialog, DataTable, Dialog, DropDown, EditContentDialog, FORMATS, FieldEditor, Form, HTTPClient, Header, Icon, Kanban, KanbanCard, KanbanColumn, LinearProgress, List, ListEditor, LoginBox, Menu, MenuIcon, MenuItem, MenuSeparator, Page, PageContext, PageProvider, Planner, Property, RadioButton, ResetPasswordBox, Section, Session, Site, SiteContext, SiteProvider, Stack, Switch, TEXTFORMATS, TYPES, Tab, TabbedContentEditor, TableEditor, TablePage, Tabs, Text, TextArea, TextField, Thumbnail, TokenField, Tooltip, Tree, TreeItem, TreeNode, TreededContentEditor, UploadArea, UploadDialog, UploadFile, Uploader, View, Viewer, WaitScreen, isFunction };
5874
5779
  //# sourceMappingURL=index.modern.js.map