ywana-core8 0.0.901 → 0.0.903

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.umd.js CHANGED
@@ -435,40 +435,45 @@
435
435
  action: click
436
436
  }) : null, /*#__PURE__*/React__default["default"].createElement(Text, null, label));
437
437
  };
438
+
439
+ /**
440
+ * Action Button
441
+ */
438
442
  var ActionButton = function ActionButton(props) {
439
- var icon = props.icon,
440
- _props$state = props.state,
441
- state = _props$state === void 0 ? "normal" : _props$state,
442
- action = props.action,
443
+ var execute = function execute() {
444
+ try {
445
+ var _temp = function () {
446
+ if (states[_state]) {
447
+ return Promise.resolve(states[_state].action()).then(function (newState) {
448
+ if (newState) setState(newState);
449
+ });
450
+ }
451
+ }();
452
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
453
+ } catch (e) {
454
+ return Promise.reject(e);
455
+ }
456
+ };
457
+ var states = props.states,
458
+ state = props.state,
443
459
  className = props.className;
444
- var _useState = React.useState("normal"),
460
+ var _useState = React.useState(),
445
461
  _state = _useState[0],
446
462
  setState = _useState[1];
447
463
  React.useEffect(function () {
448
464
  setState(state);
449
465
  }, [state]);
450
- function activate() {
451
- setState("running");
452
- if (action) action();
453
- }
454
- var actionIcon = icon;
455
- switch (_state) {
456
- case "normal":
457
- actionIcon = icon;
458
- break;
459
- case "running":
460
- actionIcon = "rotate_right";
461
- break;
462
- case "success":
463
- actionIcon = "task_alt";
464
- break;
465
- case "error":
466
- actionIcon = "error";
467
- break;
468
- }
466
+ React.useEffect(function () {
467
+ if (states[_state] && states[_state].autoexec) execute();
468
+ }, [_state]);
469
+ if (!_state) return null;
470
+ var _states$_state = states[_state],
471
+ icon = _states$_state.icon,
472
+ label = _states$_state.label;
469
473
  return /*#__PURE__*/React__default["default"].createElement(Button, _extends({}, props, {
470
- icon: actionIcon,
471
- action: activate,
474
+ icon: icon,
475
+ label: label,
476
+ action: execute,
472
477
  className: className + " action-btn " + _state
473
478
  }));
474
479
  };
@@ -4355,7 +4360,9 @@
4355
4360
  defaultView = _props$defaultView === void 0 ? "grid" : _props$defaultView,
4356
4361
  defaultFolder = props.defaultFolder,
4357
4362
  _props$filterableColu = props.filterableColumns,
4358
- filterableColumns = _props$filterableColu === void 0 ? false : _props$filterableColu;
4363
+ filterableColumns = _props$filterableColu === void 0 ? false : _props$filterableColu,
4364
+ _props$searchBy = props.searchBy,
4365
+ searchBy = _props$searchBy === void 0 ? [] : _props$searchBy;
4359
4366
  var _useState = React.useState(),
4360
4367
  selectedFolder = _useState[0],
4361
4368
  setSelectedFolder = _useState[1];
@@ -4384,7 +4391,11 @@
4384
4391
  setSearch(value);
4385
4392
  }
4386
4393
  var filteredFiles = search ? files.filter(function (file) {
4387
- return file.title.toLowerCase().includes(search.toLowerCase());
4394
+ var serchByValues = searchBy.map(function (key) {
4395
+ return file[key];
4396
+ });
4397
+ var searchByString = serchByValues.join(' ');
4398
+ return searchByString.toLowerCase().includes(search.toLowerCase());
4388
4399
  }) : files;
4389
4400
  var selectedFiles = filteredFiles.filter(function (file) {
4390
4401
  return file.folder === selectedFolder;
@@ -6317,9 +6328,6 @@
6317
6328
 
6318
6329
  /**
6319
6330
  * Content Viewer
6320
- *
6321
- * @param {*} props
6322
- * @returns
6323
6331
  */
6324
6332
  var ContentViewer = function ContentViewer(props) {
6325
6333
  var content = props.content;
@@ -6348,9 +6356,6 @@
6348
6356
 
6349
6357
  /**
6350
6358
  * Field Viewer
6351
- *
6352
- * @param {} props
6353
- * @returns
6354
6359
  */
6355
6360
  var FieldViewer = function FieldViewer(props) {
6356
6361
  var field = props.field,