Skip to content

Commit

Permalink
Support array types in fields (#31)
Browse files Browse the repository at this point in the history
* Support array types in fields

* Update pipelines

* Updated changelog
  • Loading branch information
fdc-viktor-luft committed May 13, 2024
1 parent 641e215 commit f6dd897
Show file tree
Hide file tree
Showing 9 changed files with 3,371 additions and 2,625 deletions.
16 changes: 8 additions & 8 deletions .github/actions/pnpm-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ inputs:
runs:
using: "composite"
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
env:
NODE_VERSION: "16.14"
NODE_VERSION: "20"
with:
node-version: "${{ env.NODE_VERSION }}"
- name: Install pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4
id: pnpm-install
with:
version: 7
version: 9
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ env.NODE_VERSION }}-${{ hashFiles('**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-pnpm-store-${{ env.NODE_VERSION }}-${{ inputs.target }}-${{ hashFiles(format('{0}/pnpm-lock.yaml', inputs.target)) }}
restore-keys: |
${{ runner.os }}-pnpm-store-${{ env.NODE_VERSION }}-
${{ runner.os }}-pnpm-store-${{ env.NODE_VERSION }}-${{ inputs.target }}-
- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/pnpm-install
with:
target: '.'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/pnpm-install
with:
target: '.'
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Build docs
run: pnpm docs:build
- name: Upload Artifacts
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: 'build/'

Expand All @@ -41,4 +41,4 @@ jobs:
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
}
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.1.1] - 2023-05-13

### Fixed

- Improved types to properly support array form fields

## [2.1.0] - 2023-09-13

### Added
Expand Down
4 changes: 2 additions & 2 deletions docs/src/samples/first/FirstSample.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback, useState } from 'react';
import { Validators } from '../../validators/validators';
import { Morfi } from 'morfi';
import { Morfi, type FormValidation } from 'morfi';
import { type Gender, type Person, PersonTable } from './PersonTable';
import { FormSelect, type SelectOption } from '../../fields/FormSelect';
import { FormNumberInput } from '../../fields/FormNumberInput';
Expand All @@ -16,7 +16,7 @@ type MyFormValues = {

const initialValues: MyFormValues = { firstName: 'Nick', lastName: '', gender: 'M', age: 21 };

const validation = {
const validation: FormValidation<MyFormValues> = {
firstName: { onChange: Validators.string({ min: 1, max: 10 }) },
lastName: { onBlur: Validators.string({ min: 1, max: 10 }) },
age: { onChange: Validators.number({ minLength: 1, maxLength: 3 }) },
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "morfi",
"version": "2.1.0",
"version": "2.1.1",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
"types": "dist/index.d.ts",
Expand Down
Loading

0 comments on commit f6dd897

Please sign in to comment.