Refactor Schema editor: declarative ConstraintAttributesEditor#808
Draft
alistair3149 wants to merge 10 commits intoconstraint-interpreterfrom
Draft
Refactor Schema editor: declarative ConstraintAttributesEditor#808alistair3149 wants to merge 10 commits intoconstraint-interpreterfrom
alistair3149 wants to merge 10 commits intoconstraint-interpreterfrom
Conversation
Removes TextAttributesEditor.vue and its test, which are superseded by the generic ConstraintAttributesEditor. Updates the property type registry to wire the text type to ConstraintAttributesEditor.
- Remove DateTimeAttributesEditor import and usage from NeoWikiExtension.ts - Update dateTime registration to use ConstraintAttributesEditor - Remove DateTimeAttributesEditor re-export from public-api.ts - Delete DateTimeAttributesEditor.vue and its test
…ptions chip SelectAttributesEditor now renders ConstraintAttributesEditor (which handles the multiple-toggle constraint attribute) followed by the existing options chip input. The multiple toggle behavior is declared in SelectType.getConstraintAttributes() from Task 1, making ConstraintAttributesEditor responsible for that UI. The options chip input remains as the structural editor for the select values themselves, preserving the duplicate-label validation.
External TS extensions subclassing BasePropertyType need ConstraintAttributeKind to satisfy the getConstraintAttributes() return-type signature, mirroring the Constraint export added alongside the validation refactor.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #807. Base branch is
constraint-interpreter. Once #807 merges to master, change this PR's base to master.Summary
getConstraintAttributes(): ConstraintAttributeKind[]method onBasePropertyType.ConstraintAttributesEditor.vuereads those declarations and renders the corresponding helpers (MultipleToggle,UniqueItemsToggle,IntegerRange,NumericRange,DateTimeRange).ConstraintAttributesEditordirectly. Three keep a thin wrapper for genuinely structural attributes (Number'sprecision, Select'soptions, Relation's TODO placeholder).Details
domain/ConstraintAttributeKind.tsexporting a 5-member string union (multiple-toggle,unique-items-toggle,integer-range,numeric-range,datetime-range). Field names are conventional (e.g.,integer-rangealways reads/writesproperty.minLength/property.maxLength).BasePropertyType.getConstraintAttributes()is non-abstract with default[]. Text/Url/Number/DateTime/Select override; Relation relies on the default.ConstraintAttributesEditor.vuelooks upproperty.typein the registry, retrievesgetConstraintAttributes(), and renders helpers viav-if="kinds.includes('...')".MultipleToggle:property.multipletoggle.UniqueItemsToggle:property.uniqueItemstoggle,v-if-gated onproperty.multiple.IntegerRange:property.minLength/property.maxLengthpositive-integer pair with format + min-exceeds-max checks.NumericRange:property.minimum/property.maximumnumeric pair with min-exceeds-max check.DateTimeRange:property.minimum/property.maximumISO-8601 pair viatoLocalInputValue/fromLocalInputValue, with lexicographic min-exceeds-max compare.ConstraintAttributeKindexported frompublic-api.tsso external TS extensions subclassingBasePropertyTypecan satisfy the contract (parallel to how PR Refactor frontend validation: declarative constraints + interpreter #807 exportedConstraint).<ConstraintAttributesEditor>+ structural inputs. NewPrecisionInput.vuefor Number's non-negative-integerprecision(allows 0, unlike IntegerRange's positive-integer-only).ConstraintAttributesEditor.spec.ts(40 tests) covers the equivalent of every scenario from the deleted Text/Url/DateTime editor specs, including the DateTime emit-conversion viafromLocalInputValue/toLocalInputValue.TextAttributesEditor.vue,UrlAttributesEditor.vue,DateTimeAttributesEditor.vue. Their test specs deleted too.NumberAttributesEditor.spec.tsslimmed to precision-only tests.Out of scope
requiredtoConstraintAttributesEditor—requiredlives inPropertyDefinitionEditorand stays there.multiple-toggleto types that don't currently expose it (Number, DateTime, Relation) — that's a behavior change, not a refactor.defaultvalue editor.AttributesEditorContract.tsorPropertyDefinitionEditor.vue.Manual Browser Check
0,-5,5.5, and a min > max combination — each should show the appropriate error and disable any save action).Local URLs to navigate from: http://localhost:8484/index.php/Special:Schemas
Test plan
make tscigreen (build + 815 tests across 77 files + lint)ConstraintAttributesEditor.spec.tscover the equivalent of every scenario from the deleted per-type editor specs.make tsciafter pulling.