更新 snapshot & form 获取父级数据逻辑调整

This commit is contained in:
2betop 2021-06-21 10:21:55 +08:00
parent 56fdddb129
commit 72d747e74f
6 changed files with 184 additions and 205 deletions

View File

@ -39,27 +39,23 @@ exports[`Renderer:hbox 1`] = `
class="a-Grid-col--md3 bg-white"
>
<div
class="a-Wrapper"
class="a-Form-item a-Form-item--normal"
data-role="form-item"
>
<div
class="a-Form-item a-Form-item--normal"
data-role="form-item"
class="a-Form-control a-TextControl"
>
<div
class="a-Form-control a-TextControl"
class="a-TextControl-input"
>
<div
class="a-TextControl-input"
>
<input
autocomplete="off"
name="text"
placeholder="Text"
size="10"
type="text"
value=""
/>
</div>
<input
autocomplete="off"
name="text"
placeholder="Text"
size="10"
type="text"
value=""
/>
</div>
</div>
</div>

View File

@ -33,33 +33,29 @@ exports[`Renderer:hbox 1`] = `
data-role="form-item"
>
<div
class="a-Hbox"
class="a-Hbox a-Hbox--xs"
>
<div
class="a-Hbox-col w-sm"
>
<div
class="a-Wrapper"
class="a-Form-item a-Form-item--normal"
data-role="form-item"
>
<div
class="a-Form-item a-Form-item--normal"
data-role="form-item"
class="a-Form-control a-TextControl"
>
<div
class="a-Form-control a-TextControl"
class="a-TextControl-input"
>
<div
class="a-TextControl-input"
>
<input
autocomplete="off"
name="text"
placeholder="Text"
size="10"
type="text"
value=""
/>
</div>
<input
autocomplete="off"
name="text"
placeholder="Text"
size="10"
type="text"
value=""
/>
</div>
</div>
</div>

View File

