Form: Add default properties for a new object?
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- frontend
调研方向
从 src/widgets/forms.js 第 273 行附近开始,比较 ui:Multiple 如何处理 ui:part,以及 issue 中描述的 ui:category、ui:targetClass 和 ui:from 模式。使用 sosa:Observation 示例作为验收用例,确定哪种方法应为新创建的对象定义 default properties。完成的标准是新对象获得其默认的 rdf:type,并且 solid-panes 能够渲染其表单。
由索引模型根据 Issue 内容生成。
描述
When using ui:Multiple, currently a new object is created and linked to the subject with the specified ui:property.
https://github.com/solid/solid-ui/blob/c4ad302f361cc4a1de24941a475cb66333c43805/src/widgets/forms.js#L273
The form to use for the new object is then specified by ui:part
It appears there is currently no way to specify default properties for the new object, e.g. its rdf:type.
For rdf:type in particular, this means that forms for the new object will not be rendered by solid-panes, which discovers the relevant form based on its class.
Possible solutions
I don't whether there is a need for a more general templating mechanism, but at least for rdf:type, a solution could be to allow ui:Multiple to also use ui:category (as for ui:Classifier) or ui:targetClass (as for ui:Autocomplete)
Another option would be to specify ui:from (as for ui:Choice) instead of ui:part, and choose the ui:creationForm based on the specified rdfs:Class.
Example use case
Generating a new observation
sosa:Observation ui:annotationForm :ObsForm.
:ObservationList ui:annotationForm :ObsListForm.
:ObsListForm
a ui:Multiple;
ui:part :ObsForm;
ui:property rdfs:member;
ui:category sosa:Observation.
:ThisObsList a :ObservationList.
Creating a new object in :ThisObsList would generate:
:ThisObsList rdfs:member :id1639432788935.
:id1639432788935 a sosa:Observation.
Edit: I've got an patch using ui:category here: https://github.com/josephguillaume/my-solidos-patches/blob/2860861f3ce4ddde9a8b0831ca520e4492878991/solid-ui.diff#L32
Edit: incidentally it's possible to get the desired behaviour by using ui:reverse with rdf:type as the ui:property
sosa:Observation ui:annotationForm :ObsForm.
:dummyClass ui:annotationForm :ObsListForm.
sosa:Observation a :dummyClass.
:ObsListForm
a ui:Multiple;
ui:part :ObsForm;
ui:reverse 1;
ui:property rdf:type.
Visiting sosa:Observation builds a form for :dummyClass which generates triples:
:newsubject a sosa:Observation
This might be more of a curiosity than a real solution.
- 主要语言
- TypeScript
- 星标
- 153
- 派生
- 46
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 7
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
SolidOS/solid-ui 的其他 Issue
-
enhancement
-
enhancement
-
Vite warning 未关闭enhancement
难度 3/5 1-2 天 新手友好度 64/100
-
enhancement
难度 4/5 3-5 天 新手友好度 35/100
-
enhancement
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
难度 2/5 1-3 小时 新手友好度 75/100
fil-donadoni/tolaria#4409 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
corsairdev/corsair#1764 ·