fix: Fix antd styles.

This commit is contained in:
Sam Tolmay 2021-11-29 13:00:33 +02:00
parent 71a9948d6b
commit 62a752d66c
No known key found for this signature in database
GPG Key ID: D004126FCD1A6DF0
67 changed files with 156 additions and 87 deletions

3
.pnp.cjs generated
View File

@ -5613,7 +5613,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@lowdefy/server", "workspace:packages/server"],
["@lowdefy/api", "workspace:packages/api"],
["@lowdefy/block-utils", "workspace:packages/utils/block-utils"],
["@lowdefy/blocks-antd", "workspace:packages/plugins/blocks/blocks-antd"],
["@lowdefy/blocks-basic", "workspace:packages/plugins/blocks/blocks-basic"],
["@lowdefy/build", "workspace:packages/build"],
["@lowdefy/connection-axios-http", "workspace:packages/plugins/connections/connection-axios-http"],
["@lowdefy/engine", "workspace:packages/engine"],
["@lowdefy/helpers", "workspace:packages/utils/helpers"],
["@lowdefy/layout", "workspace:packages/layout"],

View File

@ -28,8 +28,8 @@ async function validateApp({ components }) {
if (type.isNone(components.app.html)) {
components.app.html = {};
}
if (type.isNone(components.app.styles)) {
components.app.styles = {};
if (type.isNone(components.app.style)) {
components.app.style = {};
}
if (type.isNone(components.app.html.appendBody)) {
components.app.html.appendBody = '';

View File

@ -19,32 +19,93 @@ import testContext from '../test/testContext.js';
const context = testContext();
test('validateApp success', async () => {
let components = {
test('validateApp no app defined', async () => {
const components = {};
const result = await validateApp({ components, context });
expect(result).toEqual({
app: {
html: {
appendBody: 'abc',
appendHead: 'abc',
appendBody: '',
appendHead: '',
},
style: {},
},
});
});
test('validateApp empty app object', async () => {
const components = { app: {} };
const result = await validateApp({ components, context });
expect(result).toEqual({
app: {
html: {
appendBody: '',
appendHead: '',
},
style: {},
},
});
});
test('validateApp empty html', async () => {
const components = { app: { html: {} } };
const result = await validateApp({ components, context });
expect(result).toEqual({
app: {
html: {
appendBody: '',
appendHead: '',
},
style: {},
},
});
});
test('validateApp appendHead and appendHead', async () => {
const components = {
app: {
html: {
appendBody: 'body',
appendHead: 'head',
},
},
};
let result = await validateApp({ components, context });
expect(result).toEqual({ app: { html: { appendBody: 'abc', appendHead: 'abc' } } });
components = {};
result = await validateApp({ components, context });
expect(result).toEqual({ app: { html: { appendBody: '', appendHead: '' } } });
components = {
app: {},
};
result = await validateApp({ components, context });
expect(result).toEqual({ app: { html: { appendBody: '', appendHead: '' } } });
components = {
const result = await validateApp({ components, context });
expect(result).toEqual({
app: {
html: {},
html: {
appendBody: 'body',
appendHead: 'head',
},
style: {},
},
});
});
test('validateApp style', async () => {
const components = {
app: {
style: {
lessVariables: {
'primary-color': '#FF00FF',
},
},
},
};
result = await validateApp({ components, context });
expect(result).toEqual({ app: { html: { appendBody: '', appendHead: '' } } });
const result = await validateApp({ components, context });
expect(result).toEqual({
app: {
html: {
appendBody: '',
appendHead: '',
},
style: {
lessVariables: {
'primary-color': '#FF00FF',
},
},
},
});
});
test('validateApp app not an object', async () => {

View File

@ -63,10 +63,10 @@ export default {
},
},
},
styles: {
style: {
type: 'object',
errorMessage: {
type: 'App "app.styles" should be an object.',
type: 'App "app.style" should be an object.',
},
},
},

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/layout/style/index.less';
@import 'antd/es/grid/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/affix/style/index.less';
@import 'antd/es/affix/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/alert/style/index.less';
@import 'antd/es/alert/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/auto-complete/style/index.less';
@import 'antd/es/auto-complete/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/avatar/style/index.less';
@import 'antd/es/avatar/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/badge/style/index.less';
@import 'antd/es/badge/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/breadcrumb/style/index.less';
@import 'antd/es/breadcrumb/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/button/style/index.less';
@import 'antd/es/button/style/index.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/radio/style/index.less';
@import 'antd/es/radio/style/index.less';
@import '../Label/style.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/card/style/index.less';
@import 'antd/es/card/style/index.less';

View File

@ -14,6 +14,6 @@
limitations under the License.
*/
@import 'antd/lib/checkbox/style/index.less';
@import 'antd/lib/space/style/index.less';
@import 'antd/es/checkbox/style/index.less';
@import 'antd/es/space/style/index.less';
@import '../Label/style.less';

View File

@ -14,6 +14,6 @@
limitations under the License.
*/
@import 'antd/lib/checkbox/style/index.less';
@import 'antd/lib/space/style/index.less';
@import 'antd/es/checkbox/style/index.less';
@import 'antd/es/space/style/index.less';
@import '../Label/style.less';

View File

@ -22,7 +22,7 @@ import schema from './schema.json';
const { meta, tests } = block;
jest.mock('antd/lib/collapse', () => {
jest.mock('antd/es/collapse', () => {
const collapse = jest.fn(() => 'mocked');
collapse.Panel = jest.fn(() => 'mocked');
return collapse;

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/collapse/style/index.less';
@import 'antd/es/collapse/style/index.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/comment/style/index.less';
@import 'antd/es/comment/style/index.less';
@import '../Avatar/style.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/modal/style/index.less';
@import 'antd/es/modal/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/layout/style/index.less';
@import 'antd/es/layout/style/index.less';

View File

@ -14,6 +14,6 @@
limitations under the License.
*/
@import 'antd/lib/list/style/index.less';
@import 'antd/lib/typography/style/index.less';
@import 'antd/es/list/style/index.less';
@import 'antd/es/typography/style/index.less';
@import '../Button/style.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/date-picker/style/index.less';
@import 'antd/es/date-picker/style/index.less';
@import '../Label/style.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/date-picker/style/index.less';
@import 'antd/es/date-picker/style/index.less';
@import '../Label/style.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/date-picker/style/index.less';
@import 'antd/es/date-picker/style/index.less';
@import '../Label/style.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/descriptions/style/index.less';
@import 'antd/es/descriptions/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/divider/style/index.less';
@import 'antd/es/divider/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/drawer/style/index.less';
@import 'antd/es/drawer/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/layout/style/index.less';
@import 'antd/es/layout/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/layout/style/index.less';
@import 'antd/es/layout/style/index.less';

View File

@ -21,7 +21,7 @@ import React from 'react';
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
import { Col, Row } from 'antd';
import classNames from 'classnames';
import CSSMotion from 'rc-animate/lib/CSSMotion.js';
import CSSMotion from 'rc-animate/es/CSSMotion.js';
import labelLogic from './labelLogic.js';

View File

@ -14,7 +14,7 @@
limitations under the License.
*/
@import 'antd/lib/form/style/index.less';
@import 'antd/es/form/style/index.less';
.ant-form-vertical .ant-form-item-label > label::after,
.ant-form-item .ant-form-item-label > label::after,

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/layout/style/index.less';
@import 'antd/es/layout/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/menu/style/index.less';
@import 'antd/es/menu/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/message/style/index.less';
@import 'antd/es/message/style/index.less';

View File

@ -39,7 +39,7 @@ import schema from './schema.json';
const { meta, tests } = block;
jest.mock('antd/lib/modal', () => {
jest.mock('antd/es/modal', () => {
return jest.fn(() => 'mocked');
});

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/modal/style/index.less';
@import 'antd/es/modal/style/index.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/date-picker/style/index.less';
@import 'antd/es/date-picker/style/index.less';
@import '../Label/style.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/select/style/index.less';
@import 'antd/es/select/style/index.less';
@import '../Label/style.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/notification/style/index.less';
@import 'antd/es/notification/style/index.less';
@import '../Button/style.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/input-number/style/index.less';
@import 'antd/es/input-number/style/index.less';
@import '../Label/style.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/pagination/style/index.less';
@import 'antd/es/pagination/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/typography/style/index.less';
@import 'antd/es/typography/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/typography/style/index.less';
@import 'antd/es/typography/style/index.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/input/style/index.less';
@import 'antd/es/input/style/index.less';
@import '../Label/style.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/progress/style/index.less';
@import 'antd/es/progress/style/index.less';

View File

@ -14,6 +14,6 @@
limitations under the License.
*/
@import 'antd/lib/radio/style/index.less';
@import 'antd/lib/space/style/index.less';
@import 'antd/es/radio/style/index.less';
@import 'antd/es/space/style/index.less';
@import '../Label/style.less';

View File

@ -14,6 +14,6 @@
limitations under the License.
*/
@import 'antd/lib/slider/style/index.less';
@import 'antd/es/slider/style/index.less';
@import '../Label/style.less';
@import '../CheckboxSelector/style.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/result/style/index.less';
@import 'antd/es/result/style/index.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/upload/style/index.less';
@import 'antd/es/upload/style/index.less';
@import '../Button/style.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/select/style/index.less';
@import 'antd/es/select/style/index.less';
@import '../Label/style.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/layout/style/index.less';
@import 'antd/es/layout/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/statistic/style/index.less';
@import 'antd/es/statistic/style/index.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/switch/style/index.less';
@import 'antd/es/switch/style/index.less';
@import '../Label/style.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/tabs/style/index.less';
@import 'antd/es/tabs/style/index.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/input/style/index.less';
@import 'antd/es/input/style/index.less';
@import '../Label/style.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/input/style/index.less';
@import 'antd/es/input/style/index.less';
@import '../Label/style.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/timeline/style/index.less';
@import 'antd/es/timeline/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/typography/style/index.less';
@import 'antd/es/typography/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/typography/style/index.less';
@import 'antd/es/typography/style/index.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/tooltip/style/index.less';
@import 'antd/es/tooltip/style/index.less';

View File

@ -14,5 +14,5 @@
limitations under the License.
*/
@import 'antd/lib/date-picker/style/index.less';
@import 'antd/es/date-picker/style/index.less';
@import '../Label/style.less';

View File

@ -14,4 +14,4 @@
limitations under the License.
*/
@import 'antd/lib/style/index.less';
@import 'antd/es/style/index.less';

View File

@ -4,7 +4,7 @@ const appConfig = require('./build/app.json');
module.exports = withLess({
lessLoaderOptions: {
lessOptions: {
modifyVars: appConfig.styles.lessVariables,
modifyVars: appConfig.style.lessVariables,
},
},
reactStrictMode: true,

View File

@ -41,6 +41,9 @@
"dependencies": {
"@lowdefy/api": "4.0.0-alpha.5",
"@lowdefy/block-utils": "4.0.0-alpha.5",
"@lowdefy/blocks-antd": "4.0.0-alpha.5",
"@lowdefy/blocks-basic": "4.0.0-alpha.5",
"@lowdefy/connection-axios-http": "4.0.0-alpha.5",
"@lowdefy/engine": "4.0.0-alpha.5",
"@lowdefy/helpers": "4.0.0-alpha.5",
"@lowdefy/layout": "4.0.0-alpha.5",

View File

@ -21,7 +21,6 @@ import Page from '../components/Page.js';
export async function getServerSideProps() {
const apiContext = await createApiContext({ buildDirectory: './build' });
const home = await getHome(apiContext);
console.log(home);
if (home.configured === false) {
return {
redirect: {

View File

@ -3868,7 +3868,10 @@ __metadata:
dependencies:
"@lowdefy/api": 4.0.0-alpha.5
"@lowdefy/block-utils": 4.0.0-alpha.5
"@lowdefy/blocks-antd": 4.0.0-alpha.5
"@lowdefy/blocks-basic": 4.0.0-alpha.5
"@lowdefy/build": 4.0.0-alpha.5
"@lowdefy/connection-axios-http": 4.0.0-alpha.5
"@lowdefy/engine": 4.0.0-alpha.5
"@lowdefy/helpers": 4.0.0-alpha.5
"@lowdefy/layout": 4.0.0-alpha.5