ywana-core8 0.0.691 → 0.0.693

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
@@ -5804,6 +5804,7 @@ var CollectionPage = function CollectionPage(props) {
5804
5804
  sorter = props.sorter,
5805
5805
  namer = props.namer,
5806
5806
  editor = props.editor,
5807
+ editorTitle = props.editorTitle,
5807
5808
  editorActions = props.editorActions,
5808
5809
  footer = props.footer,
5809
5810
  children = props.children;
@@ -5902,7 +5903,8 @@ var CollectionPage = function CollectionPage(props) {
5902
5903
  onReload: reloadSelection,
5903
5904
  patch: patch,
5904
5905
  onChange: onChange,
5905
- actions: editorActions
5906
+ actions: editorActions,
5907
+ title: editorTitle
5906
5908
  }), children ? /*#__PURE__*/React__default["default"].createElement("article", null, children) : null, /*#__PURE__*/React__default["default"].createElement("footer", null, footer)));
5907
5909
  };
5908
5910
  var CollectionFilters = function CollectionFilters(props) {
@@ -6270,6 +6272,7 @@ var CollectionEditor = function CollectionEditor(props) {
6270
6272
 
6271
6273
  var selected = pageContext.selected;
6272
6274
  var icon = props.icon,
6275
+ title = props.title,
6273
6276
  schema = props.schema,
6274
6277
  layout = props.layout,
6275
6278
  _props$autosave2 = props.autosave,
@@ -6315,6 +6318,26 @@ var CollectionEditor = function CollectionEditor(props) {
6315
6318
  return can;
6316
6319
  }
6317
6320
 
6321
+ function renderTitle() {
6322
+ if (title) {
6323
+ return typeof title === 'function' ? title(form) : title;
6324
+ } else {
6325
+ return selected ? selected.name : "New";
6326
+ }
6327
+ }
6328
+
6329
+ function renderActions() {
6330
+ if (actions) {
6331
+ return actions.map(function (action) {
6332
+ // clone React action
6333
+ var action2 = React__default["default"].cloneElement(action, {
6334
+ form: form
6335
+ });
6336
+ return action2;
6337
+ });
6338
+ }
6339
+ }
6340
+
6318
6341
  function renderEditor() {
6319
6342
  var content = new Content(schema, form);
6320
6343
 
@@ -6344,7 +6367,7 @@ var CollectionEditor = function CollectionEditor(props) {
6344
6367
 
6345
6368
  return selected && form ? /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, /*#__PURE__*/React__default["default"].createElement(Header, {
6346
6369
  icon: icon,
6347
- title: /*#__PURE__*/React__default["default"].createElement(Text, null, selected.name)
6370
+ title: renderTitle()
6348
6371
  }, /*#__PURE__*/React__default["default"].createElement(Icon, {
6349
6372
  icon: "close",
6350
6373
  clickable: true,
@@ -6360,7 +6383,7 @@ var CollectionEditor = function CollectionEditor(props) {
6360
6383
  raised: true,
6361
6384
  disabled: !canSave(),
6362
6385
  action: save
6363
- }), actions ? actions : null), renderEditor()) : null;
6386
+ }), renderActions()), renderEditor()) : null;
6364
6387
  };
6365
6388
  /**
6366
6389
  * Collection Context