generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from danielo515/feat/dependent-fields
Feat/dependent-fields
- Loading branch information
Showing
29 changed files
with
783 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ meta.json | |
site/ | ||
docs/index.md | ||
docs/changelog.md | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: Release notes for 1.4x.0 | ||
date: 2024-06-29 | ||
tags: release-notes | ||
--- | ||
|
||
This is a very exciting release for me, because it includes one of the features that I have been wanting to implement for a long time, and also one of the most requested features. But it also includes some minor improvements, so let's take those first: | ||
|
||
- The placeholder of the label is set by default to the name of the field. This will make it easier for people to understand that the default label value is the name of the field. | ||
|
||
Now the big feature: | ||
|
||
## **Dependent fields** | ||
|
||
As with every new feature, I like to start small, so this first version is very simple. | ||
It just settles the basic foundation and works only with the most basic field types. | ||
This will allow me to gather feedback and improve it in the next releases after making sure that the basic functionality is working as expected. | ||
|
||
In this first approach there are not many safeguards either, so you can end up in forms that don't render anything, for example because of with fields that are excluding each other. I don't think this is going to be a big problem in practice, but I will be monitoring the feedback to see if it is necessary to add some kind of validation, or at least some kind of warning. | ||
The reason I am not adding it any limitations in this first version is because flexibility: forms can be called with parameters to omit fields, default values, etc. and I don't want to limit that flexibility. | ||
|
||
Here are some screenshots of the feature in action. | ||
|
||
Form builder: | ||
|
||
![boolean comparison](<conditional-boolean.png>) | ||
![string comparison](<conditional-string.png>) | ||
|
||
Form in preview mode with the condition met | ||
![condition met](<condition-met.png>) | ||
with the condition not met | ||
![condition not met](<condition-not-met.png>) | ||
|
||
This first iteration is purely visual: just because a field is hidden it does not mean that, if it has a value, is not going to be included in the result. If you fill a field, and then do something that makes it hidden, the value will still be included in the result. I think in practice most people just needs a way to start with several fields hidden, and then show them based on the value of other fields, so I think this is a good first approach. | ||
|
||
The wording of the feature is not final, I'm not very satisfied with the current wording, so I'm open to suggestions. | ||
I hope you like it, that it does not introduce too many inconveniences and that it is useful to you. | ||
|
||
Please let me know your thoughts and suggestions. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
import { type JestConfigWithTsJest } from 'ts-jest' | ||
import { type JestConfigWithTsJest } from "ts-jest"; | ||
|
||
const jestConfig: JestConfigWithTsJest = { | ||
// preset: 'ts-jest/presets/default-esm', // or other ESM presets | ||
preset: 'ts-jest', // or other ESM presets | ||
moduleDirectories: ['node_modules', '<rootDir>'], | ||
roots: ['src'], | ||
preset: "ts-jest", // or other ESM presets | ||
moduleDirectories: ["node_modules", "<rootDir>"], | ||
roots: ["src"], | ||
moduleNameMapper: { | ||
'^@std$': '<rootDir>/src/std/$1', | ||
"^@std$": "<rootDir>/src/std/$1", | ||
"^@core$": "<rootDir>/src/core/$1", | ||
}, | ||
transformIgnorePatterns: ['node_modules/(?!(svelte)/)'], | ||
transformIgnorePatterns: ["node_modules/(?!(svelte)/)"], | ||
transform: { | ||
'^.+\\.(t|j)sx?$': [ | ||
'ts-jest', | ||
"^.+\\.(t|j)sx?$": [ | ||
"ts-jest", | ||
{ | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
} | ||
export default jestConfig | ||
}; | ||
export default jestConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * as input from "./InputDefinitionSchema"; | ||
export * as input from "./input"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.