@appcorp/app-corp-vista 0.3.59 → 0.3.61

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.
@@ -3,6 +3,6 @@ import { VistaTableV1Props } from '../../type/vista-table-type';
3
3
  export declare const TOOLTIP_OFFSET = -8;
4
4
  export declare const rowClasses = "hover:bg-gray-200 dark:hover:bg-gray-800";
5
5
  export declare const dataClasses = "p-2 cursor-pointer";
6
- export declare const VistaTableBodyV1: FC<Pick<VistaTableV1Props, 'tableBodyRows' | 'tableBodyCols' | 'pageLimit' | 'loading' | 'rowActions'> & {
6
+ export declare const VistaTableBodyV1: FC<Pick<VistaTableV1Props, 'tableBodyRows' | 'tableBodyCols' | 'pageLimit' | 'loading' | 'rowActions' | 'rowActionsExpressions'> & {
7
7
  colLength: number;
8
8
  }>;
@@ -94,7 +94,7 @@ var componentMap = (_a = {},
94
94
  react_1.default.createElement(vista_badge_v1_1.VistaBadgeV1, { label: String(val), type: val ? vista_badge_type_1.VISTA_BADGE_TYPE.INFO : vista_badge_type_1.VISTA_BADGE_TYPE.WARNING }))); },
95
95
  _a);
