Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh breath #502

Open
wants to merge 77 commits into
base: next
Choose a base branch
from
Open
Changes from 6 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
71b755f
[chore]: ignore `.idea`
0x009922 Mar 6, 2023
66574d8
[misc]: migrate to `pnpm`; update deps; wip
0x009922 Mar 7, 2023
ffb8b9d
[misc]: continue cleaning dependencies
0x009922 Mar 7, 2023
2d1886c
[chore]: fix `svgo` version
0x009922 Mar 7, 2023
3fb7319
[refactor]: update `vite-plugin-svg` package
0x009922 Mar 7, 2023
cb0a8b8
[misc]: use stricter TS config
0x009922 Mar 7, 2023
09522f2
[refactor]: update `theme` package
0x009922 Mar 7, 2023
76607f2
[chore]: remove redundant tsconfig.json
0x009922 Mar 7, 2023
08f7ccc
[chore]: update `icons` package
0x009922 Mar 7, 2023
2adc132
[refactor]: migrate Storybook, wip
0x009922 Mar 7, 2023
5ab4e75
[build]: fix `vite.config.ts`
0x009922 Mar 7, 2023
d86b747
[build]: remove API Extractor
0x009922 Mar 7, 2023
aa95526
[build]: update `ui` build
0x009922 Mar 8, 2023
8cc1a33
[test]: pass `vitest` tests
0x009922 Mar 8, 2023
cc940a4
[test]: make Cypress work (but not pass yet)
0x009922 Mar 8, 2023
2f78fb1
[fix] `SModalCard`: set `title` for close button
0x009922 Mar 9, 2023
4620965
[chore]: remove redundant `cypress/plugins`
0x009922 Mar 9, 2023
8e05982
[chore]: convert `vite-plugin-svg` to `type: module`
0x009922 Mar 9, 2023
67b13a7
[chore]: update top-level scripts
0x009922 Mar 9, 2023
62592c3
[chore]: format & lint
0x009922 Mar 9, 2023
1b98710
Set pnpm as packageManager, change node 14 to 16
C4tWithShell Mar 9, 2023
47ac4f8
The same for usual Jenkinsfile
C4tWithShell Mar 9, 2023
06589f0
Change prebuild cmd, revert next.Jenkins
C4tWithShell Mar 9, 2023
08e0d6c
Add cmd
C4tWithShell Mar 9, 2023
ff45611
Add pnpm setup
C4tWithShell Mar 9, 2023
a492342
Install pnpm
C4tWithShell Mar 9, 2023
6f3f06b
Fix cmd
C4tWithShell Mar 9, 2023
ce8f956
Fix cmd
C4tWithShell Mar 9, 2023
81d6022
Fix cmd
C4tWithShell Mar 9, 2023
998e622
Change installation
C4tWithShell Mar 9, 2023
14900f2
Install pnpm globally
C4tWithShell Mar 9, 2023
541b1b3
Merge remote-tracking branch 'origin/next' into fresh-breath
0x009922 Mar 13, 2023
37c4887
[docs]: update README, remove `yarn`
0x009922 Mar 13, 2023
8d67d56
Merge branch 'fresh-breath' of github.com:soramitsu/soramitsu-js-ui-l…
0x009922 Mar 13, 2023
4549d5d
[ci]: remove obsolete `build:theme`
0x009922 Mar 13, 2023
af6ac34
[build]: fix `.d.ts` bundle errors
0x009922 Mar 13, 2023
c1145a0
[chore]: fix format
0x009922 Mar 13, 2023
f874f11
[refactor]: enable `verbatimModuleSyntax`
0x009922 Mar 13, 2023
93da1a4
[chore]: add TODO
0x009922 Mar 13, 2023
6659284
[chore]: ignore stories in `tsconfig.json`
0x009922 Mar 13, 2023
a22b190
Merge branch 'fresh-breath' into 512-stricter-type-script
0x009922 Mar 13, 2023
d8a4cf7
[refactor]: enable `noUnusedParameters`
0x009922 Mar 13, 2023
1fe85f7
[refactor]: fix *some* type errors in Cypress tests
0x009922 Mar 13, 2023
c036a5c
[misc]: add root type-checking script
0x009922 Mar 13, 2023
03a8615
[chore]: fix format
0x009922 Mar 13, 2023
db1ea9b
[refactor]: disallow unreachable code
0x009922 Mar 13, 2023
dceb8d7
[refactor]: enable `exactOptionalPropertyTypes`
0x009922 Mar 13, 2023
2191c40
[refactor]: enable `noImplicitReturns`
0x009922 Mar 13, 2023
e5e1e26
[refactor]: enable `noUncheckedIndexedAccess`
0x009922 Mar 13, 2023
832227b
[docs]: add changesets, belatedly
0x009922 Mar 13, 2023
30424e9
[fix]: refactor heights watcher, close #517
0x009922 Mar 13, 2023
05de048
[fix]: remove props from watch sources
0x009922 Mar 14, 2023
45f987e
[refactor] `STableColumn`: use strict type for `sort-orders`
0x009922 Mar 14, 2023
cc550c2
[chore]: update `test` script
0x009922 Mar 14, 2023
21918f0
[test]: fix Cypress config
0x009922 Mar 14, 2023
7744b14
[test]: revert `.only`
0x009922 Mar 14, 2023
0228216
[build]: fix tsc build configuration
0x009922 Mar 14, 2023
94fd6fb
Merge branch '512-stricter-type-script' into 517-table-heights-watch
0x009922 Mar 14, 2023
a7f17ab
[chore] theme: add `vite` as a dev dep
0x009922 Mar 14, 2023
079b2c0
[chore]: set `vite` as a workspace-level dev dep
0x009922 Mar 14, 2023
fa06a28
test 1
Mar 15, 2023
c41f7ba
adding cypress
Mar 15, 2023
0f6dda5
test 2
Mar 15, 2023
ffc9c3e
delete deprecated parameter
Mar 15, 2023
cb35246
[chore]: remove comment
0x009922 Mar 20, 2023
db29837
[chore]: use released ts 5.0.2
0x009922 Mar 20, 2023
cb972c3
Merge pull request #518 from soramitsu/512-stricter-type-script
0x009922 Mar 21, 2023
91752b4
Merge pull request #519 from soramitsu/517-table-heights-watch
0x009922 Mar 21, 2023
fbc78e3
Update Jenkinsfile
f33r0 Mar 24, 2023
8600146
Merge pull request #522 from soramitsu/feature/dops-2312/test-corepack
f33r0 Apr 4, 2023
e08264b
feauture/dops-2312/use_corepack
Apr 6, 2023
c77cd33
Merge pull request #538 from soramitsu/feauture/dops-2312/use_corepack
f33r0 Apr 12, 2023
cb02f75
Merge branch 'next' into fresh-breath
0x009922 May 2, 2023
c86e712
Update Jenkinsfile
C4tWithShell May 2, 2023
44eb9c0
Update Jenkinsfile
C4tWithShell May 2, 2023
9e37e4c
Update Jenkinsfile
C4tWithShell May 2, 2023
d08f9bb
Update next.Jenkinsfile
C4tWithShell May 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thick-rice-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@soramitsu-ui/ui': minor
---