@ -33,106 +33,102 @@ exports[`Renderer:panel 1`] = `
data-role="form-item"
>
<div
class="a-Hbox"
class="a-Hbox a-Hbox--xs"
>
<div
class="a-Hbox-col"
>
<div
class="a-Wrapper"
class="a-Form-item a-Form-item--normal"
data-role="form-item"
>
<div
class="a-Form-item a-Form-item--normal"
data-role="form-item"
class="a-Panel a-Panel--default"
style="position: relative;"
>
<div
class="a-Panel a-Panel--default"
style="position: relative;"
class="a-Panel-heading"
>
<div
class="a-Panel-heading"
>
<h3
class="a-Panel-title"
>
<span
class="a-TplField"
>
<span>
bla bla
</span>
</span>
</h3>
</div>
<div
class="bg-white"
<h3
class="a-Panel-title"
>
<span
class="a-PlainField"
class="a-TplField"
>
<span
class="text-muted"
>
Text
<span>
bla bla
</span>
</span>
</h3>
</div>
<div
class="bg-white"
>
<span
class="a-PlainField"
>
<span
class="text-muted"
>
Text
</span>
</span>
</div>
<div
class="a-Panel-footerWrap"
>
<div
class="bg-black"
>
<span
class="a-TplField"
>
<span>
<p>
footer 内容
</p>
</span>
</span>
</div>
</div>
<div
class="resize-sensor"
style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
class="a-Panel-footerWrap"
>
<div
class="bg-black"
>
<span
class="a-TplField"
>
<span>
<p>
footer 内容
</p>
</span>
</span>
</div>
</div>
<div
class="resize-sensor"
style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px; overflow: scroll; z-index: -1; visibility: hidden;"
class="resize-sensor-expand"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
class="resize-sensor-expand"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
style="position: absolute; left: 0px; top: 0px; width: 10px; height: 10px;"
/>
</div>
<div
class="resize-sensor-shrink"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
style="position: absolute; left: 0; top: 0; width: 200%; height: 200%"
/>
</div>
<div
class="resize-sensor-appear"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;animation-name: apearSensor; animation-duration: 0.2s;"
style="position: absolute; left: 0px; top: 0px; width: 10px; height: 10px;"
/>
</div>
<div
class="resize-sensor-shrink"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
style="position: absolute; left: 0; top: 0; width: 200%; height: 200%"
/>
</div>
<div
class="resize-sensor-appear"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;animation-name: apearSensor; animation-duration: 0.2s;"
/>
</div>
</div>
</div>
@ -141,114 +137,110 @@ exports[`Renderer:panel 1`] = `
class="a-Hbox-col"
>
<div
class="a-Wrapper"
class="a-Form-item a-Form-item--normal"
data-role="form-item"
>
<div
class="a-Form-item a-Form-item--normal"
data-role="form-item"
class="a-Panel a-Panel--default"
style="position: relative;"
>
<div
class="a-Panel a-Panel--default"
style="position: relative;"
class="a-Panel-heading"
>
<h3
class="a-Panel-title"
>
<span
class="a-TplField"
>
<span>
bla bla
</span>
</span>
</h3>
</div>
<div
class="a-Panel-body"
>
<div
class="a-Panel-heading"
>
<h3
class="a-Panel-title"
>
<span
class="a-TplField"
>
<span>
bla bla
</span>
</span>
</h3>
</div>
<div
class="a-Panel-body"
class="a-Form-item a-Form-item--normal"
data-role="form-item"
>
<div
class="a-Form-item a-Form-item--normal"
data-role="form-item"
class="a-Form-control a-TextControl"
>
<div
class="a-Form-control a-TextControl"
class="a-TextControl-input"
>
<div
class="a-TextControl-input"
>
<input
autocomplete="off"
placeholder="Text 1"
size="10"
type="text"
value=""
/>
</div>
</div>
</div>
<div
class="a-Form-item a-Form-item--normal"
data-role="form-item"
>
<div
class="a-Form-control a-TextControl"
>
<div
class="a-TextControl-input"
>
<input
autocomplete="off"
placeholder="Text 2"
size="10"
type="text"
value=""
/>
</div>
<input
autocomplete="off"
placeholder="Text 1"
size="10"
type="text"
value=""
/>
</div>
</div>
</div>
<div
class="resize-sensor"
style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px; overflow: scroll; z-index: -1; visibility: hidden;"
class="a-Form-item a-Form-item--normal"
data-role="form-item"
>
<div
class="a-Form-control a-TextControl"
>
<div
class="a-TextControl-input"
>
<input
autocomplete="off"
placeholder="Text 2"
size="10"
type="text"
value=""
/>
</div>
</div>
</div>
</div>
<div
class="resize-sensor"
style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
class="resize-sensor-expand"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
class="resize-sensor-expand"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
style="position: absolute; left: 0px; top: 0px; width: 10px; height: 10px;"
/>
</div>
<div
class="resize-sensor-shrink"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
style="position: absolute; left: 0; top: 0; width: 200%; height: 200%"
/>
</div>
<div
class="resize-sensor-appear"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;animation-name: apearSensor; animation-duration: 0.2s;"
style="position: absolute; left: 0px; top: 0px; width: 10px; height: 10px;"
/>
</div>
<div
class="resize-sensor-shrink"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;"
>
<div
style="position: absolute; left: 0; top: 0; width: 200%; height: 200%"
/>
</div>
<div
class="resize-sensor-appear"
style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;animation-name: apearSensor; animation-duration: 0.2s;"
/>
</div>
</div>
</div>

View File

@ -3,7 +3,7 @@
exports[`Renderer:hbox 1`] = `
<div>
<div
class="a-Hbox"
class="a-Hbox a-Hbox--xs"
>
<div
class="a-Hbox-col w-xs"

View File

@ -184,12 +184,7 @@ export function wrapControl<
// 同步 value
model.changeTmpValue(
propValue ??
store?.getValueByName(
model.name,
canAccessSuperData !== false
) ??
value
propValue ?? store?.getValueByName(model.name) ?? value
);
// 如果没有初始值,通过 onChange 设置过去

View File

@ -25,7 +25,7 @@ export const iRendererStore = StoreNode.named('iRendererStore')
drawerData: types.optional(types.frozen(), undefined)
})
.views(self => ({
getValueByName(name: string, canAccessSuper: boolean = false) {
getValueByName(name: string, canAccessSuper: boolean = true) {
return getVariable(self.data, name, canAccessSuper);
},