mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 20:39:07 +08:00
Merge remote-tracking branch 'baidu/master'
This commit is contained in:
commit
ded3240372
@ -77,7 +77,9 @@ exports[`factory:definitions 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
引用
|
||||
<span>
|
||||
引用
|
||||
</span>
|
||||
</span>
|
||||
</h2>
|
||||
</div>
|
||||
@ -97,7 +99,9 @@ exports[`factory:definitions 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
表单
|
||||
<span>
|
||||
表单
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -110,6 +114,7 @@ exports[`factory:definitions 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -137,13 +142,19 @@ exports[`factory:definitions 1`] = `
|
||||
<div
|
||||
class="a-Remark a-Form-remark"
|
||||
>
|
||||
<i
|
||||
class="a-Remark-icon fa fa-question-circle"
|
||||
/>
|
||||
<span
|
||||
class="a-Remark-icon"
|
||||
>
|
||||
<icon-mock
|
||||
classname=" icon-warning-mark"
|
||||
icon="warning-mark"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -173,6 +184,7 @@ exports[`factory:definitions 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -200,6 +212,7 @@ exports[`factory:definitions 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -227,13 +240,19 @@ exports[`factory:definitions 1`] = `
|
||||
<div
|
||||
class="a-Remark a-Form-remark"
|
||||
>
|
||||
<i
|
||||
class="a-Remark-icon fa fa-question-circle"
|
||||
/>
|
||||
<span
|
||||
class="a-Remark-icon"
|
||||
>
|
||||
<icon-mock
|
||||
classname=" icon-warning-mark"
|
||||
icon="warning-mark"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -245,9 +264,14 @@ exports[`factory:definitions 1`] = `
|
||||
<div
|
||||
class="a-Remark a-Form-remark"
|
||||
>
|
||||
<i
|
||||
class="a-Remark-icon fa fa-question-circle"
|
||||
/>
|
||||
<span
|
||||
class="a-Remark-icon"
|
||||
>
|
||||
<icon-mock
|
||||
classname=" icon-warning-mark"
|
||||
icon="warning-mark"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -261,6 +285,7 @@ exports[`factory:definitions 1`] = `
|
||||
data-tooltip="删除"
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon icon-close"
|
||||
icon="close"
|
||||
/>
|
||||
</a>
|
||||
@ -275,8 +300,9 @@ exports[`factory:definitions 1`] = `
|
||||
data-tooltip="新增一条数据"
|
||||
type="button"
|
||||
>
|
||||
<i
|
||||
class="a-Button-icon fa fa-plus"
|
||||
<icon-mock
|
||||
classname="icon icon-plus"
|
||||
icon="plus"
|
||||
/>
|
||||
<span>
|
||||
新增
|
||||
@ -288,9 +314,14 @@ exports[`factory:definitions 1`] = `
|
||||
<div
|
||||
class="a-Remark a-Form-remark"
|
||||
>
|
||||
<i
|
||||
class="a-Remark-icon fa fa-question-circle"
|
||||
/>
|
||||
<span
|
||||
class="a-Remark-icon"
|
||||
>
|
||||
<icon-mock
|
||||
classname=" icon-warning-mark"
|
||||
icon="warning-mark"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -362,7 +393,9 @@ exports[`factory:definitions override 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
引用
|
||||
<span>
|
||||
引用
|
||||
</span>
|
||||
</span>
|
||||
</h2>
|
||||
</div>
|
||||
@ -382,7 +415,9 @@ exports[`factory:definitions override 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
表单
|
||||
<span>
|
||||
表单
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -395,6 +430,7 @@ exports[`factory:definitions override 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -422,13 +458,19 @@ exports[`factory:definitions override 1`] = `
|
||||
<div
|
||||
class="a-Remark a-Form-remark"
|
||||
>
|
||||
<i
|
||||
class="a-Remark-icon fa fa-question-circle"
|
||||
/>
|
||||
<span
|
||||
class="a-Remark-icon"
|
||||
>
|
||||
<icon-mock
|
||||
classname=" icon-warning-mark"
|
||||
icon="warning-mark"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -471,9 +513,14 @@ exports[`factory:definitions override 1`] = `
|
||||
<div
|
||||
class="a-Remark a-Form-remark"
|
||||
>
|
||||
<i
|
||||
class="a-Remark-icon fa fa-question-circle"
|
||||
/>
|
||||
<span
|
||||
class="a-Remark-icon"
|
||||
>
|
||||
<icon-mock
|
||||
classname=" icon-warning-mark"
|
||||
icon="warning-mark"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -1,23 +1,23 @@
|
||||
import { RenderOptions } from "../src/factory";
|
||||
import {RenderOptions} from '../src/factory';
|
||||
|
||||
// jest.useFakeTimers 会修改 global 的 setTimeout 所以需要把原始的记录下来。
|
||||
const timerFn = setTimeout;
|
||||
export function wait(duration:number, fn?:Function) {
|
||||
return new Promise((resolve) => {
|
||||
timerFn(() => {
|
||||
fn && fn();
|
||||
resolve();
|
||||
}, duration);
|
||||
});
|
||||
const timerFn = setTimeout;
|
||||
export function wait(duration: number, fn?: Function) {
|
||||
return new Promise<void>(resolve => {
|
||||
timerFn(() => {
|
||||
fn && fn();
|
||||
resolve();
|
||||
}, duration);
|
||||
});
|
||||
}
|
||||
|
||||
export function makeEnv(env?:Partial<RenderOptions>):RenderOptions {
|
||||
return {
|
||||
session: 'test-case',
|
||||
isCancel: () => false,
|
||||
notify: (msg:string) => null,
|
||||
jumpTo: (to:string) => console.info('Now should jump to ' + to),
|
||||
alert: (msg) => console.info(`Alert: ${msg}`),
|
||||
...env
|
||||
}
|
||||
}
|
||||
export function makeEnv(env?: Partial<RenderOptions>): RenderOptions {
|
||||
return {
|
||||
session: 'test-case',
|
||||
isCancel: () => false,
|
||||
notify: (msg: string) => null,
|
||||
jumpTo: (to: string) => console.info('Now should jump to ' + to),
|
||||
alert: msg => console.info(`Alert: ${msg}`),
|
||||
...env
|
||||
};
|
||||
}
|
||||
|
17
__tests__/jest.setup.js
Normal file
17
__tests__/jest.setup.js
Normal file
@ -0,0 +1,17 @@
|
||||
const originalWarn = console.warn.bind(console.warn);
|
||||
global.beforeAll(() => {
|
||||
console.warn = msg => {
|
||||
// warning 先关了,实在太吵。
|
||||
// const str = msg.toString();
|
||||
// if (
|
||||
// str.includes('componentWillMount') ||
|
||||
// str.includes('componentWillReceiveProps')
|
||||
// ) {
|
||||
// return;
|
||||
// }
|
||||
// originalWarn(msg);
|
||||
};
|
||||
});
|
||||
global.afterAll(() => {
|
||||
console.warn = originalWarn;
|
||||
});
|
@ -15,7 +15,9 @@ exports[`Renderer:array 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:array 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:button 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:button 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<button
|
||||
class="a-Button a-Button--default a-Form-control"
|
||||
@ -43,6 +46,7 @@ exports[`Renderer:button 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<button
|
||||
class="a-Button a-Button--default a-Form-control"
|
||||
@ -55,6 +59,7 @@ exports[`Renderer:button 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<button
|
||||
class="a-Button a-Button--primary a-Form-control"
|
||||
@ -67,6 +72,7 @@ exports[`Renderer:button 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal r-2x"
|
||||
data-role="form-item"
|
||||
>
|
||||
<button
|
||||
class="a-Button a-Button--danger a-Button--sm a-Form-control"
|
||||
@ -137,7 +143,9 @@ exports[`Renderer:button 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -150,6 +158,7 @@ exports[`Renderer:button 2`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<button
|
||||
class="a-Button a-Button--default a-Form-control"
|
||||
@ -165,6 +174,7 @@ exports[`Renderer:button 2`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<button
|
||||
class="a-Button a-Button--default a-Form-control"
|
||||
@ -177,6 +187,7 @@ exports[`Renderer:button 2`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<button
|
||||
class="a-Button a-Button--primary a-Form-control"
|
||||
@ -189,6 +200,7 @@ exports[`Renderer:button 2`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal r-2x"
|
||||
data-role="form-item"
|
||||
>
|
||||
<button
|
||||
class="a-Button a-Button--danger a-Button--sm a-Form-control"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:button-group 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:button-group 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -63,6 +66,7 @@ exports[`Renderer:button-group 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -72,7 +76,7 @@ exports[`Renderer:button-group 1`] = `
|
||||
</span>
|
||||
</label>
|
||||
<div
|
||||
class="form-control-static"
|
||||
class="a-Form-static"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control"
|
||||
@ -80,10 +84,12 @@ exports[`Renderer:button-group 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
<span>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
@ -149,7 +155,9 @@ exports[`Renderer:button-group:multiple clearable 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -162,6 +170,7 @@ exports[`Renderer:button-group:multiple clearable 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -197,6 +206,7 @@ exports[`Renderer:button-group:multiple clearable 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -206,7 +216,7 @@ exports[`Renderer:button-group:multiple clearable 1`] = `
|
||||
</span>
|
||||
</label>
|
||||
<div
|
||||
class="form-control-static"
|
||||
class="a-Form-static"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control"
|
||||
@ -214,10 +224,12 @@ exports[`Renderer:button-group:multiple clearable 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
<span>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
@ -283,7 +295,9 @@ exports[`Renderer:button-group:multiple clearable 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -296,6 +310,7 @@ exports[`Renderer:button-group:multiple clearable 2`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -331,6 +346,7 @@ exports[`Renderer:button-group:multiple clearable 2`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -340,7 +356,7 @@ exports[`Renderer:button-group:multiple clearable 2`] = `
|
||||
</span>
|
||||
</label>
|
||||
<div
|
||||
class="form-control-static"
|
||||
class="a-Form-static"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control"
|
||||
@ -348,10 +364,12 @@ exports[`Renderer:button-group:multiple clearable 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
<span>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:button-toolbar 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:button-toolbar 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<div
|
||||
class="a-ButtonToolbar a-Form-control"
|
||||
@ -118,7 +121,9 @@ exports[`Renderer:button-toolbar 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -131,6 +136,7 @@ exports[`Renderer:button-toolbar 2`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<div
|
||||
class="a-ButtonToolbar a-Form-control"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:checkbox 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:checkbox 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -52,7 +55,9 @@ exports[`Renderer:checkbox 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
选项说明
|
||||
<span>
|
||||
选项说明
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:checkboxes 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:checkboxes 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -95,6 +98,7 @@ exports[`Renderer:checkboxes 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -104,7 +108,7 @@ exports[`Renderer:checkboxes 1`] = `
|
||||
</span>
|
||||
</label>
|
||||
<div
|
||||
class="form-control-static"
|
||||
class="a-Form-static"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control"
|
||||
@ -112,10 +116,12 @@ exports[`Renderer:checkboxes 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
<span>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
@ -181,7 +187,9 @@ exports[`Renderer:checkboxes 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -194,6 +202,7 @@ exports[`Renderer:checkboxes 2`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -261,6 +270,7 @@ exports[`Renderer:checkboxes 2`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -270,7 +280,7 @@ exports[`Renderer:checkboxes 2`] = `
|
||||
</span>
|
||||
</label>
|
||||
<div
|
||||
class="form-control-static"
|
||||
class="a-Form-static"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control"
|
||||
@ -278,10 +288,12 @@ exports[`Renderer:checkboxes 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
<span>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:city 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:city 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -58,7 +61,12 @@ exports[`Renderer:city 1`] = `
|
||||
</div>
|
||||
<span
|
||||
class="a-Select-arrow"
|
||||
/>
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon icon-caret"
|
||||
icon="caret"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@ -79,7 +87,12 @@ exports[`Renderer:city 1`] = `
|
||||
</div>
|
||||
<span
|
||||
class="a-Select-arrow"
|
||||
/>
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon icon-caret"
|
||||
icon="caret"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
aria-expanded="false"
|
||||
@ -100,7 +113,12 @@ exports[`Renderer:city 1`] = `
|
||||
</div>
|
||||
<span
|
||||
class="a-Select-arrow"
|
||||
/>
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon icon-caret"
|
||||
icon="caret"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:color 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:color 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -54,7 +57,7 @@ exports[`Renderer:color 1`] = `
|
||||
class="a-ColorPicker-clear"
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon"
|
||||
classname="icon icon-close"
|
||||
icon="close"
|
||||
/>
|
||||
</a>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:container 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:container 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--horizontal no-border"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label a-Form-itemColumn--normal"
|
||||
@ -47,6 +50,7 @@ exports[`Renderer:container 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--horizontal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label a-Form-itemColumn--normal"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:date 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:date 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -52,13 +55,18 @@ exports[`Renderer:date 1`] = `
|
||||
class="a-DatePicker-clear"
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon"
|
||||
classname="icon icon-close"
|
||||
icon="close"
|
||||
/>
|
||||
</a>
|
||||
<a
|
||||
class="a-DatePicker-toggler"
|
||||
/>
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon icon-calendar"
|
||||
icon="calendar"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:dateRange 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:dateRange 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -52,15 +55,16 @@ exports[`Renderer:dateRange 1`] = `
|
||||
class="a-DateRangePicker-clear"
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon"
|
||||
classname="icon icon-close"
|
||||
icon="close"
|
||||
/>
|
||||
</a>
|
||||
<a
|
||||
class="a-DateRangePicker-toggler"
|
||||
>
|
||||
<i
|
||||
class="fa fa-calendar"
|
||||
<icon-mock
|
||||
classname="icon icon-calendar"
|
||||
icon="calendar"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:date 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:date 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -52,13 +55,18 @@ exports[`Renderer:date 1`] = `
|
||||
class="a-DatePicker-clear"
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon"
|
||||
classname="icon icon-close"
|
||||
icon="close"
|
||||
/>
|
||||
</a>
|
||||
<a
|
||||
class="a-DatePicker-toggler"
|
||||
/>
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon icon-calendar"
|
||||
icon="calendar"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:fieldSet 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -37,6 +39,7 @@ exports[`Renderer:fieldSet 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--horizontal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label a-Form-itemColumn--normal"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:formula 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:formula 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -46,40 +49,40 @@ exports[`Renderer:formula 1`] = `
|
||||
class="a-Number-handler-wrap"
|
||||
>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Increase Value"
|
||||
class="a-Number-handler a-Number-handler-up "
|
||||
class="a-Number-handler a-Number-handler-up"
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
>
|
||||
<span
|
||||
class="a-Number-handler-up-inner"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Decrease Value"
|
||||
class="a-Number-handler a-Number-handler-down "
|
||||
class="a-Number-handler a-Number-handler-down"
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
>
|
||||
<span
|
||||
class="a-Number-handler-down-inner"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
aria-valuemin="-9007199254740991"
|
||||
aria-valuenow="1"
|
||||
class="a-Number-input-wrap"
|
||||
role="spinbutton"
|
||||
>
|
||||
<input
|
||||
aria-valuemax="9007199254740991"
|
||||
aria-valuemin="-9007199254740991"
|
||||
aria-valuenow="1"
|
||||
autocomplete="off"
|
||||
class="a-Number-input"
|
||||
max="9007199254740991"
|
||||
min="-9007199254740991"
|
||||
role="spinbutton"
|
||||
step="1"
|
||||
value="1"
|
||||
/>
|
||||
@ -89,6 +92,7 @@ exports[`Renderer:formula 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -107,40 +111,40 @@ exports[`Renderer:formula 1`] = `
|
||||
class="a-Number-handler-wrap"
|
||||
>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Increase Value"
|
||||
class="a-Number-handler a-Number-handler-up "
|
||||
class="a-Number-handler a-Number-handler-up"
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
>
|
||||
<span
|
||||
class="a-Number-handler-up-inner"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Decrease Value"
|
||||
class="a-Number-handler a-Number-handler-down "
|
||||
class="a-Number-handler a-Number-handler-down"
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
>
|
||||
<span
|
||||
class="a-Number-handler-down-inner"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
aria-valuemin="-9007199254740991"
|
||||
aria-valuenow="2"
|
||||
class="a-Number-input-wrap"
|
||||
role="spinbutton"
|
||||
>
|
||||
<input
|
||||
aria-valuemax="9007199254740991"
|
||||
aria-valuemin="-9007199254740991"
|
||||
aria-valuenow="2"
|
||||
autocomplete="off"
|
||||
class="a-Number-input"
|
||||
max="9007199254740991"
|
||||
min="-9007199254740991"
|
||||
role="spinbutton"
|
||||
step="1"
|
||||
value="2"
|
||||
/>
|
||||
@ -150,6 +154,7 @@ exports[`Renderer:formula 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -168,40 +173,40 @@ exports[`Renderer:formula 1`] = `
|
||||
class="a-Number-handler-wrap"
|
||||
>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Increase Value"
|
||||
class="a-Number-handler a-Number-handler-up "
|
||||
class="a-Number-handler a-Number-handler-up"
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
>
|
||||
<span
|
||||
class="a-Number-handler-up-inner"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Decrease Value"
|
||||
class="a-Number-handler a-Number-handler-down "
|
||||
class="a-Number-handler a-Number-handler-down"
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
>
|
||||
<span
|
||||
class="a-Number-handler-down-inner"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
aria-valuemin="-9007199254740991"
|
||||
aria-valuenow="3"
|
||||
class="a-Number-input-wrap"
|
||||
role="spinbutton"
|
||||
>
|
||||
<input
|
||||
aria-valuemax="9007199254740991"
|
||||
aria-valuemin="-9007199254740991"
|
||||
aria-valuenow="3"
|
||||
autocomplete="off"
|
||||
class="a-Number-input"
|
||||
max="9007199254740991"
|
||||
min="-9007199254740991"
|
||||
role="spinbutton"
|
||||
step="1"
|
||||
value="3"
|
||||
/>
|
||||
@ -211,6 +216,7 @@ exports[`Renderer:formula 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -229,40 +235,40 @@ exports[`Renderer:formula 1`] = `
|
||||
class="a-Number-handler-wrap"
|
||||
>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Increase Value"
|
||||
class="a-Number-handler a-Number-handler-up "
|
||||
class="a-Number-handler a-Number-handler-up"
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
>
|
||||
<span
|
||||
class="a-Number-handler-up-inner"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Decrease Value"
|
||||
class="a-Number-handler a-Number-handler-down "
|
||||
class="a-Number-handler a-Number-handler-down"
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
>
|
||||
<span
|
||||
class="a-Number-handler-down-inner"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
aria-valuemin="-9007199254740991"
|
||||
aria-valuenow="4"
|
||||
class="a-Number-input-wrap"
|
||||
role="spinbutton"
|
||||
>
|
||||
<input
|
||||
aria-valuemax="9007199254740991"
|
||||
aria-valuemin="-9007199254740991"
|
||||
aria-valuenow="4"
|
||||
autocomplete="off"
|
||||
class="a-Number-input"
|
||||
max="9007199254740991"
|
||||
min="-9007199254740991"
|
||||
role="spinbutton"
|
||||
step="1"
|
||||
value="4"
|
||||
/>
|
||||
@ -272,6 +278,7 @@ exports[`Renderer:formula 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -290,40 +297,40 @@ exports[`Renderer:formula 1`] = `
|
||||
class="a-Number-handler-wrap"
|
||||
>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Increase Value"
|
||||
class="a-Number-handler a-Number-handler-up "
|
||||
class="a-Number-handler a-Number-handler-up"
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
>
|
||||
<span
|
||||
class="a-Number-handler-up-inner"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Decrease Value"
|
||||
class="a-Number-handler a-Number-handler-down "
|
||||
class="a-Number-handler a-Number-handler-down"
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
>
|
||||
<span
|
||||
class="a-Number-handler-down-inner"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
aria-valuemin="-9007199254740991"
|
||||
aria-valuenow="5"
|
||||
class="a-Number-input-wrap"
|
||||
role="spinbutton"
|
||||
>
|
||||
<input
|
||||
aria-valuemax="9007199254740991"
|
||||
aria-valuemin="-9007199254740991"
|
||||
aria-valuenow="5"
|
||||
autocomplete="off"
|
||||
class="a-Number-input"
|
||||
max="9007199254740991"
|
||||
min="-9007199254740991"
|
||||
role="spinbutton"
|
||||
step="1"
|
||||
value="5"
|
||||
/>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:hbox 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:hbox 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<div
|
||||
class="a-Grid a-Form-control"
|
||||
@ -40,6 +43,7 @@ exports[`Renderer:hbox 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control a-TextControl"
|
||||
@ -66,7 +70,9 @@ exports[`Renderer:hbox 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
其他渲染器类型
|
||||
<span>
|
||||
其他渲染器类型
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:group 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -34,6 +36,7 @@ exports[`Renderer:group 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--horizontal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label a-Form-itemColumn--0"
|
||||
@ -69,6 +72,7 @@ exports[`Renderer:group 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--horizontal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label a-Form-itemColumn--0"
|
||||
@ -105,6 +109,7 @@ exports[`Renderer:group 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--inline"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -136,6 +141,7 @@ exports[`Renderer:group 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--inline"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -171,6 +177,7 @@ exports[`Renderer:group 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -198,6 +205,7 @@ exports[`Renderer:group 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:hbox 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:hbox 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<div
|
||||
class="a-FormHbox a-Form-control"
|
||||
@ -40,6 +43,7 @@ exports[`Renderer:hbox 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control a-TextControl"
|
||||
@ -65,7 +69,9 @@ exports[`Renderer:hbox 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
其他类型的渲染器
|
||||
<span>
|
||||
其他类型的渲染器
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:icon-picker 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:icon-picker 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:Form 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:Form 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -143,7 +146,9 @@ exports[`Renderer:Form initApi 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -162,6 +167,7 @@ exports[`Renderer:Form initApi 1`] = `
|
||||
/>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -189,6 +195,7 @@ exports[`Renderer:Form initApi 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -288,7 +295,9 @@ exports[`Renderer:Form sendOn:true 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -307,6 +316,7 @@ exports[`Renderer:Form sendOn:true 1`] = `
|
||||
/>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -334,6 +344,7 @@ exports[`Renderer:Form sendOn:true 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -433,7 +444,9 @@ exports[`Renderer:Form:onValidate 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -446,6 +459,7 @@ exports[`Renderer:Form:onValidate 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal is-error"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -480,6 +494,7 @@ exports[`Renderer:Form:onValidate 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal is-error"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -596,7 +611,9 @@ exports[`Renderer:Form:onValidate 3`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -609,6 +626,7 @@ exports[`Renderer:Form:onValidate 3`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -636,6 +654,7 @@ exports[`Renderer:Form:onValidate 3`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -742,7 +761,9 @@ exports[`Renderer:Form:remoteValidate 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -761,6 +782,7 @@ exports[`Renderer:Form:remoteValidate 1`] = `
|
||||
/>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal is-error"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -867,7 +889,9 @@ exports[`Renderer:Form:valdiate 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -880,6 +904,7 @@ exports[`Renderer:Form:valdiate 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal is-error is-required"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -992,7 +1017,9 @@ exports[`Renderer:Form:valdiate 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -1005,6 +1032,7 @@ exports[`Renderer:Form:valdiate 2`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal is-required"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:fieldSet 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:fieldSet 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--horizontal no-border"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label a-Form-itemColumn--normal"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:list 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:list 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -140,7 +143,9 @@ exports[`Renderer:list:multiple clearable 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -153,6 +158,7 @@ exports[`Renderer:list:multiple clearable 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -190,6 +196,7 @@ exports[`Renderer:list:multiple clearable 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -199,7 +206,7 @@ exports[`Renderer:list:multiple clearable 1`] = `
|
||||
</span>
|
||||
</label>
|
||||
<div
|
||||
class="form-control-static"
|
||||
class="a-Form-static"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control"
|
||||
@ -207,10 +214,12 @@ exports[`Renderer:list:multiple clearable 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
<span>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
@ -276,7 +285,9 @@ exports[`Renderer:list:multiple clearable 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -289,6 +300,7 @@ exports[`Renderer:list:multiple clearable 2`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -326,6 +338,7 @@ exports[`Renderer:list:multiple clearable 2`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -335,7 +348,7 @@ exports[`Renderer:list:multiple clearable 2`] = `
|
||||
</span>
|
||||
</label>
|
||||
<div
|
||||
class="form-control-static"
|
||||
class="a-Form-static"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control"
|
||||
@ -343,10 +356,12 @@ exports[`Renderer:list:multiple clearable 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
<span>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:number 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:number 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -46,40 +49,40 @@ exports[`Renderer:number 1`] = `
|
||||
class="a-Number-handler-wrap"
|
||||
>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Increase Value"
|
||||
class="a-Number-handler a-Number-handler-up "
|
||||
class="a-Number-handler a-Number-handler-up"
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
>
|
||||
<span
|
||||
class="a-Number-handler-up-inner"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
/>
|
||||
</span>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
aria-label="Decrease Value"
|
||||
class="a-Number-handler a-Number-handler-down "
|
||||
class="a-Number-handler a-Number-handler-down"
|
||||
role="button"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
>
|
||||
<span
|
||||
class="a-Number-handler-down-inner"
|
||||
unselectable="unselectable"
|
||||
unselectable="on"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
aria-valuemin="-9007199254740991"
|
||||
aria-valuenow="456"
|
||||
class="a-Number-input-wrap"
|
||||
role="spinbutton"
|
||||
>
|
||||
<input
|
||||
aria-valuemax="9007199254740991"
|
||||
aria-valuemin="-9007199254740991"
|
||||
aria-valuenow="456"
|
||||
autocomplete="off"
|
||||
class="a-Number-input"
|
||||
max="9007199254740991"
|
||||
min="-9007199254740991"
|
||||
role="spinbutton"
|
||||
step="1"
|
||||
value="456"
|
||||
/>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:panel 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:panel 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<div
|
||||
class="a-FormHbox a-Form-control"
|
||||
@ -51,7 +54,9 @@ exports[`Renderer:panel 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
bla bla
|
||||
<span>
|
||||
bla bla
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -75,9 +80,11 @@ exports[`Renderer:panel 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<p>
|
||||
footer 内容
|
||||
</p>
|
||||
<span>
|
||||
<p>
|
||||
footer 内容
|
||||
</p>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -138,7 +145,9 @@ exports[`Renderer:panel 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
bla bla
|
||||
<span>
|
||||
bla bla
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -150,6 +159,7 @@ exports[`Renderer:panel 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control a-TextControl"
|
||||
@ -170,6 +180,7 @@ exports[`Renderer:panel 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control a-TextControl"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:radios 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:radios 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -95,6 +98,7 @@ exports[`Renderer:radios 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -104,7 +108,7 @@ exports[`Renderer:radios 1`] = `
|
||||
</span>
|
||||
</label>
|
||||
<div
|
||||
class="form-control-static"
|
||||
class="a-Form-static"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control"
|
||||
@ -112,10 +116,12 @@ exports[`Renderer:radios 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
<span>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
@ -181,7 +187,9 @@ exports[`Renderer:radios 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -194,6 +202,7 @@ exports[`Renderer:radios 2`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -261,6 +270,7 @@ exports[`Renderer:radios 2`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -270,7 +280,7 @@ exports[`Renderer:radios 2`] = `
|
||||
</span>
|
||||
</label>
|
||||
<div
|
||||
class="form-control-static"
|
||||
class="a-Form-static"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control"
|
||||
@ -278,10 +288,8 @@ exports[`Renderer:radios 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
<span>
|
||||
a
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:number 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:number 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -65,6 +68,7 @@ exports[`Renderer:number 1`] = `
|
||||
>
|
||||
<span
|
||||
class="a-InputRange-label a-InputRange-label--value"
|
||||
style="left: calc(50% - 0px);"
|
||||
>
|
||||
<span
|
||||
class="a-InputRange-labelContainer"
|
||||
@ -95,6 +99,7 @@ exports[`Renderer:number 1`] = `
|
||||
</div>
|
||||
<span
|
||||
class="a-InputRange-label a-InputRange-label--mid"
|
||||
style="left: calc(50% - 60px);"
|
||||
>
|
||||
<span
|
||||
class="a-InputRange-labelContainer"
|
||||
@ -116,7 +121,7 @@ exports[`Renderer:number 1`] = `
|
||||
class="a-InputRange-clear is-active"
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon"
|
||||
classname="icon icon-close"
|
||||
icon="close"
|
||||
/>
|
||||
</a>
|
||||
@ -182,7 +187,9 @@ exports[`Renderer:range:multiple 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -195,6 +202,7 @@ exports[`Renderer:range:multiple 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -285,6 +293,7 @@ exports[`Renderer:range:multiple 1`] = `
|
||||
</div>
|
||||
<span
|
||||
class="a-InputRange-label a-InputRange-label--mid"
|
||||
style="left: calc(50% - 60px);"
|
||||
>
|
||||
<span
|
||||
class="a-InputRange-labelContainer"
|
||||
@ -317,7 +326,7 @@ exports[`Renderer:range:multiple 1`] = `
|
||||
class="a-InputRange-clear is-active"
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon"
|
||||
classname="icon icon-close"
|
||||
icon="close"
|
||||
/>
|
||||
</a>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:rating 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:rating 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:repeat 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:repeat 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -118,6 +121,7 @@ exports[`Renderer:repeat 1`] = `
|
||||
aria-owns="downshift-0-menu"
|
||||
class="a-Select is-opened pull-right has-popover"
|
||||
role="combobox"
|
||||
style="position: relative;"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
@ -131,10 +135,16 @@ exports[`Renderer:repeat 1`] = `
|
||||
</div>
|
||||
<span
|
||||
class="a-Select-arrow"
|
||||
/>
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon icon-caret"
|
||||
icon="caret"
|
||||
/>
|
||||
</span>
|
||||
<div
|
||||
class="a-PopOver a-Select-popover a-PopOver--leftBottomLeftTop"
|
||||
style="display: block; min-width: 0; left: 0px; top: 0px;"
|
||||
style="display: block; min-width: 0; left: 0px; top: 0px; position: relative;"
|
||||
theme="default"
|
||||
>
|
||||
<div
|
||||
class="a-PopOver-overlay"
|
||||
@ -142,6 +152,13 @@ exports[`Renderer:repeat 1`] = `
|
||||
<div
|
||||
class="a-Select-menu"
|
||||
>
|
||||
<div
|
||||
class="a-Select-option invisible"
|
||||
>
|
||||
<span>
|
||||
Placeholder
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
aria-selected="false"
|
||||
class="a-Select-option"
|
||||
@ -233,6 +250,84 @@ exports[`Renderer:repeat 1`] = `
|
||||
</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="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;"
|
||||
/>
|
||||
</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
|
||||
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>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:service 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:service 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal is-required"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -63,7 +66,12 @@ exports[`Renderer:service 1`] = `
|
||||
</div>
|
||||
<span
|
||||
class="a-Select-arrow"
|
||||
/>
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon icon-caret"
|
||||
icon="caret"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -75,6 +83,7 @@ exports[`Renderer:service 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal is-required"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -107,6 +116,7 @@ exports[`Renderer:service 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:static 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:static 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal bg-white"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -37,7 +40,7 @@ exports[`Renderer:static 1`] = `
|
||||
</span>
|
||||
</label>
|
||||
<div
|
||||
class="form-control-static"
|
||||
class="a-Form-static"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control is-inline"
|
||||
@ -45,21 +48,26 @@ exports[`Renderer:static 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
static
|
||||
<span>
|
||||
static
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<span
|
||||
class="a-TplField a-Form-description"
|
||||
>
|
||||
static description
|
||||
<span>
|
||||
static description
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<div
|
||||
class="form-control-static"
|
||||
class="a-Form-static"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control"
|
||||
@ -67,10 +75,12 @@ exports[`Renderer:static 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
<span>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
@ -78,9 +88,10 @@ exports[`Renderer:static 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<div
|
||||
class="form-control-static"
|
||||
class="a-Form-static"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control"
|
||||
@ -88,10 +99,12 @@ exports[`Renderer:static 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
<span>
|
||||
<span
|
||||
class="text-muted"
|
||||
>
|
||||
-
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:switch 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:switch 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal block"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -44,6 +47,7 @@ exports[`Renderer:switch 1`] = `
|
||||
>
|
||||
<input
|
||||
checked=""
|
||||
theme="default"
|
||||
type="checkbox"
|
||||
/>
|
||||
<i />
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:tabs 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -59,9 +61,11 @@ exports[`Renderer:tabs 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<p>
|
||||
tab1 内容
|
||||
</p>
|
||||
<span>
|
||||
<p>
|
||||
tab1 内容
|
||||
</p>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
@ -72,6 +76,7 @@ exports[`Renderer:tabs 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -99,6 +104,7 @@ exports[`Renderer:tabs 1`] = `
|
||||
</div>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:textarea 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:textarea 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
|
@ -15,7 +15,9 @@ exports[`Renderer:time 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The form
|
||||
<span>
|
||||
The form
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -28,6 +30,7 @@ exports[`Renderer:time 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<label
|
||||
class="a-Form-label"
|
||||
@ -52,13 +55,18 @@ exports[`Renderer:time 1`] = `
|
||||
class="a-DatePicker-clear"
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon"
|
||||
classname="icon icon-close"
|
||||
icon="close"
|
||||
/>
|
||||
</a>
|
||||
<a
|
||||
class="a-DatePicker-toggler"
|
||||
/>
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon icon-calendar"
|
||||
icon="calendar"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,38 +1,40 @@
|
||||
import React = require('react');
|
||||
import {render, fireEvent} from 'react-testing-library';
|
||||
import '../../../src/themes/default';
|
||||
import {
|
||||
render as amisRender
|
||||
} from '../../../src/index';
|
||||
import { makeEnv } from '../../helper';
|
||||
import {render as amisRender} from '../../../src/index';
|
||||
import {makeEnv, wait} from '../../helper';
|
||||
|
||||
test('Renderer:city', async () => {
|
||||
const {
|
||||
container,
|
||||
getByText
|
||||
} = render(amisRender({
|
||||
const {container, getByText} = render(
|
||||
amisRender(
|
||||
{
|
||||
type: 'form',
|
||||
api: '/api/xxx',
|
||||
controls: [
|
||||
{
|
||||
type: 'city',
|
||||
name: 'a',
|
||||
label: 'city',
|
||||
allowDistrict: true,
|
||||
allowCity: true
|
||||
}
|
||||
{
|
||||
type: 'city',
|
||||
name: 'a',
|
||||
label: 'city',
|
||||
allowDistrict: true,
|
||||
allowCity: true
|
||||
}
|
||||
],
|
||||
title: 'The form',
|
||||
actions: []
|
||||
}, {}, makeEnv({
|
||||
})));
|
||||
},
|
||||
{},
|
||||
makeEnv({})
|
||||
)
|
||||
);
|
||||
|
||||
fireEvent.click(getByText('请选择'));
|
||||
fireEvent.click(getByText('北京市'));
|
||||
fireEvent.click(getByText('请选择'));
|
||||
fireEvent.click(getByText('北京市市辖区'));
|
||||
fireEvent.click(getByText('请选择'));
|
||||
fireEvent.click(getByText('东城区'));
|
||||
await wait(200);
|
||||
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
fireEvent.click(getByText('请选择'));
|
||||
fireEvent.click(getByText('北京市'));
|
||||
fireEvent.click(getByText('请选择'));
|
||||
fireEvent.click(getByText('北京市市辖区'));
|
||||
fireEvent.click(getByText('请选择'));
|
||||
fireEvent.click(getByText('东城区'));
|
||||
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
@ -20,7 +20,9 @@ exports[`Renderer:alert 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
提示内容
|
||||
<span>
|
||||
提示内容
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -15,33 +15,35 @@ exports[`Renderer:carousel 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
|
||||
<div
|
||||
class="image "
|
||||
style="background-image: url(https://internal-amis-res.cdn.bcebos.com/images/2019-12/1577157239810/da6376bf988c.png); background-size: contain; background-repeat: no-repeat; background-position: center center;"
|
||||
/>
|
||||
|
||||
<div
|
||||
class="image "
|
||||
style="background-image: url('https://internal-amis-res.cdn.bcebos.com/images/2019-12/1577157239810/da6376bf988c.png'); background-size: contain; background-repeat: no-repeat; background-position: center center;"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<div
|
||||
class="title block"
|
||||
>
|
||||
标题
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="title block"
|
||||
>
|
||||
标题
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div
|
||||
class="description block"
|
||||
>
|
||||
描述
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="description block"
|
||||
>
|
||||
描述
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
@ -50,17 +52,19 @@ exports[`Renderer:carousel 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
|
||||
<div
|
||||
class="image "
|
||||
style="background-image: url(https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg); background-size: contain; background-repeat: no-repeat; background-position: center center;"
|
||||
/>
|
||||
|
||||
<div
|
||||
class="image "
|
||||
style="background-image: url('https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg'); background-size: contain; background-repeat: no-repeat; background-position: center center;"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
@ -83,7 +87,7 @@ exports[`Renderer:carousel 1`] = `
|
||||
class="a-Carousel-leftArrow"
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon"
|
||||
classname="icon icon-left-arrow"
|
||||
icon="left-arrow"
|
||||
/>
|
||||
</div>
|
||||
@ -91,7 +95,7 @@ exports[`Renderer:carousel 1`] = `
|
||||
class="a-Carousel-rightArrow"
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon"
|
||||
classname="icon icon-right-arrow"
|
||||
icon="right-arrow"
|
||||
/>
|
||||
</div>
|
||||
|
@ -23,7 +23,9 @@ exports[`Renderer:container 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
内容1
|
||||
<span>
|
||||
内容1
|
||||
</span>
|
||||
</span>
|
||||
<span
|
||||
class="a-PlainField"
|
||||
|
@ -8,9 +8,14 @@ exports[`Renderer:dropdown-button 1`] = `
|
||||
<button
|
||||
class="a-Button show a-Button--primary"
|
||||
>
|
||||
<i
|
||||
class="a-DropDown-caret fa fa-angle-down"
|
||||
/>
|
||||
<span
|
||||
class="a-DropDown-caret"
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon icon-caret"
|
||||
icon="caret"
|
||||
/>
|
||||
</span>
|
||||
</button>
|
||||
<ul
|
||||
class="a-DropDown-menu"
|
||||
@ -42,9 +47,14 @@ exports[`Renderer:dropdown-button 2`] = `
|
||||
<button
|
||||
class="a-Button show a-Button--primary"
|
||||
>
|
||||
<i
|
||||
class="a-DropDown-caret fa fa-angle-down"
|
||||
/>
|
||||
<span
|
||||
class="a-DropDown-caret"
|
||||
>
|
||||
<icon-mock
|
||||
classname="icon icon-caret"
|
||||
icon="caret"
|
||||
/>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -3,17 +3,21 @@
|
||||
exports[`Renderer:each 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="show"
|
||||
class="a-Each show"
|
||||
>
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
jack
|
||||
<span>
|
||||
jack
|
||||
</span>
|
||||
</span>
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
martin
|
||||
<span>
|
||||
martin
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -11,7 +11,9 @@ exports[`Renderer:hbox 1`] = `
|
||||
<div
|
||||
class="a-TplField bg-info"
|
||||
>
|
||||
w-xs
|
||||
<span>
|
||||
w-xs
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@ -20,7 +22,9 @@ exports[`Renderer:hbox 1`] = `
|
||||
<div
|
||||
class="a-TplField bg-info lter"
|
||||
>
|
||||
w-sm
|
||||
<span>
|
||||
w-sm
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@ -29,7 +33,9 @@ exports[`Renderer:hbox 1`] = `
|
||||
<div
|
||||
class="a-TplField bg-info dk"
|
||||
>
|
||||
w
|
||||
<span>
|
||||
w
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@ -38,7 +44,9 @@ exports[`Renderer:hbox 1`] = `
|
||||
<div
|
||||
class="a-TplField bg-success"
|
||||
>
|
||||
平均分配
|
||||
<span>
|
||||
平均分配
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@ -47,7 +55,9 @@ exports[`Renderer:hbox 1`] = `
|
||||
<div
|
||||
class="a-TplField bg-primary"
|
||||
>
|
||||
平均分配
|
||||
<span>
|
||||
平均分配
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -23,18 +23,25 @@ exports[`Renderer:Page 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
This is Title
|
||||
<span>
|
||||
This is Title
|
||||
</span>
|
||||
</span>
|
||||
<div
|
||||
className="a-Remark a-Remark--warning"
|
||||
onBlur={[Function]}
|
||||
onFocus={[Function]}
|
||||
onMouseOut={[Function]}
|
||||
onMouseOver={[Function]}
|
||||
>
|
||||
<i
|
||||
className="a-Remark-icon fa fa-question-circle"
|
||||
onBlur={[Function]}
|
||||
onFocus={[Function]}
|
||||
onMouseOut={[Function]}
|
||||
onMouseOver={[Function]}
|
||||
/>
|
||||
<span
|
||||
className="a-Remark-icon icon"
|
||||
>
|
||||
<icon-mock
|
||||
className=" icon-question-mark"
|
||||
icon="question-mark"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</h2>
|
||||
<small
|
||||
@ -43,7 +50,9 @@ exports[`Renderer:Page 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
This is SubTitle
|
||||
<span>
|
||||
This is SubTitle
|
||||
</span>
|
||||
</span>
|
||||
</small>
|
||||
</div>
|
||||
@ -53,7 +62,9 @@ exports[`Renderer:Page 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
This is toolbar
|
||||
<span>
|
||||
This is toolbar
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -63,7 +74,9 @@ exports[`Renderer:Page 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
This is body
|
||||
<span>
|
||||
This is body
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -82,7 +95,9 @@ exports[`Renderer:Page classNames 1`] = `
|
||||
<div
|
||||
className="a-TplField a-Page-asideTplWrapper"
|
||||
>
|
||||
This is aside
|
||||
<span>
|
||||
This is aside
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@ -103,18 +118,25 @@ exports[`Renderer:Page classNames 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
This is Title
|
||||
<span>
|
||||
This is Title
|
||||
</span>
|
||||
</span>
|
||||
<div
|
||||
className="a-Remark a-Remark--warning"
|
||||
onBlur={[Function]}
|
||||
onFocus={[Function]}
|
||||
onMouseOut={[Function]}
|
||||
onMouseOver={[Function]}
|
||||
>
|
||||
<i
|
||||
className="a-Remark-icon fa fa-question-circle"
|
||||
onBlur={[Function]}
|
||||
onFocus={[Function]}
|
||||
onMouseOut={[Function]}
|
||||
onMouseOver={[Function]}
|
||||
/>
|
||||
<span
|
||||
className="a-Remark-icon icon"
|
||||
>
|
||||
<icon-mock
|
||||
className=" icon-question-mark"
|
||||
icon="question-mark"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</h2>
|
||||
<small
|
||||
@ -123,7 +145,9 @@ exports[`Renderer:Page classNames 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
This is SubTitle
|
||||
<span>
|
||||
This is SubTitle
|
||||
</span>
|
||||
</span>
|
||||
</small>
|
||||
</div>
|
||||
@ -133,7 +157,9 @@ exports[`Renderer:Page classNames 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
This is toolbar
|
||||
<span>
|
||||
This is toolbar
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -143,7 +169,9 @@ exports[`Renderer:Page classNames 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
This is body
|
||||
<span>
|
||||
This is body
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -186,7 +214,9 @@ exports[`Renderer:Page handleAction actionType=ajax & feedback 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable a is 6
|
||||
<span>
|
||||
The variable a is 6
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -224,7 +254,9 @@ exports[`Renderer:Page handleAction actionType=ajax & feedback 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable a is 6
|
||||
<span>
|
||||
The variable a is 6
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -268,7 +300,9 @@ exports[`Renderer:Page handleAction actionType=ajax 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable a is 6
|
||||
<span>
|
||||
The variable a is 6
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -370,7 +404,9 @@ exports[`Renderer:Page handleAction actionType=dialog mergeData 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable a is
|
||||
<span>
|
||||
The variable a is
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -408,7 +444,9 @@ exports[`Renderer:Page handleAction actionType=dialog mergeData 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable a is 3
|
||||
<span>
|
||||
The variable a is 3
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -510,7 +548,9 @@ exports[`Renderer:Page handleAction actionType=drawer mergeData 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable a is
|
||||
<span>
|
||||
The variable a is
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -548,7 +588,9 @@ exports[`Renderer:Page handleAction actionType=drawer mergeData 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable a is 3
|
||||
<span>
|
||||
The variable a is 3
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -580,7 +622,9 @@ exports[`Renderer:Page initApi 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
The variable value is 2
|
||||
<span>
|
||||
The variable value is 2
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -617,7 +661,7 @@ exports[`Renderer:Page initApi error show Message 1`] = `
|
||||
type="button"
|
||||
>
|
||||
<icon-mock
|
||||
className="icon"
|
||||
className="icon icon-close"
|
||||
icon="close"
|
||||
/>
|
||||
</button>
|
||||
@ -652,7 +696,9 @@ exports[`Renderer:Page initApi reFetch when condition changes 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
The variable value is 1
|
||||
<span>
|
||||
The variable value is 1
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -677,7 +723,9 @@ exports[`Renderer:Page initApi reFetch when condition changes 2`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
The variable value is 2
|
||||
<span>
|
||||
The variable value is 2
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -720,7 +768,9 @@ exports[`Renderer:Page initApi reload by Dialog action 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable value is 1
|
||||
<span>
|
||||
The variable value is 1
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -758,7 +808,9 @@ exports[`Renderer:Page initApi reload by Dialog action 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable value is 1
|
||||
<span>
|
||||
The variable value is 1
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -796,7 +848,9 @@ exports[`Renderer:Page initApi reload by Dialog action 3`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable value is 2
|
||||
<span>
|
||||
The variable value is 2
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -840,7 +894,9 @@ exports[`Renderer:Page initApi reload by Drawer action 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable value is 1
|
||||
<span>
|
||||
The variable value is 1
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -878,7 +934,9 @@ exports[`Renderer:Page initApi reload by Drawer action 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable value is 1
|
||||
<span>
|
||||
The variable value is 1
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -922,7 +980,9 @@ exports[`Renderer:Page initApi reload by Drawer action 3`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable value is 2
|
||||
<span>
|
||||
The variable value is 2
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -958,7 +1018,9 @@ exports[`Renderer:Page initApi reload by Form submit 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
表单
|
||||
<span>
|
||||
表单
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -971,6 +1033,7 @@ exports[`Renderer:Page initApi reload by Form submit 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control a-TextControl"
|
||||
@ -1058,7 +1121,9 @@ exports[`Renderer:Page initApi reload by Form submit 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable value is 1
|
||||
<span>
|
||||
The variable value is 1
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1094,7 +1159,9 @@ exports[`Renderer:Page initApi reload by Form submit 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
表单
|
||||
<span>
|
||||
表单
|
||||
</span>
|
||||
</span>
|
||||
</h3>
|
||||
</div>
|
||||
@ -1107,6 +1174,7 @@ exports[`Renderer:Page initApi reload by Form submit 2`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Form-item a-Form-item--normal"
|
||||
data-role="form-item"
|
||||
>
|
||||
<div
|
||||
class="a-Form-control a-TextControl"
|
||||
@ -1194,7 +1262,9 @@ exports[`Renderer:Page initApi reload by Form submit 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable value is 2
|
||||
<span>
|
||||
The variable value is 2
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1238,7 +1308,9 @@ exports[`Renderer:Page initApi reload by action 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable value is 1
|
||||
<span>
|
||||
The variable value is 1
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1282,7 +1354,9 @@ exports[`Renderer:Page initApi reload by action 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable value is 2
|
||||
<span>
|
||||
The variable value is 2
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1314,7 +1388,9 @@ exports[`Renderer:Page initApi show loading 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
The variable value is
|
||||
<span>
|
||||
The variable value is
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1345,7 +1421,9 @@ exports[`Renderer:Page initApi show loading 2`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
The variable value is 3
|
||||
<span>
|
||||
The variable value is 3
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1376,7 +1454,9 @@ exports[`Renderer:Page initApi silentPolling 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
The variable value is
|
||||
<span>
|
||||
The variable value is
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1407,7 +1487,9 @@ exports[`Renderer:Page initApi silentPolling 2`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
The variable value is 3
|
||||
<span>
|
||||
The variable value is 3
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1432,7 +1514,9 @@ exports[`Renderer:Page initApi silentPolling 3`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
The variable value is 3
|
||||
<span>
|
||||
The variable value is 3
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1457,7 +1541,9 @@ exports[`Renderer:Page initApi silentPolling 4`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
The variable value is 4
|
||||
<span>
|
||||
The variable value is 4
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1482,7 +1568,9 @@ exports[`Renderer:Page initData 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
The variable value is 1
|
||||
<span>
|
||||
The variable value is 1
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1513,7 +1601,9 @@ exports[`Renderer:Page initFetchOn trigger initApi fetch when condition becomes
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
The variable value is 6
|
||||
<span>
|
||||
The variable value is 6
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1538,7 +1628,9 @@ exports[`Renderer:Page location query 1`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
The variable value is 5
|
||||
<span>
|
||||
The variable value is 5
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1563,7 +1655,9 @@ exports[`Renderer:Page location query 2`] = `
|
||||
<span
|
||||
className="a-TplField"
|
||||
>
|
||||
The variable value is 6
|
||||
<span>
|
||||
The variable value is 6
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -17,11 +17,22 @@ exports[`Renderer:qr-code 1`] = `
|
||||
<div
|
||||
class="a-QrCode"
|
||||
>
|
||||
<canvas
|
||||
<svg
|
||||
class=""
|
||||
height="128"
|
||||
style="height: 128px; width: 128px;"
|
||||
shape-rendering="crispEdges"
|
||||
viewBox="0 0 21 21"
|
||||
width="128"
|
||||
/>
|
||||
>
|
||||
<path
|
||||
d="M0,0 h21v21H0z"
|
||||
fill="#fff"
|
||||
/>
|
||||
<path
|
||||
d="M0 0h7v1H0zM9 0h1v1H9zM12 0h1v1H12zM14,0 h7v1H14zM0 1h1v1H0zM6 1h1v1H6zM8 1h1v1H8zM11 1h1v1H11zM14 1h1v1H14zM20,1 h1v1H20zM0 2h1v1H0zM2 2h3v1H2zM6 2h1v1H6zM9 2h1v1H9zM14 2h1v1H14zM16 2h3v1H16zM20,2 h1v1H20zM0 3h1v1H0zM2 3h3v1H2zM6 3h1v1H6zM8 3h1v1H8zM11 3h1v1H11zM14 3h1v1H14zM16 3h3v1H16zM20,3 h1v1H20zM0 4h1v1H0zM2 4h3v1H2zM6 4h1v1H6zM10 4h3v1H10zM14 4h1v1H14zM16 4h3v1H16zM20,4 h1v1H20zM0 5h1v1H0zM6 5h1v1H6zM8 5h3v1H8zM12 5h1v1H12zM14 5h1v1H14zM20,5 h1v1H20zM0 6h7v1H0zM8 6h1v1H8zM10 6h1v1H10zM12 6h1v1H12zM14,6 h7v1H14zM10 7h3v1H10zM0 8h5v1H0zM6 8h4v1H6zM12 8h2v1H12zM15 8h1v1H15zM17 8h1v1H17zM19 8h1v1H19zM2 9h4v1H2zM7 9h4v1H7zM12 9h1v1H12zM15 9h1v1H15zM17 9h1v1H17zM20,9 h1v1H20zM3 10h1v1H3zM6 10h3v1H6zM11 10h1v1H11zM13 10h1v1H13zM16 10h4v1H16zM0 11h1v1H0zM5 11h1v1H5zM7 11h1v1H7zM10 11h1v1H10zM15 11h5v1H15zM1 12h1v1H1zM3 12h1v1H3zM5 12h3v1H5zM11 12h1v1H11zM13 12h1v1H13zM16 12h1v1H16zM8 13h2v1H8zM11 13h4v1H11zM20,13 h1v1H20zM0 14h7v1H0zM8 14h3v1H8zM12 14h1v1H12zM14 14h2v1H14zM17 14h3v1H17zM0 15h1v1H0zM6 15h1v1H6zM9 15h1v1H9zM11 15h4v1H11zM17 15h2v1H17zM0 16h1v1H0zM2 16h3v1H2zM6 16h1v1H6zM8 16h1v1H8zM12 16h1v1H12zM15 16h1v1H15zM17 16h1v1H17zM19 16h1v1H19zM0 17h1v1H0zM2 17h3v1H2zM6 17h1v1H6zM8 17h1v1H8zM10 17h1v1H10zM12 17h1v1H12zM15 17h1v1H15zM18 17h1v1H18zM0 18h1v1H0zM2 18h3v1H2zM6 18h1v1H6zM8 18h1v1H8zM11 18h1v1H11zM13 18h1v1H13zM16 18h2v1H16zM0 19h1v1H0zM6 19h1v1H6zM8 19h1v1H8zM15 19h2v1H15zM18 19h1v1H18zM0 20h7v1H0zM8 20h4v1H8zM13 20h1v1H13zM16 20h1v1H16zM18 20h2v1H18z"
|
||||
fill="#000"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -35,9 +35,11 @@ exports[`Renderer:tabs 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
<p>
|
||||
tab1 内容
|
||||
</p>
|
||||
<span>
|
||||
<p>
|
||||
tab1 内容
|
||||
</p>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,140 +3,23 @@
|
||||
exports[`store:index 1`] = `
|
||||
Object {
|
||||
"storeType": "RendererStore",
|
||||
"stores": Object {},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`store:index 2`] = `
|
||||
Object {
|
||||
"storeType": "RendererStore",
|
||||
"stores": Object {
|
||||
"1": Object {
|
||||
"action": undefined,
|
||||
"busying": false,
|
||||
"checking": false,
|
||||
"childrenIds": Array [],
|
||||
"data": Object {},
|
||||
"dialogData": undefined,
|
||||
"dialogOpen": false,
|
||||
"disposed": false,
|
||||
"drawerData": undefined,
|
||||
"drawerOpen": false,
|
||||
"error": false,
|
||||
"fetching": false,
|
||||
"hasRemoteData": false,
|
||||
"id": "1",
|
||||
"initedAt": 0,
|
||||
"initializing": false,
|
||||
"msg": "",
|
||||
"parentId": "",
|
||||
"path": "/xxx",
|
||||
"pristine": Object {},
|
||||
"saving": false,
|
||||
"schema": null,
|
||||
"schemaKey": "",
|
||||
"storeType": "ServiceStore",
|
||||
"updatedAt": 0,
|
||||
},
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`store:index 3`] = `
|
||||
Object {
|
||||
"storeType": "RendererStore",
|
||||
"stores": Object {
|
||||
"1": Object {
|
||||
"action": undefined,
|
||||
"busying": false,
|
||||
"checking": false,
|
||||
"childrenIds": Array [
|
||||
"2",
|
||||
],
|
||||
"data": Object {},
|
||||
"dialogData": undefined,
|
||||
"dialogOpen": false,
|
||||
"disposed": false,
|
||||
"drawerData": undefined,
|
||||
"drawerOpen": false,
|
||||
"error": false,
|
||||
"fetching": false,
|
||||
"hasRemoteData": false,
|
||||
"id": "1",
|
||||
"initedAt": 0,
|
||||
"initializing": false,
|
||||
"msg": "",
|
||||
"parentId": "",
|
||||
"path": "/xxx",
|
||||
"pristine": Object {},
|
||||
"saving": false,
|
||||
"schema": null,
|
||||
"schemaKey": "",
|
||||
"storeType": "ServiceStore",
|
||||
"updatedAt": 0,
|
||||
},
|
||||
"2": Object {
|
||||
"action": undefined,
|
||||
"busying": false,
|
||||
"checking": false,
|
||||
"childrenIds": Array [],
|
||||
"data": Object {},
|
||||
"dialogData": undefined,
|
||||
"dialogOpen": false,
|
||||
"disposed": false,
|
||||
"drawerData": undefined,
|
||||
"drawerOpen": false,
|
||||
"error": false,
|
||||
"fetching": false,
|
||||
"hasRemoteData": false,
|
||||
"id": "2",
|
||||
"initedAt": 0,
|
||||
"initializing": false,
|
||||
"msg": "",
|
||||
"parentId": "1",
|
||||
"path": "/yyy",
|
||||
"pristine": Object {},
|
||||
"saving": false,
|
||||
"schema": null,
|
||||
"schemaKey": "",
|
||||
"storeType": "ServiceStore",
|
||||
"updatedAt": 0,
|
||||
},
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`store:index 4`] = `
|
||||
Object {
|
||||
"storeType": "RendererStore",
|
||||
"stores": Object {
|
||||
"1": Object {
|
||||
"action": undefined,
|
||||
"busying": false,
|
||||
"checking": false,
|
||||
"childrenIds": Array [],
|
||||
"data": Object {},
|
||||
"dialogData": undefined,
|
||||
"dialogOpen": false,
|
||||
"disposed": false,
|
||||
"drawerData": undefined,
|
||||
"drawerOpen": false,
|
||||
"error": false,
|
||||
"fetching": false,
|
||||
"hasRemoteData": false,
|
||||
"id": "1",
|
||||
"initedAt": 0,
|
||||
"initializing": false,
|
||||
"msg": "",
|
||||
"parentId": "",
|
||||
"path": "/xxx",
|
||||
"pristine": Object {},
|
||||
"saving": false,
|
||||
"schema": null,
|
||||
"schemaKey": "",
|
||||
"storeType": "ServiceStore",
|
||||
"updatedAt": 0,
|
||||
},
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
@ -1,73 +1,95 @@
|
||||
import { getSnapshot, getEnv, onSnapshot } from 'mobx-state-tree';
|
||||
import { ServiceStore } from '../../src/store/service';
|
||||
import { RendererStore } from '../../src/store';
|
||||
import {getSnapshot, getEnv, onSnapshot} from 'mobx-state-tree';
|
||||
import {StoreNode} from '../../src/store/node';
|
||||
import {ServiceStore} from '../../src/store/service';
|
||||
import {RendererStore} from '../../src/store';
|
||||
import omit = require('lodash/omit');
|
||||
|
||||
|
||||
test('store:ServiceStore', () => {
|
||||
const store = ServiceStore.create({
|
||||
id: '1',
|
||||
storeType: ServiceStore.name
|
||||
});
|
||||
const store = ServiceStore.create({
|
||||
id: '1',
|
||||
storeType: ServiceStore.name
|
||||
});
|
||||
|
||||
expect(getSnapshot(store)).toMatchSnapshot();
|
||||
expect(getSnapshot(store)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
|
||||
test('store:ServiceStore fetchInitData success', async () => {
|
||||
const fetcher = jest.fn().mockImplementationOnce(() => Promise.resolve({
|
||||
ok: true,
|
||||
data: {
|
||||
a: 1,
|
||||
b: 2
|
||||
}
|
||||
}));
|
||||
const mainStore = RendererStore.create({}, {
|
||||
fetcher
|
||||
});
|
||||
const states:Array<any> = [];
|
||||
const fetcher = jest.fn().mockImplementationOnce(() =>
|
||||
Promise.resolve({
|
||||
ok: true,
|
||||
data: {
|
||||
a: 1,
|
||||
b: 2
|
||||
}
|
||||
})
|
||||
);
|
||||
const isCancel = jest.fn(() => false);
|
||||
const mainStore = RendererStore.create(
|
||||
{},
|
||||
{
|
||||
fetcher,
|
||||
isCancel
|
||||
}
|
||||
);
|
||||
const states: Array<any> = [];
|
||||
|
||||
const store = ServiceStore.create(
|
||||
{
|
||||
id: '1',
|
||||
storeType: ServiceStore.name
|
||||
},
|
||||
{
|
||||
fetcher,
|
||||
isCancel
|
||||
}
|
||||
);
|
||||
mainStore.addStore(store);
|
||||
|
||||
const store = ServiceStore.create({
|
||||
id: '1',
|
||||
storeType: ServiceStore.name
|
||||
});
|
||||
mainStore.addStore(store);
|
||||
onSnapshot(store, snapshot => states.push(snapshot));
|
||||
|
||||
onSnapshot(store, (snapshot) => states.push(snapshot));
|
||||
await store.fetchInitData('/api/xxx');
|
||||
|
||||
await store.fetchInitData('/api/xxx');
|
||||
const ignoreUdatedAt = states.map(snapshot => omit(snapshot, ['updatedAt']));
|
||||
expect(ignoreUdatedAt).toMatchSnapshot();
|
||||
|
||||
const ignoreUdatedAt = states.map(snapshot => omit(snapshot, ['updatedAt']));
|
||||
expect(ignoreUdatedAt).toMatchSnapshot();
|
||||
|
||||
expect(states.length).toBe(2);
|
||||
expect(states[1].updatedAt).not.toEqual(states[0].updatedAt);
|
||||
expect(states.length).toBe(2);
|
||||
expect(states[1].updatedAt).not.toEqual(states[0].updatedAt);
|
||||
});
|
||||
|
||||
test('store:ServiceStore fetchInitData failed', async () => {
|
||||
const fetcher = jest.fn().mockImplementationOnce(() => Promise.reject('Network Error'));
|
||||
const notify = jest.fn();
|
||||
const isCancel = jest.fn(() => false);
|
||||
const mainStore = RendererStore.create({}, {
|
||||
fetcher,
|
||||
notify,
|
||||
isCancel
|
||||
});
|
||||
const states:Array<any> = [];
|
||||
const fetcher = jest
|
||||
.fn()
|
||||
.mockImplementationOnce(() => Promise.reject('Network Error'));
|
||||
const notify = jest.fn();
|
||||
const isCancel = jest.fn(() => false);
|
||||
const mainStore = RendererStore.create(
|
||||
{},
|
||||
{
|
||||
fetcher,
|
||||
notify,
|
||||
isCancel
|
||||
}
|
||||
);
|
||||
const states: Array<any> = [];
|
||||
|
||||
const store = ServiceStore.create(
|
||||
{
|
||||
id: '1',
|
||||
storeType: ServiceStore.name
|
||||
},
|
||||
{
|
||||
fetcher,
|
||||
notify,
|
||||
isCancel
|
||||
}
|
||||
);
|
||||
mainStore.addStore(store);
|
||||
|
||||
const store = ServiceStore.create({
|
||||
id: '1',
|
||||
storeType: ServiceStore.name
|
||||
});
|
||||
mainStore.addStore(store);
|
||||
onSnapshot(store, snapshot => states.push(snapshot));
|
||||
|
||||
onSnapshot(store, (snapshot) => states.push(snapshot));
|
||||
|
||||
await store.fetchInitData('/api/xxx');
|
||||
expect(states).toMatchSnapshot();
|
||||
expect(notify).toHaveBeenCalled();
|
||||
expect(notify).toHaveBeenLastCalledWith("error", "Network Error");
|
||||
expect(isCancel).toHaveBeenCalled();
|
||||
});
|
||||
await store.fetchInitData('/api/xxx');
|
||||
expect(states).toMatchSnapshot();
|
||||
expect(notify).toHaveBeenCalled();
|
||||
expect(notify).toHaveBeenLastCalledWith('error', 'Network Error');
|
||||
expect(isCancel).toHaveBeenCalled();
|
||||
});
|
||||
|
@ -35,7 +35,9 @@ exports[`api:cache 1`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable value is 1
|
||||
<span>
|
||||
The variable value is 1
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -79,7 +81,9 @@ exports[`api:cache 2`] = `
|
||||
<span
|
||||
class="a-TplField"
|
||||
>
|
||||
The variable value is 1
|
||||
<span>
|
||||
The variable value is 1
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -552,9 +552,9 @@ Cards 模式支持 [Cards](./cards) 中的所有功能。
|
||||
|
||||
例如上例中,配置`{ perPage: 50 }`,指定分页的默认每页数据条数为 50 条。
|
||||
|
||||
## 数据源接口轮训
|
||||
## 数据源接口轮询
|
||||
|
||||
可以配置`interval`来实现数据接口轮训功能,默认最低为`3000`毫秒,
|
||||
可以配置`interval`来实现数据接口轮询功能,默认最低为`3000`毫秒,
|
||||
|
||||
```schema:height="600" scope="body"
|
||||
{
|
||||
@ -590,7 +590,7 @@ Cards 模式支持 [Cards](./cards) 中的所有功能。
|
||||
}
|
||||
```
|
||||
|
||||
配置`stopAutoRefreshWhen`表达式,来实现满足条件,停止轮训
|
||||
配置`stopAutoRefreshWhen`表达式,来实现满足条件,停止轮询
|
||||
|
||||
## 列配置
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
---
|
||||
title: City 城市选择器
|
||||
description:
|
||||
description:
|
||||
type: 0
|
||||
group: null
|
||||
menuName: City
|
||||
icon:
|
||||
icon:
|
||||
order: 10
|
||||
---
|
||||
|
||||
城市选择器,可用于让用户输入城市。
|
||||
|
||||
## 基本用法
|
||||
@ -20,7 +21,8 @@ order: 10
|
||||
{
|
||||
"name": "city",
|
||||
"type": "city",
|
||||
"label": "城市"
|
||||
"label": "城市",
|
||||
"searchable": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -73,13 +75,9 @@ order: 10
|
||||
|
||||
当做选择器表单项使用时,除了支持 [普通表单项属性表](./formitem#%E5%B1%9E%E6%80%A7%E8%A1%A8) 中的配置以外,还支持下面一些配置
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 说明 |
|
||||
| ------------- | --------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
|
||||
| allowCity | `boolean` | `true` | 允许选择城市 |
|
||||
| allowDistrict | `boolean` | `true` | 允许选择区域 |
|
||||
| extractValue | `boolean` | `true` | 默认 `true` 是否抽取值,如果设置成 `false` 值格式会变成对象,包含 `code`、`province`、`city` 和 `district` 文字信息。 |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 说明 |
|
||||
| ------------- | --------- | ------- | --------------------------------------------------------------------------------------------------------------------- |
|
||||
| allowCity | `boolean` | `true` | 允许选择城市 |
|
||||
| allowDistrict | `boolean` | `true` | 允许选择区域 |
|
||||
| searchable | `boolean` | `false` | 是否出搜索框 |
|
||||
| extractValue | `boolean` | `true` | 默认 `true` 是否抽取值,如果设置成 `false` 值格式会变成对象,包含 `code`、`province`、`city` 和 `district` 文字信息。 |
|
||||
|
@ -373,9 +373,9 @@ Form 默认会在底部渲染一个提交按钮,用于执行表单的提交行
|
||||
}
|
||||
```
|
||||
|
||||
### 轮训初始化请求
|
||||
### 轮询初始化请求
|
||||
|
||||
Form 支持轮训初始化接口,步骤如下:
|
||||
Form 支持轮询初始化接口,步骤如下:
|
||||
|
||||
1. 配置`initApi`
|
||||
2. 配置 `interval`:单位为`ms`,最低值`3000`,低于该值按`3000`处理
|
||||
@ -396,7 +396,7 @@ Form 支持轮训初始化接口,步骤如下:
|
||||
}
|
||||
```
|
||||
|
||||
如果希望在满足某个条件的情况下停止轮训,配置`stopAutoRefreshWhen`表达式。
|
||||
如果希望在满足某个条件的情况下停止轮询,配置`stopAutoRefreshWhen`表达式。
|
||||
|
||||
```schema:height="300" scope="body"
|
||||
{
|
||||
@ -580,9 +580,9 @@ Form 支持轮训初始化接口,步骤如下:
|
||||
2. 为行为按钮配置`"actionType": "submit"`
|
||||
3. 配置`"type": "submit"`的按钮
|
||||
|
||||
### 轮训提交请求
|
||||
### 轮询提交请求
|
||||
|
||||
通过设置`asyncApi`,当表单提交发送保存接口后,还会继续轮训请求该接口,默认间隔为`3秒`,直到返回 `finished` 属性为 `true` 才 结束。
|
||||
通过设置`asyncApi`,当表单提交发送保存接口后,还会继续轮询请求该接口,默认间隔为`3秒`,直到返回 `finished` 属性为 `true` 才 结束。
|
||||
|
||||
```schema:height="330" scope="body"
|
||||
{
|
||||
@ -605,7 +605,7 @@ Form 支持轮训初始化接口,步骤如下:
|
||||
}
|
||||
```
|
||||
|
||||
如果决定结束轮训的标识字段名不是 `finished`,请设置`finishedField`属性,比如:`"finishedField": "is_success"`
|
||||
如果决定结束轮询的标识字段名不是 `finished`,请设置`finishedField`属性,比如:`"finishedField": "is_success"`
|
||||
|
||||
## 重置表单
|
||||
|
||||
@ -850,13 +850,13 @@ Form 支持轮训初始化接口,步骤如下:
|
||||
| interval | `number` | `3000` | 刷新时间(最低 3000) |
|
||||
| silentPolling | `boolean` | `false` | 配置刷新时是否显示加载动画 |
|
||||
| stopAutoRefreshWhen | `string` | `""` | 通过[表达式](./Types.md#表达式) 来配置停止刷新的条件 |
|
||||
| initAsyncApi | [API](../../types/api) | | Form 用来获取初始数据的 api,与 initApi 不同的是,会一直轮训请求该接口,直到返回 finished 属性为 true 才 结束。 |
|
||||
| initAsyncApi | [API](../../types/api) | | Form 用来获取初始数据的 api,与 initApi 不同的是,会一直轮询请求该接口,直到返回 finished 属性为 true 才 结束。 |
|
||||
| initFetch | `boolean` | `true` | 设置了 initApi 或者 initAsyncApi 后,默认会开始就发请求,设置为 false 后就不会起始就请求接口 |
|
||||
| initFetchOn | `string` | | 用表达式来配置 |
|
||||
| initFinishedField | `string` | `finished` | 设置了 initAsyncApi 后,默认会从返回数据的 data.finished 来判断是否完成,也可以设置成其他的 xxx,就会从 data.xxx 中获取 |
|
||||
| initCheckInterval | `number` | `3000` | 设置了 initAsyncApi 以后,默认拉取的时间间隔 |
|
||||
| asyncApi | [API](../../types/api) | | 设置此属性后,表单提交发送保存接口后,还会继续轮训请求该接口,直到返回 `finished` 属性为 `true` 才 结束。 |
|
||||
| checkInterval | `number` | 3000 | 轮训请求的时间间隔,默认为 3 秒。设置 `asyncApi` 才有效 |
|
||||
| asyncApi | [API](../../types/api) | | 设置此属性后,表单提交发送保存接口后,还会继续轮询请求该接口,直到返回 `finished` 属性为 `true` 才 结束。 |
|
||||
| checkInterval | `number` | 3000 | 轮询请求的时间间隔,默认为 3 秒。设置 `asyncApi` 才有效 |
|
||||
| finishedField | `string` | `"finished"` | 如果决定结束的字段名不是 `finished` 请设置此属性,比如 `is_success` |
|
||||
| submitOnChange | `boolean` | `false` | 表单修改即提交 |
|
||||
| submitOnInit | `boolean` | `false` | 初始就提交一次 |
|
||||
|
@ -1,10 +1,10 @@
|
||||
---
|
||||
title: TreeSelect 树形选择器
|
||||
description:
|
||||
description:
|
||||
type: 0
|
||||
group: null
|
||||
menuName: TreeSelect 树形选择器
|
||||
icon:
|
||||
icon:
|
||||
order: 60
|
||||
---
|
||||
|
||||
@ -41,6 +41,24 @@ order: 60
|
||||
{
|
||||
"label": "file D",
|
||||
"value": 5
|
||||
},
|
||||
{
|
||||
"label": "Folder E",
|
||||
"children": [
|
||||
{
|
||||
"label": "Folder G",
|
||||
"children": [
|
||||
{
|
||||
"label": "file H",
|
||||
"value": 6
|
||||
},
|
||||
{
|
||||
"label": "file I",
|
||||
"value": 7
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -49,7 +67,3 @@ order: 60
|
||||
```
|
||||
|
||||
更多用法,见 [Tree](./tree)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -88,9 +88,9 @@ Page 默认将页面分为几个区域,分别是**内容区(`body`)**、**
|
||||
|
||||
具体 API 规范查看 [API 文档](../types/api)。
|
||||
|
||||
## 轮训初始化接口
|
||||
## 轮询初始化接口
|
||||
|
||||
想要在页面渲染后,轮训请求初始化接口,步骤如下:
|
||||
想要在页面渲染后,轮询请求初始化接口,步骤如下:
|
||||
|
||||
1. 配置 initApi;
|
||||
2. 配置 interval:单位为 ms,最低值 3000,低于该值按 3000 处理。
|
||||
@ -109,13 +109,13 @@ Page 默认将页面分为几个区域,分别是**内容区(`body`)**、**
|
||||
}
|
||||
```
|
||||
|
||||
如果希望在满足某个条件的情况下停止轮训,配置`stopAutoRefreshWhen`表达式。
|
||||
如果希望在满足某个条件的情况下停止轮询,配置`stopAutoRefreshWhen`表达式。
|
||||
|
||||
```schema:height="200"
|
||||
{
|
||||
"type": "page",
|
||||
"initApi": "https://houtai.baidu.com/api/mock2/page/initData",
|
||||
"stopAutoRefreshWhen": "this.time % 5", // 当时间戳能被5整除时,停止轮训
|
||||
"stopAutoRefreshWhen": "this.time % 5", // 当时间戳能被5整除时,停止轮询
|
||||
"interval": 3000,
|
||||
"body": [
|
||||
{
|
||||
|
@ -293,6 +293,6 @@ amis 中部分组件,作为展示组件,自身没有**使用接口初始化
|
||||
| messages | `Object` | | 消息提示覆写,默认消息读取的是接口返回的 toast 提示文字,但是在此可以覆写它。 |
|
||||
| messages.fetchSuccess | `string` | | 接口请求成功时的 toast 提示文字 |
|
||||
| messages.fetchFailed | `string` | `"初始化失败"` | 接口请求失败时 toast 提示文字 |
|
||||
| interval | `number` | | 轮训时间间隔(最低 3000) |
|
||||
| silentPolling | `boolean` | `false` | 配置轮训时是否显示加载动画 |
|
||||
| stopAutoRefreshWhen | [表达式](../concepts/expression) | | 配置停止轮训的条件 |
|
||||
| interval | `number` | | 轮询时间间隔(最低 3000) |
|
||||
| silentPolling | `boolean` | `false` | 配置轮询时是否显示加载动画 |
|
||||
| stopAutoRefreshWhen | [表达式](../concepts/expression) | | 配置停止轮询的条件 |
|
||||
|
@ -16,7 +16,7 @@ order: 14
|
||||
|
||||
- 某个条件下显示或隐藏某个组件
|
||||
- 某个条件下请求接口
|
||||
- 某个条件下轮训接口停止轮训
|
||||
- 某个条件下轮询接口停止轮询
|
||||
- 等等...
|
||||
|
||||
> 联动配置项一般都是 [表达式](./expression)
|
||||
@ -142,7 +142,7 @@ order: 14
|
||||
> - `form`组件中的`initApi`;
|
||||
> - `select`组件中的`source`选项源接口`url`, `data`只能用于主动联动;
|
||||
> - `service`组件中的`api`和`schemaApi`;
|
||||
> - `crud`组件中的`api`;
|
||||
> - `crud`组件中的`api`;(crud 默认是跟地址栏联动,如果要做请关闭同步地址栏 syncLocation: false)
|
||||
> - 等等...
|
||||
|
||||
#### 配置请求条件
|
||||
|
@ -155,7 +155,7 @@ API 还支持配置对象类型
|
||||
}
|
||||
```
|
||||
|
||||
支持[数据映射](./data-mapping)
|
||||
支持[数据映射](../concepts/data-mapping)
|
||||
|
||||
> 当`method`配置为`get`时,`data`中的值默认会添加到请求路径中
|
||||
|
||||
|
@ -50,6 +50,23 @@ export default function (schema) {
|
||||
updateLocation: (location, replace) => {
|
||||
router[replace ? 'replace' : 'push'](normalizeLink(location));
|
||||
},
|
||||
jumpTo: (to, action) => {
|
||||
if (to === 'goBack') {
|
||||
return router.location.goBack();
|
||||
}
|
||||
to = normalizeLink(to);
|
||||
if (action && action.actionType === 'url') {
|
||||
action.blank === false
|
||||
? (window.location.href = to)
|
||||
: window.open(to);
|
||||
return;
|
||||
}
|
||||
if (/^https?:\/\//.test(to)) {
|
||||
window.location.replace(to);
|
||||
} else {
|
||||
router.push(to);
|
||||
}
|
||||
},
|
||||
isCurrentUrl: to => {
|
||||
const link = normalizeLink(to);
|
||||
return router.isActive(link);
|
||||
|
File diff suppressed because one or more lines are too long
@ -177,7 +177,12 @@ export function embed(
|
||||
return window.history.back();
|
||||
}
|
||||
|
||||
replace || (location.href = normalizeLink(to));
|
||||
if (replace && window.history.replaceState) {
|
||||
window.history.replaceState('', document.title, to);
|
||||
return;
|
||||
}
|
||||
|
||||
location.href = normalizeLink(to);
|
||||
},
|
||||
isCurrentUrl: (to: string) => {
|
||||
const link = normalizeLink(to);
|
||||
|
154
fis-conf.js
154
fis-conf.js
@ -110,24 +110,23 @@ fis.match('/docs/**.md', {
|
||||
parser: [
|
||||
parserMarkdown,
|
||||
function (contents, file) {
|
||||
return contents.replace(/\bhref=\\('|")(.+?)\\\1/g, function (
|
||||
_,
|
||||
quota,
|
||||
link
|
||||
) {
|
||||
if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) {
|
||||
let parts = link.split('#');
|
||||
parts[0] = parts[0].replace('.md', '');
|
||||
return contents.replace(
|
||||
/\bhref=\\('|")(.+?)\\\1/g,
|
||||
function (_, quota, link) {
|
||||
if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) {
|
||||
let parts = link.split('#');
|
||||
parts[0] = parts[0].replace('.md', '');
|
||||
|
||||
if (parts[0][0] !== '/') {
|
||||
parts[0] = path.resolve(path.dirname(file.subpath), parts[0]);
|
||||
if (parts[0][0] !== '/') {
|
||||
parts[0] = path.resolve(path.dirname(file.subpath), parts[0]);
|
||||
}
|
||||
|
||||
return 'href=\\' + quota + parts.join('#') + '\\' + quota;
|
||||
}
|
||||
|
||||
return 'href=\\' + quota + parts.join('#') + '\\' + quota;
|
||||
return _;
|
||||
}
|
||||
|
||||
return _;
|
||||
});
|
||||
);
|
||||
}
|
||||
],
|
||||
isMod: true
|
||||
@ -170,7 +169,14 @@ fis.match('{*.ts,*.jsx,*.tsx,/src/**.js,/src/**.ts}', {
|
||||
}),
|
||||
|
||||
function (content) {
|
||||
return content.replace(/\b[a-zA-Z_0-9$]+\.__uri\s*\(/g, '__uri(');
|
||||
return content
|
||||
.replace(/\b[a-zA-Z_0-9$]+\.__uri\s*\(/g, '__uri(')
|
||||
.replace(
|
||||
/return\s+(tslib_\d+)\.__importStar\(require\(('|")(.*?)\2\)\);/g,
|
||||
function (_, tslib, quto, value) {
|
||||
return `return new Promise(function(resolve){require(['${value}'], function(ret) {resolve(${tslib}.__importStar(ret));})});`;
|
||||
}
|
||||
);
|
||||
}
|
||||
],
|
||||
preprocessor: fis.plugin('js-require-css'),
|
||||
@ -239,19 +245,26 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
allowUmdGlobalAccess: true
|
||||
}),
|
||||
function (contents) {
|
||||
return contents.replace(
|
||||
/(?:\w+\.)?\b__uri\s*\(\s*('|")(.*?)\1\s*\)/g,
|
||||
function (_, quote, value) {
|
||||
let str = quote + value + quote;
|
||||
return (
|
||||
'(function(){try {return __uri(' +
|
||||
str +
|
||||
')} catch(e) {return ' +
|
||||
str +
|
||||
'}})()'
|
||||
);
|
||||
}
|
||||
);
|
||||
return contents
|
||||
.replace(
|
||||
/(?:\w+\.)?\b__uri\s*\(\s*('|")(.*?)\1\s*\)/g,
|
||||
function (_, quote, value) {
|
||||
let str = quote + value + quote;
|
||||
return (
|
||||
'(function(){try {return __uri(' +
|
||||
str +
|
||||
')} catch(e) {return ' +
|
||||
str +
|
||||
'}})()'
|
||||
);
|
||||
}
|
||||
)
|
||||
.replace(
|
||||
/return\s+(tslib_\d+)\.__importStar\(require\(('|")(.*?)\2\)\);/g,
|
||||
function (_, tslib, quto, value) {
|
||||
return `return new Promise(function(resolve){require(['${value}'], function(ret) {resolve(${tslib}.__importStar(ret));})});`;
|
||||
}
|
||||
);
|
||||
}
|
||||
],
|
||||
preprocessor: null
|
||||
@ -345,9 +358,15 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
experimentalDecorators: true,
|
||||
sourceMap: false
|
||||
}),
|
||||
|
||||
function (content) {
|
||||
return content.replace(/\b[a-zA-Z_0-9$]+\.__uri\s*\(/g, '__uri(');
|
||||
return content
|
||||
.replace(/\b[a-zA-Z_0-9$]+\.__uri\s*\(/g, '__uri(')
|
||||
.replace(
|
||||
/return\s+(tslib_\d+)\.__importStar\(require\(('|")(.*?)\2\)\);/g,
|
||||
function (_, tslib, quto, value) {
|
||||
return `return new Promise(function(resolve){require(['${value}'], function(ret) {resolve(${tslib}.__importStar(ret));})});`;
|
||||
}
|
||||
);
|
||||
}
|
||||
],
|
||||
preprocessor: fis.plugin('js-require-css'),
|
||||
@ -521,24 +540,25 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
parser: [
|
||||
parserMarkdown,
|
||||
function (contents, file) {
|
||||
return contents.replace(/\bhref=\\('|")(.+?)\\\1/g, function (
|
||||
_,
|
||||
quota,
|
||||
link
|
||||
) {
|
||||
if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) {
|
||||
let parts = link.split('#');
|
||||
parts[0] = parts[0].replace('.md', '');
|
||||
return contents.replace(
|
||||
/\bhref=\\('|")(.+?)\\\1/g,
|
||||
function (_, quota, link) {
|
||||
if (/\.md($|#)/.test(link) && !/^https?\:/.test(link)) {
|
||||
let parts = link.split('#');
|
||||
parts[0] = parts[0].replace('.md', '');
|
||||
|
||||
if (parts[0][0] !== '/') {
|
||||
parts[0] = path.resolve(path.dirname(file.subpath), parts[0]);
|
||||
if (parts[0][0] !== '/') {
|
||||
parts[0] = path.resolve(path.dirname(file.subpath), parts[0]);
|
||||
}
|
||||
|
||||
return (
|
||||
'href=\\' + quota + '/amis' + parts.join('#') + '\\' + quota
|
||||
);
|
||||
}
|
||||
|
||||
return 'href=\\' + quota + '/amis' + parts.join('#') + '\\' + quota;
|
||||
return _;
|
||||
}
|
||||
|
||||
return _;
|
||||
});
|
||||
);
|
||||
}
|
||||
]
|
||||
});
|
||||
@ -658,18 +678,17 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
DocJs.getContent(),
|
||||
ExampleJs.getContent()
|
||||
].join('\n');
|
||||
source.replace(/\bpath\b\s*\:\s*('|")(.*?)\1/g, function (
|
||||
_,
|
||||
qutoa,
|
||||
path
|
||||
) {
|
||||
if (path === '*') {
|
||||
return;
|
||||
}
|
||||
source.replace(
|
||||
/\bpath\b\s*\:\s*('|")(.*?)\1/g,
|
||||
function (_, qutoa, path) {
|
||||
if (path === '*') {
|
||||
return;
|
||||
}
|
||||
|
||||
pages.push(path.replace(/^\//, ''));
|
||||
return _;
|
||||
});
|
||||
pages.push(path.replace(/^\//, ''));
|
||||
return _;
|
||||
}
|
||||
);
|
||||
|
||||
const contents = indexHtml.getContent();
|
||||
pages.forEach(function (path) {
|
||||
@ -713,7 +732,30 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
sourceMap: false,
|
||||
importHelpers: true,
|
||||
esModuleInterop: true
|
||||
})
|
||||
}),
|
||||
|
||||
function (contents) {
|
||||
return contents
|
||||
.replace(
|
||||
/(?:\w+\.)?\b__uri\s*\(\s*('|")(.*?)\1\s*\)/g,
|
||||
function (_, quote, value) {
|
||||
let str = quote + value + quote;
|
||||
return (
|
||||
'(function(){try {return __uri(' +
|
||||
str +
|
||||
')} catch(e) {return ' +
|
||||
str +
|
||||
'}})()'
|
||||
);
|
||||
}
|
||||
)
|
||||
.replace(
|
||||
/return\s+(tslib_\d+)\.__importStar\(require\(('|")(.*?)\2\)\);/g,
|
||||
function (_, tslib, quto, value) {
|
||||
return `return new Promise(function(resolve){require(['${value}'], function(ret) {resolve(${tslib}.__importStar(ret));})});`;
|
||||
}
|
||||
);
|
||||
}
|
||||
]
|
||||
});
|
||||
ghPages.match('*', {
|
||||
|
46
package.json
46
package.json
@ -93,9 +93,10 @@
|
||||
"@types/async": "^2.0.45",
|
||||
"@types/classnames": "^2.2.3",
|
||||
"@types/dom-helpers": "^3.4.1",
|
||||
"@types/echarts": "^4.9.2",
|
||||
"@types/history": "^4.6.0",
|
||||
"@types/hoist-non-react-statics": "^3.3.1",
|
||||
"@types/jest": "^24.0.11",
|
||||
"@types/jest": "^24.9.1",
|
||||
"@types/jquery": "^3.3.1",
|
||||
"@types/lodash": "^4.14.76",
|
||||
"@types/mkdirp": "^1.0.1",
|
||||
@ -143,8 +144,8 @@
|
||||
"fs-walk": "0.0.2",
|
||||
"glob": "^7.1.6",
|
||||
"husky": "^2.2.0",
|
||||
"jest": "^24.5.0",
|
||||
"jest-canvas-mock": "^2.1.0",
|
||||
"jest": "^26.6.3",
|
||||
"jest-canvas-mock": "^2.3.0",
|
||||
"js-yaml": "^3.10.0",
|
||||
"lint-staged": "^8.1.6",
|
||||
"marked": "^1.1.1",
|
||||
@ -157,10 +158,10 @@
|
||||
"react-test-renderer": "^16.8.6",
|
||||
"react-testing-library": "6.0.4",
|
||||
"strip-json-comments": "^2.0.1",
|
||||
"ts-jest": "^24.0.0",
|
||||
"ts-json-schema-generator": "^0.73.0",
|
||||
"ts-jest": "^26.4.4",
|
||||
"ts-json-schema-generator": "^0.80.0",
|
||||
"ts-node": "^9.0.0",
|
||||
"typescript": "^4.0.2"
|
||||
"typescript": "~4.1.2"
|
||||
},
|
||||
"jest": {
|
||||
"testEnvironment": "jsdom",
|
||||
@ -183,9 +184,40 @@
|
||||
"\\.(css|less|sass|scss)$": "<rootDir>/__mocks__/styleMock.js",
|
||||
"\\.(svg)$": "<rootDir>/__mocks__/svgMock.js"
|
||||
},
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/__tests__/jest.setup.js"
|
||||
],
|
||||
"globals": {
|
||||
"ts-jest": {
|
||||
"diagnostics": false
|
||||
"diagnostics": false,
|
||||
"tsconfig": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom",
|
||||
"ES2015"
|
||||
],
|
||||
"sourceMap": true,
|
||||
"jsx": "react",
|
||||
"moduleResolution": "node",
|
||||
"rootDir": ".",
|
||||
"importHelpers": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"sourceRoot": ".",
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": false,
|
||||
"typeRoots": [
|
||||
"./node_modules/@types",
|
||||
"./types"
|
||||
],
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -19,10 +19,13 @@
|
||||
}
|
||||
|
||||
&-fixedLeft {
|
||||
// 还是改成默认不显示,footable 展示的时候,配置 固定列还没修复
|
||||
left: 0;
|
||||
top: -99999px;
|
||||
|
||||
&.in {
|
||||
box-shadow: $Table-fixedLeft-boxShadow;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
& > .#{$ns}Table-table {
|
||||
@ -38,10 +41,13 @@
|
||||
}
|
||||
|
||||
&-fixedRight {
|
||||
// 还是改成默认不显示,footable 展示的时候,配置 固定列还没修复
|
||||
right: 0;
|
||||
top: -99999px;
|
||||
|
||||
&.in {
|
||||
box-shadow: $Table-fixedRight-boxShadow;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
& > .#{$ns}Table-table {
|
||||
|
@ -15,6 +15,7 @@
|
||||
flex-grow: 1;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
|
||||
> input {
|
||||
display: inline-block;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -176,9 +176,7 @@ export class Editor extends React.Component<EditorProps, any> {
|
||||
}
|
||||
|
||||
loadMonaco() {
|
||||
(require as any)(['monaco-editor'], (monaco: any) => {
|
||||
this.initMonaco(monaco);
|
||||
});
|
||||
import('monaco-editor').then(monaco => this.initMonaco(monaco));
|
||||
}
|
||||
|
||||
initMonaco(monaco: any) {
|
||||
|
@ -14,7 +14,7 @@ export interface ResultBoxProps
|
||||
onChange?: (value: string) => void;
|
||||
onResultClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
||||
result?: Array<any> | any;
|
||||
itemRender: (value: any) => JSX.Element;
|
||||
itemRender: (value: any) => JSX.Element | string;
|
||||
onResultChange?: (value: Array<any>) => void;
|
||||
allowInput?: boolean;
|
||||
inputPlaceholder: string;
|
||||
|
@ -798,4 +798,31 @@ export class TreeSelector extends React.Component<
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找某个值的所有祖先节点
|
||||
* @param ancestors
|
||||
* @param options
|
||||
* @param value
|
||||
*/
|
||||
export function findAncestorsWithValue(
|
||||
ancestors: any[],
|
||||
options: any[],
|
||||
value: any
|
||||
) {
|
||||
for (let option of options) {
|
||||
if (option.value === value) {
|
||||
return true;
|
||||
}
|
||||
// 如果没有就在 children 中查找
|
||||
if (option.children) {
|
||||
const inChild = findAncestorsWithValue(ancestors, option.children, value);
|
||||
if (inChild) {
|
||||
ancestors.unshift(option);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export default themeable(localeable(TreeSelector));
|
||||
|
@ -1322,7 +1322,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
// newUnSelectedItems.push(...unSelectedItems);
|
||||
}
|
||||
|
||||
if (pickerMode && !multiple && newItems.length > 1) {
|
||||
if (pickerMode && multiple !== false && newItems.length > 1) {
|
||||
newUnSelectedItems.push(...newItems.splice(0, newItems.length - 1));
|
||||
}
|
||||
|
||||
@ -1706,7 +1706,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
<Button
|
||||
classPrefix={ns}
|
||||
onClick={() => {
|
||||
(require as any)(['papaparse'], (papaparse: any) => {
|
||||
import('papaparse').then((papaparse: any) => {
|
||||
const csvText = papaparse.unparse(store.data.items);
|
||||
if (csvText) {
|
||||
const blob = new Blob([csvText], {
|
||||
@ -1969,7 +1969,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
)
|
||||
: null}
|
||||
|
||||
{keepItemSelectionOnPageChange && multiple
|
||||
{keepItemSelectionOnPageChange && multiple !== false
|
||||
? this.renderSelection()
|
||||
: null}
|
||||
|
||||
|
@ -224,32 +224,34 @@ export class Chart extends React.Component<ChartProps> {
|
||||
refFn(ref: any) {
|
||||
const chartRef = this.props.chartRef;
|
||||
if (ref) {
|
||||
(require as any)(
|
||||
[
|
||||
'echarts',
|
||||
'echarts/extension/dataTool',
|
||||
'echarts/extension/bmap/bmap',
|
||||
'echarts/map/js/china',
|
||||
'echarts/map/js/world'
|
||||
],
|
||||
(echarts: any, dataTool: any) => {
|
||||
(window as any).echarts = echarts;
|
||||
echarts.dataTool = dataTool;
|
||||
this.echarts = echarts.init(ref);
|
||||
this.echarts.on('click', this.handleClick);
|
||||
this.unSensor = resizeSensor(ref, () => {
|
||||
const width = ref.offsetWidth;
|
||||
const height = ref.offsetHeight;
|
||||
this.echarts.resize({
|
||||
width,
|
||||
height
|
||||
});
|
||||
});
|
||||
Promise.all([
|
||||
import('echarts'),
|
||||
|
||||
chartRef && chartRef(this.echarts);
|
||||
this.renderChart();
|
||||
}
|
||||
);
|
||||
// @ts-ignore
|
||||
import('echarts/extension/dataTool'),
|
||||
// @ts-ignore
|
||||
import('echarts/extension/bmap/bmap'),
|
||||
// @ts-ignore
|
||||
import('echarts/map/js/china'),
|
||||
// @ts-ignore
|
||||
import('echarts/map/js/world')
|
||||
]).then(([echarts, dataTool]: any) => {
|
||||
(window as any).echarts = echarts;
|
||||
echarts.dataTool = dataTool;
|
||||
this.echarts = echarts.init(ref);
|
||||
this.echarts.on('click', this.handleClick);
|
||||
this.unSensor = resizeSensor(ref, () => {
|
||||
const width = ref.offsetWidth;
|
||||
const height = ref.offsetHeight;
|
||||
this.echarts.resize({
|
||||
width,
|
||||
height
|
||||
});
|
||||
});
|
||||
|
||||
chartRef && chartRef(this.echarts);
|
||||
this.renderChart();
|
||||
});
|
||||
} else {
|
||||
chartRef && chartRef(null);
|
||||
this.unSensor && this.unSensor();
|
||||
|
@ -92,6 +92,11 @@ export interface DrawerSchema extends BaseSchema {
|
||||
* 点击外部的时候是否关闭弹框。
|
||||
*/
|
||||
closeOnOutside?: boolean;
|
||||
|
||||
/**
|
||||
* 是否显示错误信息
|
||||
*/
|
||||
showErrorMsg?: boolean;
|
||||
}
|
||||
|
||||
export type DrawerSchemaBase = Omit<DrawerSchema, 'type'>;
|
||||
@ -126,7 +131,8 @@ export default class Drawer extends React.Component<DrawerProps, object> {
|
||||
'resizable',
|
||||
'overlay',
|
||||
'body',
|
||||
'popOverContainer'
|
||||
'popOverContainer',
|
||||
'showErrorMsg'
|
||||
];
|
||||
static defaultProps: Partial<DrawerProps> = {
|
||||
title: '',
|
||||
@ -135,7 +141,8 @@ export default class Drawer extends React.Component<DrawerProps, object> {
|
||||
position: 'right',
|
||||
resizable: false,
|
||||
overlay: true,
|
||||
closeOnEsc: false
|
||||
closeOnEsc: false,
|
||||
showErrorMsg: true
|
||||
};
|
||||
|
||||
reaction: any;
|
||||
@ -374,14 +381,14 @@ export default class Drawer extends React.Component<DrawerProps, object> {
|
||||
return null;
|
||||
}
|
||||
|
||||
const {store, render, classnames: cx} = this.props;
|
||||
const {store, render, classnames: cx, showErrorMsg} = this.props;
|
||||
|
||||
return (
|
||||
<div className={cx('Drawer-footer')}>
|
||||
{store.loading || store.error ? (
|
||||
<div className={cx('Drawer-info')}>
|
||||
<Spinner size="sm" key="info" show={store.loading} />
|
||||
{store.error ? (
|
||||
{showErrorMsg && store.error ? (
|
||||
<span className={cx('Drawer-error')}>{store.msg}</span>
|
||||
) : null}
|
||||
</div>
|
||||
|
@ -45,6 +45,11 @@ export interface CityControlSchema extends FormBaseControl {
|
||||
* 允许选择街道?
|
||||
*/
|
||||
allowStreet?: boolean;
|
||||
|
||||
/**
|
||||
* 是否显示搜索框
|
||||
*/
|
||||
searchable?: boolean;
|
||||
}
|
||||
|
||||
export interface CityPickerProps
|
||||
@ -129,19 +134,33 @@ export class CityPicker extends React.Component<
|
||||
return;
|
||||
}
|
||||
|
||||
(require as any)(['./CityDB'], (db: any) =>
|
||||
import('./CityDB').then(db => {
|
||||
this.setState(
|
||||
{
|
||||
db: {
|
||||
...db.default,
|
||||
province: db.province,
|
||||
province: db.province as any,
|
||||
city: db.city,
|
||||
district: db.district
|
||||
}
|
||||
},
|
||||
callback
|
||||
)
|
||||
);
|
||||
);
|
||||
});
|
||||
|
||||
// require.ensure(['./CityDB'], (db: any) =>
|
||||
// this.setState(
|
||||
// {
|
||||
// db: {
|
||||
// ...db.default,
|
||||
// province: db.province,
|
||||
// city: db.city,
|
||||
// district: db.district
|
||||
// }
|
||||
// },
|
||||
// callback
|
||||
// )
|
||||
// );
|
||||
}
|
||||
|
||||
@autobind
|
||||
@ -311,6 +330,7 @@ export class CityPicker extends React.Component<
|
||||
allowCity,
|
||||
allowDistrict,
|
||||
allowStreet,
|
||||
searchable,
|
||||
translate: __
|
||||
} = this.props;
|
||||
|
||||
@ -319,6 +339,7 @@ export class CityPicker extends React.Component<
|
||||
return db ? (
|
||||
<div className={cx('CityPicker', className)}>
|
||||
<Select
|
||||
searchable={searchable}
|
||||
disabled={disabled}
|
||||
options={db.province.map(item => ({
|
||||
label: db[item],
|
||||
@ -332,6 +353,7 @@ export class CityPicker extends React.Component<
|
||||
allowDistrict &&
|
||||
Array.isArray(db.district[provinceCode]) ? (
|
||||
<Select
|
||||
searchable={searchable}
|
||||
disabled={disabled}
|
||||
options={(db.district[provinceCode] as Array<number>).map(item => ({
|
||||
label: db[item],
|
||||
@ -344,6 +366,7 @@ export class CityPicker extends React.Component<
|
||||
db.city[provinceCode] &&
|
||||
db.city[provinceCode].length ? (
|
||||
<Select
|
||||
searchable={searchable}
|
||||
disabled={disabled}
|
||||
options={db.city[provinceCode].map(item => ({
|
||||
label: db[item],
|
||||
@ -358,6 +381,7 @@ export class CityPicker extends React.Component<
|
||||
allowDistrict &&
|
||||
(db.district[provinceCode]?.[cityCode] as any)?.length ? (
|
||||
<Select
|
||||
searchable={searchable}
|
||||
disabled={disabled}
|
||||
options={(db.district[provinceCode][cityCode] as Array<number>).map(
|
||||
item => ({
|
||||
@ -407,10 +431,12 @@ export class LocationControl extends React.Component<LocationControlProps> {
|
||||
extractValue,
|
||||
joinValues,
|
||||
allowStreet,
|
||||
disabled
|
||||
disabled,
|
||||
searchable
|
||||
} = this.props;
|
||||
return (
|
||||
<ThemedCity
|
||||
searchable={searchable}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
allowCity={allowCity}
|
||||
|
@ -35,12 +35,8 @@ export interface DiffControlSchema extends FormBaseControl {
|
||||
options?: any;
|
||||
}
|
||||
|
||||
function loadComponent(): Promise<React.ReactType> {
|
||||
return new Promise(resolve =>
|
||||
(require as any)(['../../components/Editor'], (component: any) =>
|
||||
resolve(component.default)
|
||||
)
|
||||
);
|
||||
function loadComponent(): Promise<any> {
|
||||
return import('../../components/Editor');
|
||||
}
|
||||
|
||||
export interface DiffEditorProps
|
||||
|
@ -181,7 +181,7 @@ export default class MatrixCheckbox extends React.Component<
|
||||
}
|
||||
|
||||
// todo 优化这块
|
||||
return await new Promise((resolve, reject) => {
|
||||
return await new Promise<void>((resolve, reject) => {
|
||||
if (!this.mounted) {
|
||||
return resolve();
|
||||
}
|
||||
@ -228,7 +228,7 @@ export default class MatrixCheckbox extends React.Component<
|
||||
error: reason,
|
||||
loading: false
|
||||
},
|
||||
resolve
|
||||
() => resolve()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
} from './Options';
|
||||
import cx from 'classnames';
|
||||
import Button from '../../components/Button';
|
||||
import {SchemaNode, Schema, Action} from '../../types';
|
||||
import {SchemaNode, Schema, Action, PlainObject} from '../../types';
|
||||
import find from 'lodash/find';
|
||||
import {
|
||||
anyChanged,
|
||||
@ -67,7 +67,7 @@ export interface PickerControlSchema extends FormOptionsControl {
|
||||
|
||||
export interface PickerProps extends OptionsControlProps {
|
||||
modalMode: 'dialog' | 'drawer';
|
||||
pickerSchema: object;
|
||||
pickerSchema: PlainObject;
|
||||
labelField: string;
|
||||
}
|
||||
|
||||
@ -169,7 +169,9 @@ export default class PickerControl extends React.PureComponent<
|
||||
|
||||
buildSchema(props: PickerProps) {
|
||||
return {
|
||||
checkOnItemClick: true,
|
||||
...props.pickerSchema,
|
||||
labelTpl: props.pickerSchema?.labelTpl ?? props.labelTpl,
|
||||
type: 'crud',
|
||||
pickerMode: true,
|
||||
syncLocation: false,
|
||||
@ -177,7 +179,6 @@ export default class PickerControl extends React.PureComponent<
|
||||
keepItemSelectionOnPageChange: true,
|
||||
valueField: props.valueField,
|
||||
labelField: props.labelField,
|
||||
checkOnItemClick: true,
|
||||
|
||||
// 不支持批量操作,会乱套
|
||||
bulkActions: props.multiple
|
||||
@ -361,6 +362,7 @@ export default class PickerControl extends React.PureComponent<
|
||||
labelTpl,
|
||||
disabled
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<div className={`${ns}Picker-values`}>
|
||||
{selectedOptions.map((item, index) => (
|
||||
|
@ -26,17 +26,11 @@ export interface RichTextProps extends FormControlProps {
|
||||
|
||||
function loadRichText(
|
||||
type: 'tinymce' | 'froala' = 'froala'
|
||||
): () => Promise<React.ReactType> {
|
||||
): () => Promise<any> {
|
||||
return () =>
|
||||
new Promise(resolve =>
|
||||
type === 'tinymce'
|
||||
? (require as any)(['../../components/Tinymce'], (component: any) =>
|
||||
resolve(component.default)
|
||||
)
|
||||
: (require as any)(['../../components/RichText'], (component: any) =>
|
||||
resolve(component.default)
|
||||
)
|
||||
);
|
||||
type === 'tinymce'
|
||||
? import('../../components/Tinymce')
|
||||
: import('../../components/RichText');
|
||||
}
|
||||
|
||||
export default class RichTextControl extends React.Component<
|
||||
|
@ -125,7 +125,14 @@ export default class TextControl extends React.PureComponent<
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const {formItem, autoComplete, addHook, formInited, data} = this.props;
|
||||
const {
|
||||
formItem,
|
||||
autoComplete,
|
||||
addHook,
|
||||
formInited,
|
||||
data,
|
||||
name
|
||||
} = this.props;
|
||||
|
||||
if (isEffectiveApi(autoComplete, data) && formItem) {
|
||||
if (formInited) {
|
||||
|
@ -11,6 +11,7 @@ import {
|
||||
} from './Options';
|
||||
import {Icon} from '../../components/icons';
|
||||
import TreeSelector from '../../components/Tree';
|
||||
import {findAncestorsWithValue} from '../../components/Tree';
|
||||
// @ts-ignore
|
||||
import matchSorter from 'match-sorter';
|
||||
import debouce from 'lodash/debounce';
|
||||
@ -410,7 +411,17 @@ export default class TreeSelectControl extends React.Component<
|
||||
@autobind
|
||||
renderItem(item: Option) {
|
||||
const {labelField} = this.props;
|
||||
return item[labelField || 'label'];
|
||||
// 将所有祖先节点也展现出来
|
||||
const ancestors: any[] = [];
|
||||
findAncestorsWithValue(ancestors, this.props.options, item.value);
|
||||
let ancestorsLabel = '';
|
||||
if (ancestors.length) {
|
||||
ancestorsLabel =
|
||||
ancestors
|
||||
.map((option: any) => option[labelField || 'label'])
|
||||
.join(' / ') + ' / ';
|
||||
}
|
||||
return ancestorsLabel + item[labelField || 'label'];
|
||||
}
|
||||
|
||||
renderOuter() {
|
||||
|
@ -104,7 +104,7 @@ export interface FormSchema extends BaseSchema {
|
||||
initApi?: SchemaApi;
|
||||
|
||||
/**
|
||||
* Form 用来获取初始数据的 api,与initApi不同的是,会一直轮训请求该接口,直到返回 finished 属性为 true 才 结束。
|
||||
* Form 用来获取初始数据的 api,与initApi不同的是,会一直轮询请求该接口,直到返回 finished 属性为 true 才 结束。
|
||||
*/
|
||||
initAsyncApi?: SchemaApi;
|
||||
|
||||
@ -161,12 +161,12 @@ export interface FormSchema extends BaseSchema {
|
||||
api?: SchemaApi;
|
||||
|
||||
/**
|
||||
* 设置此属性后,表单提交发送保存接口后,还会继续轮训请求该接口,直到返回 finished 属性为 true 才 结束。
|
||||
* 设置此属性后,表单提交发送保存接口后,还会继续轮询请求该接口,直到返回 finished 属性为 true 才 结束。
|
||||
*/
|
||||
asyncApi?: SchemaApi;
|
||||
|
||||
/**
|
||||
* 轮训请求的时间间隔,默认为 3秒。设置 asyncApi 才有效
|
||||
* 轮询请求的时间间隔,默认为 3秒。设置 asyncApi 才有效
|
||||
*/
|
||||
checkInterval?: number;
|
||||
|
||||
|
@ -227,7 +227,7 @@ export class HeadCellFilterDropDown extends React.Component<
|
||||
? filterOptions.map((option: any, index) => (
|
||||
<li
|
||||
key={index}
|
||||
className={cx('DropDown-divider', {
|
||||
className={cx({
|
||||
'is-selected': option.selected
|
||||
})}
|
||||
onClick={this.handleClick.bind(this, option.value)}
|
||||
@ -236,7 +236,7 @@ export class HeadCellFilterDropDown extends React.Component<
|
||||
</li>
|
||||
))
|
||||
: filterOptions.map((option: any, index) => (
|
||||
<li key={index} className={cx('DropDown-divider')}>
|
||||
<li key={index}>
|
||||
<Checkbox
|
||||
classPrefix={ns}
|
||||
onChange={this.handleCheck.bind(this, option.value)}
|
||||
@ -248,7 +248,6 @@ export class HeadCellFilterDropDown extends React.Component<
|
||||
))}
|
||||
<li
|
||||
key="DropDown-menu-reset"
|
||||
className={cx('DropDown-divider')}
|
||||
onClick={this.handleReset.bind(this)}
|
||||
>
|
||||
{__('重置')}
|
||||
|
199
src/renderers/Table/TableBody.tsx
Normal file
199
src/renderers/Table/TableBody.tsx
Normal file
@ -0,0 +1,199 @@
|
||||
import React from 'react';
|
||||
import {ClassNamesFn} from '../../theme';
|
||||
import {IColumn, IRow} from '../../store/table';
|
||||
import {SchemaNode, Action} from '../../types';
|
||||
import {TableRow} from './TableRow';
|
||||
import {filter} from '../../utils/tpl';
|
||||
import {observer} from 'mobx-react';
|
||||
import {trace, reaction} from 'mobx';
|
||||
import {flattenTree} from '../../utils/helper';
|
||||
|
||||
export interface TableBodyProps {
|
||||
className?: string;
|
||||
rowsProps?: any;
|
||||
tableClassName?: string;
|
||||
classnames: ClassNamesFn;
|
||||
columns: Array<IColumn>;
|
||||
rows: Array<IRow>;
|
||||
placeholder?: string;
|
||||
render: (region: string, node: SchemaNode, props?: any) => JSX.Element;
|
||||
renderCell: (
|
||||
region: string,
|
||||
column: IColumn,
|
||||
item: IRow,
|
||||
props: any
|
||||
) => React.ReactNode;
|
||||
onCheck: (item: IRow) => void;
|
||||
onQuickChange?: (
|
||||
item: IRow,
|
||||
values: object,
|
||||
saveImmediately?: boolean | any,
|
||||
savePristine?: boolean
|
||||
) => void;
|
||||
footable?: boolean;
|
||||
ignoreFootableContent?: boolean;
|
||||
footableColumns: Array<IColumn>;
|
||||
checkOnItemClick?: boolean;
|
||||
buildItemProps?: (item: IRow, index: number) => any;
|
||||
onAction?: (e: React.UIEvent<any>, action: Action, ctx: object) => void;
|
||||
rowClassNameExpr?: string;
|
||||
rowClassName?: string;
|
||||
}
|
||||
|
||||
export class TableBody extends React.Component<TableBodyProps> {
|
||||
reaction?: () => void;
|
||||
constructor(props: TableBodyProps) {
|
||||
super(props);
|
||||
|
||||
const rows = props.rows;
|
||||
|
||||
this.reaction = reaction(
|
||||
() =>
|
||||
`${flattenTree(rows)
|
||||
.map(item => `${item.id}`)
|
||||
.join(',')}${rows
|
||||
.filter(item => item.checked)
|
||||
.map(item => item.id)
|
||||
.join(',')}`,
|
||||
() => this.forceUpdate(),
|
||||
{
|
||||
onError: () => this.reaction!()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps: TableBodyProps) {
|
||||
const props = this.props;
|
||||
|
||||
if (
|
||||
props.columns !== nextProps.columns ||
|
||||
props.buildItemProps !== nextProps.buildItemProps
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
componentwillUnmount() {
|
||||
this.reaction?.();
|
||||
}
|
||||
|
||||
renderRows(
|
||||
rows: Array<any>,
|
||||
columns = this.props.columns,
|
||||
rowProps: any = {}
|
||||
): any {
|
||||
const {
|
||||
rowClassName,
|
||||
rowClassNameExpr,
|
||||
onAction,
|
||||
buildItemProps,
|
||||
checkOnItemClick,
|
||||
classnames: cx,
|
||||
render,
|
||||
renderCell,
|
||||
onCheck,
|
||||
onQuickChange,
|
||||
footable,
|
||||
ignoreFootableContent,
|
||||
footableColumns
|
||||
} = this.props;
|
||||
|
||||
return rows.map((item: IRow, rowIndex: number) => {
|
||||
const itemProps = buildItemProps ? buildItemProps(item, rowIndex) : null;
|
||||
|
||||
const doms = [
|
||||
<TableRow
|
||||
{...itemProps}
|
||||
classnames={cx}
|
||||
checkOnItemClick={checkOnItemClick}
|
||||
key={item.id}
|
||||
itemIndex={rowIndex}
|
||||
item={item}
|
||||
itemClassName={cx(
|
||||
rowClassNameExpr
|
||||
? filter(rowClassNameExpr, item.data)
|
||||
: rowClassName,
|
||||
{
|
||||
'is-last': item.depth > 1 && rowIndex === rows.length - 1
|
||||
}
|
||||
)}
|
||||
columns={columns}
|
||||
renderCell={renderCell}
|
||||
render={render}
|
||||
onAction={onAction}
|
||||
onCheck={onCheck}
|
||||
// todo 先注释 quickEditEnabled={item.depth === 1}
|
||||
onQuickChange={onQuickChange}
|
||||
{...rowProps}
|
||||
/>
|
||||
];
|
||||
|
||||
if (footable && footableColumns.length) {
|
||||
if (item.depth === 1) {
|
||||
doms.push(
|
||||
<TableRow
|
||||
{...itemProps}
|
||||
classnames={cx}
|
||||
checkOnItemClick={checkOnItemClick}
|
||||
key={`foot-${item.id}`}
|
||||
itemIndex={rowIndex}
|
||||
item={item}
|
||||
itemClassName={cx(
|
||||
rowClassNameExpr
|
||||
? filter(rowClassNameExpr, item.data)
|
||||
: rowClassName
|
||||
)}
|
||||
columns={footableColumns}
|
||||
renderCell={renderCell}
|
||||
render={render}
|
||||
onAction={onAction}
|
||||
onCheck={onCheck}
|
||||
footableMode
|
||||
footableColSpan={columns.length}
|
||||
onQuickChange={onQuickChange}
|
||||
ignoreFootableContent={ignoreFootableContent}
|
||||
{...rowProps}
|
||||
/>
|
||||
);
|
||||
}
|
||||
} else if (item.children.length) {
|
||||
// 嵌套表格
|
||||
doms.push(
|
||||
...this.renderRows(item.children, columns, {
|
||||
...rowProps,
|
||||
parent: item
|
||||
})
|
||||
);
|
||||
}
|
||||
return doms;
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
placeholder,
|
||||
classnames: cx,
|
||||
className,
|
||||
render,
|
||||
rows,
|
||||
columns,
|
||||
rowsProps
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<tbody className={className}>
|
||||
{rows.length ? (
|
||||
this.renderRows(rows, columns, rowsProps)
|
||||
) : (
|
||||
<tr className={cx('Table-placeholder')}>
|
||||
<td colSpan={columns.length}>
|
||||
{render('placeholder', placeholder || '暂无数据')}
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
</tbody>
|
||||
);
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import {filter} from '../../utils/tpl';
|
||||
import {observer} from 'mobx-react';
|
||||
import {trace, reaction} from 'mobx';
|
||||
import {flattenTree} from '../../utils/helper';
|
||||
import {TableBody} from './TableBody';
|
||||
|
||||
export interface TableContentProps {
|
||||
className?: string;
|
||||
@ -52,22 +53,6 @@ export class TableContent extends React.Component<TableContentProps> {
|
||||
reaction?: () => void;
|
||||
constructor(props: TableContentProps) {
|
||||
super(props);
|
||||
|
||||
const rows = props.rows;
|
||||
|
||||
this.reaction = reaction(
|
||||
() =>
|
||||
`${flattenTree(rows)
|
||||
.map(item => `${item.id}`)
|
||||
.join(',')}${rows
|
||||
.filter(item => item.checked)
|
||||
.map(item => item.id)
|
||||
.join(',')}`,
|
||||
() => this.forceUpdate(),
|
||||
{
|
||||
onError: () => this.reaction!()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps: TableContentProps) {
|
||||
@ -83,100 +68,6 @@ export class TableContent extends React.Component<TableContentProps> {
|
||||
return false;
|
||||
}
|
||||
|
||||
componentwillUnmount() {
|
||||
this.reaction?.();
|
||||
}
|
||||
|
||||
renderRows(
|
||||
rows: Array<any>,
|
||||
columns = this.props.columns,
|
||||
rowProps: any = {}
|
||||
): any {
|
||||
const {
|
||||
rowClassName,
|
||||
rowClassNameExpr,
|
||||
onAction,
|
||||
buildItemProps,
|
||||
checkOnItemClick,
|
||||
classnames: cx,
|
||||
render,
|
||||
renderCell,
|
||||
onCheck,
|
||||
onQuickChange,
|
||||
footable,
|
||||
footableColumns
|
||||
} = this.props;
|
||||
|
||||
return rows.map((item: IRow, rowIndex: number) => {
|
||||
const itemProps = buildItemProps ? buildItemProps(item, rowIndex) : null;
|
||||
|
||||
const doms = [
|
||||
<TableRow
|
||||
{...itemProps}
|
||||
classnames={cx}
|
||||
checkOnItemClick={checkOnItemClick}
|
||||
key={item.id}
|
||||
itemIndex={rowIndex}
|
||||
item={item}
|
||||
itemClassName={cx(
|
||||
rowClassNameExpr
|
||||
? filter(rowClassNameExpr, item.data)
|
||||
: rowClassName,
|
||||
{
|
||||
'is-last': item.depth > 1 && rowIndex === rows.length - 1
|
||||
}
|
||||
)}
|
||||
columns={columns}
|
||||
renderCell={renderCell}
|
||||
render={render}
|
||||
onAction={onAction}
|
||||
onCheck={onCheck}
|
||||
// todo 先注释 quickEditEnabled={item.depth === 1}
|
||||
onQuickChange={onQuickChange}
|
||||
{...rowProps}
|
||||
/>
|
||||
];
|
||||
|
||||
if (footable && footableColumns.length) {
|
||||
if (item.depth === 1) {
|
||||
doms.push(
|
||||
<TableRow
|
||||
{...itemProps}
|
||||
classnames={cx}
|
||||
checkOnItemClick={checkOnItemClick}
|
||||
key={`foot-${item.id}`}
|
||||
itemIndex={rowIndex}
|
||||
item={item}
|
||||
itemClassName={cx(
|
||||
rowClassNameExpr
|
||||
? filter(rowClassNameExpr, item.data)
|
||||
: rowClassName
|
||||
)}
|
||||
columns={footableColumns}
|
||||
renderCell={renderCell}
|
||||
render={render}
|
||||
onAction={onAction}
|
||||
onCheck={onCheck}
|
||||
footableMode
|
||||
footableColSpan={columns.length}
|
||||
onQuickChange={onQuickChange}
|
||||
{...rowProps}
|
||||
/>
|
||||
);
|
||||
}
|
||||
} else if (item.children.length) {
|
||||
// 嵌套表格
|
||||
doms.push(
|
||||
...this.renderRows(item.children, columns, {
|
||||
...rowProps,
|
||||
parent: item
|
||||
})
|
||||
);
|
||||
}
|
||||
return doms;
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
placeholder,
|
||||
@ -189,7 +80,17 @@ export class TableContent extends React.Component<TableContentProps> {
|
||||
onScroll,
|
||||
tableRef,
|
||||
rows,
|
||||
renderHeadCell
|
||||
renderHeadCell,
|
||||
renderCell,
|
||||
onCheck,
|
||||
rowClassName,
|
||||
onQuickChange,
|
||||
footable,
|
||||
footableColumns,
|
||||
checkOnItemClick,
|
||||
buildItemProps,
|
||||
onAction,
|
||||
rowClassNameExpr
|
||||
} = this.props;
|
||||
|
||||
const tableClassName = cx('Table-table', this.props.tableClassName);
|
||||
@ -225,17 +126,23 @@ export class TableContent extends React.Component<TableContentProps> {
|
||||
)}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.length ? (
|
||||
this.renderRows(rows, columns)
|
||||
) : (
|
||||
<tr className={cx('Table-placeholder')}>
|
||||
<td colSpan={columns.length}>
|
||||
{render('placeholder', placeholder || '暂无数据')}
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
</tbody>
|
||||
<TableBody
|
||||
classnames={cx}
|
||||
placeholder={placeholder}
|
||||
render={render}
|
||||
renderCell={renderCell}
|
||||
onCheck={onCheck}
|
||||
onQuickChange={onQuickChange}
|
||||
footable={footable}
|
||||
footableColumns={footableColumns}
|
||||
checkOnItemClick={checkOnItemClick}
|
||||
buildItemProps={buildItemProps}
|
||||
onAction={onAction}
|
||||
rowClassNameExpr={rowClassNameExpr}
|
||||
rowClassName={rowClassName}
|
||||
rows={rows}
|
||||
columns={columns}
|
||||
></TableBody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
|
@ -21,6 +21,7 @@ interface TableRowProps extends Pick<RendererProps, 'render'> {
|
||||
itemIndex: number;
|
||||
regionPrefix?: string;
|
||||
checkOnItemClick?: boolean;
|
||||
ignoreFootableContent?: boolean;
|
||||
[propName: string]: any;
|
||||
}
|
||||
|
||||
@ -103,6 +104,7 @@ export class TableRow extends React.Component<TableRowProps> {
|
||||
renderCell,
|
||||
children,
|
||||
footableMode,
|
||||
ignoreFootableContent,
|
||||
footableColSpan,
|
||||
regionPrefix,
|
||||
checkOnItemClick,
|
||||
@ -135,37 +137,39 @@ export class TableRow extends React.Component<TableRowProps> {
|
||||
})}
|
||||
>
|
||||
<td className={cx(`Table-foot`)} colSpan={footableColSpan}>
|
||||
<table className={cx(`Table-footTable`)}>
|
||||
<tbody>
|
||||
{columns.map(column => (
|
||||
<tr key={column.index}>
|
||||
{column.label !== false ? (
|
||||
<th>
|
||||
{render(
|
||||
`${regionPrefix}${itemIndex}/${column.index}/tpl`,
|
||||
column.label
|
||||
)}
|
||||
</th>
|
||||
) : null}
|
||||
{ignoreFootableContent ? null : (
|
||||
<table className={cx(`Table-footTable`)}>
|
||||
<tbody>
|
||||
{columns.map(column => (
|
||||
<tr key={column.index}>
|
||||
{column.label !== false ? (
|
||||
<th>
|
||||
{render(
|
||||
`${regionPrefix}${itemIndex}/${column.index}/tpl`,
|
||||
column.label
|
||||
)}
|
||||
</th>
|
||||
) : null}
|
||||
|
||||
{renderCell(
|
||||
`${regionPrefix}${itemIndex}/${column.index}`,
|
||||
column,
|
||||
item,
|
||||
{
|
||||
...rest,
|
||||
width: null,
|
||||
rowIndex: itemIndex,
|
||||
colIndex: column.rawIndex,
|
||||
key: column.index,
|
||||
onAction: this.handleAction,
|
||||
onQuickChange: this.handleQuickChange
|
||||
}
|
||||
)}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
{renderCell(
|
||||
`${regionPrefix}${itemIndex}/${column.index}`,
|
||||
column,
|
||||
item,
|
||||
{
|
||||
...rest,
|
||||
width: null,
|
||||
rowIndex: itemIndex,
|
||||
colIndex: column.rawIndex,
|
||||
key: column.index,
|
||||
onAction: this.handleAction,
|
||||
onQuickChange: this.handleQuickChange
|
||||
}
|
||||
)}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
|
@ -40,6 +40,7 @@ import {SchemaQuickEdit} from '../QuickEdit';
|
||||
import {SchemaCopyable} from '../Copyable';
|
||||
import {SchemaRemark} from '../Remark';
|
||||
import {toDataURL, getImageDimensions} from '../../utils/image';
|
||||
import {TableBody} from './TableBody';
|
||||
|
||||
/**
|
||||
* 表格列,不指定类型时默认为文本类型。
|
||||
@ -1572,7 +1573,17 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
headerOnly: boolean = false,
|
||||
tableClassName: string = ''
|
||||
) {
|
||||
const {placeholder, store, classnames: cx, render, data} = this.props;
|
||||
const {
|
||||
placeholder,
|
||||
store,
|
||||
classnames: cx,
|
||||
render,
|
||||
data,
|
||||
checkOnItemClick,
|
||||
buildItemProps,
|
||||
rowClassNameExpr,
|
||||
rowClassName
|
||||
} = this.props;
|
||||
const hideHeader = store.filteredColumns.every(column => !column.label);
|
||||
|
||||
return (
|
||||
@ -1612,25 +1623,37 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
</thead>
|
||||
|
||||
{headerOnly ? null : (
|
||||
<tbody>
|
||||
{rows.length ? (
|
||||
this.renderRows(rows, columns, {
|
||||
regionPrefix: 'fixed/',
|
||||
renderCell: (
|
||||
region: string,
|
||||
column: IColumn,
|
||||
item: IRow,
|
||||
props: any
|
||||
) => this.renderCell(region, column, item, props, true)
|
||||
})
|
||||
) : (
|
||||
<tr className={cx('Table-placeholder')}>
|
||||
<td colSpan={columns.length}>
|
||||
{render('placeholder', placeholder, {data})}
|
||||
</td>
|
||||
</tr>
|
||||
<TableBody
|
||||
tableClassName={cx(
|
||||
store.combineNum > 0 ? 'Table-table--withCombine' : '',
|
||||
tableClassName
|
||||
)}
|
||||
</tbody>
|
||||
classnames={cx}
|
||||
placeholder={placeholder}
|
||||
render={render}
|
||||
renderCell={this.renderCell}
|
||||
onCheck={this.handleCheck}
|
||||
onQuickChange={store.dragging ? undefined : this.handleQuickChange}
|
||||
footable={store.footable}
|
||||
ignoreFootableContent
|
||||
footableColumns={store.footableColumns}
|
||||
checkOnItemClick={checkOnItemClick}
|
||||
buildItemProps={buildItemProps}
|
||||
onAction={this.handleAction}
|
||||
rowClassNameExpr={rowClassNameExpr}
|
||||
rowClassName={rowClassName}
|
||||
columns={columns}
|
||||
rows={rows}
|
||||
rowsProps={{
|
||||
regionPrefix: 'fixed/',
|
||||
renderCell: (
|
||||
region: string,
|
||||
column: IColumn,
|
||||
item: IRow,
|
||||
props: any
|
||||
) => this.renderCell(region, column, item, props, true)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</table>
|
||||
);
|
||||
@ -1753,7 +1776,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
<Button
|
||||
classPrefix={ns}
|
||||
onClick={() => {
|
||||
(require as any)(['exceljs'], async (ExcelJS: any) => {
|
||||
import('exceljs').then(async (ExcelJS: any) => {
|
||||
if (!store.data.items || store.data.items.length === 0) {
|
||||
return;
|
||||
}
|
||||
@ -2085,93 +2108,6 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
: footerNode || toolbarNode || null;
|
||||
}
|
||||
|
||||
renderRows(
|
||||
rows: Array<any>,
|
||||
columns = this.props.store.filteredColumns,
|
||||
rowProps: any = {}
|
||||
): any {
|
||||
const {
|
||||
store,
|
||||
rowClassName,
|
||||
rowClassNameExpr,
|
||||
onAction,
|
||||
buildItemProps,
|
||||
checkOnItemClick,
|
||||
classPrefix: ns,
|
||||
classnames: cx,
|
||||
render
|
||||
} = this.props;
|
||||
|
||||
return rows.map((item: IRow, rowIndex: number) => {
|
||||
const itemProps = buildItemProps ? buildItemProps(item, rowIndex) : null;
|
||||
|
||||
const doms = [
|
||||
<TableRow
|
||||
{...itemProps}
|
||||
classPrefix={ns}
|
||||
classnames={cx}
|
||||
checkOnItemClick={checkOnItemClick}
|
||||
key={item.id}
|
||||
itemIndex={rowIndex}
|
||||
item={item}
|
||||
itemClassName={cx(
|
||||
rowClassNameExpr
|
||||
? filter(rowClassNameExpr, item.data)
|
||||
: rowClassName,
|
||||
{
|
||||
'is-last': item.depth > 1 && rowIndex === rows.length - 1,
|
||||
'is-expanded': item.expanded,
|
||||
'is-expandable': item.expandable
|
||||
}
|
||||
)}
|
||||
columns={columns}
|
||||
renderCell={this.renderCell}
|
||||
render={render}
|
||||
onAction={onAction}
|
||||
onCheck={this.handleCheck}
|
||||
// todo 先注释 quickEditEnabled={item.depth === 1}
|
||||
onQuickChange={store.dragging ? null : this.handleQuickChange}
|
||||
{...rowProps}
|
||||
/>
|
||||
];
|
||||
|
||||
if (store.footable && store.footableColumns.length) {
|
||||
if (item.depth === 1) {
|
||||
doms.push(
|
||||
<TableRow
|
||||
{...itemProps}
|
||||
classPrefix={ns}
|
||||
classnames={cx}
|
||||
checkOnItemClick={checkOnItemClick}
|
||||
key={`foot-${item.id}`}
|
||||
itemIndex={rowIndex}
|
||||
item={item}
|
||||
itemClassName={cx(
|
||||
rowClassNameExpr
|
||||
? filter(rowClassNameExpr, item.data)
|
||||
: rowClassName
|
||||
)}
|
||||
columns={store.footableColumns}
|
||||
renderCell={this.renderCell}
|
||||
render={render}
|
||||
onAction={onAction}
|
||||
onCheck={this.handleCheck}
|
||||
footableMode
|
||||
footableColSpan={store.filteredColumns.length}
|
||||
onQuickChange={store.dragging ? null : this.handleQuickChange}
|
||||
{...rowProps}
|
||||
/>
|
||||
);
|
||||
}
|
||||
} else if (Array.isArray(item.data.children)) {
|
||||
// 嵌套表格
|
||||
doms.push(...this.renderRows(item.children, columns, rowProps));
|
||||
}
|
||||
|
||||
return doms;
|
||||
});
|
||||
}
|
||||
|
||||
renderItemActions() {
|
||||
const {itemActions, render, store, classnames: cx} = this.props;
|
||||
const finalActions = Array.isArray(itemActions)
|
||||
|
@ -221,7 +221,7 @@ export class FlvSource extends React.Component<FlvSourceProps, any> {
|
||||
setError,
|
||||
autoPlay
|
||||
}: any) {
|
||||
(require as any)(['flv.js'], (flvjs: any) => {
|
||||
import('flv.js').then((flvjs: any) => {
|
||||
video = video || (manager.video && manager.video.video);
|
||||
|
||||
let flvPlayer = flvjs.createPlayer(
|
||||
@ -335,7 +335,8 @@ export class HlsSource extends React.Component<HlsSourceProps, any> {
|
||||
}
|
||||
|
||||
initHls({video, manager, src, autoPlay, actions}: any) {
|
||||
(require as any)(['hls.js'], (Hls: any) => {
|
||||
// @ts-ignore
|
||||
import('hls.js').then((Hls: any) => {
|
||||
// load hls video source base on hls.js
|
||||
if (Hls.isSupported()) {
|
||||
video = video || (manager.video && manager.video.video);
|
||||
|
@ -2,7 +2,7 @@ import {types, SnapshotIn, isAlive, onAction} from 'mobx-state-tree';
|
||||
import {iRendererStore} from './iRenderer';
|
||||
import {FormItemStore} from './formItem';
|
||||
import {FormStore, IFormStore, IFormItemStore} from './form';
|
||||
import {getStoreById} from './index';
|
||||
import {getStoreById} from './manager';
|
||||
|
||||
export const UniqueGroup = types
|
||||
.model('UniqueGroup', {
|
||||
|
@ -23,9 +23,8 @@ import {
|
||||
isEmpty,
|
||||
mapObject
|
||||
} from '../utils/helper';
|
||||
import {IComboStore} from './combo';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import {IRendererStore, getStoreById, removeStore} from '.';
|
||||
import {getStoreById, removeStore} from './manager';
|
||||
|
||||
export const FormStore = ServiceStore.named('FormStore')
|
||||
.props({
|
||||
|
@ -18,6 +18,7 @@ import {TranslateFn} from '../locale';
|
||||
import find from 'lodash/find';
|
||||
import {IStoreNode} from './node';
|
||||
import {FormItemStore} from './formItem';
|
||||
import {addStore, getStoreById, getStores, removeStore} from './manager';
|
||||
|
||||
setLivelynessChecking(
|
||||
process.env.NODE_ENV === 'production' ? 'ignore' : 'error'
|
||||
@ -59,7 +60,7 @@ export const RendererStore = types
|
||||
},
|
||||
|
||||
get stores() {
|
||||
return stores;
|
||||
return getStores();
|
||||
}
|
||||
}))
|
||||
.actions(self => ({
|
||||
@ -89,51 +90,3 @@ export {iRendererStore, IIRendererStore};
|
||||
export const RegisterStore = function (store: any) {
|
||||
allowedStoreList.push(store as any);
|
||||
};
|
||||
|
||||
const stores: {
|
||||
[propName: string]: IStoreNode;
|
||||
} = {};
|
||||
|
||||
export function addStore(store: IStoreNode) {
|
||||
if (stores[store.id]) {
|
||||
return stores[store.id];
|
||||
}
|
||||
|
||||
stores[store.id] = store;
|
||||
|
||||
// drawer dialog 不加进去,否则有些容器就不会自我销毁 store 了。
|
||||
if (store.parentId && !/(?:dialog|drawer)$/.test(store.path)) {
|
||||
const parent = stores[store.parentId] as IIRendererStore;
|
||||
parent.addChildId(store.id);
|
||||
}
|
||||
|
||||
cleanUp();
|
||||
return store;
|
||||
}
|
||||
|
||||
const toDelete: Array<string> = [];
|
||||
|
||||
export function removeStore(store: IStoreNode) {
|
||||
const id = store.id;
|
||||
toDelete.push(id);
|
||||
store.dispose(cleanUp);
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
let index = toDelete.length - 1;
|
||||
while (index >= 0) {
|
||||
const id = toDelete[index];
|
||||
const store = stores[id];
|
||||
|
||||
if (store && !isAlive(store)) {
|
||||
delete stores[id];
|
||||
toDelete.splice(index, 1);
|
||||
} else {
|
||||
index--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getStoreById(id: string) {
|
||||
return stores[id];
|
||||
}
|
||||
|
55
src/store/manager.ts
Normal file
55
src/store/manager.ts
Normal file
@ -0,0 +1,55 @@
|
||||
import {isAlive} from 'mobx-state-tree';
|
||||
import {IIRendererStore} from './iRenderer';
|
||||
import {IStoreNode} from './node';
|
||||
|
||||
const stores: {
|
||||
[propName: string]: IStoreNode;
|
||||
} = {};
|
||||
|
||||
export function addStore(store: IStoreNode) {
|
||||
if (stores[store.id]) {
|
||||
return stores[store.id];
|
||||
}
|
||||
|
||||
stores[store.id] = store;
|
||||
|
||||
// drawer dialog 不加进去,否则有些容器就不会自我销毁 store 了。
|
||||
if (store.parentId && !/(?:dialog|drawer)$/.test(store.path)) {
|
||||
const parent = stores[store.parentId] as IIRendererStore;
|
||||
parent.addChildId(store.id);
|
||||
}
|
||||
|
||||
cleanUp();
|
||||
return store;
|
||||
}
|
||||
|
||||
const toDelete: Array<string> = [];
|
||||
|
||||
export function removeStore(store: IStoreNode) {
|
||||
const id = store.id;
|
||||
toDelete.push(id);
|
||||
store.dispose(cleanUp);
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
let index = toDelete.length - 1;
|
||||
while (index >= 0) {
|
||||
const id = toDelete[index];
|
||||
const store = stores[id];
|
||||
|
||||
if (store && !isAlive(store)) {
|
||||
delete stores[id];
|
||||
toDelete.splice(index, 1);
|
||||
} else {
|
||||
index--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getStoreById(id: string) {
|
||||
return stores[id];
|
||||
}
|
||||
|
||||
export function getStores() {
|
||||
return stores;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import {types, destroy, isAlive, detach, getEnv} from 'mobx-state-tree';
|
||||
import {getStoreById} from './index';
|
||||
import {getStoreById} from './manager';
|
||||
|
||||
export const StoreNode = types
|
||||
.model('StoreNode', {
|
||||
|
@ -117,10 +117,27 @@ export const Row = types
|
||||
return data;
|
||||
},
|
||||
|
||||
get expanded(): boolean {
|
||||
get collapsed(): boolean {
|
||||
const table = getParent(self, self.depth * 2) as ITableStore;
|
||||
if (table.dragging) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !table.dragging && table.isExpanded(self as IRow);
|
||||
let from: IRow = self as any;
|
||||
|
||||
while (from && (from as any) !== table) {
|
||||
if (!table.isExpanded(from)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
from = getParent(from, 2);
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
get expanded(): boolean {
|
||||
return !this.collapsed;
|
||||
},
|
||||
|
||||
get moved() {
|
||||
|
@ -1269,7 +1269,7 @@ export function mapObject(value: any, fn: Function): any {
|
||||
}
|
||||
|
||||
export function loadScript(src: string) {
|
||||
return new Promise((ok, fail) => {
|
||||
return new Promise<void>((ok, fail) => {
|
||||
const script = document.createElement('script');
|
||||
script.onerror = reason => fail(reason);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user