flipper-ui 0.25.15 → 0.25.16

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.
@@ -45,6 +45,10 @@ var _omit = _interopRequireDefault(require("ramda/es/omit"));
45
45
 
46
46
  var _contains = _interopRequireDefault(require("ramda/es/contains"));
47
47
 
48
+ var _cond = _interopRequireDefault(require("ramda/es/cond"));
49
+
50
+ var _T = _interopRequireDefault(require("ramda/es/T"));
51
+
48
52
  var _styledComponents = _interopRequireDefault(require("styled-components"));
49
53
 
50
54
  var _Button = _interopRequireDefault(require("./Button"));
@@ -252,9 +256,12 @@ var EditableTable = function EditableTable(props) {
252
256
  }));
253
257
  },
254
258
  Action: function Action(localProps) {
255
- if (!localProps.action) {
256
- return /*#__PURE__*/_react["default"].createElement(_materialTable.MTableAction, localProps);
257
- } else if ('position' in localProps.action && localProps.action.position === 'toolbar') {
259
+ var disabled = localProps.disabled,
260
+ size = localProps.size,
261
+ data = localProps.data;
262
+ var isDisabled = !!disabled;
263
+
264
+ var renderToolbarButton = function renderToolbarButton() {
258
265
  var ActionIcon = localProps.action.icon;
259
266
  return /*#__PURE__*/_react["default"].createElement(_Button["default"], {
260
267
  fullWidth: true,
@@ -266,9 +273,35 @@ var EditableTable = function EditableTable(props) {
266
273
  valueRef.current = '';
267
274
  }
268
275
  }, /*#__PURE__*/_react["default"].createElement(ActionIcon, null));
269
- } else {
270
- return /*#__PURE__*/_react["default"].createElement(_materialTable.MTableAction, localProps);
271
- }
276
+ };
277
+
278
+ var renderActionButton = function renderActionButton() {
279
+ return /*#__PURE__*/_react["default"].createElement(_materialTable.MTableAction, {
280
+ disabled: isDisabled,
281
+ size: size,
282
+ data: data,
283
+ action: localProps.action
284
+ });
285
+ };
286
+
287
+ var renderDefault = function renderDefault() {
288
+ return /*#__PURE__*/_react["default"].createElement(_materialTable.MTableAction, {
289
+ disabled: true,
290
+ action: function action() {},
291
+ size: 0,
292
+ data: []
293
+ });
294
+ };
295
+
296
+ var hasData = function hasData(localProps) {
297
+ return !!localProps.action && size && data;
298
+ };
299
+
300
+ var isToolbar = function isToolbar(localProps) {
301
+ return localProps.action && 'position' in localProps.action && localProps.action.position === 'toolbar';
302
+ };
303
+
304
+ return (0, _cond["default"])([[isToolbar, renderToolbarButton], [hasData, renderActionButton], [_T["default"], renderDefault]])(localProps);
272
305
  },
273
306
  EditField: function EditField(localProps) {
274
307
  if (localProps.columnDef.type === 'datetime') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flipper-ui",
3
- "version": "0.25.15",
3
+ "version": "0.25.16",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "homepage": "https://flipper-ui.ngi.com.br/",
@@ -11,7 +11,11 @@
11
11
  "scripts": {
12
12
  "test": "jest --coverage",
13
13
  "start": "start-storybook -p 6006",
14
- "build": "yarn build:ts && yarn build:babel",
14
+ "clean": "rm -rf ./dist/*",
15
+ "copy:package": "cp package.json dist/",
16
+ "publish:yalc": "cd dist/ && yalc publish && cd ..",
17
+ "build": "yarn clean && yarn build:ts && yarn build:babel",
18
+ "build:link": "yarn build && yarn copy:package && yarn publish:yalc",
15
19
  "build:ts": "tsc --emitDeclarationOnly",
16
20
  "build:babel": "babel src --out-dir dist --extensions \".ts,.tsx\"",
17
21
  "lint": "eslint -c .eslintrc.json 'src/**/*.{ts,tsx}'",