|
|
|
|
|
|
|
|
|
@@ -2716,7 +2665,6 @@ exports[`Renderer:table column head style className 1`] = `
@@ -3353,7 +3293,6 @@ exports[`Renderer:table combine Renderer:table combineNum only 1`] = `
@@ -4125,7 +4053,6 @@ exports[`Renderer:table combine Renderer:table combineNum with fromIndex 1`] = `
@@ -5057,7 +4973,6 @@ exports[`Renderer:table groupName-default 1`] = `
colspan="2"
data-index="3"
rowspan="1"
- style="width: 0px; height: 0px;"
>
@@ -6022,7 +5924,6 @@ exports[`Renderer:table groupName-middleNoGroupName 1`] = `
colspan="1"
data-index="3"
rowspan="1"
- style="width: 0px; height: 0px;"
>
@@ -6984,7 +6872,6 @@ exports[`Renderer:table groupName-startNoGroupName 1`] = `
data-index="3"
label="Engine"
rowspan="2"
- style="width: 0px; height: 0px;"
>
@@ -7938,7 +7813,6 @@ exports[`Renderer:table groupName-withTpl 1`] = `
colspan="2"
data-index="3"
rowspan="1"
- style="width: 0px; height: 0px;"
>
|
|
|
|
|
|
|
|
|
@@ -8695,7 +8545,6 @@ exports[`Renderer:table isHead fixed 1`] = `
{
expect(buildApi('/api/xxx')).toMatchObject({
@@ -322,3 +322,22 @@ test('api:cache', async () => {
expect(fetcher).toHaveBeenCalledTimes(1); // 只请求一次,第二次请求从缓存中取
expect(container).toMatchSnapshot();
});
+
+test('api:isvalidapi', () => {
+ expect(isValidApi('api/xxx')).toBeFalsy();
+ expect(isValidApi('api/xxx?a=1')).toBeFalsy();
+ expect(isValidApi('/x')).toBeTruthy();
+ expect(isValidApi('/api/xxx?a=1&b=2&c=3')).toBeTruthy();
+ expect(isValidApi('http://xxxdomain')).toBeTruthy();
+ expect(isValidApi('http://xxxdomain/')).toBeTruthy();
+ expect(isValidApi('http://xxxdomain/api')).toBeTruthy();
+ expect(isValidApi('app://')).toBeFalsy();
+ expect(isValidApi('app://x')).toBeTruthy();
+ expect(isValidApi('app://x?a=1')).toBeTruthy();
+ expect(isValidApi('app://x?a=1&b=2')).toBeTruthy();
+ expect(isValidApi('app://x b?a=1&b=2')).toBeFalsy();
+ expect(isValidApi('app://x%20b?a=1&b=2')).toBeTruthy();
+ expect(isValidApi('ftp://127.0.0.1/xxx')).toBeTruthy();
+ expect(isValidApi('wss://127.0.0.1/xxx')).toBeTruthy();
+ expect(isValidApi('taf://127.0.0.1/xxx')).toBeTruthy();
+});
diff --git a/packages/amis/src/renderers/Table/index.tsx b/packages/amis/src/renderers/Table/index.tsx
index 6e72c2df2..5d9f5c82a 100644
--- a/packages/amis/src/renderers/Table/index.tsx
+++ b/packages/amis/src/renderers/Table/index.tsx
@@ -1221,6 +1221,11 @@ export default class Table extends React.Component {
this.outterWidth = outter.offsetWidth;
this.outterHeight = outter.offsetHeight;
+ // 没有渲染则跳过
+ if (!this.totalWidth) {
+ return;
+ }
+
let widths: {
[propName: string]: number;
} = (this.widths = {});
| | | | | |