**refactor**(`STableColumn`): use strict type for `sort-orders` prop -- it should be 1-3 length array without duplications
2 changes: 1 addition & 1 deletion packages/theme/package.json
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
"src"
],
"scripts": {
"test": "vitest"
"test": "vitest run"
},
"devDependencies": {
"sass": "^1.49.0"
3 changes: 1 addition & 2 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
"build:clean": "del dist ts-build",
"build:vite": "vite build",
"build:dts": "run-s build:dts:tsc build:dts:rollup",
"build:dts:tsc": "vue-tsc --outDir ts-build --declaration --emitDeclarationOnly",
"build:dts:tsc": "vue-tsc -p tsconfig.build.json",
"build:dts:rollup": "rollup -c rollup.dts.config.cjs"
},
"dependencies": {
@@ -42,7 +42,6 @@
"focus-trap": "^7.3",
"jsoneditor": "^9.5",
"lodash-es": "^4.17",
"tiny-invariant": "^1.3",
"type-fest": "^3.6",
"vue": "^3.2"
},
12 changes: 6 additions & 6 deletions packages/ui/src/components/Table/STableColumn.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { defineComponent, type PropType } from 'vue'
import { type TableActionColumnApi, type TableColumnApi, useTableApi } from '@/components'
import { uniqueElementId } from '@/util'
import { usePropTypeFilter } from '@/composables/prop-type-filter'
import { TABLE_COLUMN_ALIGN_VALUES, TABLE_COLUMN_TYPE_VALUES } from '@/components/Table/consts'
import { TABLE_COLUMN_ALIGN_VALUES, TABLE_COLUMN_TYPE_VALUES } from './consts'
import type {
TableColumnCellValueFormatter,
TableColumnRowSelectableFunc,
TableColumnSortBy,
TableColumnSortOrder,
TableColumnSortOrders,
TableColumnAlign,
TableColumnType,
} from './types'
import type { TableColumnWidthProps } from './api'
import { useTableApi } from './api'
import type { TableColumnWidthProps, TableActionColumnApi, TableColumnApi } from './api'

