react-ui-basics 0.0.163 → 0.0.166

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/Table.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ChangeEvent, Component, ReactElement } from 'react';
1
+ import { ChangeEvent, Component, ReactElement, SyntheticEvent } from 'react';
2
2
  import './Table.css';
3
3
  export declare const SORT_ASC: string;
4
4
  export declare const SORT_DESC: string;
@@ -10,7 +10,7 @@ export interface RowProps<T> {
10
10
  item: T;
11
11
  disabled?: (t: T) => boolean;
12
12
  editing: any;
13
- onClick?: (t: T) => void;
13
+ onClick?: (t: T, e: SyntheticEvent) => void;
14
14
  className?: string | ((e: T) => string);
15
15
  columns: TableColumn<T>[];
16
16
  cancelEditing: () => void;
@@ -19,7 +19,7 @@ export interface RowProps<T> {
19
19
  setValue: (v: any) => void;
20
20
  setEditing: (t: T, i: number, field: string) => void;
21
21
  }
22
- export declare type Formatter<T, V> = ((value?: V, item?: T, format?: string) => ReactElement) | ((value: V, item: T) => ReactElement) | ((value: V) => ReactElement);
22
+ export declare type Formatter<T, V> = ((value?: V, item?: T, format?: string) => ReactElement | string) | ((value: V, item: T) => ReactElement | string) | ((value: V) => ReactElement | string);
23
23
  export interface TableColumn<T> {
24
24
  field?: string;
25
25
  className?: string;
@@ -40,7 +40,7 @@ export interface TableProps<T> {
40
40
  sortOrder?: SortOrder;
41
41
  sortBy?: string;
42
42
  onSortChange?: (sortBy: string, sortOrder: SortOrder) => void;
43
- onRowClick?: (t: T) => void;
43
+ onRowClick?: (t: T, e: SyntheticEvent) => void;
44
44
  disabled?: (t: T) => boolean;
45
45
  toKey?: (t: T) => number | string;
46
46
  onChange?: (t: T, cancel: () => void) => void;
package/Table.js CHANGED
@@ -5,6 +5,7 @@ import { jsxs as jsxRuntime_1, jsx as jsxRuntime_2 } from 'react/jsx-runtime';
5
5
  import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers";
6
6
  import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers";
7
7
  import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
8
+ import './Table.css';
8
9
  import { Component } from 'react';
9
10
  import TextField from './TextField.js';
10
11
  import AutocompleteSelect, { MODE_MULTIPLE_MINI, MODE_DEFAULT } from './AutocompleteSelect.js';
@@ -85,8 +86,8 @@ var Table = /** @class */ (function (_super) {
85
86
  setData(dataState(), sortBy, sortOrder, comparator);
86
87
  };
87
88
  _this[ReactConstants[0]] = function () {
88
- var _a = props(), sortBy = _a.sortBy, _b = _a.sortOrder, sortOrder = _b === void 0 ? SORT_ASC : _b, columns = _a.columns;
89
- setData(dataState(), sortBy, sortOrder, comparatorGetter(columns.find(function (it) { return it.field === sortBy; })));
89
+ var _a = props(), sortBy = _a.sortBy, _b = _a.sortOrder, sortOrder = _b === void 0 ? SORT_ASC : _b, columns = _a.columns, data = __data(_a);
90
+ setData(data, sortBy, sortOrder, comparatorGetter(columns.find(function (it) { return it.field === sortBy; })));
90
91
  updateHeaders();
91
92
  updateHeadersInterval = setInterval(updateHeaders, 1000);
92
93
  };
@@ -130,7 +131,7 @@ var Row = /** @class */ (function (_super) {
130
131
  }
131
132
  Row.prototype[ReactConstants[3]] = function () {
132
133
  var _a = __props(this), item = _a.item, disabled = _a.disabled, editing = _a.editing, onClick = _a[ReactConstants[6]], className = _a[ReactConstants[5]], columns = _a.columns, setEditing = _a.setEditing, cancelEditing = _a.cancelEditing, onFinishEditing = _a.onFinishEditing, handleInputChange = _a.handleInputChange, setValue = _a.setValue;
133
- return jsxRuntime_2("tr", __extends({ [ReactConstants[6]]: function (e) { return onClick(item); }, [ReactConstants[5]]: classNames(disabled && disabled(item) && 'disabled', className && (isFunction(className) ? className(item) : className)) }, { [ReactConstants[4]]: columns.filter(function (it) { return !!it; }).map(function (column, i) {
134
+ return jsxRuntime_2("tr", __extends({ [ReactConstants[6]]: function (e) { return onClick(item, e); }, [ReactConstants[5]]: classNames(disabled && disabled(item) && 'disabled', className && (isFunction(className) ? className(item) : className)) }, { [ReactConstants[4]]: columns.filter(function (it) { return !!it; }).map(function (column, i) {
134
135
  var isEditing = editing && editing.columnIndex === i;
135
136
  var editable = isFunction(column.editable) ? column.editable(item) : !!column.editable;
136
137
  return (jsxRuntime_1("td", __extends({ [ReactConstants[5]]: classNames(editable ? 'editable' : 'ro', isEditing && 'editing', column[ReactConstants[5]]), [ReactConstants[6]]: !isEditing && editable ? function () { return setEditing(item, i, column.field); } : NOOP }, { [ReactConstants[4]]: [(isEditing || column.displayEditor) && !column.editor && (jsxRuntime_2(TextField, { value: column.preEditor ? column.preEditor(__value(editing)) : __value(editing), focused: true, onBlur: cancelEditing, [ReactConstants[7]]: handleInputChange, onKeyDown: function (e) {
package/TextField.js CHANGED
@@ -4,6 +4,7 @@ import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _
4
4
  import {toConsumableArray as __toConsumableArray} from "./_virtual/_rollupPluginBabelHelpers";
5
5
  import {extends as __extends} from "./_virtual/_rollupPluginBabelHelpers";
6
6
  import {inherits as __inherits} from "./_virtual/_rollupPluginBabelHelpers";
7
+ import './TextField.css';
7
8
  import 'react';
8
9
  import ReactCreateElement from './ReactCreateElement.js';
9
10
  import { classNames, isUndefined, orNoop, addEventListener, getRandomId, createRef, setTimeout } from './Tools.js';