-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generated mat-form-field but it's very wonky
- Loading branch information
1 parent
1d07a0e
commit a000c92
Showing
19 changed files
with
332 additions
and
10 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
` | ||
|
||
form_field"MatFormField*mat-form-field22 | ||
@angular/material/form-fieldMatFormFieldModule! | ||
hideRequiredMarkerboolean9 | ||
color" | ||
primary | ||
accent | ||
warnprimaryThemePalette6 | ||
|
||
floatLabel | ||
always | ||
autoalwaysFloatLabelType= | ||
|
||
appearance | ||
fill | ||
outlinefillMatFormFieldAppearance= | ||
subscriptSizing | ||
fixed | ||
dynamicfixedSubscriptSizing | ||
hintLabelstring |
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,84 @@ | ||
{ | ||
"input": { | ||
"name": "form_field", | ||
"targetClass": "MatFormField", | ||
"hasContent": true, | ||
"elementName": "mat-form-field", | ||
"tsFilename": "", | ||
"directiveNamesList": [], | ||
"nativeEventsList": [], | ||
"skipPropertyNamesList": [], | ||
"ngModule": { | ||
"importPath": "@angular/material/form-field", | ||
"moduleName": "MatFormFieldModule", | ||
"otherSymbolsList": [] | ||
} | ||
}, | ||
"inputPropsList": [ | ||
{ | ||
"name": "hideRequiredMarker", | ||
"alias": "", | ||
"type": { | ||
"simpleType": 2 | ||
}, | ||
"debugType": "boolean" | ||
}, | ||
{ | ||
"name": "color", | ||
"alias": "", | ||
"type": { | ||
"simpleType": 0, | ||
"stringLiterals": { | ||
"stringLiteralList": ["primary", "accent", "warn"], | ||
"defaultValue": "primary" | ||
} | ||
}, | ||
"debugType": "ThemePalette" | ||
}, | ||
{ | ||
"name": "floatLabel", | ||
"alias": "", | ||
"type": { | ||
"simpleType": 0, | ||
"stringLiterals": { | ||
"stringLiteralList": ["always", "auto"], | ||
"defaultValue": "always" | ||
} | ||
}, | ||
"debugType": "FloatLabelType" | ||
}, | ||
{ | ||
"name": "appearance", | ||
"alias": "", | ||
"type": { | ||
"simpleType": 0, | ||
"stringLiterals": { | ||
"stringLiteralList": ["fill", "outline"], | ||
"defaultValue": "fill" | ||
} | ||
}, | ||
"debugType": "MatFormFieldAppearance" | ||
}, | ||
{ | ||
"name": "subscriptSizing", | ||
"alias": "", | ||
"type": { | ||
"simpleType": 0, | ||
"stringLiterals": { | ||
"stringLiteralList": ["fixed", "dynamic"], | ||
"defaultValue": "fixed" | ||
} | ||
}, | ||
"debugType": "SubscriptSizing" | ||
}, | ||
{ | ||
"name": "hintLabel", | ||
"alias": "", | ||
"type": { | ||
"simpleType": 1 | ||
}, | ||
"debugType": "string" | ||
} | ||
], | ||
"outputPropsList": [] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
load("//mesop/components:defs.bzl", "mesop_component") | ||
|
||
package( | ||
default_visibility = ["//build_defs:mesop_internal"], | ||
) | ||
|
||
mesop_component( | ||
name = "form_field", | ||
) |
Empty file.
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,13 @@ | ||
load("//build_defs:defaults.bzl", "py_library") | ||
|
||
package( | ||
default_visibility = ["//build_defs:mesop_internal"], | ||
) | ||
|
||
py_library( | ||
name = "e2e", | ||
srcs = glob(["*.py"]), | ||
deps = [ | ||
"//mesop", | ||
], | ||
) |
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 @@ | ||
from . import form_field_app as form_field_app |
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,10 @@ | ||
import mesop as me | ||
|
||
|
||
@me.page(path="/components/form_field/e2e/form_field_app") | ||
def app(): | ||
me.text(text="Hello, World!") | ||
me.input() | ||
with me.form_field(): | ||
me.input() | ||
me.text(text="Another") |
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,8 @@ | ||
import {test, expect} from '@playwright/test'; | ||
|
||
test('test', async ({page}) => { | ||
await page.goto('/components/form_field/e2e/form_field_app'); | ||
expect(await page.getByText('Hello, world!').textContent()).toContain( | ||
'Hello, world!', | ||
); | ||
}); |
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,14 @@ | ||
<mat-form-field | ||
[hideRequiredMarker]="config().getHideRequiredMarker()" | ||
[color]="getColor()" | ||
[floatLabel]="getFloatLabel()" | ||
[appearance]="getAppearance()" | ||
[subscriptSizing]="getSubscriptSizing()" | ||
[hintLabel]="config().getHintLabel()" | ||
> | ||
<!-- <div> | ||
</div> --> | ||
<ng-content></ng-content> | ||
<input matInput hidden /> | ||
</mat-form-field> |
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,13 @@ | ||
|
||
syntax = "proto3"; | ||
|
||
package mesop.components.form_field; | ||
|
||
message FormFieldType { | ||
bool hide_required_marker = 1; | ||
string color = 2; | ||
string float_label = 3; | ||
string appearance = 4; | ||
string subscript_sizing = 5; | ||
string hint_label = 6; | ||
} |
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,36 @@ | ||
from typing import Literal | ||
|
||
from pydantic import validate_arguments | ||
|
||
import mesop.components.form_field.form_field_pb2 as form_field_pb | ||
from mesop.component_helpers import ( | ||
insert_composite_component, | ||
) | ||
|
||
|
||
@validate_arguments | ||
def form_field( | ||
*, | ||
key: str | None = None, | ||
hide_required_marker: bool = False, | ||
color: Literal["primary", "accent", "warn"] = "primary", | ||
float_label: Literal["always", "auto"] = "always", | ||
appearance: Literal["fill", "outline"] = "fill", | ||
subscript_sizing: Literal["fixed", "dynamic"] = "fixed", | ||
hint_label: str = "", | ||
): | ||
""" | ||
TODO_doc_string | ||
""" | ||
return insert_composite_component( | ||
key=key, | ||
type_name="form_field", | ||
proto=form_field_pb.FormFieldType( | ||
hide_required_marker=hide_required_marker, | ||
color=color, | ||
float_label=float_label, | ||
appearance=appearance, | ||
subscript_sizing=subscript_sizing, | ||
hint_label=hint_label, | ||
), | ||
) |
Oops, something went wrong.