flipper-ui 0.25.14 → 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"));
@@ -90,7 +94,7 @@ function _templateObject5() {
90
94
  }
91
95
 
92
96
  function _templateObject4() {
93
- var data = (0, _taggedTemplateLiteral2["default"])(["\n transition: opacity 200ms ease;\n button {\n display: none; \n }; \n &:hover {\n background: -moz-linear-gradient(left,", " 0%, ", " 100%);\n background: -webkit-linear-gradient(left,", " 0%,", " 100%);\n background: linear-gradient(to right,", " 0%,", " 100%);\n };\n &:hover button {\n display: inline-block !important;\n };\n td {\n min-width: 64px;\n };\n"]);
97
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n transition: opacity 200ms ease;\n button {\n display: none;\n };\n &:hover {\n background: -moz-linear-gradient(left,", " 0%, ", " 100%);\n background: -webkit-linear-gradient(left,", " 0%,", " 100%);\n background: linear-gradient(to right,", " 0%,", " 100%);\n };\n &:hover button {\n display: inline-block !important;\n };\n td {\n min-width: 64px;\n };\n"]);
94
98
 
95
99
  _templateObject4 = function _templateObject4() {
96
100
  return data;
@@ -110,7 +114,7 @@ function _templateObject3() {
110
114
  }
111
115
 
112
116
  function _templateObject2() {
113
- var data = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 4px; \n font-weight: 500 !important;\n"]);
117
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 4px;\n font-weight: 500 !important;\n"]);
114
118
 
115
119
  _templateObject2 = function _templateObject2() {
116
120
  return data;
@@ -252,7 +256,12 @@ var EditableTable = function EditableTable(props) {
252
256
  }));
253
257
  },
254
258
  Action: function Action(localProps) {
255
- 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() {
256
265
  var ActionIcon = localProps.action.icon;
257
266
  return /*#__PURE__*/_react["default"].createElement(_Button["default"], {
258
267
  fullWidth: true,
@@ -264,9 +273,35 @@ var EditableTable = function EditableTable(props) {
264
273
  valueRef.current = '';
265
274
  }
266
275
  }, /*#__PURE__*/_react["default"].createElement(ActionIcon, null));
267
- }
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
+ };
268
303
 
269
- return /*#__PURE__*/_react["default"].createElement(_materialTable.MTableAction, localProps);
304
+ return (0, _cond["default"])([[isToolbar, renderToolbarButton], [hasData, renderActionButton], [_T["default"], renderDefault]])(localProps);
270
305
  },
271
306
  EditField: function EditField(localProps) {
272
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.14",
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}'",