export default /* @__PURE__ */ defineComponent({
name: 'STableColumn',
@@ -81,8 +81,8 @@ export default /* @__PURE__ */ defineComponent({
* Accepts an array, as the user clicks on the header, the column is sorted in order of the elements in the array
*/
sortOrders: {
type: Array as PropType<TableColumnSortOrder[]>,
default: () => ['ascending', 'descending', null],
type: Array as unknown as PropType<TableColumnSortOrders>,
default: (): TableColumnSortOrders => ['ascending', 'descending', null],
},
/**
* Function that formats cell content
4 changes: 2 additions & 2 deletions packages/ui/src/components/Table/api.ts
Original file line number Diff line number Diff line change
@@ -4,9 +4,9 @@ import type {
TableColumnCellValueFormatter,
TableColumnRowSelectableFunc,
TableColumnSortBy,
TableColumnSortOrder,
TableColumnAlign,
TableRow,
TableColumnSortOrders,
} from './types'

export interface TableColumnWidthProps {
@@ -23,7 +23,7 @@ export interface TableColumnSortProps {
sortable: boolean | 'custom'
sortMethod: (<T extends TableRow>(a: T, b: T) => number) | null
sortBy: TableColumnSortBy
sortOrders: TableColumnSortOrder[]
sortOrders: TableColumnSortOrders
}

export interface TableCommonColumnApi extends TableColumnWidthProps, TableColumnAlignProps, TableColumnSortProps {
11 changes: 10 additions & 1 deletion packages/ui/src/components/Table/types.ts
Original file line number Diff line number Diff line change
@@ -24,7 +24,16 @@ export type TableColumnCellValueFormatter = (
export type TableColumnSortByPropKeyFunc = (row: TableRow, index: number) => string
export type TableColumnRowSelectableFunc = (row: TableRow, index: number) => boolean
export type TableColumnSortBy = string | TableColumnSortByPropKeyFunc | (TableColumnSortByPropKeyFunc | string)[]
export type TableColumnSortOrder = 'ascending' | 'descending' | null
export type TableColumnSortOrder = TableColumnSortOrders[0]
export type TableColumnSortOrders =
| OptionalNonEmptyTriple<['ascending', 'descending', null]>
| OptionalNonEmptyTriple<['ascending', null, 'descending']>
| OptionalNonEmptyTriple<['descending', 'ascending', null]>
| OptionalNonEmptyTriple<['descending', null, 'ascending']>
| OptionalNonEmptyTriple<[null, 'ascending', 'descending']>
| OptionalNonEmptyTriple<[null, 'descending', 'ascending']>

type OptionalNonEmptyTriple<T extends [any, any, any]> = [T[0], T[1]?, T[2]?]

export interface TableRowConfigCallbackParams {
row: TableRow
10 changes: 4 additions & 6 deletions packages/ui/src/components/Table/use-column-sort.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ import type { Ref } from 'vue'
import type { TableColumnApi } from './api'
import type { TableColumnSortOrder, TableRow } from './types'
import { get } from 'lodash-es'
import invariant from 'tiny-invariant'

export function useColumnSort(data: Ref<TableRow[]>) {
const sortState: { column: TableColumnApi | null; order: TableColumnSortOrder } = shallowReactive({
@@ -16,11 +15,10 @@ export function useColumnSort(data: Ref<TableRow[]>) {
sortState.order = null
}

function getNextOrder(column: TableColumnApi, order: TableColumnSortOrder) {
const index = column.sortOrders.indexOf(order)
const item = column.sortOrders[(index + 1) % column.sortOrders.length]
invariant(item)
return item
function getNextOrder(column: TableColumnApi, order: TableColumnSortOrder): TableColumnSortOrder {
const array = column.sortOrders
// `!` is safe because of `%` and array's non-emptiness
return array[(array.indexOf(order) + 1) % array.length]!
}

function getKey(column: TableColumnApi, { value, index }: { value: TableRow; index: number }) {
9 changes: 9 additions & 0 deletions packages/ui/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"include": ["src", "auto-imports.d.ts"],
"compilerOptions": {
"outDir": "ts-build",
"declaration": true,
"emitDeclarationOnly": true
}
}
6 changes: 6 additions & 0 deletions packages/ui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -10,6 +10,12 @@
// not really works within Vue templates
"exactOptionalPropertyTypes": false
},
"ts-node": {
"compilerOptions": {
// Cypress conflicts with `verbatimModuleSyntax`
"verbatimModuleSyntax": false
}
},
"include": ["."],
"exclude": ["dist", "ts-build", "cypress", "test", "storybook-static", "stories"]
}
64 changes: 29 additions & 35 deletions pnpm-lock.yaml

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