ywana-core8 0.0.283 → 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
  */
@@ -4480,6 +4385,7 @@ var CollectionPage = function CollectionPage(props) {
4480
4385
  name = _props$name === void 0 ? "Collection 1" : _props$name,
4481
4386
  schema = props.schema,
4482
4387
  url = props.url,
4388
+ host = props.host,
4483
4389
  groupBy = props.groupBy,
4484
4390
  editor = props.editor,
4485
4391
  field = props.field,
@@ -4495,7 +4401,7 @@ var CollectionPage = function CollectionPage(props) {
4495
4401
  pageContext = _useContext[0],
4496
4402
  setPageContext = _useContext[1];
4497
4403
 
4498
- var context = CollectionContext(url, field);
4404
+ var context = CollectionContext(url, field, host);
4499
4405
  useEffect(function () {
4500
4406
  try {
4501
4407
  return Promise.resolve(context.load()).then(function () {
@@ -4819,7 +4725,7 @@ var CollectionEditor = function CollectionEditor(props) {
4819
4725
 
4820
4726
 
4821
4727
  var CollectionContext = function CollectionContext(url, field, host) {
4822
- var API = CollectionAPI(url);
4728
+ var API = CollectionAPI(url, host);
4823
4729
  return {
4824
4730
  all: [],
4825
4731
  selected: null,
@@ -4940,7 +4846,7 @@ var CollectionContext = function CollectionContext(url, field, host) {
4940
4846
  * Collection API
4941
4847
  */
4942
4848
 
4943
- var CollectionAPI = function CollectionAPI(url) {
4849
+ var CollectionAPI = function CollectionAPI(url, host) {
4944
4850
  var http = HTTPClient(host || window.API || process.env.REACT_APP_API, Session);
4945
4851
  return {
4946
4852
  all: function all(filters) {
@@ -5232,7 +5138,7 @@ var TablePage = function TablePage(props) {
5232
5138
  }
5233
5139
  };
5234
5140
 
5235
- site.openDialog( /*#__PURE__*/React.createElement(CreateContentDialog$1, {
5141
+ site.openDialog( /*#__PURE__*/React.createElement(CreateContentDialog, {
5236
5142
  label: "Crear " + name,
5237
5143
  type: schema,
5238
5144
  onOK: onOK,
@@ -5869,5 +5775,5 @@ var isFunction = function isFunction(value) {
5869
5775
  return value && (Object.prototype.toString.call(value) === "[object Function]" || "function" === typeof value || value instanceof Function);
5870
5776
  };
5871
5777
 
5872
- 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 };
5873
5779
  //# sourceMappingURL=index.modern.js.map