Compare commits

...

4 Commits

Author SHA1 Message Date
LeoYuan 袁力皓
f197355f19 chore(release): code-generator - 1.0.7-beta.4 2022-12-16 14:13:54 +08:00
LeoYuan 袁力皓
f93e17c530 chore: update UT snapshots of CodeGenerator 2022-12-14 15:32:06 +08:00
eternalsky
b4ffa02314 feat(codegen): add demo slots & add new cli option solutionOptions 2022-12-14 14:07:53 +08:00
LeoYuan 袁力皓
1a453e2d21 feat: support UIPaaS-Component code generator solution 2022-12-13 11:36:44 +08:00
122 changed files with 1143 additions and 1125 deletions

View File

@ -14,6 +14,7 @@ program
.option('-c, --cwd <cwd>', 'specify the working directory', '.')
.option('-q, --quiet', 'be quiet, do not output anything unless get error', false)
.option('-v, --verbose', 'be verbose, output more information', false)
.option('--solution-options <options>', 'specify the solution options', '{}')
.arguments('[input-schema] ali lowcode schema JSON file')
.action(function doGenerate(inputSchema, command) {
var options = command.opts();

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-code-generator",
"version": "1.0.7-beta.3",
"version": "1.0.7-beta.4",
"description": "出码引擎 for LowCode Engine",
"license": "MIT",
"main": "lib/index.js",

View File

@ -25,6 +25,7 @@ export async function run(
output?: string;
quiet?: boolean;
verbose?: boolean;
solutionOptions?: string;
},
): Promise<number> {
try {
@ -41,6 +42,19 @@ export async function run(
);
}
let solutionOptions = {};
if (options.solutionOptions) {
try {
solutionOptions = JSON.parse(options.solutionOptions);
} catch (err: any) {
throw new Error(
`solution options parse error, error message is "${err.message}"`,
);
}
}
// 读取 Schema
const schema = await loadSchemaFile(schemaFile);
@ -48,7 +62,7 @@ export async function run(
const createProjectBuilder = await getProjectBuilderFactory(options.solution, {
quiet: options.quiet,
});
const builder = createProjectBuilder();
const builder = createProjectBuilder(solutionOptions);
// 生成代码
const generatedSourceCodes = await builder.generateProject(schema);
@ -75,7 +89,7 @@ export async function run(
async function getProjectBuilderFactory(
solution: string,
{ quiet }: { quiet?: boolean },
): Promise<() => IProjectBuilder> {
): Promise<(options: {[prop: string]: any}) => IProjectBuilder> {
if (solution in CodeGenerator.solutions) {
return CodeGenerator.solutions[solution as 'icejs' | 'rax'];
}

View File

@ -559,8 +559,8 @@ codealike.json
"registry": "https://registry.npm.xxx.com"
},
"dependencies": {
"@alilc/lowcode-code-generator": "^1.0.0-beta.16",
"@alilc/lowcode-types": "^1.0.0-beta.21",
"@alilc/lowcode-code-generator": "^1.0.0",
"@alilc/lowcode-types": "^1.0.0",
"tslib": "^2.3.0"
},
"devDependencies": {

View File

@ -62,10 +62,10 @@ export class ProjectBuilder implements IProjectBuilder {
private projectPostProcessors: ProjectPostProcessor[];
/** 是否处于严格模式 */
public readonly inStrictMode: boolean;
readonly inStrictMode: boolean;
/** 一些额外的上下文数据 */
public readonly extraContextData: IContextData;
readonly extraContextData: IContextData;
constructor({
template,
@ -241,6 +241,15 @@ export class ProjectBuilder implements IProjectBuilder {
});
}
// demo
if (parseResult.project && builders.demo) {
const { files } = await builders.demo.generateModule(parseResult.project);
buildResult.push({
path: this.template.slots.demo.path,
files,
});
}
// TODO: 更多 slots 的处理??是不是可以考虑把 template 中所有的 slots 都处理下?
// Post Process
@ -260,7 +269,10 @@ export class ProjectBuilder implements IProjectBuilder {
let finalResult = projectRoot;
for (const projectPostProcessor of this.projectPostProcessors) {
// eslint-disable-next-line no-await-in-loop
finalResult = await projectPostProcessor(finalResult, schema, originalSchema);
finalResult = await projectPostProcessor(finalResult, schema, originalSchema, {
template: this.template,
parseResult,
});
}
return finalResult;

View File

@ -32,7 +32,7 @@ import {
import { SUPPORT_SCHEMA_VERSION_LIST } from '../const';
import { getErrorMessage } from '../utils/errors';
import { handleSubNodes } from '../utils/schema';
import { handleSubNodes, isValidContainerType } from '../utils/schema';
import { uniqueArray } from '../utils/common';
import { componentAnalyzer } from '../analyzer/componentAnalyzer';
import { ensureValidClassName } from '../utils/validate';
@ -141,7 +141,7 @@ export class SchemaParser implements ISchemaParser {
if (schema.componentsTree.length > 0) {
const firstRoot: ContainerSchema = schema.componentsTree[0] as ContainerSchema;
if (!('fileName' in firstRoot) || !firstRoot.fileName) {
if (!firstRoot.fileName && !isValidContainerType(firstRoot)) {
// 整个 schema 描述一个容器,且无根节点定义
const container: IContainerInfo = {
...firstRoot,
@ -259,8 +259,7 @@ export class SchemaParser implements ISchemaParser {
utils = schema.utils;
utilsDeps = schema.utils
.filter(
(u): u is { name: string; type: 'npm' | 'tnpm'; content: NpmInfo } =>
u.type !== 'function',
(u): u is { name: string; type: 'npm' | 'tnpm'; content: NpmInfo } => u.type !== 'function',
)
.map(
(u): IExternalDependency => ({

View File

@ -9,7 +9,7 @@ const PARSERS = ['css', 'scss', 'less', 'json', 'html', 'vue'];
export interface ProcessorConfig {
customFileTypeParser: Record<string, string>;
plugins?: Array<prettier.Plugin>;
plugins?: prettier.Plugin[];
}
const factory: PostProcessorFactory<ProcessorConfig> = (config?: ProcessorConfig) => {
@ -33,6 +33,8 @@ const factory: PostProcessorFactory<ProcessorConfig> = (config?: ProcessorConfig
return prettier.format(content, {
parser,
plugins: [parserBabel, parserPostCss, parserHtml, ...(cfg.plugins || [])],
singleQuote: true,
jsxSingleQuote: false,
});
};

View File

@ -25,6 +25,7 @@ export enum FileType {
TS = 'ts',
TSX = 'tsx',
JSON = 'json',
MD = 'md',
}
export enum ChunkType {
@ -170,11 +171,17 @@ export interface IProjectBuilder {
/** 项目级别的前置处理器 */
export type ProjectPreProcessor = (schema: ProjectSchema) => Promise<ProjectSchema> | ProjectSchema;
export interface ProjectPostProcessorOptions {
parseResult?: IParseResult;
template?: IProjectTemplate;
}
/** 项目级别的后置处理器 */
export type ProjectPostProcessor = (
result: ResultDir,
schema: ProjectSchema,
originalSchema: ProjectSchema | string,
options: ProjectPostProcessorOptions,
) => Promise<ResultDir> | ResultDir;
/** 模块级别的后置处理器的工厂方法 */

View File

@ -1,7 +1,7 @@
import changeCase from 'change-case';
import type { IProjectInfo } from '../types/intermediate';
export type DataSourceDependenciesConfig = {
export interface DataSourceDependenciesConfig {
/** 数据源引擎的版本 */
engineVersion?: string;
/** 数据源引擎的包名 */
@ -14,7 +14,7 @@ export type DataSourceDependenciesConfig = {
handlersPackages?: {
[key: string]: string;
};
};
}
export function buildDataSourceDependencies(
ir: IProjectInfo,
@ -22,13 +22,13 @@ export function buildDataSourceDependencies(
): Record<string, string> {
return {
// 数据源引擎的依赖包
[cfg.enginePackage || '@alilc/lowcode-datasource-engine']: cfg.engineVersion || 'latest',
[cfg.enginePackage || '@alilc/lowcode-datasource-engine']: cfg.engineVersion || '^1.0.0',
// 各种数据源的 handlers 的依赖包
...(ir.dataSourcesTypes || []).reduce(
(acc, dsType) => ({
...acc,
[getDataSourceHandlerPackageName(dsType)]: cfg.handlersVersion?.[dsType] || 'latest',
[getDataSourceHandlerPackageName(dsType)]: cfg.handlersVersion?.[dsType] || '^1.0.0',
}),
{},
),

View File

@ -11,6 +11,7 @@ import * as schema from './schema';
import * as version from './version';
import * as scope from './Scope';
import * as expressionParser from './expressionParser';
import * as dataSource from './dataSource';
export {
common,
@ -25,4 +26,5 @@ export {
version,
scope,
expressionParser,
dataSource,
};

View File

@ -182,7 +182,7 @@ function generateSimpleNode(
function linkPieces(pieces: CodePiece[]): string {
const tagsPieces = pieces.filter((p) => p.type === PIECE_TYPE.TAG);
if (tagsPieces.length !== 1) {
throw new CodeGeneratorError('One node only need one tag define');
throw new CodeGeneratorError('Only one tag definition required', tagsPieces);
}
const tagName = tagsPieces[0].value;
@ -270,8 +270,7 @@ export function generateReactLoopCtrl(
const loopDataExpr = pipe(
nodeItem.loop,
// 将 JSExpression 转换为 JS 表达式代码:
(expr) =>
generateCompositeType(expr, scope, {
(expr) => generateCompositeType(expr, scope, {
handlers: config?.handlers,
tolerateEvalErrors: false, // 这个内部不需要包 try catch, 下面会统一加的
}),
@ -391,8 +390,7 @@ export function createNodeGenerator(cfg: NodeGeneratorConfig = {}): NodeGenerato
return `{${valueStr}}`;
};
return (nodeItem: NodeDataType, scope: IScope) =>
unwrapJsExprQuoteInJsx(generateNode(nodeItem, scope));
return (nodeItem: NodeDataType, scope: IScope) => unwrapJsExprQuoteInJsx(generateNode(nodeItem, scope));
}
const defaultReactGeneratorConfig: NodeGeneratorConfig = {

View File

@ -138,3 +138,11 @@ export function handleSubNodes<T>(
return [];
}
}
export function isValidContainerType(schema: NodeSchema) {
return [
'Page',
'Component',
'Block',
].includes(schema.componentName);
}

View File

@ -19,7 +19,7 @@ describe(testCaseBaseName, () => {
`
<Greetings
content={this._i18nText({
key: "greetings.hello",
key: 'greetings.hello',
params: { name: this.state.name },
})}
/>

View File

@ -27,7 +27,7 @@ describe(testCaseBaseName, () => {
});
const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx');
expect(generatedPageFileContent).toContain(`import Foo from "example-package/lib/index.js";`);
expect(generatedPageFileContent).toContain('import Foo from \'example-package/lib/index.js\';');
});
test('named import with no alias', async () => {
@ -47,7 +47,7 @@ describe(testCaseBaseName, () => {
const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx');
expect(generatedPageFileContent).toContain(
`import { Foo } from "example-package/lib/index.js";`,
'import { Foo } from \'example-package/lib/index.js\';',
);
});
@ -68,7 +68,7 @@ describe(testCaseBaseName, () => {
const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx');
expect(generatedPageFileContent).toContain(
`import { Bar as Foo } from "example-package/lib/index.js";`,
'import { Bar as Foo } from \'example-package/lib/index.js\';',
);
});
@ -88,7 +88,7 @@ describe(testCaseBaseName, () => {
});
const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx');
expect(generatedPageFileContent).toContain(`import Foo from "example-package/lib/index.js";`);
expect(generatedPageFileContent).toContain('import Foo from \'example-package/lib/index.js\';');
});
test('default import with sub name and export name', async () => {
@ -107,9 +107,9 @@ describe(testCaseBaseName, () => {
});
const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx');
expect(generatedPageFileContent).toContain(`import Bar from "example-package/lib/index.js";`);
expect(generatedPageFileContent).toContain('import Bar from \'example-package/lib/index.js\';');
expect(generatedPageFileContent).toContain(`const Foo = Bar.Baz;`);
expect(generatedPageFileContent).toContain('const Foo = Bar.Baz;');
});
test('default import with sub name without export name', async () => {
@ -129,10 +129,10 @@ describe(testCaseBaseName, () => {
const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx');
expect(generatedPageFileContent).toContain(
`import __$examplePackage_default from "example-package/lib/index.js";`,
'import __$examplePackage_default from \'example-package/lib/index.js\';',
);
expect(generatedPageFileContent).toContain(`const Foo = __$examplePackage_default.Baz;`);
expect(generatedPageFileContent).toContain('const Foo = __$examplePackage_default.Baz;');
});
test('named import with sub name', async () => {
@ -152,10 +152,10 @@ describe(testCaseBaseName, () => {
const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx');
expect(generatedPageFileContent).toContain(
`import { Bar } from "example-package/lib/index.js";`,
'import { Bar } from \'example-package/lib/index.js\';',
);
expect(generatedPageFileContent).toContain(`const Foo = Bar.Baz;`);
expect(generatedPageFileContent).toContain('const Foo = Bar.Baz;');
});
test('default imports with different componentName', async () => {
@ -187,11 +187,11 @@ describe(testCaseBaseName, () => {
});
const generatedPageFileContent = readOutputTextFile('demo-project/src/pages/Test/index.jsx');
expect(generatedPageFileContent).toContain(`import Foo from "example-package";`);
expect(generatedPageFileContent).toContain(`import Baz from "example-package";`);
expect(generatedPageFileContent).toContain('import Foo from \'example-package\';');
expect(generatedPageFileContent).toContain('import Baz from \'example-package\';');
expect(generatedPageFileContent).not.toContain(`const Foo =`);
expect(generatedPageFileContent).not.toContain(`const Baz =`);
expect(generatedPageFileContent).not.toContain('const Foo =');
expect(generatedPageFileContent).not.toContain('const Baz =');
});
});

View File

@ -22,7 +22,7 @@ test(testCaseBaseName, async () => {
Button,
Typography,
Tag,
} from "@alilc/antd-lowcode-materials/dist/antd-lowcode.esm.js";`);
} from '@alilc/antd-lowcode-materials/dist/antd-lowcode.esm.js';`);
});
function exportProject(inputPath: string, outputPath: string) {

View File

@ -19,15 +19,15 @@ test(testCaseBaseName, async () => {
// 里面有的数据源则应该生成对应的 dependencies
expect(generatedPackageJson.dependencies).toMatchObject({
'@alilc/lowcode-datasource-engine': 'latest',
'@alilc/lowcode-datasource-fetch-handler': 'latest',
'@alilc/lowcode-datasource-engine': '^1.0.0',
'@alilc/lowcode-datasource-fetch-handler': '^1.0.0',
});
// 里面没有的,则不应该生成对应的 dependencies
expect(generatedPackageJson.dependencies).not.toMatchObject({
'@alilc/lowcode-datasource-url-params-handler': 'latest',
'@alilc/lowcode-datasource-mtop-handler': 'latest',
'@alilc/lowcode-datasource-mopen-handler': 'latest',
'@alilc/lowcode-datasource-url-params-handler': '^1.0.0',
'@alilc/lowcode-datasource-mtop-handler': '^1.0.0',
'@alilc/lowcode-datasource-mopen-handler': '^1.0.0',
});
});

View File

@ -11,7 +11,7 @@
"lint": "npm run eslint && npm run stylelint"
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"universal-env": "^3.2.0",
"intl-messageformat": "^9.3.6",
"rax": "^1.1.0",

View File

@ -11,9 +11,9 @@
"lint": "npm run eslint && npm run stylelint"
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-url-params-handler": "latest",
"@alilc/lowcode-datasource-fetch-handler": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"@alilc/lowcode-datasource-url-params-handler": "^1.0.0",
"@alilc/lowcode-datasource-fetch-handler": "^1.0.0",
"universal-env": "^3.2.0",
"intl-messageformat": "^9.3.6",
"rax": "^1.1.0",

View File

@ -253,6 +253,7 @@ class Home$$Page extends Component {
if (!response.success) {
throw new Error(response.message);
}
return response.data;
},
isInit: true,
@ -279,6 +280,7 @@ class Home$$Page extends Component {
if (!response.success) {
throw new Error(response.message);
}
return response.data.result;
},
isInit: true,

View File

@ -11,7 +11,7 @@
"lint": "npm run eslint && npm run stylelint"
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"universal-env": "^3.2.0",
"intl-messageformat": "^9.3.6",
"rax": "^1.1.0",

View File

@ -11,7 +11,7 @@
"lint": "npm run eslint && npm run stylelint"
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"universal-env": "^3.2.0",
"intl-messageformat": "^9.3.6",
"rax": "^1.1.0",

View File

@ -11,7 +11,7 @@
"lint": "npm run eslint && npm run stylelint"
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"universal-env": "^3.2.0",
"intl-messageformat": "^9.3.6",
"rax": "^1.1.0",

View File

@ -11,7 +11,7 @@
"lint": "npm run eslint && npm run stylelint"
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"universal-env": "^3.2.0",
"intl-messageformat": "^9.3.6",
"rax": "^1.1.0",

View File

@ -11,7 +11,7 @@
"lint": "npm run eslint && npm run stylelint"
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"universal-env": "^3.2.0",
"intl-messageformat": "^9.3.6",
"rax": "^1.1.0",

View File

@ -11,7 +11,7 @@
"lint": "npm run eslint && npm run stylelint"
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"universal-env": "^3.2.0",
"intl-messageformat": "^9.3.6",
"rax": "^1.1.0",

View File

@ -11,7 +11,7 @@
"lint": "npm run eslint && npm run stylelint"
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"universal-env": "^3.2.0",
"intl-messageformat": "^9.3.6",
"rax": "^1.1.0",

View File

@ -11,7 +11,7 @@
"lint": "npm run eslint && npm run stylelint"
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"universal-env": "^3.2.0",
"intl-messageformat": "^9.3.6",
"rax": "^1.1.0",

View File

@ -11,8 +11,8 @@
"lint": "npm run eslint && npm run stylelint"
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-url-params-handler": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"@alilc/lowcode-datasource-url-params-handler": "^1.0.0",
"universal-env": "^3.2.0",
"intl-messageformat": "^9.3.6",
"rax": "^1.1.0",

View File

@ -11,7 +11,7 @@
"lint": "npm run eslint && npm run stylelint"
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"universal-env": "^3.2.0",
"intl-messageformat": "^9.3.6",
"rax": "^1.1.0",

View File

@ -11,8 +11,8 @@
"lint": "npm run eslint && npm run stylelint"
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-http-handler": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"@alilc/lowcode-datasource-http-handler": "^1.0.0",
"universal-env": "^3.2.0",
"intl-messageformat": "^9.3.6",
"rax": "^1.1.0",

View File

@ -11,9 +11,9 @@
"intl-messageformat": "^9.3.6",
"@ice/store": "^1.4.3",
"@loadable/component": "^5.15.2",
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-url-params-handler": "latest",
"@alilc/lowcode-datasource-fetch-handler": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"@alilc/lowcode-datasource-url-params-handler": "^1.0.0",
"@alilc/lowcode-datasource-fetch-handler": "^1.0.0",
"@alifd/next": "1.19.18"
},
"devDependencies": {

View File

@ -1,11 +1,11 @@
import { createApp } from "ice";
import { createApp } from 'ice';
const appConfig = {
app: {
rootId: "app",
rootId: 'app',
},
router: {
type: "hash",
type: 'hash',
},
};
createApp(appConfig);

View File

@ -1,3 +1,3 @@
const __$$constants = { ENV: "prod", DOMAIN: "xxx.xxx.com" };
const __$$constants = { ENV: 'prod', DOMAIN: 'xxx.xxx.com' };
export default __$$constants;

View File

@ -1,5 +1,5 @@
// 引入默认全局样式
@import "@alifd/next/reset.scss";
@import '@alifd/next/reset.scss';
body {
-webkit-font-smoothing: antialiased;

View File

@ -1,9 +1,9 @@
const i18nConfig = {};
let locale =
typeof navigator === "object" && typeof navigator.language === "string"
typeof navigator === 'object' && typeof navigator.language === 'string'
? navigator.language
: "zh-CN";
: 'zh-CN';
const getLocale = () => locale;
@ -13,22 +13,22 @@ const setLocale = (target) => {
const isEmptyVariables = (variables) =>
(Array.isArray(variables) && variables.length === 0) ||
(typeof variables === "object" &&
(typeof variables === 'object' &&
(!variables || Object.keys(variables).length === 0));
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === "string"
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? "")
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg =
i18nConfig[locale]?.[id] ??
i18nConfig[locale.replace("-", "_")]?.[id] ??
i18nConfig[locale.replace('-', '_')]?.[id] ??
defaultMessage;
if (msg == null) {
console.warn("[i18n]: unknown message id: %o (locale=%o)", id, locale);
console.warn('[i18n]: unknown message id: %o (locale=%o)', id, locale);
return fallback === undefined ? `${id}` : fallback;
}
@ -49,7 +49,7 @@ const _inject2 = (target) => {
};
target._i18nText = (t) => {
// 优先取直接传过来的语料
const localMsg = t[locale] ?? t[String(locale).replace("-", "_")];
const localMsg = t[locale] ?? t[String(locale).replace('-', '_')];
if (localMsg != null) {
return format(localMsg, t.params);
}
@ -61,7 +61,7 @@ const _inject2 = (target) => {
}
// 兜底用 use 指定的或默认语言的
return format(t[t.use || "zh-CN"] ?? t.en_US, t.params);
return format(t[t.use || 'zh-CN'] ?? t.en_US, t.params);
};
// 注入到上下文中去

View File

@ -1,22 +1,22 @@
// : "__$$" 访
// react
import React from "react";
import React from 'react';
import { Form, Input, NumberPicker, Select, Button } from "@alifd/next";
import { Form, Input, NumberPicker, Select, Button } from '@alifd/next';
import { createUrlParamsHandler as __$$createUrlParamsRequestHandler } from "@alilc/lowcode-datasource-url-params-handler";
import { createUrlParamsHandler as __$$createUrlParamsRequestHandler } from '@alilc/lowcode-datasource-url-params-handler';
import { createFetchHandler as __$$createFetchRequestHandler } from "@alilc/lowcode-datasource-fetch-handler";
import { createFetchHandler as __$$createFetchRequestHandler } from '@alilc/lowcode-datasource-fetch-handler';
import { create as __$$createDataSourceEngine } from "@alilc/lowcode-datasource-engine/runtime";
import { create as __$$createDataSourceEngine } from '@alilc/lowcode-datasource-engine/runtime';
import utils, { RefsManager } from "../../utils";
import utils, { RefsManager } from '../../utils';
import * as __$$i18n from "../../i18n";
import * as __$$i18n from '../../i18n';
import __$$constants from "../../constants";
import __$$constants from '../../constants';
import "./index.css";
import './index.css';
class Test$$Page extends React.Component {
_context = this;
@ -51,7 +51,7 @@ class Test$$Page extends React.Component {
__$$i18n._inject2(this);
this.state = { text: "outter" };
this.state = { text: 'outter' };
}
$ = (refName) => {
@ -67,8 +67,8 @@ class Test$$Page extends React.Component {
return {
list: [
{
id: "urlParams",
type: "urlParams",
id: 'urlParams',
type: 'urlParams',
isInit: function () {
return undefined;
},
@ -77,12 +77,12 @@ class Test$$Page extends React.Component {
},
},
{
id: "user",
type: "fetch",
id: 'user',
type: 'fetch',
options: function () {
return {
method: "GET",
uri: "https://shs.xxx.com/mock/1458/demo/user",
method: 'GET',
uri: 'https://shs.xxx.com/mock/1458/demo/user',
isSync: true,
};
},
@ -90,6 +90,7 @@ class Test$$Page extends React.Component {
if (!response.data.success) {
throw new Error(response.data.message);
}
return response.data.data;
},
isInit: function () {
@ -97,12 +98,12 @@ class Test$$Page extends React.Component {
},
},
{
id: "orders",
type: "fetch",
id: 'orders',
type: 'fetch',
options: function () {
return {
method: "GET",
uri: "https://shs.xxx.com/mock/1458/demo/orders",
method: 'GET',
uri: 'https://shs.xxx.com/mock/1458/demo/orders',
isSync: true,
};
},
@ -110,6 +111,7 @@ class Test$$Page extends React.Component {
if (!response.data.success) {
throw new Error(response.data.message);
}
return response.data.data.result;
},
isInit: function () {
@ -118,7 +120,7 @@ class Test$$Page extends React.Component {
},
],
dataHandler: function (dataMap) {
console.info("All datasources loaded:", dataMap);
console.info('All datasources loaded:', dataMap);
},
};
}
@ -126,18 +128,18 @@ class Test$$Page extends React.Component {
componentDidMount() {
this._dataSourceEngine.reloadDataSource();
console.log("componentDidMount");
console.log('componentDidMount');
}
render() {
const __$$context = this._context || this;
const { state } = __$$context;
return (
<div ref={this._refsManager.linkRef("outterView")} autoLoading={true}>
<div ref={this._refsManager.linkRef('outterView')} autoLoading={true}>
<Form
labelCol={__$$eval(() => this.state.colNum)}
style={{}}
ref={this._refsManager.linkRef("testForm")}
ref={this._refsManager.linkRef('testForm')}
>
<Form.Item label="姓名:" name="name" initValue="李雷">
<Input placeholder="请输入" size="medium" style={{ width: 320 }} />
@ -148,18 +150,18 @@ class Test$$Page extends React.Component {
<Form.Item label="职业:" name="profession">
<Select
dataSource={[
{ label: "教师", value: "t" },
{ label: "医生", value: "d" },
{ label: "歌手", value: "s" },
{ label: '教师', value: 't' },
{ label: '医生', value: 'd' },
{ label: '歌手', value: 's' },
]}
/>
</Form.Item>
<div style={{ textAlign: "center" }}>
<div style={{ textAlign: 'center' }}>
<Button.Group>
{__$$evalArray(() => ["a", "b", "c"]).map((item, index) =>
{__$$evalArray(() => ['a', 'b', 'c']).map((item, index) =>
((__$$context) =>
!!__$$eval(() => index >= 1) && (
<Button type="primary" style={{ margin: "0 5px 0 5px" }}>
<Button type="primary" style={{ margin: '0 5px 0 5px' }}>
{__$$eval(() => item)}
</Button>
))(__$$createChildContext(__$$context, { item, index }))

View File

@ -1,14 +1,14 @@
import Test from "@/pages/Test";
import Test from '@/pages/Test';
import BasicLayout from "@/layouts/BasicLayout";
import BasicLayout from '@/layouts/BasicLayout';
const routerConfig = [
{
path: "/",
path: '/',
component: BasicLayout,
children: [
{
path: "/",
path: '/',
component: Test,
},
],

View File

@ -1,4 +1,4 @@
import { createRef } from "react";
import { createRef } from 'react';
export class RefsManager {
constructor() {

View File

@ -11,8 +11,8 @@
"intl-messageformat": "^9.3.6",
"@ice/store": "^1.4.3",
"@loadable/component": "^5.15.2",
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-url-params-handler": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"@alilc/lowcode-datasource-url-params-handler": "^1.0.0",
"@alilc/b6-page": "^0.1.0",
"@alilc/b6-text": "^0.1.0",
"@alilc/b6-compact-legao-builtin": "1.x",

View File

@ -1,11 +1,11 @@
import { createApp } from "ice";
import { createApp } from 'ice';
const appConfig = {
app: {
rootId: "app",
rootId: 'app',
},
router: {
type: "hash",
type: 'hash',
},
};
createApp(appConfig);

View File

@ -1,5 +1,5 @@
// 引入默认全局样式
@import "@alifd/next/reset.scss";
@import '@alifd/next/reset.scss';
body {
-webkit-font-smoothing: antialiased;

View File

@ -1,9 +1,9 @@
const i18nConfig = {};
let locale =
typeof navigator === "object" && typeof navigator.language === "string"
typeof navigator === 'object' && typeof navigator.language === 'string'
? navigator.language
: "zh-CN";
: 'zh-CN';
const getLocale = () => locale;
@ -13,22 +13,22 @@ const setLocale = (target) => {
const isEmptyVariables = (variables) =>
(Array.isArray(variables) && variables.length === 0) ||
(typeof variables === "object" &&
(typeof variables === 'object' &&
(!variables || Object.keys(variables).length === 0));
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === "string"
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? "")
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg =
i18nConfig[locale]?.[id] ??
i18nConfig[locale.replace("-", "_")]?.[id] ??
i18nConfig[locale.replace('-', '_')]?.[id] ??
defaultMessage;
if (msg == null) {
console.warn("[i18n]: unknown message id: %o (locale=%o)", id, locale);
console.warn('[i18n]: unknown message id: %o (locale=%o)', id, locale);
return fallback === undefined ? `${id}` : fallback;
}
@ -49,7 +49,7 @@ const _inject2 = (target) => {
};
target._i18nText = (t) => {
// 优先取直接传过来的语料
const localMsg = t[locale] ?? t[String(locale).replace("-", "_")];
const localMsg = t[locale] ?? t[String(locale).replace('-', '_')];
if (localMsg != null) {
return format(localMsg, t.params);
}
@ -61,7 +61,7 @@ const _inject2 = (target) => {
}
// 兜底用 use 指定的或默认语言的
return format(t[t.use || "zh-CN"] ?? t.en_US, t.params);
return format(t[t.use || 'zh-CN'] ?? t.en_US, t.params);
};
// 注入到上下文中去

View File

@ -1,22 +1,22 @@
// : "__$$" 访
// react
import React from "react";
import React from 'react';
import { Page } from "@alilc/b6-page";
import { Page } from '@alilc/b6-page';
import { Text } from "@alilc/b6-text";
import { Text } from '@alilc/b6-text';
import { createUrlParamsHandler as __$$createUrlParamsRequestHandler } from "@alilc/lowcode-datasource-url-params-handler";
import { createUrlParamsHandler as __$$createUrlParamsRequestHandler } from '@alilc/lowcode-datasource-url-params-handler';
import { create as __$$createDataSourceEngine } from "@alilc/lowcode-datasource-engine/runtime";
import { create as __$$createDataSourceEngine } from '@alilc/lowcode-datasource-engine/runtime';
import utils from "../../utils";
import utils from '../../utils';
import * as __$$i18n from "../../i18n";
import * as __$$i18n from '../../i18n';
import __$$constants from "../../constants";
import __$$constants from '../../constants';
import "./index.css";
import './index.css';
class Aaaa$$Page extends React.Component {
_context = this;
@ -60,12 +60,12 @@ class Aaaa$$Page extends React.Component {
return {
list: [
{
id: "urlParams",
type: "urlParams",
description: "URL参数",
id: 'urlParams',
type: 'urlParams',
description: 'URL参数',
options: function () {
return {
uri: "",
uri: '',
};
},
isInit: function () {

View File

@ -1,14 +1,14 @@
import Aaaa from "@/pages/Aaaa";
import Aaaa from '@/pages/Aaaa';
import BasicLayout from "@/layouts/BasicLayout";
import BasicLayout from '@/layouts/BasicLayout';
const routerConfig = [
{
path: "/",
path: '/',
component: BasicLayout,
children: [
{
path: "/aaaa",
path: '/aaaa',
component: Aaaa,
},
],

View File

@ -1,10 +1,10 @@
import legaoBuiltin from "@alilc/b6-compact-legao-builtin";
import legaoBuiltin from '@alilc/b6-compact-legao-builtin';
import { message, Modal as modal } from "antd";
import { message, Modal as modal } from 'antd';
import { mocks } from "@alilc/b6-util-mocks";
import { mocks } from '@alilc/b6-util-mocks';
import { createRef } from "react";
import { createRef } from 'react';
export class RefsManager {
constructor() {

View File

@ -11,7 +11,7 @@
"intl-messageformat": "^9.3.6",
"@ice/store": "^1.4.3",
"@loadable/component": "^5.15.2",
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"@alifd/next": "1.19.18"
},
"devDependencies": {

View File

@ -1,11 +1,11 @@
import { createApp } from "ice";
import { createApp } from 'ice';
const appConfig = {
app: {
rootId: "app",
rootId: 'app',
},
router: {
type: "hash",
type: 'hash',
},
};
createApp(appConfig);

View File

@ -1,3 +1,3 @@
const __$$constants = { ENV: "prod", DOMAIN: "xxx.xxx.com" };
const __$$constants = { ENV: 'prod', DOMAIN: 'xxx.xxx.com' };
export default __$$constants;

View File

@ -1,5 +1,5 @@
// 引入默认全局样式
@import "@alifd/next/reset.scss";
@import '@alifd/next/reset.scss';
body {
-webkit-font-smoothing: antialiased;

View File

@ -1,18 +1,18 @@
const i18nConfig = {
"zh-CN": {
"i18n-jwg27yo4": "你好",
"i18n-jwg27yo3": "中国",
'zh-CN': {
'i18n-jwg27yo4': '你好',
'i18n-jwg27yo3': '中国',
},
"en-US": {
"i18n-jwg27yo4": "Hello",
"i18n-jwg27yo3": "China",
'en-US': {
'i18n-jwg27yo4': 'Hello',
'i18n-jwg27yo3': 'China',
},
};
let locale =
typeof navigator === "object" && typeof navigator.language === "string"
typeof navigator === 'object' && typeof navigator.language === 'string'
? navigator.language
: "zh-CN";
: 'zh-CN';
const getLocale = () => locale;
@ -22,22 +22,22 @@ const setLocale = (target) => {
const isEmptyVariables = (variables) =>
(Array.isArray(variables) && variables.length === 0) ||
(typeof variables === "object" &&
(typeof variables === 'object' &&
(!variables || Object.keys(variables).length === 0));
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === "string"
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? "")
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg =
i18nConfig[locale]?.[id] ??
i18nConfig[locale.replace("-", "_")]?.[id] ??
i18nConfig[locale.replace('-', '_')]?.[id] ??
defaultMessage;
if (msg == null) {
console.warn("[i18n]: unknown message id: %o (locale=%o)", id, locale);
console.warn('[i18n]: unknown message id: %o (locale=%o)', id, locale);
return fallback === undefined ? `${id}` : fallback;
}
@ -58,7 +58,7 @@ const _inject2 = (target) => {
};
target._i18nText = (t) => {
// 优先取直接传过来的语料
const localMsg = t[locale] ?? t[String(locale).replace("-", "_")];
const localMsg = t[locale] ?? t[String(locale).replace('-', '_')];
if (localMsg != null) {
return format(localMsg, t.params);
}
@ -70,7 +70,7 @@ const _inject2 = (target) => {
}
// 兜底用 use 指定的或默认语言的
return format(t[t.use || "zh-CN"] ?? t.en_US, t.params);
return format(t[t.use || 'zh-CN'] ?? t.en_US, t.params);
};
// 注入到上下文中去

View File

@ -1,16 +1,16 @@
// : "__$$" 访
// react
import React from "react";
import React from 'react';
import { Form, Input, NumberPicker, Select, Button } from "@alifd/next";
import { Form, Input, NumberPicker, Select, Button } from '@alifd/next';
import utils, { RefsManager } from "../../utils";
import utils, { RefsManager } from '../../utils';
import * as __$$i18n from "../../i18n";
import * as __$$i18n from '../../i18n';
import __$$constants from "../../constants";
import __$$constants from '../../constants';
import "./index.css";
import './index.css';
class Test$$Page extends React.Component {
_context = this;
@ -28,7 +28,7 @@ class Test$$Page extends React.Component {
__$$i18n._inject2(this);
this.state = { text: "outter" };
this.state = { text: 'outter' };
}
$ = (refName) => {
@ -40,21 +40,21 @@ class Test$$Page extends React.Component {
};
componentDidMount() {
console.log("componentDidMount");
console.log('componentDidMount');
}
render() {
const __$$context = this._context || this;
const { state } = __$$context;
return (
<div ref={this._refsManager.linkRef("outterView")} autoLoading={true}>
<div ref={this._refsManager.linkRef('outterView')} autoLoading={true}>
<Form
labelCol={__$$eval(() => this.state.colNum)}
style={{}}
ref={this._refsManager.linkRef("testForm")}
ref={this._refsManager.linkRef('testForm')}
>
<Form.Item
label={__$$eval(() => this.i18n("i18n-jwg27yo4"))}
label={__$$eval(() => this.i18n('i18n-jwg27yo4'))}
name="name"
initValue="李雷"
>
@ -66,24 +66,24 @@ class Test$$Page extends React.Component {
<Form.Item label="职业:" name="profession">
<Select
dataSource={[
{ label: "教师", value: "t" },
{ label: "医生", value: "d" },
{ label: "歌手", value: "s" },
{ label: '教师', value: 't' },
{ label: '医生', value: 'd' },
{ label: '歌手', value: 's' },
]}
/>
</Form.Item>
<div style={{ textAlign: "center" }}>
<div style={{ textAlign: 'center' }}>
<Button.Group>
<Button
type="primary"
style={{ margin: "0 5px 0 5px" }}
style={{ margin: '0 5px 0 5px' }}
htmlType="submit"
>
提交
</Button>
<Button
type="normal"
style={{ margin: "0 5px 0 5px" }}
style={{ margin: '0 5px 0 5px' }}
htmlType="reset"
>
重置

View File

@ -1,14 +1,14 @@
import Test from "@/pages/Test";
import Test from '@/pages/Test';
import BasicLayout from "@/layouts/BasicLayout";
import BasicLayout from '@/layouts/BasicLayout';
const routerConfig = [
{
path: "/",
path: '/',
component: BasicLayout,
children: [
{
path: "/",
path: '/',
component: Test,
},
],

View File

@ -1,4 +1,4 @@
import { createRef } from "react";
import { createRef } from 'react';
export class RefsManager {
constructor() {

View File

@ -11,7 +11,7 @@
"intl-messageformat": "^9.3.6",
"@ice/store": "^1.4.3",
"@loadable/component": "^5.15.2",
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"@alifd/next": "1.19.18"
},
"devDependencies": {

View File

@ -1,11 +1,11 @@
import { createApp } from "ice";
import { createApp } from 'ice';
const appConfig = {
app: {
rootId: "app",
rootId: 'app',
},
router: {
type: "hash",
type: 'hash',
},
};
createApp(appConfig);

View File

@ -1,3 +1,3 @@
const __$$constants = { ENV: "prod", DOMAIN: "xxx.xxx.com" };
const __$$constants = { ENV: 'prod', DOMAIN: 'xxx.xxx.com' };
export default __$$constants;

View File

@ -1,5 +1,5 @@
// 引入默认全局样式
@import "@alifd/next/reset.scss";
@import '@alifd/next/reset.scss';
body {
-webkit-font-smoothing: antialiased;

View File

@ -1,18 +1,18 @@
const i18nConfig = {
"zh-CN": {
"i18n-jwg27yo4": "你好",
"i18n-jwg27yo3": "中国",
'zh-CN': {
'i18n-jwg27yo4': '你好',
'i18n-jwg27yo3': '中国',
},
"en-US": {
"i18n-jwg27yo4": "Hello",
"i18n-jwg27yo3": "China",
'en-US': {
'i18n-jwg27yo4': 'Hello',
'i18n-jwg27yo3': 'China',
},
};
let locale =
typeof navigator === "object" && typeof navigator.language === "string"
typeof navigator === 'object' && typeof navigator.language === 'string'
? navigator.language
: "zh-CN";
: 'zh-CN';
const getLocale = () => locale;
@ -22,22 +22,22 @@ const setLocale = (target) => {
const isEmptyVariables = (variables) =>
(Array.isArray(variables) && variables.length === 0) ||
(typeof variables === "object" &&
(typeof variables === 'object' &&
(!variables || Object.keys(variables).length === 0));
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === "string"
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? "")
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg =
i18nConfig[locale]?.[id] ??
i18nConfig[locale.replace("-", "_")]?.[id] ??
i18nConfig[locale.replace('-', '_')]?.[id] ??
defaultMessage;
if (msg == null) {
console.warn("[i18n]: unknown message id: %o (locale=%o)", id, locale);
console.warn('[i18n]: unknown message id: %o (locale=%o)', id, locale);
return fallback === undefined ? `${id}` : fallback;
}
@ -58,7 +58,7 @@ const _inject2 = (target) => {
};
target._i18nText = (t) => {
// 优先取直接传过来的语料
const localMsg = t[locale] ?? t[String(locale).replace("-", "_")];
const localMsg = t[locale] ?? t[String(locale).replace('-', '_')];
if (localMsg != null) {
return format(localMsg, t.params);
}
@ -70,7 +70,7 @@ const _inject2 = (target) => {
}
// 兜底用 use 指定的或默认语言的
return format(t[t.use || "zh-CN"] ?? t.en_US, t.params);
return format(t[t.use || 'zh-CN'] ?? t.en_US, t.params);
};
// 注入到上下文中去

View File

@ -1,6 +1,6 @@
// : "__$$" 访
// react
import React from "react";
import React from 'react';
import Super, {
Button,
@ -9,17 +9,17 @@ import Super, {
NumberPicker,
Select,
SearchTable as SearchTableExport,
} from "@alifd/next";
} from '@alifd/next';
import SuperOther from "@alifd/next";
import SuperOther from '@alifd/next';
import utils from "../../utils";
import utils from '../../utils';
import * as __$$i18n from "../../i18n";
import * as __$$i18n from '../../i18n';
import __$$constants from "../../constants";
import __$$constants from '../../constants';
import "./index.css";
import './index.css';
const SuperSub = Super.Sub;

View File

@ -1,14 +1,14 @@
import Test from "@/pages/Test";
import Test from '@/pages/Test';
import BasicLayout from "@/layouts/BasicLayout";
import BasicLayout from '@/layouts/BasicLayout';
const routerConfig = [
{
path: "/",
path: '/',
component: BasicLayout,
children: [
{
path: "/",
path: '/',
component: Test,
},
],

View File

@ -1,4 +1,4 @@
import { createRef } from "react";
import { createRef } from 'react';
export class RefsManager {
constructor() {

View File

@ -11,9 +11,9 @@
"intl-messageformat": "^9.3.6",
"@ice/store": "^1.4.3",
"@loadable/component": "^5.15.2",
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-fetch-handler": "latest",
"@alife/container": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"@alilc/lowcode-datasource-fetch-handler": "^1.0.0",
"@alife/container": "^1.0.0",
"@alife/mc-assets-1935": "0.1.9"
},
"devDependencies": {

View File

@ -1,11 +1,11 @@
import { createApp } from "ice";
import { createApp } from 'ice';
const appConfig = {
app: {
rootId: "app",
rootId: 'app',
},
router: {
type: "hash",
type: 'hash',
},
};
createApp(appConfig);

View File

@ -1,5 +1,5 @@
// 引入默认全局样式
@import "@alifd/next/reset.scss";
@import '@alifd/next/reset.scss';
body {
-webkit-font-smoothing: antialiased;

View File

@ -1,9 +1,9 @@
const i18nConfig = {};
let locale =
typeof navigator === "object" && typeof navigator.language === "string"
typeof navigator === 'object' && typeof navigator.language === 'string'
? navigator.language
: "zh-CN";
: 'zh-CN';
const getLocale = () => locale;
@ -13,22 +13,22 @@ const setLocale = (target) => {
const isEmptyVariables = (variables) =>
(Array.isArray(variables) && variables.length === 0) ||
(typeof variables === "object" &&
(typeof variables === 'object' &&
(!variables || Object.keys(variables).length === 0));
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === "string"
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? "")
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg =
i18nConfig[locale]?.[id] ??
i18nConfig[locale.replace("-", "_")]?.[id] ??
i18nConfig[locale.replace('-', '_')]?.[id] ??
defaultMessage;
if (msg == null) {
console.warn("[i18n]: unknown message id: %o (locale=%o)", id, locale);
console.warn('[i18n]: unknown message id: %o (locale=%o)', id, locale);
return fallback === undefined ? `${id}` : fallback;
}
@ -49,7 +49,7 @@ const _inject2 = (target) => {
};
target._i18nText = (t) => {
// 优先取直接传过来的语料
const localMsg = t[locale] ?? t[String(locale).replace("-", "_")];
const localMsg = t[locale] ?? t[String(locale).replace('-', '_')];
if (localMsg != null) {
return format(localMsg, t.params);
}
@ -61,7 +61,7 @@ const _inject2 = (target) => {
}
// 兜底用 use 指定的或默认语言的
return format(t[t.use || "zh-CN"] ?? t.en_US, t.params);
return format(t[t.use || 'zh-CN'] ?? t.en_US, t.params);
};
// 注入到上下文中去

View File

@ -1,27 +1,27 @@
// : "__$$" 访
// react
import React from "react";
import React from 'react';
import {
Page as NextPage,
Block as NextBlock,
P as NextP,
Text as NextText,
} from "@alife/container/lib/index.js";
} from '@alife/container/lib/index.js';
import { AliSearchTable as AliSearchTableExport } from "@alife/mc-assets-1935/build/lowcode/index.js";
import { AliSearchTable as AliSearchTableExport } from '@alife/mc-assets-1935/build/lowcode/index.js';
import { createFetchHandler as __$$createFetchRequestHandler } from "@alilc/lowcode-datasource-fetch-handler";
import { createFetchHandler as __$$createFetchRequestHandler } from '@alilc/lowcode-datasource-fetch-handler';
import { create as __$$createDataSourceEngine } from "@alilc/lowcode-datasource-engine/runtime";
import { create as __$$createDataSourceEngine } from '@alilc/lowcode-datasource-engine/runtime';
import utils, { RefsManager } from "../../utils";
import utils, { RefsManager } from '../../utils';
import * as __$$i18n from "../../i18n";
import * as __$$i18n from '../../i18n';
import __$$constants from "../../constants";
import __$$constants from '../../constants';
import "./index.css";
import './index.css';
const NextBlockCell = NextBlock.Cell;
@ -57,7 +57,7 @@ class Test$$Page extends React.Component {
__$$i18n._inject2(this);
this.state = { text: "outter", isShowDialog: false };
this.state = { text: 'outter', isShowDialog: false };
}
$ = (refName) => {
@ -73,28 +73,28 @@ class Test$$Page extends React.Component {
return {
list: [
{
type: "fetch",
type: 'fetch',
isInit: function () {
return true;
},
options: function () {
return {
params: {},
method: "GET",
method: 'GET',
isCors: true,
timeout: 5000,
headers: {},
uri: "https://mocks.xxx.com/mock/jjpin/user/list",
uri: 'https://mocks.xxx.com/mock/jjpin/user/list',
};
},
id: "users",
id: 'users',
},
],
};
}
componentWillUnmount() {
console.log("will umount");
console.log('will umount');
}
componentDidUpdate(prevProps, prevState, snapshot) {
@ -102,7 +102,7 @@ class Test$$Page extends React.Component {
}
testFunc() {
console.log("test func");
console.log('test func');
}
onClick() {
@ -118,13 +118,13 @@ class Test$$Page extends React.Component {
}
onSearch(values) {
console.log("search form:", values);
console.log('search form:', values);
console.log(this.dataSourceMap);
this.dataSourceMap["users"].load(values);
this.dataSourceMap['users'].load(values);
}
onClear() {
console.log("form reset");
console.log('form reset');
this.setState({
isShowDialog: true,
});
@ -137,7 +137,7 @@ class Test$$Page extends React.Component {
componentDidMount() {
this._dataSourceEngine.reloadDataSource();
console.log("did mount");
console.log('did mount');
}
render() {
@ -145,12 +145,12 @@ class Test$$Page extends React.Component {
const { state } = __$$context;
return (
<div
ref={this._refsManager.linkRef("outterView")}
style={{ height: "100%" }}
ref={this._refsManager.linkRef('outterView')}
style={{ height: '100%' }}
>
<NextPage
columns={12}
placeholderStyle={{ gridRowEnd: "span 1", gridColumnEnd: "span 12" }}
placeholderStyle={{ gridRowEnd: 'span 1', gridColumnEnd: 'span 12' }}
placeholder="页面主体内容拖拽Block布局组件到这里"
header={
<NextP
@ -165,13 +165,13 @@ class Test$$Page extends React.Component {
</NextP>
}
headerTest={[]}
headerProps={{ background: "surface" }}
headerProps={{ background: 'surface' }}
footer={null}
minHeight="100vh"
>
<NextBlock
prefix="next-"
placeholderStyle={{ height: "100%" }}
placeholderStyle={{ height: '100%' }}
noPadding={false}
noBorder={false}
background="surface"
@ -183,7 +183,7 @@ class Test$$Page extends React.Component {
title=""
primaryKey="732"
prefix="next-"
placeholderStyle={{ height: "100%" }}
placeholderStyle={{ height: '100%' }}
colSpan={1}
rowSpan={1}
>
@ -199,13 +199,13 @@ class Test$$Page extends React.Component {
dataSource={__$$eval(() => this.state.users.data)}
rowKey="workid"
columns={[
{ title: "花名", dataIndex: "cname" },
{ title: "user_id", dataIndex: "workid" },
{ title: "部门", dataIndex: "dep" },
{ title: '花名', dataIndex: 'cname' },
{ title: 'user_id', dataIndex: 'workid' },
{ title: '部门', dataIndex: 'dep' },
]}
searchItems={[
{ label: "姓名", name: "cname" },
{ label: "部门", name: "dep" },
{ label: '姓名', name: 'cname' },
{ label: '部门', name: 'dep' },
]}
onSearch={function () {
return this.onSearch.apply(
@ -220,7 +220,7 @@ class Test$$Page extends React.Component {
);
}.bind(this)}
pagination={{
defaultPageSize: "",
defaultPageSize: '',
onPageChange: function () {
return this.onPageChange.apply(
this,
@ -237,16 +237,16 @@ class Test$$Page extends React.Component {
<NextPage
columns={12}
headerDivider={true}
placeholderStyle={{ gridRowEnd: "span 1", gridColumnEnd: "span 12" }}
placeholderStyle={{ gridRowEnd: 'span 1', gridColumnEnd: 'span 12' }}
placeholder="页面主体内容拖拽Block布局组件到这里"
header={null}
headerProps={{ background: "surface" }}
headerProps={{ background: 'surface' }}
footer={null}
minHeight="100vh"
>
<NextBlock
prefix="next-"
placeholderStyle={{ height: "100%" }}
placeholderStyle={{ height: '100%' }}
noPadding={false}
noBorder={false}
background="surface"
@ -258,7 +258,7 @@ class Test$$Page extends React.Component {
title=""
primaryKey="472"
prefix="next-"
placeholderStyle={{ height: "100%" }}
placeholderStyle={{ height: '100%' }}
colSpan={1}
rowSpan={1}
/>

View File

@ -1,14 +1,14 @@
import Test from "@/pages/Test";
import Test from '@/pages/Test';
import BasicLayout from "@/layouts/BasicLayout";
import BasicLayout from '@/layouts/BasicLayout';
const routerConfig = [
{
path: "/",
path: '/',
component: BasicLayout,
children: [
{
path: "",
path: '',
component: Test,
},
],

View File

@ -1,4 +1,4 @@
import { createRef } from "react";
import { createRef } from 'react';
export class RefsManager {
constructor() {

View File

@ -12,7 +12,7 @@
},
{
"package": "@alife/container",
"version": "latest",
"version": "^1.0.0",
"exportName": "P",
"main": "lib/index.js",
"destructuring": true,
@ -21,7 +21,7 @@
},
{
"package": "@alife/container",
"version": "latest",
"version": "^1.0.0",
"exportName": "Block",
"main": "lib/index.js",
"destructuring": true,
@ -30,7 +30,7 @@
},
{
"package": "@alife/container",
"version": "latest",
"version": "^1.0.0",
"exportName": "Block",
"main": "lib/index.js",
"destructuring": true,
@ -39,7 +39,7 @@
},
{
"package": "@alife/container",
"version": "latest",
"version": "^1.0.0",
"exportName": "Text",
"main": "lib/index.js",
"destructuring": true,
@ -48,7 +48,7 @@
},
{
"package": "@alife/container",
"version": "latest",
"version": "^1.0.0",
"exportName": "Page",
"main": "lib/index.js",
"destructuring": true,

View File

@ -11,7 +11,7 @@
"intl-messageformat": "^9.3.6",
"@ice/store": "^1.4.3",
"@loadable/component": "^5.15.2",
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"undefined": "*",
"@alife/container": "0.3.7",
"@alilc/antd-lowcode": "0.5.4",

View File

@ -1,11 +1,11 @@
import { createApp } from "ice";
import { createApp } from 'ice';
const appConfig = {
app: {
rootId: "app",
rootId: 'app',
},
router: {
type: "hash",
type: 'hash',
},
};
createApp(appConfig);

View File

@ -1,5 +1,5 @@
// 引入默认全局样式
@import "@alifd/next/reset.scss";
@import '@alifd/next/reset.scss';
body {
-webkit-font-smoothing: antialiased;

View File

@ -1,9 +1,9 @@
const i18nConfig = {};
let locale =
typeof navigator === "object" && typeof navigator.language === "string"
typeof navigator === 'object' && typeof navigator.language === 'string'
? navigator.language
: "zh-CN";
: 'zh-CN';
const getLocale = () => locale;
@ -13,22 +13,22 @@ const setLocale = (target) => {
const isEmptyVariables = (variables) =>
(Array.isArray(variables) && variables.length === 0) ||
(typeof variables === "object" &&
(typeof variables === 'object' &&
(!variables || Object.keys(variables).length === 0));
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === "string"
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? "")
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg =
i18nConfig[locale]?.[id] ??
i18nConfig[locale.replace("-", "_")]?.[id] ??
i18nConfig[locale.replace('-', '_')]?.[id] ??
defaultMessage;
if (msg == null) {
console.warn("[i18n]: unknown message id: %o (locale=%o)", id, locale);
console.warn('[i18n]: unknown message id: %o (locale=%o)', id, locale);
return fallback === undefined ? `${id}` : fallback;
}
@ -49,7 +49,7 @@ const _inject2 = (target) => {
};
target._i18nText = (t) => {
// 优先取直接传过来的语料
const localMsg = t[locale] ?? t[String(locale).replace("-", "_")];
const localMsg = t[locale] ?? t[String(locale).replace('-', '_')];
if (localMsg != null) {
return format(localMsg, t.params);
}
@ -61,7 +61,7 @@ const _inject2 = (target) => {
}
// 兜底用 use 指定的或默认语言的
return format(t[t.use || "zh-CN"] ?? t.en_US, t.params);
return format(t[t.use || 'zh-CN'] ?? t.en_US, t.params);
};
// 注入到上下文中去

View File

@ -1,12 +1,12 @@
// : "__$$" 访
// react
import React from "react";
import React from 'react';
import {
Page as NextPage,
Block as NextBlock,
P as NextP,
} from "@alife/container/lib/index.js";
} from '@alife/container/lib/index.js';
import {
Card,
@ -18,17 +18,17 @@ import {
Form,
InputNumber,
Input,
} from "@alilc/antd-lowcode/dist/antd-lowcode.esm.js";
} from '@alilc/antd-lowcode/dist/antd-lowcode.esm.js';
import { AliAutoSearchTable } from "@alife/mc-assets-1935/build/lowcode/index.js";
import { AliAutoSearchTable } from '@alife/mc-assets-1935/build/lowcode/index.js';
import utils, { RefsManager } from "../../utils";
import utils, { RefsManager } from '../../utils';
import * as __$$i18n from "../../i18n";
import * as __$$i18n from '../../i18n';
import __$$constants from "../../constants";
import __$$constants from '../../constants';
import "./index.css";
import './index.css';
const NextBlockCell = NextBlock.Cell;
@ -51,7 +51,7 @@ class Test$$Page extends React.Component {
__$$i18n._inject2(this);
this.state = {
name: "nongzhou",
name: 'nongzhou',
gateways: [],
selectedGateway: null,
records: [],
@ -102,23 +102,23 @@ class Test$$Page extends React.Component {
const { state } = __$$context;
return (
<div
ref={this._refsManager.linkRef("outterView")}
style={{ height: "100%" }}
ref={this._refsManager.linkRef('outterView')}
style={{ height: '100%' }}
>
<NextPage
columns={12}
headerDivider={true}
placeholderStyle={{ gridRowEnd: "span 1", gridColumnEnd: "span 12" }}
placeholderStyle={{ gridRowEnd: 'span 1', gridColumnEnd: 'span 12' }}
placeholder="页面主体内容拖拽Block布局组件到这里"
header={null}
headerProps={{ background: "surface" }}
headerProps={{ background: 'surface' }}
footer={null}
minHeight="100vh"
style={{ cursor: "pointer" }}
style={{ cursor: 'pointer' }}
>
<NextBlock
prefix="next-"
placeholderStyle={{ height: "100%" }}
placeholderStyle={{ height: '100%' }}
noPadding={false}
noBorder={false}
background="surface"
@ -130,7 +130,7 @@ class Test$$Page extends React.Component {
<NextBlockCell
title=""
prefix="next-"
placeholderStyle={{ height: "100%" }}
placeholderStyle={{ height: '100%' }}
layoutmode="O"
childTotalColumns={12}
isAutoContainer={true}
@ -151,16 +151,16 @@ class Test$$Page extends React.Component {
<Typography.Text>所在网关</Typography.Text>
<Select
style={{
marginTop: "16px",
marginRight: "16px",
marginBottom: "16px",
marginLeft: "16px",
width: "400px",
display: "inline-block",
marginTop: '16px',
marginRight: '16px',
marginBottom: '16px',
marginLeft: '16px',
width: '400px',
display: 'inline-block',
}}
options={__$$eval(() => this.state.gateways)}
mode="single"
defaultValue={["auto-edd-uniproxy"]}
defaultValue={['auto-edd-uniproxy']}
labelInValue={true}
showSearch={true}
allowClear={false}
@ -171,23 +171,23 @@ class Test$$Page extends React.Component {
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onChange",
relatedEventName: "onChange",
type: 'componentEvent',
name: 'onChange',
relatedEventName: 'onChange',
},
],
eventList: [
{ name: "onBlur", disabled: false },
{ name: "onChange", disabled: true },
{ name: "onDeselect", disabled: false },
{ name: "onFocus", disabled: false },
{ name: "onInputKeyDown", disabled: false },
{ name: "onMouseEnter", disabled: false },
{ name: "onMouseLeave", disabled: false },
{ name: "onPopupScroll", disabled: false },
{ name: "onSearch", disabled: false },
{ name: "onSelect", disabled: false },
{ name: "onDropdownVisibleChange", disabled: false },
{ name: 'onBlur', disabled: false },
{ name: 'onChange', disabled: true },
{ name: 'onDeselect', disabled: false },
{ name: 'onFocus', disabled: false },
{ name: 'onInputKeyDown', disabled: false },
{ name: 'onMouseEnter', disabled: false },
{ name: 'onMouseLeave', disabled: false },
{ name: 'onPopupScroll', disabled: false },
{ name: 'onSearch', disabled: false },
{ name: 'onSelect', disabled: false },
{ name: 'onDropdownVisibleChange', disabled: false },
],
}}
onChange={function () {
@ -201,19 +201,19 @@ class Test$$Page extends React.Component {
<Button
type="primary"
style={{
display: "block",
marginTop: "20px",
marginBottom: "20px",
display: 'block',
marginTop: '20px',
marginBottom: '20px',
}}
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onClick",
relatedEventName: "onCreateOrder",
type: 'componentEvent',
name: 'onClick',
relatedEventName: 'onCreateOrder',
},
],
eventList: [{ name: "onClick", disabled: true }],
eventList: [{ name: 'onClick', disabled: true }],
}}
onClick={function () {
this.onCreateOrder.apply(
@ -231,14 +231,14 @@ class Test$$Page extends React.Component {
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onCancel",
relatedEventName: "onCancelModal",
type: 'componentEvent',
name: 'onCancel',
relatedEventName: 'onCancelModal',
},
],
eventList: [
{ name: "onCancel", disabled: true },
{ name: "onOk", disabled: false },
{ name: 'onCancel', disabled: true },
{ name: 'onOk', disabled: false },
],
}}
onCancel={function () {
@ -262,16 +262,16 @@ class Test$$Page extends React.Component {
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onFinish",
relatedEventName: "onConfirmCreateOrder",
type: 'componentEvent',
name: 'onFinish',
relatedEventName: 'onConfirmCreateOrder',
},
],
eventList: [
{ name: "onFinish", disabled: true },
{ name: "onFinishFailed", disabled: false },
{ name: "onFieldsChange", disabled: false },
{ name: "onValuesChange", disabled: false },
{ name: 'onFinish', disabled: true },
{ name: 'onFinishFailed', disabled: false },
{ name: 'onFieldsChange', disabled: false },
{ name: 'onValuesChange', disabled: false },
],
}}
>
@ -287,10 +287,10 @@ class Test$$Page extends React.Component {
<Form.Item
wrapperCol={{ offset: 6 }}
style={{
flexDirection: "row",
alignItems: "flex-end",
justifyContent: "center",
display: "flex",
flexDirection: 'row',
alignItems: 'flex-end',
justifyContent: 'center',
display: 'flex',
}}
labelAlign="right"
>
@ -302,12 +302,12 @@ class Test$$Page extends React.Component {
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onClick",
relatedEventName: "onCancelModal",
type: 'componentEvent',
name: 'onClick',
relatedEventName: 'onCancelModal',
},
],
eventList: [{ name: "onClick", disabled: true }],
eventList: [{ name: 'onClick', disabled: true }],
}}
onClick={function () {
this.onCancelModal.apply(
@ -326,27 +326,27 @@ class Test$$Page extends React.Component {
dataSource={__$$eval(() => this.state.records)}
columns={[
{
title: "发布名称",
dataIndex: "order_name",
key: "name",
title: '发布名称',
dataIndex: 'order_name',
key: 'name',
},
{
title: "类型",
dataIndex: "order_type_desc",
key: "age",
title: '类型',
dataIndex: 'order_type_desc',
key: 'age',
},
{
title: "发布状态",
dataIndex: "order_status_desc",
key: "address",
title: '发布状态',
dataIndex: 'order_status_desc',
key: 'address',
},
{ title: "发布人", dataIndex: "creator_name" },
{ title: "当前批次/总批次", dataIndex: "cur_batch_no" },
{ title: '发布人', dataIndex: 'creator_name' },
{ title: '当前批次/总批次', dataIndex: 'cur_batch_no' },
{
title: "发布机器/总机器",
dataIndex: "pubblish_ip_finish_num",
title: '发布机器/总机器',
dataIndex: 'pubblish_ip_finish_num',
},
{ title: "发布时间", dataIndex: "publish_id" },
{ title: '发布时间', dataIndex: 'publish_id' },
]}
actions={__$$eval(() => this.actions || [])}
getActions={function () {

View File

@ -1,14 +1,14 @@
import Test from "@/pages/Test";
import Test from '@/pages/Test';
import BasicLayout from "@/layouts/BasicLayout";
import BasicLayout from '@/layouts/BasicLayout';
const routerConfig = [
{
path: "/",
path: '/',
component: BasicLayout,
children: [
{
path: "",
path: '',
component: Test,
},
],

View File

@ -1,4 +1,4 @@
import { createRef } from "react";
import { createRef } from 'react';
export class RefsManager {
constructor() {

View File

@ -11,9 +11,9 @@
"intl-messageformat": "^9.3.6",
"@ice/store": "^1.4.3",
"@loadable/component": "^5.15.2",
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-url-params-handler": "latest",
"@alilc/lowcode-datasource-fetch-handler": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"@alilc/lowcode-datasource-url-params-handler": "^1.0.0",
"@alilc/lowcode-datasource-fetch-handler": "^1.0.0",
"@alifd/next": "1.19.18"
},
"devDependencies": {

View File

@ -1,11 +1,11 @@
import { createApp } from "ice";
import { createApp } from 'ice';
const appConfig = {
app: {
rootId: "app",
rootId: 'app',
},
router: {
type: "hash",
type: 'hash',
},
};
createApp(appConfig);

View File

@ -1,3 +1,3 @@
const __$$constants = { ENV: "prod", DOMAIN: "xxx.xxx.com" };
const __$$constants = { ENV: 'prod', DOMAIN: 'xxx.xxx.com' };
export default __$$constants;

View File

@ -1,5 +1,5 @@
// 引入默认全局样式
@import "@alifd/next/reset.scss";
@import '@alifd/next/reset.scss';
body {
-webkit-font-smoothing: antialiased;

View File

@ -1,9 +1,9 @@
const i18nConfig = {};
let locale =
typeof navigator === "object" && typeof navigator.language === "string"
typeof navigator === 'object' && typeof navigator.language === 'string'
? navigator.language
: "zh-CN";
: 'zh-CN';
const getLocale = () => locale;
@ -13,22 +13,22 @@ const setLocale = (target) => {
const isEmptyVariables = (variables) =>
(Array.isArray(variables) && variables.length === 0) ||
(typeof variables === "object" &&
(typeof variables === 'object' &&
(!variables || Object.keys(variables).length === 0));
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === "string"
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? "")
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg =
i18nConfig[locale]?.[id] ??
i18nConfig[locale.replace("-", "_")]?.[id] ??
i18nConfig[locale.replace('-', '_')]?.[id] ??
defaultMessage;
if (msg == null) {
console.warn("[i18n]: unknown message id: %o (locale=%o)", id, locale);
console.warn('[i18n]: unknown message id: %o (locale=%o)', id, locale);
return fallback === undefined ? `${id}` : fallback;
}
@ -49,7 +49,7 @@ const _inject2 = (target) => {
};
target._i18nText = (t) => {
// 优先取直接传过来的语料
const localMsg = t[locale] ?? t[String(locale).replace("-", "_")];
const localMsg = t[locale] ?? t[String(locale).replace('-', '_')];
if (localMsg != null) {
return format(localMsg, t.params);
}
@ -61,7 +61,7 @@ const _inject2 = (target) => {
}
// 兜底用 use 指定的或默认语言的
return format(t[t.use || "zh-CN"] ?? t.en_US, t.params);
return format(t[t.use || 'zh-CN'] ?? t.en_US, t.params);
};
// 注入到上下文中去

View File

@ -1,22 +1,22 @@
// : "__$$" 访
// react
import React from "react";
import React from 'react';
import { Form, Input, NumberPicker, Select, Button } from "@alifd/next";
import { Form, Input, NumberPicker, Select, Button } from '@alifd/next';
import { createUrlParamsHandler as __$$createUrlParamsRequestHandler } from "@alilc/lowcode-datasource-url-params-handler";
import { createUrlParamsHandler as __$$createUrlParamsRequestHandler } from '@alilc/lowcode-datasource-url-params-handler';
import { createFetchHandler as __$$createFetchRequestHandler } from "@alilc/lowcode-datasource-fetch-handler";
import { createFetchHandler as __$$createFetchRequestHandler } from '@alilc/lowcode-datasource-fetch-handler';
import { create as __$$createDataSourceEngine } from "@alilc/lowcode-datasource-engine/runtime";
import { create as __$$createDataSourceEngine } from '@alilc/lowcode-datasource-engine/runtime';
import utils, { RefsManager } from "../../utils";
import utils, { RefsManager } from '../../utils';
import * as __$$i18n from "../../i18n";
import * as __$$i18n from '../../i18n';
import __$$constants from "../../constants";
import __$$constants from '../../constants';
import "./index.css";
import './index.css';
class Test$$Page extends React.Component {
_context = this;
@ -51,7 +51,7 @@ class Test$$Page extends React.Component {
__$$i18n._inject2(this);
this.state = { text: "outter" };
this.state = { text: 'outter' };
}
$ = (refName) => {
@ -67,8 +67,8 @@ class Test$$Page extends React.Component {
return {
list: [
{
id: "urlParams",
type: "urlParams",
id: 'urlParams',
type: 'urlParams',
isInit: function () {
return undefined;
},
@ -77,12 +77,12 @@ class Test$$Page extends React.Component {
},
},
{
id: "user",
type: "fetch",
id: 'user',
type: 'fetch',
options: function () {
return {
method: "GET",
uri: "https://shs.xxx.com/mock/1458/demo/user",
method: 'GET',
uri: 'https://shs.xxx.com/mock/1458/demo/user',
isSync: true,
};
},
@ -90,6 +90,7 @@ class Test$$Page extends React.Component {
if (!response.data.success) {
throw new Error(response.data.message);
}
return response.data.data;
},
isInit: function () {
@ -97,12 +98,12 @@ class Test$$Page extends React.Component {
},
},
{
id: "orders",
type: "fetch",
id: 'orders',
type: 'fetch',
options: function () {
return {
method: "GET",
uri: "https://shs.xxx.com/mock/1458/demo/orders",
method: 'GET',
uri: 'https://shs.xxx.com/mock/1458/demo/orders',
isSync: true,
};
},
@ -110,6 +111,7 @@ class Test$$Page extends React.Component {
if (!response.data.success) {
throw new Error(response.data.message);
}
return response.data.data.result;
},
isInit: function () {
@ -118,7 +120,7 @@ class Test$$Page extends React.Component {
},
],
dataHandler: function (dataMap) {
console.info("All datasources loaded:", dataMap);
console.info('All datasources loaded:', dataMap);
},
};
}
@ -126,18 +128,18 @@ class Test$$Page extends React.Component {
componentDidMount() {
this._dataSourceEngine.reloadDataSource();
console.log("componentDidMount");
console.log('componentDidMount');
}
render() {
const __$$context = this._context || this;
const { state } = __$$context;
return (
<div ref={this._refsManager.linkRef("outterView")} autoLoading={true}>
<div ref={this._refsManager.linkRef('outterView')} autoLoading={true}>
<Form
labelCol={__$$eval(() => this.state.colNum)}
style={{}}
ref={this._refsManager.linkRef("testForm")}
ref={this._refsManager.linkRef('testForm')}
>
<Form.Item label="姓名:" name="name" initValue="李雷">
<Input placeholder="请输入" size="medium" style={{ width: 320 }} />
@ -148,18 +150,18 @@ class Test$$Page extends React.Component {
<Form.Item label="职业:" name="profession">
<Select
dataSource={[
{ label: "教师", value: "t" },
{ label: "医生", value: "d" },
{ label: "歌手", value: "s" },
{ label: '教师', value: 't' },
{ label: '医生', value: 'd' },
{ label: '歌手', value: 's' },
]}
/>
</Form.Item>
<div style={{ textAlign: "center" }}>
<div style={{ textAlign: 'center' }}>
<Button.Group>
{__$$evalArray(() => ["a", "b", "c"]).map((item, index) =>
{__$$evalArray(() => ['a', 'b', 'c']).map((item, index) =>
((__$$context) =>
!!false && (
<Button type="primary" style={{ margin: "0 5px 0 5px" }}>
<Button type="primary" style={{ margin: '0 5px 0 5px' }}>
{__$$eval(() => item)}
</Button>
))(__$$createChildContext(__$$context, { item, index }))

View File

@ -1,14 +1,14 @@
import Test from "@/pages/Test";
import Test from '@/pages/Test';
import BasicLayout from "@/layouts/BasicLayout";
import BasicLayout from '@/layouts/BasicLayout';
const routerConfig = [
{
path: "/",
path: '/',
component: BasicLayout,
children: [
{
path: "/",
path: '/',
component: Test,
},
],

View File

@ -1,4 +1,4 @@
import { createRef } from "react";
import { createRef } from 'react';
export class RefsManager {
constructor() {

View File

@ -11,7 +11,7 @@
"intl-messageformat": "^9.3.6",
"@ice/store": "^1.4.3",
"@loadable/component": "^5.15.2",
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"undefined": "*",
"@alilc/antd-lowcode": "0.8.0",
"@alife/container": "0.3.7"

View File

@ -1,11 +1,11 @@
import { createApp } from "ice";
import { createApp } from 'ice';
const appConfig = {
app: {
rootId: "app",
rootId: 'app',
},
router: {
type: "hash",
type: 'hash',
},
};
createApp(appConfig);

View File

@ -1,5 +1,5 @@
// 引入默认全局样式
@import "@alifd/next/reset.scss";
@import '@alifd/next/reset.scss';
body {
-webkit-font-smoothing: antialiased;

View File

@ -1,9 +1,9 @@
const i18nConfig = {};
let locale =
typeof navigator === "object" && typeof navigator.language === "string"
typeof navigator === 'object' && typeof navigator.language === 'string'
? navigator.language
: "zh-CN";
: 'zh-CN';
const getLocale = () => locale;
@ -13,22 +13,22 @@ const setLocale = (target) => {
const isEmptyVariables = (variables) =>
(Array.isArray(variables) && variables.length === 0) ||
(typeof variables === "object" &&
(typeof variables === 'object' &&
(!variables || Object.keys(variables).length === 0));
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === "string"
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? "")
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg =
i18nConfig[locale]?.[id] ??
i18nConfig[locale.replace("-", "_")]?.[id] ??
i18nConfig[locale.replace('-', '_')]?.[id] ??
defaultMessage;
if (msg == null) {
console.warn("[i18n]: unknown message id: %o (locale=%o)", id, locale);
console.warn('[i18n]: unknown message id: %o (locale=%o)', id, locale);
return fallback === undefined ? `${id}` : fallback;
}
@ -49,7 +49,7 @@ const _inject2 = (target) => {
};
target._i18nText = (t) => {
// 优先取直接传过来的语料
const localMsg = t[locale] ?? t[String(locale).replace("-", "_")];
const localMsg = t[locale] ?? t[String(locale).replace('-', '_')];
if (localMsg != null) {
return format(localMsg, t.params);
}
@ -61,7 +61,7 @@ const _inject2 = (target) => {
}
// 兜底用 use 指定的或默认语言的
return format(t[t.use || "zh-CN"] ?? t.en_US, t.params);
return format(t[t.use || 'zh-CN'] ?? t.en_US, t.params);
};
// 注入到上下文中去

View File

@ -1,6 +1,6 @@
// : "__$$" 访
// react
import React from "react";
import React from 'react';
import {
Modal,
@ -12,22 +12,22 @@ import {
DatePicker,
InputNumber,
Button,
} from "@alilc/antd-lowcode/dist/antd-lowcode.esm.js";
} from '@alilc/antd-lowcode/dist/antd-lowcode.esm.js';
import {
Text as NextText,
Page as NextPage,
Block as NextBlock,
P as NextP,
} from "@alife/container/lib/index.js";
} from '@alife/container/lib/index.js';
import utils, { RefsManager } from "../../utils";
import utils, { RefsManager } from '../../utils';
import * as __$$i18n from "../../i18n";
import * as __$$i18n from '../../i18n';
import __$$constants from "../../constants";
import __$$constants from '../../constants';
import "./index.css";
import './index.css';
const NextBlockCell = NextBlock.Cell;
@ -52,9 +52,9 @@ class Test$$Page extends React.Component {
currentStep: 0,
isModifyDialogVisible: false,
isModifyStatus: false,
secondCommitText: "完成并提交",
thirdAuditText: "审核中",
thirdButtonText: "修改",
secondCommitText: '完成并提交',
thirdAuditText: '审核中',
thirdButtonText: '修改',
customerProjectInfo: {
id: null,
systemProjectName: null,
@ -75,28 +75,28 @@ class Test$$Page extends React.Component {
status: null,
},
versionLinesArray: [
{ label: "AmapAuto 485", value: 1 },
{ label: "AmapAuto 505", value: 2 },
{ label: 'AmapAuto 485', value: 1 },
{ label: 'AmapAuto 505', value: 2 },
],
projectModalsArray: [
{ label: "车机", value: 1 },
{ label: "车镜", value: 2 },
{ label: "记录仪", value: 3 },
{ label: "其他", value: 4 },
{ label: '车机', value: 1 },
{ label: '车镜', value: 2 },
{ label: '记录仪', value: 3 },
{ label: '其他', value: 4 },
],
osVersionsArray: [
{ label: "安卓5", value: 1 },
{ label: "安卓6", value: 2 },
{ label: "安卓7", value: 3 },
{ label: "安卓8", value: 4 },
{ label: "安卓9", value: 5 },
{ label: "安卓10", value: 6 },
{ label: '安卓5', value: 1 },
{ label: '安卓6', value: 2 },
{ label: '安卓7', value: 3 },
{ label: '安卓8', value: 4 },
{ label: '安卓9', value: 5 },
{ label: '安卓10', value: 6 },
],
instructionsArray: [
{ label: "ARM64-V8", value: "ARM64-V8" },
{ label: "ARM32-V7", value: "ARM32-V7" },
{ label: "X86", value: "X86" },
{ label: "X64", value: "X64" },
{ label: 'ARM64-V8', value: 'ARM64-V8' },
{ label: 'ARM32-V7', value: 'ARM32-V7' },
{ label: 'X86', value: 'X86' },
{ label: 'X64', value: 'X64' },
],
};
}
@ -151,7 +151,6 @@ class Test$$Page extends React.Component {
onOkModifyDialogThird() {
//
this.setState({
currentStep: 0,
isModifyDialogVisible: false,
@ -160,7 +159,6 @@ class Test$$Page extends React.Component {
onCancelModifyDialogThird() {
//
this.setState({
isModifyDialogVisible: false,
});
@ -177,17 +175,17 @@ class Test$$Page extends React.Component {
onClickFirstBack() {
//
this.$router.push("/myProjectList");
this.$router.push('/myProjectList');
}
onClickSecondBack() {
//
this.$router.push("/myProjectList");
this.$router.push('/myProjectList');
}
onClickThirdBack() {
//
this.$router.push("/myProjectList");
this.$router.push('/myProjectList');
}
onValuesChange(_, values) {
@ -206,8 +204,8 @@ class Test$$Page extends React.Component {
const { state } = __$$context;
return (
<div
ref={this._refsManager.linkRef("outterView")}
style={{ height: "100%" }}
ref={this._refsManager.linkRef('outterView')}
style={{ height: '100%' }}
>
<Modal
title="是否修改"
@ -222,19 +220,19 @@ class Test$$Page extends React.Component {
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onOk",
relatedEventName: "onOkModifyDialogThird",
type: 'componentEvent',
name: 'onOk',
relatedEventName: 'onOkModifyDialogThird',
},
{
type: "componentEvent",
name: "onCancel",
relatedEventName: "onCancelModifyDialogThird",
type: 'componentEvent',
name: 'onCancel',
relatedEventName: 'onCancelModifyDialogThird',
},
],
eventList: [
{ name: "onCancel", disabled: true },
{ name: "onOk", disabled: true },
{ name: 'onCancel', disabled: true },
{ name: 'onOk', disabled: true },
],
}}
onOk={function () {
@ -253,11 +251,11 @@ class Test$$Page extends React.Component {
<NextText
type="inherit"
style={{
fontStyle: "normal",
textAlign: "left",
display: "block",
fontFamily: "arial, helvetica, microsoft yahei",
fontWeight: "normal",
fontStyle: 'normal',
textAlign: 'left',
display: 'block',
fontFamily: 'arial, helvetica, microsoft yahei',
fontWeight: 'normal',
}}
>
修改将撤回此前填写的信息
@ -266,17 +264,17 @@ class Test$$Page extends React.Component {
<NextPage
columns={12}
headerDivider={true}
placeholderStyle={{ gridRowEnd: "span 1", gridColumnEnd: "span 12" }}
placeholderStyle={{ gridRowEnd: 'span 1', gridColumnEnd: 'span 12' }}
placeholder="页面主体内容拖拽Block布局组件到这里"
header={null}
headerProps={{ background: "surface" }}
headerProps={{ background: 'surface' }}
footer={null}
minHeight="100vh"
style={{}}
>
<NextBlock
prefix="next-"
placeholderStyle={{ height: "100%" }}
placeholderStyle={{ height: '100%' }}
noPadding={false}
noBorder={false}
background="surface"
@ -288,7 +286,7 @@ class Test$$Page extends React.Component {
<NextBlockCell
title=""
prefix="next-"
placeholderStyle={{ height: "100%" }}
placeholderStyle={{ height: '100%' }}
layoutmode="O"
childTotalColumns={12}
isAutoContainer={true}
@ -302,7 +300,7 @@ class Test$$Page extends React.Component {
textSpacing={true}
align="left"
flex={true}
style={{ marginBottom: "24px" }}
style={{ marginBottom: '24px' }}
>
<Steps current={__$$eval(() => this.state.currentStep)}>
<Steps.Step title="版本申请" description="" />
@ -319,7 +317,7 @@ class Test$$Page extends React.Component {
align="left"
full={true}
flex={true}
style={{ display: "flex", justifyContent: "center" }}
style={{ display: 'flex', justifyContent: 'center' }}
>
<Form
labelCol={{ span: 10 }}
@ -332,30 +330,30 @@ class Test$$Page extends React.Component {
}.bind(this)}
name="basic"
style={{
display: "flex",
flexDirection: "column",
width: "600px",
justifyContent: "center",
display: 'flex',
flexDirection: 'column',
width: '600px',
justifyContent: 'center',
}}
layout="vertical"
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onFinish",
relatedEventName: "onFinishFirst",
type: 'componentEvent',
name: 'onFinish',
relatedEventName: 'onFinishFirst',
},
{
type: "componentEvent",
name: "onValuesChange",
relatedEventName: "onValuesChange",
type: 'componentEvent',
name: 'onValuesChange',
relatedEventName: 'onValuesChange',
},
],
eventList: [
{ name: "onFinish", disabled: true },
{ name: "onFinishFailed", disabled: false },
{ name: "onFieldsChange", disabled: false },
{ name: "onValuesChange", disabled: true },
{ name: 'onFinish', disabled: true },
{ name: 'onFinishFailed', disabled: false },
{ name: 'onFieldsChange', disabled: false },
{ name: 'onValuesChange', disabled: true },
],
}}
initialValues={__$$eval(
@ -371,13 +369,13 @@ class Test$$Page extends React.Component {
{!!false && (
<Form.Item
label=""
style={{ width: "600px" }}
style={{ width: '600px' }}
colon={false}
name="id"
>
<Input
placeholder=""
style={{ width: "600px" }}
style={{ width: '600px' }}
bordered={false}
disabled={true}
/>
@ -390,20 +388,20 @@ class Test$$Page extends React.Component {
labelAlign="left"
colon={false}
required={true}
style={{ flexDirection: "column", width: "600px" }}
style={{ flexDirection: 'column', width: '600px' }}
requiredobj={{
required: true,
message: "请选择版本类型",
message: '请选择版本类型',
}}
>
<Checkbox.Group
options={[
{ label: "基础版本", value: "3" },
{ label: "AR导航", value: "1" },
{ label: "货车导航", value: "2" },
{ label: "UI定制", value: "4", disabled: false },
{ label: '基础版本', value: '3' },
{ label: 'AR导航', value: '1' },
{ label: '货车导航', value: '2' },
{ label: 'UI定制', value: '4', disabled: false },
]}
style={{ width: "600px" }}
style={{ width: '600px' }}
disabled={__$$eval(
() =>
this.state.customerProjectInfo.id > 0 &&
@ -416,13 +414,13 @@ class Test$$Page extends React.Component {
labelAlign="left"
colon={false}
required={true}
style={{ width: "600px" }}
style={{ width: '600px' }}
name="versionLine"
requiredobj={{ required: true, message: "请选择版本线" }}
requiredobj={{ required: true, message: '请选择版本线' }}
extra=""
>
<Select
style={{ width: "600px" }}
style={{ width: '600px' }}
options={__$$eval(() => this.state.versionLinesArray)}
disabled={__$$eval(
() =>
@ -436,27 +434,27 @@ class Test$$Page extends React.Component {
label="项目名称"
colon={false}
required={true}
style={{ display: "flex" }}
style={{ display: 'flex' }}
labelAlign="left"
extra=""
name="systemProjectName"
requiredobj={{
required: true,
message: "请按格式填写项目名称",
message: '请按格式填写项目名称',
}}
typeobj={{
type: "string",
type: 'string',
message:
"请输入项目名称,格式:公司简称-产品名称-版本类型",
'请输入项目名称,格式:公司简称-产品名称-版本类型',
}}
lenobj={{
max: 100,
message: "项目名称不能超过100个字符",
message: '项目名称不能超过100个字符',
}}
>
<Input
placeholder="公司简称-产品名称-版本类型"
style={{ width: "600px" }}
style={{ width: '600px' }}
disabled={__$$eval(
() =>
this.state.customerProjectInfo.id > 0 &&
@ -466,18 +464,18 @@ class Test$$Page extends React.Component {
</Form.Item>
<Form.Item
label="预期交付时间"
style={{ width: "600px" }}
style={{ width: '600px' }}
colon={false}
required={true}
name="expectedTime"
labelAlign="left"
requiredobj={{
required: true,
message: "请填写预期交付时间",
message: '请填写预期交付时间',
}}
>
<DatePicker
style={{ width: "600px" }}
style={{ width: '600px' }}
disabled={__$$eval(
() =>
this.state.customerProjectInfo.id > 0 &&
@ -487,11 +485,11 @@ class Test$$Page extends React.Component {
</Form.Item>
<Form.Item
label="预期出货量"
style={{ width: "600px" }}
style={{ width: '600px' }}
required={true}
requiredobj={{
required: true,
message: "请填写预期出货量",
message: '请填写预期出货量',
}}
name="expectedNum"
labelAlign="left"
@ -499,7 +497,7 @@ class Test$$Page extends React.Component {
>
<InputNumber
value={3}
style={{ width: "600px" }}
style={{ width: '600px' }}
placeholder="单位(台)使用该版本的机器数量+预计出货量,请如实填写"
disabled={__$$eval(
() =>
@ -511,28 +509,28 @@ class Test$$Page extends React.Component {
/>
</Form.Item>
<Form.Item
wrapperCol={{ offset: "" }}
wrapperCol={{ offset: '' }}
style={{
flexDirection: "row",
alignItems: "baseline",
justifyContent: "space-between",
width: "600px",
display: "block",
flexDirection: 'row',
alignItems: 'baseline',
justifyContent: 'space-between',
width: '600px',
display: 'block',
}}
labelAlign="left"
colon={false}
>
<Button
style={{ margin: "0px" }}
style={{ margin: '0px' }}
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onClick",
relatedEventName: "onClickFirstBack",
type: 'componentEvent',
name: 'onClick',
relatedEventName: 'onClickFirstBack',
},
],
eventList: [{ name: "onClick", disabled: true }],
eventList: [{ name: 'onClick', disabled: true }],
}}
onClick={function () {
this.onClickFirstBack.apply(
@ -547,12 +545,12 @@ class Test$$Page extends React.Component {
type="primary"
htmlType="submit"
style={{
boxShadow: "rgba(31, 56, 88, 0.2) 0px 0px 0px 0px",
float: "right",
boxShadow: 'rgba(31, 56, 88, 0.2) 0px 0px 0px 0px',
float: 'right',
}}
__events={{
eventDataList: [],
eventList: [{ name: "onClick", disabled: false }],
eventList: [{ name: 'onClick', disabled: false }],
}}
>
下一步
@ -570,7 +568,7 @@ class Test$$Page extends React.Component {
align="left"
full={true}
flex={true}
style={{ display: "flex", justifyContent: "center" }}
style={{ display: 'flex', justifyContent: 'center' }}
>
<Form
labelCol={{ span: 10 }}
@ -583,31 +581,31 @@ class Test$$Page extends React.Component {
}.bind(this)}
name="basic"
style={{
display: "flex",
flexDirection: "column",
width: "600px",
justifyContent: "center",
height: "800px",
display: 'flex',
flexDirection: 'column',
width: '600px',
justifyContent: 'center',
height: '800px',
}}
layout="vertical"
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onFinish",
relatedEventName: "onFinishSecond",
type: 'componentEvent',
name: 'onFinish',
relatedEventName: 'onFinishSecond',
},
{
type: "componentEvent",
name: "onValuesChange",
relatedEventName: "onValuesChange",
type: 'componentEvent',
name: 'onValuesChange',
relatedEventName: 'onValuesChange',
},
],
eventList: [
{ name: "onFinish", disabled: true },
{ name: "onFinishFailed", disabled: false },
{ name: "onFieldsChange", disabled: false },
{ name: "onValuesChange", disabled: true },
{ name: 'onFinish', disabled: true },
{ name: 'onFinishFailed', disabled: false },
{ name: 'onFieldsChange', disabled: false },
{ name: 'onValuesChange', disabled: true },
],
}}
initialValues={__$$eval(
@ -625,15 +623,15 @@ class Test$$Page extends React.Component {
labelAlign="left"
colon={false}
required={true}
style={{ width: "600px" }}
style={{ width: '600px' }}
name="projectModal"
requiredobj={{
required: true,
message: "请选择设备类型",
message: '请选择设备类型',
}}
>
<Select
style={{ width: "600px" }}
style={{ width: '600px' }}
options={__$$eval(() => this.state.projectModalsArray)}
disabled={__$$eval(
() =>
@ -645,19 +643,19 @@ class Test$$Page extends React.Component {
</Form.Item>
<Form.Item
label="屏幕分辨率宽"
style={{ width: "600px" }}
style={{ width: '600px' }}
name="displayWidth"
colon={false}
required={true}
requiredobj={{
required: true,
message: "请输入屏幕分辨率宽",
message: '请输入屏幕分辨率宽',
}}
labelAlign="left"
>
<InputNumber
value={3}
style={{ width: "600px" }}
style={{ width: '600px' }}
placeholder="例如1280"
disabled={__$$eval(
() =>
@ -669,19 +667,19 @@ class Test$$Page extends React.Component {
</Form.Item>
<Form.Item
label="屏幕分辨率高"
style={{ width: "600px" }}
style={{ width: '600px' }}
labelAlign="left"
colon={false}
name="displayHeight"
required={true}
requiredobj={{
required: true,
message: "请输入屏幕分辨率高",
message: '请输入屏幕分辨率高',
}}
>
<InputNumber
value={3}
style={{ width: "600px" }}
style={{ width: '600px' }}
placeholder="例如720"
disabled={__$$eval(
() =>
@ -693,19 +691,19 @@ class Test$$Page extends React.Component {
</Form.Item>
<Form.Item
label="屏幕尺寸inch"
style={{ width: "600px" }}
style={{ width: '600px' }}
name="displayInch"
labelAlign="left"
required={true}
colon={false}
requiredobj={{
required: true,
message: "请输入屏幕尺寸",
message: '请输入屏幕尺寸',
}}
>
<InputNumber
value={3}
style={{ width: "600px" }}
style={{ width: '600px' }}
placeholder="请输入尺寸"
disabled={__$$eval(
() =>
@ -717,7 +715,7 @@ class Test$$Page extends React.Component {
</Form.Item>
<Form.Item
label="屏幕DPI"
style={{ width: "600px" }}
style={{ width: '600px' }}
labelAlign="left"
colon={false}
required={false}
@ -725,7 +723,7 @@ class Test$$Page extends React.Component {
>
<InputNumber
value={3}
style={{ width: "600px" }}
style={{ width: '600px' }}
placeholder="UI定制项目必填"
disabled={__$$eval(
() =>
@ -739,19 +737,19 @@ class Test$$Page extends React.Component {
label="芯片名称"
colon={false}
required={true}
style={{ display: "flex" }}
style={{ display: 'flex' }}
labelAlign="left"
extra=""
name="mainSoc"
requiredobj={{
required: true,
message: "请输入芯片名称",
message: '请输入芯片名称',
}}
lenobj={{ max: 50, message: "芯片名称不能超过50个字符" }}
lenobj={{ max: 50, message: '芯片名称不能超过50个字符' }}
>
<Input
placeholder="请输入芯片名称"
style={{ width: "600px" }}
style={{ width: '600px' }}
disabled={__$$eval(
() =>
this.state.customerProjectInfo.id > 0 &&
@ -761,11 +759,11 @@ class Test$$Page extends React.Component {
</Form.Item>
<Form.Item
label="芯片核数"
style={{ width: "600px" }}
style={{ width: '600px' }}
required={true}
requiredobj={{
required: true,
message: "请输入芯片核数",
message: '请输入芯片核数',
}}
name="cpuCoreNum"
labelAlign="left"
@ -773,7 +771,7 @@ class Test$$Page extends React.Component {
>
<InputNumber
value={3}
style={{ width: "600px" }}
style={{ width: '600px' }}
placeholder="请输入芯片核数"
disabled={__$$eval(
() =>
@ -786,14 +784,14 @@ class Test$$Page extends React.Component {
</Form.Item>
<Form.Item
label="指令集"
style={{ width: "600px" }}
style={{ width: '600px' }}
required={true}
requiredobj={{ required: true, message: "请选择指令集" }}
requiredobj={{ required: true, message: '请选择指令集' }}
name="instructions"
colon={false}
>
<Select
style={{ width: "600px" }}
style={{ width: '600px' }}
options={__$$eval(() => this.state.instructionsArray)}
disabled={__$$eval(
() =>
@ -807,15 +805,15 @@ class Test$$Page extends React.Component {
labelAlign="left"
colon={false}
required={true}
style={{ width: "600px" }}
style={{ width: '600px' }}
name="osVersion"
requiredobj={{
required: true,
message: "请选择系统版本",
message: '请选择系统版本',
}}
>
<Select
style={{ width: "600px" }}
style={{ width: '600px' }}
options={__$$eval(() => this.state.osVersionsArray)}
disabled={__$$eval(
() =>
@ -826,24 +824,24 @@ class Test$$Page extends React.Component {
/>
</Form.Item>
<Form.Item
wrapperCol={{ offset: "" }}
wrapperCol={{ offset: '' }}
style={{
flexDirection: "row",
width: "600px",
display: "flex",
flexDirection: 'row',
width: '600px',
display: 'flex',
}}
>
<Button
style={{ marginLeft: "0" }}
style={{ marginLeft: '0' }}
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onClick",
relatedEventName: "onClickSecondBack",
type: 'componentEvent',
name: 'onClick',
relatedEventName: 'onClickSecondBack',
},
],
eventList: [{ name: "onClick", disabled: true }],
eventList: [{ name: 'onClick', disabled: true }],
}}
onClick={function () {
this.onClickSecondBack.apply(
@ -857,7 +855,7 @@ class Test$$Page extends React.Component {
<Button
type="primary"
htmlType="submit"
style={{ float: "right", marginLeft: "20px" }}
style={{ float: 'right', marginLeft: '20px' }}
loading={__$$eval(
() =>
this.state.LOADING_ADD_OR_UPDATE_CUSTOMER_PROJECT
@ -868,16 +866,16 @@ class Test$$Page extends React.Component {
<Button
type="primary"
htmlType="submit"
style={{ marginLeft: "0px", float: "right" }}
style={{ marginLeft: '0px', float: 'right' }}
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onClick",
relatedEventName: "onClickPreSecond",
type: 'componentEvent',
name: 'onClick',
relatedEventName: 'onClickPreSecond',
},
],
eventList: [{ name: "onClick", disabled: true }],
eventList: [{ name: 'onClick', disabled: true }],
}}
onClick={function () {
this.onClickPreSecond.apply(
@ -901,7 +899,7 @@ class Test$$Page extends React.Component {
align="left"
full={true}
flex={true}
style={{ display: "flex", justifyContent: "center" }}
style={{ display: 'flex', justifyContent: 'center' }}
>
<Form
labelCol={{ span: 10 }}
@ -914,25 +912,25 @@ class Test$$Page extends React.Component {
}.bind(this)}
name="basic"
style={{
display: "flex",
flexDirection: "column",
width: "600px",
justifyContent: "center",
display: 'flex',
flexDirection: 'column',
width: '600px',
justifyContent: 'center',
}}
layout="vertical"
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onFinishFailed",
relatedEventName: "onFinishFailed",
type: 'componentEvent',
name: 'onFinishFailed',
relatedEventName: 'onFinishFailed',
},
],
eventList: [
{ name: "onFinish", disabled: false },
{ name: "onFinishFailed", disabled: true },
{ name: "onFieldsChange", disabled: false },
{ name: "onValuesChange", disabled: false },
{ name: 'onFinish', disabled: false },
{ name: 'onFinishFailed', disabled: true },
{ name: 'onFieldsChange', disabled: false },
{ name: 'onValuesChange', disabled: false },
],
}}
>
@ -940,11 +938,11 @@ class Test$$Page extends React.Component {
<Steps
current={1}
style={{
width: "600px",
display: "flex",
justifyContent: "space-around",
alignItems: "center",
height: "300px",
width: '600px',
display: 'flex',
justifyContent: 'space-around',
alignItems: 'center',
height: '300px',
}}
labelPlacement="horizontal"
direction="vertical"
@ -952,35 +950,35 @@ class Test$$Page extends React.Component {
<Steps.Step
title="提交完成"
description=""
style={{ width: "200px" }}
style={{ width: '200px' }}
/>
<Steps.Step
title={__$$eval(() => this.state.thirdAuditText)}
subTitle=""
description=""
style={{ width: "200px" }}
style={{ width: '200px' }}
/>
</Steps>
</Form.Item>
<Form.Item
wrapperCol={{ offset: "" }}
wrapperCol={{ offset: '' }}
style={{
flexDirection: "row",
width: "600px",
display: "flex",
flexDirection: 'row',
width: '600px',
display: 'flex',
}}
>
<Button
style={{ marginLeft: "0" }}
style={{ marginLeft: '0' }}
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onClick",
relatedEventName: "onClickThirdBack",
type: 'componentEvent',
name: 'onClick',
relatedEventName: 'onClickThirdBack',
},
],
eventList: [{ name: "onClick", disabled: true }],
eventList: [{ name: 'onClick', disabled: true }],
}}
onClick={function () {
this.onClickThirdBack.apply(
@ -994,16 +992,16 @@ class Test$$Page extends React.Component {
<Button
type="primary"
htmlType="submit"
style={{ float: "right", marginLeft: "20px" }}
style={{ float: 'right', marginLeft: '20px' }}
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onClick",
relatedEventName: "onClickModifyThird",
type: 'componentEvent',
name: 'onClick',
relatedEventName: 'onClickModifyThird',
},
],
eventList: [{ name: "onClick", disabled: true }],
eventList: [{ name: 'onClick', disabled: true }],
}}
onClick={function () {
this.onClickModifyThird.apply(
@ -1020,16 +1018,16 @@ class Test$$Page extends React.Component {
<Button
type="primary"
htmlType="submit"
style={{ marginLeft: "0px", float: "right" }}
style={{ marginLeft: '0px', float: 'right' }}
__events={{
eventDataList: [
{
type: "componentEvent",
name: "onClick",
relatedEventName: "onClickPreThird",
type: 'componentEvent',
name: 'onClick',
relatedEventName: 'onClickPreThird',
},
],
eventList: [{ name: "onClick", disabled: true }],
eventList: [{ name: 'onClick', disabled: true }],
}}
onClick={function () {
this.onClickPreThird.apply(

View File

@ -1,14 +1,14 @@
import Test from "@/pages/Test";
import Test from '@/pages/Test';
import BasicLayout from "@/layouts/BasicLayout";
import BasicLayout from '@/layouts/BasicLayout';
const routerConfig = [
{
path: "/",
path: '/',
component: BasicLayout,
children: [
{
path: "",
path: '',
component: Test,
},
],

View File

@ -1,4 +1,4 @@
import { createRef } from "react";
import { createRef } from 'react';
export class RefsManager {
constructor() {

View File

@ -11,8 +11,8 @@
"intl-messageformat": "^9.3.6",
"@ice/store": "^1.4.3",
"@loadable/component": "^5.15.2",
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-http-handler": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"@alilc/lowcode-datasource-http-handler": "^1.0.0",
"@alilc/lowcode-components": "^1.0.0"
},
"devDependencies": {

View File

@ -1,11 +1,11 @@
import { createApp } from "ice";
import { createApp } from 'ice';
const appConfig = {
app: {
rootId: "app",
rootId: 'app',
},
router: {
type: "hash",
type: 'hash',
},
};
createApp(appConfig);

View File

@ -1,5 +1,5 @@
// 引入默认全局样式
@import "@alifd/next/reset.scss";
@import '@alifd/next/reset.scss';
body {
-webkit-font-smoothing: antialiased;

View File

@ -1,9 +1,9 @@
const i18nConfig = {};
let locale =
typeof navigator === "object" && typeof navigator.language === "string"
typeof navigator === 'object' && typeof navigator.language === 'string'
? navigator.language
: "zh-CN";
: 'zh-CN';
const getLocale = () => locale;
@ -13,22 +13,22 @@ const setLocale = (target) => {
const isEmptyVariables = (variables) =>
(Array.isArray(variables) && variables.length === 0) ||
(typeof variables === "object" &&
(typeof variables === 'object' &&
(!variables || Object.keys(variables).length === 0));
// 按低代码规范里面的要求进行变量替换
const format = (msg, variables) =>
typeof msg === "string"
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? "")
typeof msg === 'string'
? msg.replace(/\$\{(\w+)\}/g, (match, key) => variables?.[key] ?? '')
: msg;
const i18nFormat = ({ id, defaultMessage, fallback }, variables) => {
const msg =
i18nConfig[locale]?.[id] ??
i18nConfig[locale.replace("-", "_")]?.[id] ??
i18nConfig[locale.replace('-', '_')]?.[id] ??
defaultMessage;
if (msg == null) {
console.warn("[i18n]: unknown message id: %o (locale=%o)", id, locale);
console.warn('[i18n]: unknown message id: %o (locale=%o)', id, locale);
return fallback === undefined ? `${id}` : fallback;
}
@ -49,7 +49,7 @@ const _inject2 = (target) => {
};
target._i18nText = (t) => {
// 优先取直接传过来的语料
const localMsg = t[locale] ?? t[String(locale).replace("-", "_")];
const localMsg = t[locale] ?? t[String(locale).replace('-', '_')];
if (localMsg != null) {
return format(localMsg, t.params);
}
@ -61,7 +61,7 @@ const _inject2 = (target) => {
}
// 兜底用 use 指定的或默认语言的
return format(t[t.use || "zh-CN"] ?? t.en_US, t.params);
return format(t[t.use || 'zh-CN'] ?? t.en_US, t.params);
};
// 注入到上下文中去

View File

@ -1,20 +1,20 @@
// : "__$$" 访
// react
import React from "react";
import React from 'react';
import { Page, Table } from "@alilc/lowcode-components";
import { Page, Table } from '@alilc/lowcode-components';
import { createHttpHandler as __$$createHttpRequestHandler } from "@alilc/lowcode-datasource-http-handler";
import { createHttpHandler as __$$createHttpRequestHandler } from '@alilc/lowcode-datasource-http-handler';
import { create as __$$createDataSourceEngine } from "@alilc/lowcode-datasource-engine/runtime";
import { create as __$$createDataSourceEngine } from '@alilc/lowcode-datasource-engine/runtime';
import utils from "../../utils";
import utils from '../../utils';
import * as __$$i18n from "../../i18n";
import * as __$$i18n from '../../i18n';
import __$$constants from "../../constants";
import __$$constants from '../../constants';
import "./index.css";
import './index.css';
class Example$$Page extends React.Component {
_context = this;
@ -56,12 +56,12 @@ class Example$$Page extends React.Component {
return {
list: [
{
id: "userList",
type: "http",
description: "用户列表",
id: 'userList',
type: 'http',
description: '用户列表',
options: function () {
return {
uri: "https://api.example.com/user/list",
uri: 'https://api.example.com/user/list',
};
},
isInit: function () {
@ -82,10 +82,10 @@ class Example$$Page extends React.Component {
return (
<div>
<Table
dataSource={__$$eval(() => this.dataSourceMap["userList"])}
dataSource={__$$eval(() => this.dataSourceMap['userList'])}
columns={[
{ dataIndex: "name", title: "姓名" },
{ dataIndex: "age", title: "年龄" },
{ dataIndex: 'name', title: '姓名' },
{ dataIndex: 'age', title: '年龄' },
]}
/>
</div>

View File

@ -1,14 +1,14 @@
import Example from "@/pages/Example";
import Example from '@/pages/Example';
import BasicLayout from "@/layouts/BasicLayout";
import BasicLayout from '@/layouts/BasicLayout';
const routerConfig = [
{
path: "/",
path: '/',
component: BasicLayout,
children: [
{
path: "",
path: '',
component: Example,
},
],

View File

@ -1,4 +1,4 @@
import { createRef } from "react";
import { createRef } from 'react';
export class RefsManager {
constructor() {

View File

@ -11,8 +11,8 @@
"intl-messageformat": "^9.3.6",
"@ice/store": "^1.4.3",
"@loadable/component": "^5.15.2",
"@alilc/lowcode-datasource-engine": "latest",
"@alilc/lowcode-datasource-jsonp-handler": "latest",
"@alilc/lowcode-datasource-engine": "^1.0.0",
"@alilc/lowcode-datasource-jsonp-handler": "^1.0.0",
"@alifd/next": "1.19.18"
},
"devDependencies": {

View File

@ -1,11 +1,11 @@
import { createApp } from "ice";
import { createApp } from 'ice';
const appConfig = {
app: {
rootId: "app",
rootId: 'app',
},
router: {
type: "hash",
type: 'hash',
},
};
createApp(appConfig);

Some files were not shown because too many files have changed in this diff Show More