Skip to content

Commit

Permalink
1.0.15 - optimizing TypeScript API to not have to use enums for prope…
Browse files Browse the repository at this point in the history
…rties
  • Loading branch information
OvidijusParsiunas committed Nov 12, 2023
1 parent 4c7a498 commit db9de44
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 47 deletions.
4 changes: 2 additions & 2 deletions component/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion component/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "active-table",
"version": "1.0.14",
"version": "1.0.15",
"description": "Framework agnostic table component for editable data experience",
"main": "./dist/activeTable.js",
"module": "./dist/activeTable.js",
Expand Down
4 changes: 2 additions & 2 deletions component/src/activeTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ import {StickyPropsUtils} from './utils/stickyProps/stickyPropsUtils';
import {ExportSingleFile, Files, ImportOptions} from './types/files';
import {ActiveOverlayElements} from './types/activeOverlayElements';
import {CellHighlightUtils} from './utils/color/cellHighlightUtils';
import {DEFAULT_COLUMN_TYPES_STR} from './enums/defaultColumnTypes';
import {ColumnsSettingsMap} from './types/columnsSettingsInternal';
import {ExportFile, ImportFile} from './types/fileTriggerMethods';
import {customElement, property, state} from 'lit/decorators.js';
import {RowDropdownSettings} from './types/rowDropdownSettings';
import {StripedRowsInternal} from './types/stripedRowsInternal';
import {DEFAULT_COLUMN_TYPES} from './enums/defaultColumnTypes';
import {DefaultCellHoverColors} from './types/cellStateColors';
import {WindowElement} from './elements/window/windowElement';
import {UserKeyEventsState} from './types/userKeyEventsState';
Expand Down Expand Up @@ -268,7 +268,7 @@ export class ActiveTable extends LitElement {
isColumnResizable?: boolean;

@property({type: Array})
availableDefaultColumnTypes?: DEFAULT_COLUMN_TYPES[]; // this will reduce the default types to ones included here
availableDefaultColumnTypes?: DEFAULT_COLUMN_TYPES_STR[]; // this will reduce the default types to ones included here

@property({type: Array})
customColumnTypes?: ColumnTypes; // additional custom column types
Expand Down
10 changes: 10 additions & 0 deletions component/src/enums/defaultColumnTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@ export enum DEFAULT_COLUMN_TYPES {
SELECT = 'Select',
LABEL = 'Label',
}

export type DEFAULT_COLUMN_TYPES_STR =
| 'Text'
| 'Number'
| 'Currency'
| 'Date d-m-y'
| 'Date m-d-y'
| 'Checkbox'
| 'Select'
| 'Label';
4 changes: 2 additions & 2 deletions component/src/types/columnType.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {LabelOptions, SelectOptions, CellDropdownT} from './cellDropdown';
import {DEFAULT_COLUMN_TYPES} from '../enums/defaultColumnTypes';
import {DEFAULT_COLUMN_TYPES_STR} from '../enums/defaultColumnTypes';
import {CustomTextProcessing} from './customTextProcessing';
import {IconSettings} from './dropdownButtonItem';
import {Calendar} from './calendarFunctionality';
Expand All @@ -10,7 +10,7 @@ import {Sorting} from './sorting';
// This is to be used by the client exclusively

// can reuse one of the existing icons
export type ColumnIconSettings = InterfacesUnion<{reusableIconName: DEFAULT_COLUMN_TYPES} | IconSettings>;
export type ColumnIconSettings = InterfacesUnion<{reusableIconName: DEFAULT_COLUMN_TYPES_STR} | IconSettings>;

interface Parent {
name: string;
Expand Down
5 changes: 3 additions & 2 deletions component/src/utils/columnSettings/columnSettingsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import {DefaultColumnsSettings} from '../../types/columnsSettingsDefault';
import {ColumnSettingsBorderUtils} from './columnSettingsBorderUtils';
import {ColumnSettingsStyleUtils} from './columnSettingsStyleUtils';
import {ColumnSettingsWidthUtils} from './columnSettingsWidthUtils';
import {DEFAULT_COLUMN_TYPES} from '../../enums/defaultColumnTypes';
import {ColumnTypesUtils} from '../columnType/columnTypesUtils';
import {ResetColumnStructure} from './resetColumnStructure';
import {CellElement} from '../../elements/cell/cellElement';
import {GenericObject} from '../../types/genericObject';
import {ActiveTable} from '../../activeTable';
import {EMPTY_STRING} from '../../consts/text';
import {ActiveTable} from '../../activeTable';

export class ColumnSettingsUtils {
private static updateSizer(at: ActiveTable, columnIndex: number) {
Expand Down Expand Up @@ -118,7 +119,7 @@ export class ColumnSettingsUtils {

private static setDefaultTypeProperties(at: ActiveTable) {
const {_defaultColumnsSettings} = at;
_defaultColumnsSettings.availableDefaultColumnTypes = at.availableDefaultColumnTypes;
_defaultColumnsSettings.availableDefaultColumnTypes = at.availableDefaultColumnTypes as DEFAULT_COLUMN_TYPES[];
_defaultColumnsSettings.customColumnTypes = at.customColumnTypes;
_defaultColumnsSettings.defaultColumnTypeName = at.defaultColumnTypeName;
_defaultColumnsSettings.types = ColumnTypesUtils.getProcessedTypes(_defaultColumnsSettings);
Expand Down
18 changes: 9 additions & 9 deletions other-packages/react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions other-packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "active-table-react",
"version": "1.0.14",
"version": "1.0.15",
"description": "Active Table wrapper for React",
"main": "./dist/activeTable.js",
"module": "./dist/activeTable.js",
Expand Down Expand Up @@ -33,7 +33,7 @@
"license": "MIT",
"dependencies": {
"@lit-labs/react": "^1.1.1",
"active-table": "1.0.14"
"active-table": "1.0.15"
},
"devDependencies": {
"@types/react": "^18.0.28",
Expand Down
2 changes: 1 addition & 1 deletion website/docs/docs/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ npm install active-table-react
Access the component via CDN:

```
https://unpkg.com/active-table@1.0.14/dist/activeTable.bundle.js
https://unpkg.com/active-table@1.0.15/dist/activeTable.bundle.js
```
6 changes: 3 additions & 3 deletions website/docs/examples/design.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Basic examples to help you get started with Active Table.

### Unique column types {#uniqueColumnTypes}

This example makes use of the [`customColumnsSettings`](../docs/column#customColumnsSettings) property to set static types for individual columns. The _Date Created_
This example makes use of the [`customColumnsSettings`](/docs/column#customColumnsSettings) property to set static types for individual columns. The _Date Created_
column has two available date formats.

import TableContainerProgrammaticUpdates from '@site/src/components/table/tableContainerProgrammaticUpdates';
Expand Down Expand Up @@ -197,8 +197,8 @@ Table configuration for a dark design.

### Dynamic updates {#dynamicUpdates}

The programmatic cell update functionality is provided by the [`updateCell`](../docs/methods#updateCell) method that exists on the component element reference.
The example additionally makes use of properties like [`customColumnsSettings`](../docs/column#customColumnsSettings) and [`stripedRows`](../docs/row#stripedRows)
The programmatic cell update functionality is provided by the [`updateCell`](/docs/methods#updateCell) method that exists on the component element reference.
The example additionally makes use of properties like [`customColumnsSettings`](/docs/column#customColumnsSettings) and [`stripedRows`](/docs/row#stripedRows)
to set a stock related look. Whilst all of the columns are set to not be editable, the _Stock_ column allows its data to be changed and its rows to be sorted.

<TableContainerProgrammaticUpdates isStock={true} minHeight="300">
Expand Down
2 changes: 1 addition & 1 deletion website/docs/examples/files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ declare global {

## Examples

React project that uses a package bundler - should work similarly for other [Frameworks](./frameworks):
React project that uses a package bundler - should work similarly for other [Frameworks](/examples/frameworks):

[Click for Live Example](https://codesandbox.io/s/active-table-react-xlsx-h3j7rq?file=/src/App.tsx)

Expand Down
42 changes: 21 additions & 21 deletions website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@docusaurus/preset-classic": "^2.3.0",
"@docusaurus/theme-search-algolia": "^2.3.1",
"@mdx-js/react": "^1.6.22",
"active-table-react": "^1.0.14",
"active-table-react": "^1.0.15",
"clsx": "^1.2.1",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
Expand Down

0 comments on commit db9de44

Please sign in to comment.