96
96
  var VistaTableBodyV1 = function (_a) {
97
- var colLength = _a.colLength, loading = _a.loading, pageLimit = _a.pageLimit, tableBodyCols = _a.tableBodyCols, tableBodyRows = _a.tableBodyRows, rowActions = _a.rowActions;
97
+ var colLength = _a.colLength, loading = _a.loading, pageLimit = _a.pageLimit, tableBodyCols = _a.tableBodyCols, tableBodyRows = _a.tableBodyRows, rowActions = _a.rowActions, _b = _a.rowActionsExpressions, rowActionsExpressions = _b === void 0 ? [] : _b;
98
98
  return (react_1.default.createElement(react_1.default.Fragment, null,
99
99
  loading &&
100
100
  new Array(Number(pageLimit)).fill(1).map(function () {
@@ -109,6 +109,13 @@ var VistaTableBodyV1 = function (_a) {
109
109
  tableBodyRows.length > 0 &&
110
110
  (tableBodyRows === null || tableBodyRows === void 0 ? void 0 : tableBodyRows.map(function (row) {
111
111
  var ref = (0, uuid_1.v4)();
112
+ // Filter rowActions for this specific row based on expressions
113
+ var updatedRowActions = rowActions.filter(function (action, index) {
114
+ if (rowActionsExpressions[index]) {
115
+ return rowActionsExpressions[index](row);
116
+ }
117
+ return true;
118
+ });
112
119
  return (react_1.default.createElement("tr", { key: ref, className: exports.rowClasses }, tableBodyCols.map(function (_a) {
113
120
  var _b, _c, _d, _e, _f, _g, _h;
114
121
  var key = _a.key, componentType = _a.componentType, expression = _a.expression;
@@ -158,7 +165,7 @@ var VistaTableBodyV1 = function (_a) {
158
165
  computedValue = row.id;
159
166
  }
160
167
  var reff = (0, uuid_1.v4)();
161
- return (react_1.default.createElement(react_1.Fragment, { key: reff }, (_h = componentMap[componentType]) === null || _h === void 0 ? void 0 : _h.call(componentMap, computedValue, rowActions)));
168
+ return (react_1.default.createElement(react_1.Fragment, { key: reff }, (_h = componentMap[componentType]) === null || _h === void 0 ? void 0 : _h.call(componentMap, computedValue, updatedRowActions)));
162
169
  })));
163
170
  }))));
164
171
  };
@@ -11,7 +11,7 @@ var vista_table_head_v1_1 = require("./vista-table-head-v1");
11
11
  var vista_table_body_v1_1 = require("./vista-table-body-v1");
12
12
  var empty_table_1 = require("./empty-table");
13
13
  var VistaTableV1 = function (_a) {
14
- var currentPage = _a.currentPage, dir = _a.dir, handleNextOnClick = _a.handleNextOnClick, handleOnSelect = _a.handleOnSelect, handlePreviousOnClick = _a.handlePreviousOnClick, handleSearchInput = _a.handleSearchInput, handleSuffixOnClick = _a.handleSuffixOnClick, headerActions = _a.headerActions, isNextDisabled = _a.isNextDisabled, isPreviousDisabled = _a.isPreviousDisabled, listOptions = _a.listOptions, loading = _a.loading, _b = _a.nextLabel, nextLabel = _b === void 0 ? 'Next' : _b, nodeSelectKey = _a.nodeSelectKey, _c = _a.ofLabel, ofLabel = _c === void 0 ? 'of' : _c, _d = _a.pageLabel, pageLabel = _d === void 0 ? 'Page' : _d, pageLimit = _a.pageLimit, _e = _a.previousLabel, previousLabel = _e === void 0 ? 'Previous' : _e, rowActions = _a.rowActions, searchDisabled = _a.searchDisabled, _f = _a.searchEnabled, searchEnabled = _f === void 0 ? false : _f, searchId = _a.searchId, searchPlaceholder = _a.searchPlaceholder, searchValue = _a.searchValue, selectKey1 = _a.selectKey1, selectKey2 = _a.selectKey2, selectedItem = _a.selectedItem, tableBodyCols = _a.tableBodyCols, tableBodyRows = _a.tableBodyRows, tableDescription = _a.tableDescription, tableHeadItems = _a.tableHeadItems, tableHeading = _a.tableHeading, totalPages = _a.totalPages;
14
+ var currentPage = _a.currentPage, dir = _a.dir, handleNextOnClick = _a.handleNextOnClick, handleOnSelect = _a.handleOnSelect, handlePreviousOnClick = _a.handlePreviousOnClick, handleSearchInput = _a.handleSearchInput, handleSuffixOnClick = _a.handleSuffixOnClick, headerActions = _a.headerActions, isNextDisabled = _a.isNextDisabled, isPreviousDisabled = _a.isPreviousDisabled, listOptions = _a.listOptions, loading = _a.loading, _b = _a.nextLabel, nextLabel = _b === void 0 ? 'Next' : _b, nodeSelectKey = _a.nodeSelectKey, _c = _a.ofLabel, ofLabel = _c === void 0 ? 'of' : _c, _d = _a.pageLabel, pageLabel = _d === void 0 ? 'Page' : _d, pageLimit = _a.pageLimit, _e = _a.previousLabel, previousLabel = _e === void 0 ? 'Previous' : _e, rowActions = _a.rowActions, _f = _a.rowActionsExpressions, rowActionsExpressions = _f === void 0 ? [] : _f, searchDisabled = _a.searchDisabled, _g = _a.searchEnabled, searchEnabled = _g === void 0 ? false : _g, searchId = _a.searchId, searchPlaceholder = _a.searchPlaceholder, searchValue = _a.searchValue, selectKey1 = _a.selectKey1, selectKey2 = _a.selectKey2, selectedItem = _a.selectedItem, tableBodyCols = _a.tableBodyCols, tableBodyRows = _a.tableBodyRows, tableDescription = _a.tableDescription, tableHeadItems = _a.tableHeadItems, tableHeading = _a.tableHeading, totalPages = _a.totalPages;
15
15
  return (react_1.default.createElement("div", null,
16
16
  react_1.default.createElement(vista_table_header_v1_1.VistaTableHeaderV1, { handleSearchInput: handleSearchInput, handleSuffixOnClick: handleSuffixOnClick, headerActions: headerActions, searchDisabled: searchDisabled, searchEnabled: searchEnabled, searchId: searchId, searchPlaceholder: searchPlaceholder, searchValue: searchValue, tableDescription: tableDescription, tableHeading: tableHeading }),
17
17
  react_1.default.createElement("div", { className: "mt-8 inline-block min-w-full py-2 align-middle" },
@@ -19,7 +19,7 @@ var VistaTableV1 = function (_a) {
19
19
  react_1.default.createElement("thead", null,
20
20
  react_1.default.createElement(vista_table_head_v1_1.VistaTableHeadV1, { items: tableHeadItems })),
21
21
  react_1.default.createElement("tbody", { className: "divide-y divide-gray-500 overflow-y-auto" },
22
- react_1.default.createElement(vista_table_body_v1_1.VistaTableBodyV1, { colLength: tableHeadItems.length, loading: loading, pageLimit: pageLimit, rowActions: rowActions, tableBodyCols: tableBodyCols, tableBodyRows: tableBodyRows }))),
22
+ react_1.default.createElement(vista_table_body_v1_1.VistaTableBodyV1, { colLength: tableHeadItems.length, loading: loading, pageLimit: pageLimit, rowActions: rowActions, rowActionsExpressions: rowActionsExpressions, tableBodyCols: tableBodyCols, tableBodyRows: tableBodyRows }))),
23
23
  !loading && (tableBodyRows === null || tableBodyRows === void 0 ? void 0 : tableBodyRows.length) === 0 && (react_1.default.createElement("div", { className: "flex flex-row justify-center p-16" },
24
24
  react_1.default.createElement(empty_table_1.EmptyTable, null))),
25
25
  react_1.default.createElement(vista_table_footer_v1_1.VistaTableFooterV1, { currentPage: currentPage, dir: dir, handleNextOnClick: handleNextOnClick, handleOnSelect: handleOnSelect, handlePreviousOnClick: handlePreviousOnClick, isNextDisabled: isNextDisabled, isPreviousDisabled: isPreviousDisabled, listOptions: listOptions, nextLabel: nextLabel, nodeSelectKey: nodeSelectKey, ofLabel: ofLabel, pageLabel: pageLabel, previousLabel: previousLabel, selectKey1: selectKey1, selectKey2: selectKey2, selectedItem: selectedItem, totalPages: totalPages }))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/app-corp-vista",
3
- "version": "0.3.59",
3
+ "version": "0.3.61",
4
4
  "scripts": {
5
5
  "build": "yarn clean && yarn build:ts && cp package.json lib && cp README.md lib && cp yarn.lock lib",
6
6
  "build:next": "next build",
@@ -142,7 +142,7 @@ exports.byteducatorTemplateV1 = {
142
142
  y: 12,
143
143
  },
144
144
  required: false,
145
- content: 'Type Something...',
145
+ content: '',
146
146
  width: 45,
147
147
  height: 5,
148
148
  rotate: 0,
@@ -152,7 +152,7 @@ exports.byteducatorTemplateV1 = {
152
152
  lineHeight: 1,
153
153
  characterSpacing: 0,
154
154
  fontColor: '#000000',
155
- fontName: 'Roboto',
155
+ fontName: 'font_regular',
156
156
  backgroundColor: '',
157
157
  opacity: 1,
158
158
  strikethrough: false,
@@ -44,20 +44,21 @@ export interface VistaTableV1Props {
44
44
  pageLimit: number;
45
45
  previousLabel?: string;
46
46
  rowActions: RowActionItem[];
47
+ rowActionsExpressions?: ((row: any) => boolean)[];
47
48
  searchDisabled: boolean;
48
49
  searchEnabled?: boolean;
49
50
  searchId: string;
50
51
  searchPlaceholder: string;
51
52
  searchValue: string;
52
- selectKey1: string;
53
- selectKey2?: string;
54
53
  selectedItem: {
55
54
  [key: string]: any;
56
55
  };
56
+ selectKey1: string;
57
+ selectKey2?: string;
57
58
  tableBodyCols: any[];
58
59
  tableBodyRows: any[];
59
60
  tableDescription: string;
60
- tableHeadItems: TableHeadItemV1[];
61
61
  tableHeading: string;
62
+ tableHeadItems: TableHeadItemV1[];
62
63
  totalPages: number;
63
64
  }