fix: workflow executions not show and format codes (#1184)
Co-authored-by: sealday <sealday@gmail.com> Reviewed-on: daoyoucloud/tachybase#1184
This commit is contained in:
parent
64741b1726
commit
d99bd8f4a5
@ -1,5 +1,6 @@
|
||||
import { getUmiConfig, IndexGenerator } from '@tachybase/devtools/umiConfig';
|
||||
import path from 'path';
|
||||
import { getUmiConfig, IndexGenerator } from '@tachybase/devtools/umiConfig';
|
||||
|
||||
import { defineConfig } from 'umi';
|
||||
|
||||
const umiConfig = getUmiConfig();
|
||||
@ -10,7 +11,8 @@ process.env.DID_YOU_KNOW = 'none';
|
||||
const pluginPrefix = (process.env.PLUGIN_PACKAGE_PREFIX || '').split(',').filter((item) => !item.includes('preset')); // 因为现在 preset 是直接引入的,所以不能忽略,如果以后 preset 也是动态插件的形式引入,那么这里可以去掉
|
||||
|
||||
const pluginDirs = (process.env.PLUGIN_PATH || 'packages/plugins/,packages/samples/,packages/pro-plugins/')
|
||||
.split(',').map(item => path.join(process.cwd(), item));
|
||||
.split(',')
|
||||
.map((item) => path.join(process.cwd(), item));
|
||||
|
||||
const outputPluginPath = path.join(__dirname, 'src', '.plugins');
|
||||
const indexGenerator = new IndexGenerator(outputPluginPath, pluginDirs);
|
||||
@ -36,7 +38,9 @@ export default defineConfig({
|
||||
src: `${appPublicPath}browser-checker.js`,
|
||||
},
|
||||
{
|
||||
content: isDevCmd ? '' : `
|
||||
content: isDevCmd
|
||||
? ''
|
||||
: `
|
||||
window['__webpack_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
|
||||
window['__tachybase_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
|
||||
window['__tachybase_api_base_url__'] = '{{env.API_BASE_URL}}';
|
||||
@ -71,7 +75,7 @@ export default defineConfig({
|
||||
safari: 12,
|
||||
},
|
||||
codeSplitting: {
|
||||
jsStrategy: 'depPerChunk'
|
||||
jsStrategy: 'depPerChunk',
|
||||
},
|
||||
chainWebpack(config, { env }) {
|
||||
if (env === 'production') {
|
||||
|
@ -68,7 +68,9 @@ function css_browser_selector(u) {
|
||||
(/Version\/(\d+)(\.(\d+))+/i.test(ua)
|
||||
? ' ' + a + RegExp.$1 + ' ' + a + RegExp.$1 + RegExp.$2.replace('.', '_')
|
||||
: '') +
|
||||
(/Android (.+); (.+) Build/i.test(ua) ? ' ' + dv + RegExp.$2.replace(/ /g, '_').replace(/-/g, '_') : '')
|
||||
(/Android (.+); (.+) Build/i.test(ua)
|
||||
? ' ' + dv + RegExp.$2.replace(/ /g, '_').replace(/-/g, '_')
|
||||
: '')
|
||||
: is('chrome')
|
||||
? w +
|
||||
' ' +
|
||||
@ -113,7 +115,9 @@ function css_browser_selector(u) {
|
||||
? 'playbook'
|
||||
: is('mac')
|
||||
? 'mac' +
|
||||
(/mac os x ((\d+)[.|_](\d+))/.test(ua) ? ' mac' + RegExp.$2 + ' mac' + RegExp.$1.replace('.', '_') : '')
|
||||
(/mac os x ((\d+)[.|_](\d+))/.test(ua)
|
||||
? ' mac' + RegExp.$2 + ' mac' + RegExp.$1.replace('.', '_')
|
||||
: '')
|
||||
: is('win')
|
||||
? 'win' +
|
||||
(is('windows nt 6.2')
|
||||
|
@ -1 +1,11 @@
|
||||
{"name":"","short_name":"","icons":[{"src":"./android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
||||
{
|
||||
"name": "",
|
||||
"short_name": "",
|
||||
"icons": [
|
||||
{ "src": "./android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" },
|
||||
{ "src": "/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" }
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { PluginConfiguration } from '@tachybase/server';
|
||||
import process from 'process';
|
||||
import { PluginConfiguration } from '@tachybase/server';
|
||||
|
||||
export default [process.env.PRESET_NAME ?? 'tachybase'] as PluginConfiguration[];
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Gateway } from '@tachybase/server';
|
||||
|
||||
import { getConfig } from './config';
|
||||
|
||||
getConfig()
|
||||
|
@ -1,26 +1,39 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import path from 'path';
|
||||
|
||||
|
||||
|
||||
import type { Project } from '@pnpm/workspace.find-packages';
|
||||
import chalk from 'chalk';
|
||||
import execa from 'execa';
|
||||
|
||||
|
||||
|
||||
import { buildCjs } from './buildCjs';
|
||||
import { buildClient } from './buildClient';
|
||||
import { buildDeclaration } from './buildDeclaration';
|
||||
import { buildEsm } from './buildEsm';
|
||||
import { buildPlugin } from './buildPlugin';
|
||||
import { CORE_APP, CORE_CLIENT, ESM_PACKAGES, getCjsPackages, getPluginPackages, getPresetsPackages, PACKAGES_PATH, ROOT_PATH } from './constant';
|
||||
import {
|
||||
CORE_APP,
|
||||
CORE_CLIENT,
|
||||
ESM_PACKAGES,
|
||||
getCjsPackages,
|
||||
getPluginPackages,
|
||||
getPresetsPackages,
|
||||
PACKAGES_PATH,
|
||||
ROOT_PATH,
|
||||
} from './constant';
|
||||
import { signals } from './stats';
|
||||
import { tarPlugin } from './tarPlugin';
|
||||
import { getPackageJson, getPkgLog, getUserConfig, PkgLog, readFromCache, toUnixPath, UserConfig, writeToCache } from './utils';
|
||||
import {
|
||||
getPackageJson,
|
||||
getPkgLog,
|
||||
getUserConfig,
|
||||
PkgLog,
|
||||
readFromCache,
|
||||
toUnixPath,
|
||||
UserConfig,
|
||||
writeToCache,
|
||||
} from './utils';
|
||||
import { getPackages } from './utils/getPackages';
|
||||
|
||||
|
||||
const BUILD_ERROR = 'build-error';
|
||||
|
||||
export async function build(pkgs: string[]) {
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { build } from 'tsup';
|
||||
import fg from 'fast-glob';
|
||||
import path from 'path';
|
||||
|
||||
import chalk from 'chalk';
|
||||
import { globExcludeFiles, EsbuildSupportExts } from './constant';
|
||||
import fg from 'fast-glob';
|
||||
import { build } from 'tsup';
|
||||
|
||||
import { EsbuildSupportExts, globExcludeFiles } from './constant';
|
||||
import { PkgLog, UserConfig } from './utils';
|
||||
|
||||
export function buildCjs(cwd: string, userConfig: UserConfig, sourcemap: boolean = false, log: PkgLog) {
|
||||
@ -10,11 +12,14 @@ export function buildCjs(cwd: string, userConfig: UserConfig, sourcemap: boolean
|
||||
|
||||
const entry = fg.globSync(['src/**', ...globExcludeFiles], { cwd, absolute: true });
|
||||
const outDir = path.join(cwd, 'lib');
|
||||
const otherExts = Array.from(new Set(entry.map((item) => path.extname(item)).filter((item) => !EsbuildSupportExts.includes(item))));
|
||||
const otherExts = Array.from(
|
||||
new Set(entry.map((item) => path.extname(item)).filter((item) => !EsbuildSupportExts.includes(item))),
|
||||
);
|
||||
if (otherExts.length) {
|
||||
log('%s will not be processed, only be copied to the lib directory.', chalk.yellow(otherExts.join(',')));
|
||||
}
|
||||
return build(userConfig.modifyTsupConfig({
|
||||
return build(
|
||||
userConfig.modifyTsupConfig({
|
||||
entry,
|
||||
splitting: false,
|
||||
clean: true,
|
||||
@ -31,5 +36,6 @@ export function buildCjs(cwd: string, userConfig: UserConfig, sourcemap: boolean
|
||||
},
|
||||
format: 'cjs',
|
||||
skipNodeModulesBundle: true,
|
||||
}));
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
import path from 'path';
|
||||
|
||||
import react from '@vitejs/plugin-react';
|
||||
import fg from 'fast-glob';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { build as tsupBuild } from 'tsup';
|
||||
import { build as viteBuild } from 'vite';
|
||||
import { libInjectCss } from 'vite-plugin-lib-inject-css';
|
||||
|
@ -1,8 +1,9 @@
|
||||
|
||||
import path from 'path';
|
||||
import { PkgLog, UserConfig } from './utils';
|
||||
import { build as viteBuild } from 'vite';
|
||||
|
||||
import fg from 'fast-glob';
|
||||
import { build as viteBuild } from 'vite';
|
||||
|
||||
import { PkgLog, UserConfig } from './utils';
|
||||
|
||||
export async function buildEsm(cwd: string, userConfig: UserConfig, sourcemap: boolean = false, log: PkgLog) {
|
||||
log('build esm');
|
||||
@ -12,7 +13,9 @@ export async function buildEsm(cwd: string, userConfig: UserConfig, sourcemap: b
|
||||
|
||||
await build(cwd, indexEntry, outDir, userConfig, sourcemap, log);
|
||||
|
||||
const clientEntry = fg.sync(['src/client/index.ts', 'src/client.ts'], { cwd, absolute: true, onlyFiles: true })?.[0]?.replaceAll(/\\/g, '/');
|
||||
const clientEntry = fg
|
||||
.sync(['src/client/index.ts', 'src/client.ts'], { cwd, absolute: true, onlyFiles: true })?.[0]
|
||||
?.replaceAll(/\\/g, '/');
|
||||
const clientOutDir = path.resolve(cwd, 'es/client');
|
||||
if (clientEntry) {
|
||||
await build(cwd, clientEntry, clientOutDir, userConfig, sourcemap, log);
|
||||
@ -26,7 +29,14 @@ export async function buildEsm(cwd: string, userConfig: UserConfig, sourcemap: b
|
||||
}
|
||||
}
|
||||
|
||||
function build(cwd: string, entry: string, outDir: string, userConfig: UserConfig, sourcemap: boolean = false, log: PkgLog) {
|
||||
function build(
|
||||
cwd: string,
|
||||
entry: string,
|
||||
outDir: string,
|
||||
userConfig: UserConfig,
|
||||
sourcemap: boolean = false,
|
||||
log: PkgLog,
|
||||
) {
|
||||
const cwdWin = cwd.replaceAll(/\\/g, '/');
|
||||
const cwdUnix = cwd.replaceAll(/\//g, '\\');
|
||||
const external = function (id: string) {
|
||||
|
@ -1,15 +1,16 @@
|
||||
import path from 'path';
|
||||
|
||||
import ncc from '@vercel/ncc';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import chalk from 'chalk';
|
||||
import fg from 'fast-glob';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { build as tsupBuild } from 'tsup';
|
||||
import { build as viteBuild } from 'vite';
|
||||
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
|
||||
|
||||
import { EsbuildSupportExts, globExcludeFiles } from './constant';
|
||||
import { PkgLog, UserConfig, getPackageJson } from './utils';
|
||||
import { getPackageJson, PkgLog, UserConfig } from './utils';
|
||||
import {
|
||||
buildCheck,
|
||||
checkFileSize,
|
||||
@ -123,9 +124,9 @@ const external = [
|
||||
'lodash',
|
||||
'china-division',
|
||||
];
|
||||
const pluginPrefix = (
|
||||
process.env.PLUGIN_PACKAGE_PREFIX || '@tachybase/plugin-,@tachybase/preset-,@hera/plugin-'
|
||||
).split(',');
|
||||
const pluginPrefix = (process.env.PLUGIN_PACKAGE_PREFIX || '@tachybase/plugin-,@tachybase/preset-,@hera/plugin-').split(
|
||||
',',
|
||||
);
|
||||
|
||||
const target_dir = 'dist';
|
||||
|
||||
@ -150,7 +151,9 @@ export function deleteServerFiles(cwd: string, log: PkgLog) {
|
||||
|
||||
export function writeExternalPackageVersion(cwd: string, log: PkgLog) {
|
||||
log('write external version');
|
||||
const sourceFiles = fg.globSync(sourceGlobalFiles, { cwd, absolute: true }).map((item) => fs.readFileSync(item, 'utf-8'));
|
||||
const sourceFiles = fg
|
||||
.globSync(sourceGlobalFiles, { cwd, absolute: true })
|
||||
.map((item) => fs.readFileSync(item, 'utf-8'));
|
||||
const sourcePackages = getSourcePackages(sourceFiles);
|
||||
const excludePackages = getExcludePackages(sourcePackages, external, pluginPrefix);
|
||||
const data = excludePackages.reduce<Record<string, string>>((prev, packageName) => {
|
||||
@ -171,7 +174,9 @@ export function writeExternalPackageVersion(cwd: string, log: PkgLog) {
|
||||
export async function buildServerDeps(cwd: string, serverFiles: string[], log: PkgLog) {
|
||||
log('build plugin server dependencies');
|
||||
const outDir = path.join(cwd, target_dir, 'node_modules');
|
||||
const serverFileSource = serverFiles.filter(item => validExts.includes(path.extname(item))).map((item) => fs.readFileSync(item, 'utf-8'));
|
||||
const serverFileSource = serverFiles
|
||||
.filter((item) => validExts.includes(path.extname(item)))
|
||||
.map((item) => fs.readFileSync(item, 'utf-8'));
|
||||
const sourcePackages = getSourcePackages(serverFileSource);
|
||||
const includePackages = getIncludePackages(sourcePackages, external, pluginPrefix);
|
||||
const excludePackages = getExcludePackages(sourcePackages, external, pluginPrefix);
|
||||
@ -265,14 +270,17 @@ export async function buildPluginServer(cwd: string, userConfig: UserConfig, sou
|
||||
const packageJson = getPackageJson(cwd);
|
||||
const serverFiles = fg.globSync(serverGlobalFiles, { cwd, absolute: true });
|
||||
buildCheck({ cwd, packageJson, entry: 'server', files: serverFiles, log });
|
||||
const otherExts = Array.from(new Set(serverFiles.map((item) => path.extname(item)).filter((item) => !EsbuildSupportExts.includes(item))));
|
||||
const otherExts = Array.from(
|
||||
new Set(serverFiles.map((item) => path.extname(item)).filter((item) => !EsbuildSupportExts.includes(item))),
|
||||
);
|
||||
if (otherExts.length) {
|
||||
log('%s will not be processed, only be copied to the dist directory.', chalk.yellow(otherExts.join(',')));
|
||||
}
|
||||
|
||||
deleteServerFiles(cwd, log);
|
||||
|
||||
await tsupBuild(userConfig.modifyTsupConfig({
|
||||
await tsupBuild(
|
||||
userConfig.modifyTsupConfig({
|
||||
entry: serverFiles,
|
||||
splitting: false,
|
||||
clean: false,
|
||||
@ -288,7 +296,8 @@ export async function buildPluginServer(cwd: string, userConfig: UserConfig, sou
|
||||
...otherExts.reduce((prev, cur) => ({ ...prev, [cur]: 'copy' }), {}),
|
||||
'.json': 'copy',
|
||||
},
|
||||
}));
|
||||
}),
|
||||
);
|
||||
|
||||
await buildServerDeps(cwd, serverFiles, log);
|
||||
}
|
||||
@ -316,7 +325,8 @@ export async function buildPluginClient(cwd: string, userConfig: UserConfig, sou
|
||||
const entry = fg.globSync('src/client/index.{ts,tsx,js,jsx}', { absolute: true, cwd });
|
||||
const outputFileName = 'index.js';
|
||||
|
||||
await viteBuild(userConfig.modifyViteConfig({
|
||||
await viteBuild(
|
||||
userConfig.modifyViteConfig({
|
||||
mode: process.env.NODE_ENV || 'production',
|
||||
define: {
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
|
||||
@ -350,11 +360,9 @@ export async function buildPluginClient(cwd: string, userConfig: UserConfig, sou
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
react(),
|
||||
cssInjectedByJsPlugin({ styleId: packageJson.name }),
|
||||
],
|
||||
}));
|
||||
plugins: [react(), cssInjectedByJsPlugin({ styleId: packageJson.name })],
|
||||
}),
|
||||
);
|
||||
|
||||
checkFileSize(outDir, log);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { Project } from '@pnpm/workspace.find-packages';
|
||||
import path from 'path';
|
||||
|
||||
import type { Project } from '@pnpm/workspace.find-packages';
|
||||
|
||||
export const globExcludeFiles = [
|
||||
'!src/**/__tests__',
|
||||
'!src/**/__test__',
|
||||
|
5
packages/core/build/src/index.d.ts
vendored
5
packages/core/build/src/index.d.ts
vendored
@ -1,6 +1,5 @@
|
||||
|
||||
import { Options as TsupConfig } from 'tsup'
|
||||
import { InlineConfig as ViteConfig } from 'vite'
|
||||
import { Options as TsupConfig } from 'tsup';
|
||||
import { InlineConfig as ViteConfig } from 'vite';
|
||||
|
||||
export type PkgLog = (msg: string, ...args: any[]) => void;
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
export * from './build';
|
||||
export * from './utils'
|
||||
export * from './utils';
|
||||
|
@ -1,10 +1,11 @@
|
||||
import path from 'path';
|
||||
import tar from 'tar';
|
||||
|
||||
import fg from 'fast-glob';
|
||||
import fs from 'fs-extra';
|
||||
import tar from 'tar';
|
||||
|
||||
import { PkgLog } from "./utils";
|
||||
import { TAR_OUTPUT_DIR, tarIncludesFiles } from './constant'
|
||||
import { TAR_OUTPUT_DIR, tarIncludesFiles } from './constant';
|
||||
import { PkgLog } from './utils';
|
||||
|
||||
export function tarPlugin(cwd: string, log: PkgLog) {
|
||||
log('tar package');
|
||||
@ -12,14 +13,24 @@ export function tarPlugin(cwd: string, log: PkgLog) {
|
||||
const npmIgnore = path.join(cwd, '.npmignore');
|
||||
let files = pkg.files || [];
|
||||
if (fs.existsSync(npmIgnore)) {
|
||||
files = fs.readFileSync(npmIgnore, 'utf-8').split('\n').filter((item) => item.trim()).map(item => `!${item}`);
|
||||
files = fs
|
||||
.readFileSync(npmIgnore, 'utf-8')
|
||||
.split('\n')
|
||||
.filter((item) => item.trim())
|
||||
.map((item) => `!${item}`);
|
||||
files.push('**/*');
|
||||
}
|
||||
|
||||
// 必须包含的文件
|
||||
files.push(...tarIncludesFiles);
|
||||
|
||||
files = files.map((item: string) => item !== '**/*' && fs.existsSync(path.join(cwd, item.replace('!', ''))) && fs.statSync(path.join(cwd, item.replace('!', ''))).isDirectory() ? `${item}/**/*` : item);
|
||||
files = files.map((item: string) =>
|
||||
item !== '**/*' &&
|
||||
fs.existsSync(path.join(cwd, item.replace('!', ''))) &&
|
||||
fs.statSync(path.join(cwd, item.replace('!', ''))).isDirectory()
|
||||
? `${item}/**/*`
|
||||
: item,
|
||||
);
|
||||
|
||||
const tarball = path.join(TAR_OUTPUT_DIR, `${pkg.name}-${pkg.version}.tgz`);
|
||||
const tarFiles = fg.sync(files, { cwd });
|
||||
|
@ -1,8 +1,9 @@
|
||||
import fs from 'fs';
|
||||
import chalk from 'chalk';
|
||||
import { builtinModules } from 'module';
|
||||
import path from 'path';
|
||||
|
||||
import chalk from 'chalk';
|
||||
|
||||
const requireRegex = /require\s*\(['"`](.*?)['"`]\)/g;
|
||||
const importRegex = /^import(?:['"\s]*([\w*${}\s,]+)from\s*)?['"\s]['"\s](.*[@\w_-]+)['"\s].*/gm;
|
||||
|
||||
@ -156,10 +157,14 @@ export function checkRequire(sourceFiles: string[], log: Log) {
|
||||
export function checkFileSize(outDir: string, log: Log) {
|
||||
const files = fs.readdirSync(outDir);
|
||||
|
||||
files.forEach(file => {
|
||||
files.forEach((file) => {
|
||||
const fileSize = getFileSize(path.join(outDir, file));
|
||||
if (fileSize > 1024 * 1024) {
|
||||
log(`The %s size %s exceeds 1MB. You can use dynamic import \`import()\` for lazy loading content.`, chalk.red(file), chalk.red(formatFileSize(fileSize)));
|
||||
log(
|
||||
`The %s size %s exceeds 1MB. You can use dynamic import \`import()\` for lazy loading content.`,
|
||||
chalk.red(file),
|
||||
chalk.red(formatFileSize(fileSize)),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import path from 'path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
|
||||
export function winPath(path: string) {
|
||||
@ -17,20 +18,15 @@ export function getRltExternalsFromDeps(
|
||||
depExternals: Record<string, string>,
|
||||
current: { name: string; outputDir: string },
|
||||
) {
|
||||
return Object.entries(depExternals).reduce<Record<string, string>>(
|
||||
(r, [dep, target]) => {
|
||||
return Object.entries(depExternals).reduce<Record<string, string>>((r, [dep, target]) => {
|
||||
// skip self
|
||||
if (dep !== current.name) {
|
||||
// transform dep externals path to relative path
|
||||
r[dep] = winPath(
|
||||
path.relative(current.outputDir, path.dirname(target)),
|
||||
);
|
||||
r[dep] = winPath(path.relative(current.outputDir, path.dirname(target)));
|
||||
}
|
||||
|
||||
return r;
|
||||
},
|
||||
{},
|
||||
);
|
||||
}, {});
|
||||
}
|
||||
|
||||
function findPackageJson(filePath) {
|
||||
@ -44,7 +40,7 @@ function findPackageJson(filePath) {
|
||||
// 递归寻找直到根目录
|
||||
return findPackageJson(directory);
|
||||
} else {
|
||||
throw new Error('package.json not found.')
|
||||
throw new Error('package.json not found.');
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,10 +96,10 @@ export function getDepsConfig(cwd: string, outDir: string, depsName: string[], e
|
||||
pkg: depPkg,
|
||||
outputDir,
|
||||
mainFile,
|
||||
}
|
||||
};
|
||||
|
||||
return acc;
|
||||
}, {})
|
||||
}, {});
|
||||
|
||||
// process externals for deps
|
||||
Object.values(deps).forEach((depConfig) => {
|
||||
|
@ -1,10 +1,11 @@
|
||||
import Topo from '@hapi/topo';
|
||||
import fg from 'fast-glob';
|
||||
import path from 'path';
|
||||
|
||||
import Topo from '@hapi/topo';
|
||||
import { findWorkspacePackages, type Project } from '@pnpm/workspace.find-packages';
|
||||
import fg from 'fast-glob';
|
||||
|
||||
import { PACKAGES_PATH, ROOT_PATH } from '../constant';
|
||||
import { toUnixPath } from './utils';
|
||||
import { findWorkspacePackages } from '@pnpm/workspace.find-packages';
|
||||
import type { Project } from '@pnpm/workspace.find-packages';
|
||||
|
||||
/**
|
||||
* 获取构建包的绝对路径,支持项目路径和 npm 两种形式
|
||||
|
@ -1,10 +1,12 @@
|
||||
import chalk from 'chalk';
|
||||
import path from 'path';
|
||||
|
||||
import chalk from 'chalk';
|
||||
import { register } from 'esbuild-register/dist/node';
|
||||
import fg from 'fast-glob';
|
||||
import fs from 'fs-extra';
|
||||
import { Options as TsupConfig } from 'tsup'
|
||||
import { InlineConfig as ViteConfig } from 'vite'
|
||||
import { register } from 'esbuild-register/dist/node';
|
||||
import { Options as TsupConfig } from 'tsup';
|
||||
import { InlineConfig as ViteConfig } from 'vite';
|
||||
|
||||
import { NODE_MODULES } from '../constant';
|
||||
|
||||
let previousColor = '';
|
||||
@ -73,9 +75,9 @@ export function getUserConfig(cwd: string) {
|
||||
throw new Error(`Multiple build configs found: ${buildConfigs.join(', ')}`);
|
||||
}
|
||||
if (buildConfigs.length === 1) {
|
||||
const { unregister } = register({})
|
||||
const { unregister } = register({});
|
||||
const userConfig = require(path.join(cwd, buildConfigs[0]));
|
||||
unregister()
|
||||
unregister();
|
||||
Object.assign(config, userConfig.default || userConfig);
|
||||
}
|
||||
return config;
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { defineConfig } from 'tsup';
|
||||
import fg from 'fast-glob';
|
||||
import path from 'path';
|
||||
|
||||
import fg from 'fast-glob';
|
||||
import { defineConfig } from 'tsup';
|
||||
|
||||
import { globExcludeFiles } from './src/constant';
|
||||
|
||||
const entry = fg.globSync(['src/**', ...globExcludeFiles], { cwd: __dirname, absolute: true });
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { builtinModules, createRequire } from 'node:module';
|
||||
import esbuild from 'rollup-plugin-esbuild';
|
||||
import process from 'node:process';
|
||||
import dts from 'rollup-plugin-dts';
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import json from '@rollup/plugin-json';
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
import { defineConfig } from 'rollup';
|
||||
import dts from 'rollup-plugin-dts';
|
||||
import esbuild from 'rollup-plugin-esbuild';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const pkg = require('./package.json');
|
||||
|
@ -1,11 +1,11 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import chalk from 'chalk';
|
||||
import { initEnv, genTsConfigPaths } from './util';
|
||||
import { Command } from 'commander';
|
||||
import commands from './commands';
|
||||
import semver from 'semver';
|
||||
|
||||
import commands from './commands';
|
||||
import { genTsConfigPaths, initEnv } from './util';
|
||||
|
||||
const cli = new Command();
|
||||
|
||||
cli.version((await import('../package.json')).version);
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { resolve } from 'path';
|
||||
|
||||
import { type Command } from 'commander';
|
||||
import { run, nodeCheck, isPackageValid, buildIndexHtml } from '../util';
|
||||
|
||||
import { buildIndexHtml, isPackageValid, nodeCheck, run } from '../util';
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Command } from 'commander';
|
||||
import { run, isDev } from '../util';
|
||||
|
||||
import { isDev, run } from '../util';
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { resolve } from 'path';
|
||||
import { Command } from 'commander';
|
||||
import { readFileSync, writeFileSync } from 'fs';
|
||||
import { resolve } from 'path';
|
||||
import { URL } from 'url';
|
||||
|
||||
import { Command } from 'commander';
|
||||
|
||||
const __dirname = new URL('.', import.meta.url).pathname;
|
||||
|
||||
export default (cli: Command) => {
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { resolve } from 'path';
|
||||
|
||||
import { Command } from 'commander';
|
||||
|
||||
import { PluginGenerator } from '../plugin-generator';
|
||||
|
||||
export default (cli: Command) => {
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { Command } from 'commander';
|
||||
import { run, postCheck, nodeCheck, promptForTs } from '../util';
|
||||
import { getPortPromise } from 'portfinder';
|
||||
|
||||
import { nodeCheck, postCheck, promptForTs, run } from '../util';
|
||||
|
||||
export default (cli: Command) => {
|
||||
const { APP_PACKAGE_ROOT } = process.env;
|
||||
cli
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { Command } from 'commander';
|
||||
import { run, isPortReachable } from '../util';
|
||||
import { execSync } from 'node:child_process';
|
||||
import axios from 'axios';
|
||||
import { pTest } from './p-test';
|
||||
import { cpus } from 'os';
|
||||
import treeKill from 'tree-kill';
|
||||
|
||||
import axios from 'axios';
|
||||
import chalk from 'chalk';
|
||||
import { Command } from 'commander';
|
||||
import treeKill from 'tree-kill';
|
||||
|
||||
import { isPortReachable, run } from '../util';
|
||||
import { pTest } from './p-test';
|
||||
|
||||
/**
|
||||
* 检查服务是否启动成功
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Command } from 'commander';
|
||||
import { run, isDev, isProd, promptForTs } from '../util';
|
||||
|
||||
import { isDev, isProd, promptForTs, run } from '../util';
|
||||
|
||||
export default (cli: Command) => {
|
||||
const { APP_PACKAGE_ROOT, SERVER_TSCONFIG_PATH } = process.env;
|
||||
|
@ -1,19 +1,20 @@
|
||||
import { Command } from 'commander';
|
||||
|
||||
import { generateAppDir } from '../util';
|
||||
import global from './global';
|
||||
import createNginxConf from './create-nginx-conf';
|
||||
import build from './build';
|
||||
import tar from './tar';
|
||||
import dev from './dev';
|
||||
import start from './start';
|
||||
import e2e from './e2e';
|
||||
import clean from './clean';
|
||||
import createNginxConf from './create-nginx-conf';
|
||||
import createPlugin from './create-plugin';
|
||||
import dev from './dev';
|
||||
import e2e from './e2e';
|
||||
import global from './global';
|
||||
import pm2 from './pm2';
|
||||
import postinstall from './postinstall';
|
||||
import start from './start';
|
||||
import tar from './tar';
|
||||
import test from './test';
|
||||
import umi from './umi';
|
||||
import upgrade from './upgrade';
|
||||
import postinstall from './postinstall';
|
||||
import createPlugin from './create-plugin';
|
||||
|
||||
export default async (cli: Command) => {
|
||||
generateAppDir();
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { execa } from 'execa';
|
||||
import { existsSync, mkdirSync, readFileSync } from 'fs';
|
||||
import { resolve } from 'path';
|
||||
import pAll from 'p-all';
|
||||
|
||||
import { parse } from 'dotenv';
|
||||
import { existsSync, readFileSync, mkdirSync } from 'fs';
|
||||
import { execa } from 'execa';
|
||||
import fastGlob from 'fast-glob';
|
||||
import lodash from 'lodash';
|
||||
import pAll from 'p-all';
|
||||
|
||||
let ENV_FILE = resolve(process.cwd(), '.env.e2e');
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Command } from 'commander';
|
||||
|
||||
import { run } from '../util';
|
||||
|
||||
export default (cli: Command) => {
|
||||
|
@ -1,9 +1,11 @@
|
||||
import { Command } from 'commander';
|
||||
import { run, isDev, isPackageValid, generatePlaywrightPath } from '../util';
|
||||
import { resolve } from 'path';
|
||||
import { existsSync } from 'fs';
|
||||
import { readFile, writeFile } from 'fs/promises';
|
||||
import { createStoragePluginsSymlink, createDevPluginsSymlink } from '@tachybase/utils/plugin-symlink';
|
||||
import { resolve } from 'path';
|
||||
import { createDevPluginsSymlink, createStoragePluginsSymlink } from '@tachybase/utils/plugin-symlink';
|
||||
|
||||
import { Command } from 'commander';
|
||||
|
||||
import { generatePlaywrightPath, isDev, isPackageValid, run } from '../util';
|
||||
|
||||
export default (cli: Command) => {
|
||||
const { APP_PACKAGE_ROOT } = process.env;
|
||||
|
@ -1,10 +1,12 @@
|
||||
import { Command } from 'commander';
|
||||
import { run, postCheck, promptForTs } from '../util';
|
||||
import { existsSync } from 'fs';
|
||||
import { resolve } from 'path';
|
||||
|
||||
import chalk from 'chalk';
|
||||
import { Command } from 'commander';
|
||||
import _ from 'lodash';
|
||||
|
||||
import { postCheck, promptForTs, run } from '../util';
|
||||
|
||||
export default (cli: Command) => {
|
||||
const { APP_PACKAGE_ROOT, NODE_ARGS } = process.env;
|
||||
cli
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { resolve } from 'path';
|
||||
|
||||
import { Command } from 'commander';
|
||||
import { run, nodeCheck, isPackageValid } from '../util';
|
||||
|
||||
import { isPackageValid, nodeCheck, run } from '../util';
|
||||
|
||||
export default (cli: Command) => {
|
||||
cli
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { Command } from 'commander';
|
||||
import { run } from '../util';
|
||||
import { sep } from 'path';
|
||||
|
||||
import { Command } from 'commander';
|
||||
|
||||
import { run } from '../util';
|
||||
|
||||
function addTestCommand(name: string, cli: Command) {
|
||||
return cli
|
||||
.command(name)
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Command } from 'commander';
|
||||
import { run, isDev } from '../util';
|
||||
|
||||
import { isDev, run } from '../util';
|
||||
|
||||
export default (cli: Command) => {
|
||||
const { APP_PACKAGE_ROOT } = process.env;
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { Command } from 'commander';
|
||||
import { resolve } from 'path';
|
||||
import { run, promptForTs, runAppCommand, hasCorePackages, hasTsNode } from '../util';
|
||||
import { existsSync, rmSync } from 'fs';
|
||||
import { resolve } from 'path';
|
||||
|
||||
import { Command } from 'commander';
|
||||
|
||||
import { hasCorePackages, hasTsNode, promptForTs, run, runAppCommand } from '../util';
|
||||
|
||||
export default (cli: Command) => {
|
||||
cli
|
||||
|
@ -1,12 +1,14 @@
|
||||
import chalk from 'chalk';
|
||||
import { existsSync } from 'fs';
|
||||
import { join, resolve } from 'path';
|
||||
import { Generator } from '@umijs/utils';
|
||||
import { readFile } from 'fs/promises';
|
||||
import { genTsConfigPaths } from './util';
|
||||
import { execa } from 'execa';
|
||||
import { join, resolve } from 'path';
|
||||
import { URL } from 'url';
|
||||
|
||||
import { Generator } from '@umijs/utils';
|
||||
import chalk from 'chalk';
|
||||
import { execa } from 'execa';
|
||||
|
||||
import { genTsConfigPaths } from './util';
|
||||
|
||||
const __dirname = new URL('.', import.meta.url).pathname;
|
||||
|
||||
function camelize(str: string) {
|
||||
@ -40,7 +42,7 @@ export class PluginGenerator extends Generator {
|
||||
...this.context,
|
||||
packageName: name,
|
||||
packageVersion,
|
||||
tachybaseVersion: "0.0.1",
|
||||
tachybaseVersion: '0.0.1',
|
||||
pascalCaseName: capitalize(camelize(name.split('/').pop())),
|
||||
};
|
||||
}
|
||||
|
@ -1,27 +1,32 @@
|
||||
import {
|
||||
cpSync as _cpSync,
|
||||
existsSync as _existsSync,
|
||||
writeFileSync as _writeFileSync,
|
||||
copyFileSync,
|
||||
cpSync,
|
||||
existsSync,
|
||||
mkdirSync,
|
||||
readFileSync,
|
||||
rmSync,
|
||||
symlinkSync,
|
||||
unlinkSync,
|
||||
writeFileSync,
|
||||
} from 'fs';
|
||||
import { readFile, writeFile } from 'fs/promises';
|
||||
import { createRequire } from 'module';
|
||||
import { Socket } from 'net';
|
||||
import { dirname, join, resolve, sep } from 'path';
|
||||
|
||||
import chalk from 'chalk';
|
||||
import { config } from 'dotenv';
|
||||
import { execa, Options } from 'execa';
|
||||
import fastGlob from 'fast-glob';
|
||||
import { dirname, join, resolve, sep } from 'path';
|
||||
import { readFile, writeFile } from 'fs/promises';
|
||||
import { existsSync, mkdirSync, cpSync, writeFileSync } from 'fs';
|
||||
import { config } from 'dotenv';
|
||||
import {
|
||||
unlinkSync,
|
||||
symlinkSync,
|
||||
existsSync as _existsSync,
|
||||
rmSync,
|
||||
cpSync as _cpSync,
|
||||
copyFileSync,
|
||||
readFileSync,
|
||||
writeFileSync as _writeFileSync,
|
||||
} from 'fs';
|
||||
import { createRequire } from 'module';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
export function isPackageValid(pkg: string) {
|
||||
try {
|
||||
require(pkg)
|
||||
require(pkg);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
|
@ -1,4 +1,5 @@
|
||||
import axios from 'axios';
|
||||
|
||||
import { APIClient } from '../APIClient';
|
||||
|
||||
describe('APIClient', () => {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { APIClient, APIClientProvider, compose, useRequest } from '@tachybase/client';
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
import React from 'react';
|
||||
import { APIClient, APIClientProvider, compose, useRequest } from '@tachybase/client';
|
||||
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
|
||||
const apiClient = new APIClient();
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { APIClient, APIClientProvider, compose, useRequest } from '@tachybase/client';
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
import React from 'react';
|
||||
import { APIClient, APIClientProvider, compose, useRequest } from '@tachybase/client';
|
||||
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
|
||||
const apiClient = new APIClient();
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { uid } from '@tachybase/schema';
|
||||
import React from 'react';
|
||||
import { APIClient, APIClientProvider, useAPIClient, useRequest } from '@tachybase/client';
|
||||
import { uid } from '@tachybase/schema';
|
||||
|
||||
import { Button, Input, Space, Table } from 'antd';
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
import React from 'react';
|
||||
|
||||
const apiClient = new APIClient();
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
import React, { Component } from 'react';
|
||||
import { render, screen, sleep, userEvent, waitFor } from '@tachybase/test/client';
|
||||
|
||||
import axios from 'axios';
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
import React, { Component } from 'react';
|
||||
import { Link, Outlet } from 'react-router-dom';
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { Application } from '../Application';
|
||||
import { Plugin } from '../Plugin';
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { Application } from '../Application';
|
||||
import axios from 'axios';
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
|
||||
import { Application } from '../Application';
|
||||
|
||||
describe('PluginSettingsManager', () => {
|
||||
let app: Application;
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { render, screen, userEvent, sleep, waitFor } from '@tachybase/test/client';
|
||||
import React, { FC } from 'react';
|
||||
import { render, screen, sleep, userEvent, waitFor } from '@tachybase/test/client';
|
||||
|
||||
import axios from 'axios';
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
import React, { FC } from 'react';
|
||||
import { Link, Outlet } from 'react-router-dom';
|
||||
import { beforeAll } from 'vitest';
|
||||
|
||||
import { Application } from '../Application';
|
||||
import { RouteType, RouterManager, createRouterManager } from '../RouterManager';
|
||||
import { createRouterManager, RouterManager, RouteType } from '../RouterManager';
|
||||
|
||||
describe('Router', () => {
|
||||
let app: Application;
|
||||
|
@ -1,9 +1,10 @@
|
||||
import React from 'react';
|
||||
import { fireEvent, render, screen, waitFor } from '@tachybase/test/client';
|
||||
import { SchemaToolbarProvider, useSchemaToolbar, useSchemaToolbarRender } from '../schema-toolbar';
|
||||
import { SchemaComponent, SchemaComponentProvider, SortableContext, SortableProvider } from '../../schema-component';
|
||||
import { useFieldSchema } from '@tachybase/schema';
|
||||
import { Application, ApplicationContext } from '@tachybase/client';
|
||||
import { useFieldSchema } from '@tachybase/schema';
|
||||
import { fireEvent, render, screen, waitFor } from '@tachybase/test/client';
|
||||
|
||||
import { SchemaComponent, SchemaComponentProvider, SortableContext, SortableProvider } from '../../schema-component';
|
||||
import { SchemaToolbarProvider, useSchemaToolbar, useSchemaToolbarRender } from '../schema-toolbar';
|
||||
|
||||
describe('SchemaToolbar', () => {
|
||||
test('SchemaToolbarProvider & useSchemaToolbar', () => {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { SchemaComponent, SchemaComponentProvider } from '../../../schema-component';
|
||||
import { render } from '@tachybase/test/client';
|
||||
|
||||
import { SchemaComponent, SchemaComponentProvider } from '../../../schema-component';
|
||||
import { withDynamicSchemaProps } from '../../hoc';
|
||||
|
||||
const HelloComponent = withDynamicSchemaProps((props: any) => (
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { render, screen } from '@tachybase/test/client';
|
||||
import React from 'react';
|
||||
import { render, screen } from '@tachybase/test/client';
|
||||
|
||||
import { describe } from 'vitest';
|
||||
|
||||
import { compose, normalizeContainer } from '../utils';
|
||||
|
||||
describe('utils', () => {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { createContext } from 'react';
|
||||
|
||||
import { Application } from './Application';
|
||||
|
||||
export const ApplicationContext = createContext<Application>(null);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import type { ButtonProps } from 'antd';
|
||||
|
||||
import { SchemaInitializerItemType, SchemaInitializerItemTypeWithoutName, SchemaInitializerOptions } from './types';
|
||||
|
||||
export class SchemaInitializer<P1 = ButtonProps, P2 = {}> {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { ButtonProps } from 'antd';
|
||||
|
||||
import { Application } from '../Application';
|
||||
import { SchemaInitializer } from './SchemaInitializer';
|
||||
import { SchemaInitializerItemTypeWithoutName } from './types';
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { useForm } from '@tachybase/schema';
|
||||
import React, { FC, useCallback, useMemo } from 'react';
|
||||
import { useActionContext, SchemaComponent } from '../../../schema-component';
|
||||
import { useForm } from '@tachybase/schema';
|
||||
|
||||
import { SchemaComponent, useActionContext } from '../../../schema-component';
|
||||
import { useSchemaInitializerItem } from '../context';
|
||||
|
||||
export interface SchemaInitializerActionModalProps {
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { Button, ButtonProps } from 'antd';
|
||||
import React, { FC } from 'react';
|
||||
|
||||
import { Button, ButtonProps } from 'antd';
|
||||
|
||||
import { Icon } from '../../../icon';
|
||||
import { useCompile } from '../../../schema-component';
|
||||
import { useGetAriaLabelOfSchemaInitializer } from '../../../schema-initializer/hooks/useGetAriaLabelOfSchemaInitializer';
|
||||
|
@ -3,6 +3,7 @@ import React, { FC, memo, useMemo } from 'react';
|
||||
import { useFindComponent } from '../../../schema-component';
|
||||
import { SchemaInitializerItemContext } from '../context';
|
||||
import { SchemaInitializerItemType } from '../types';
|
||||
|
||||
export const SchemaInitializerChildren: FC<{ children: SchemaInitializerItemType[] }> = (props) => {
|
||||
const { children } = props;
|
||||
if (!children) return null;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Divider, theme } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
import { Divider, theme } from 'antd';
|
||||
|
||||
export const SchemaInitializerDivider = () => {
|
||||
const { token } = theme.useToken();
|
||||
return <Divider style={{ marginTop: token.marginXXS, marginBottom: token.marginXXS }} />;
|
||||
|
@ -1,6 +1,8 @@
|
||||
import React, { memo, ReactNode, useMemo } from 'react';
|
||||
import { uid } from '@tachybase/schema';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import React, { ReactNode, memo, useMemo } from 'react';
|
||||
|
||||
import { Icon } from '../../../icon';
|
||||
import { useCompile } from '../../../schema-component';
|
||||
import { useSchemaInitializerItem } from '../context';
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { theme } from 'antd';
|
||||
import React, { FC } from 'react';
|
||||
|
||||
import { theme } from 'antd';
|
||||
|
||||
import { useCompile } from '../../../schema-component';
|
||||
import { useSchemaInitializerItem } from '../context';
|
||||
import { SchemaInitializerOptions } from '../types';
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { ButtonProps } from 'antd';
|
||||
import React, { FC } from 'react';
|
||||
import { SchemaInitializerChildren } from './SchemaInitializerChildren';
|
||||
|
||||
import { ButtonProps } from 'antd';
|
||||
|
||||
import { SchemaInitializerOptions } from '../types';
|
||||
import { SchemaInitializerChildren } from './SchemaInitializerChildren';
|
||||
|
||||
export type SchemaInitializerItemsProps<P1 = ButtonProps, P2 = {}> = P2 & {
|
||||
options?: SchemaInitializerOptions<P1, P2>;
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { Select, SelectProps } from 'antd';
|
||||
import React, { FC, useCallback, useMemo, useState } from 'react';
|
||||
import { SchemaInitializerItemProps, SchemaInitializerItem } from './SchemaInitializerItem';
|
||||
|
||||
import { Select, SelectProps } from 'antd';
|
||||
|
||||
import { useSchemaInitializerItem } from '../context';
|
||||
import { SchemaInitializerItem, SchemaInitializerItemProps } from './SchemaInitializerItem';
|
||||
|
||||
export interface SchemaInitializerSelectItemProps extends SchemaInitializerItemProps {
|
||||
options?: SelectProps['options'];
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { Switch } from 'antd';
|
||||
import React, { FC } from 'react';
|
||||
import { SchemaInitializerItemProps, SchemaInitializerItem } from './SchemaInitializerItem';
|
||||
|
||||
import { Switch } from 'antd';
|
||||
|
||||
import { useCompile } from '../../../schema-component';
|
||||
import { useSchemaInitializerItem } from '../context';
|
||||
import { SchemaInitializerItem, SchemaInitializerItemProps } from './SchemaInitializerItem';
|
||||
|
||||
export interface SchemaInitializerSwitchItemProps extends SchemaInitializerItemProps {
|
||||
checked?: boolean;
|
||||
|
@ -1,4 +1,5 @@
|
||||
import React, { createContext } from 'react';
|
||||
|
||||
import { InsertType, SchemaInitializerItemType, SchemaInitializerOptions } from '../types';
|
||||
|
||||
export const SchemaInitializerContext = createContext<{
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import { useSchemaInitializerSubMenuContext } from '../components/SchemaInitializerSubMenu';
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { ISchema } from '@tachybase/schema';
|
||||
import { ButtonProps, PopoverProps } from 'antd';
|
||||
import { ComponentType, ReactNode } from 'react';
|
||||
import { ISchema } from '@tachybase/schema';
|
||||
|
||||
import { ButtonProps, PopoverProps } from 'antd';
|
||||
|
||||
import type {
|
||||
SchemaInitializerActionModalProps,
|
||||
SchemaInitializerItemGroupProps,
|
||||
|
@ -1,10 +1,12 @@
|
||||
import { ISchema, useFieldSchema } from '@tachybase/schema';
|
||||
import { SchemaSettingsItemType } from './types';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { createDesignable, useDesignable } from '../../schema-component';
|
||||
import { saveAs } from 'file-saver';
|
||||
import { useAPIClient } from '../../api-client';
|
||||
import { useMemo } from 'react';
|
||||
import { ISchema, useFieldSchema } from '@tachybase/schema';
|
||||
|
||||
import { saveAs } from 'file-saver';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useAPIClient } from '../../api-client';
|
||||
import { createDesignable, useDesignable } from '../../schema-component';
|
||||
import { SchemaSettingsItemType } from './types';
|
||||
|
||||
export const defaultSettingItems = [
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { MenuOutlined } from '@ant-design/icons';
|
||||
import React, { FC, useMemo } from 'react';
|
||||
|
||||
import { MenuOutlined } from '@ant-design/icons';
|
||||
|
||||
import { useGetAriaLabelOfDesigner } from '../../../schema-settings/hooks/useGetAriaLabelOfDesigner';
|
||||
import { SchemaSettingOptions } from '../types';
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { FC, useMemo } from 'react';
|
||||
import React, { FC, useMemo } from 'react';
|
||||
import { useField, useFieldSchema } from '@tachybase/schema';
|
||||
|
||||
import { useDesignable } from '../../../schema-component';
|
||||
import { SchemaSettingsDropdown } from '../../../schema-settings';
|
||||
import { SchemaSettingOptions } from '../types';
|
||||
import { SchemaSettingsChildren } from './SchemaSettingsChildren';
|
||||
import { SchemaSettingsIcon } from './SchemaSettingsIcon';
|
||||
import React from 'react';
|
||||
import { useDesignable } from '../../../schema-component';
|
||||
import { useField, useFieldSchema } from '@tachybase/schema';
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { createContext, useContext } from 'react';
|
||||
|
||||
import { SchemaSettingsItemType } from '../types';
|
||||
|
||||
export const SchemaSettingItemContext = createContext<SchemaSettingsItemType>({} as any);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { ComponentType } from 'react';
|
||||
|
||||
import {
|
||||
SchemaSettingsCascaderItemProps,
|
||||
SchemaSettingsItemProps,
|
||||
|
@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
import { createContext, useContext } from 'react';
|
||||
import React, { createContext, useContext } from 'react';
|
||||
|
||||
export const SchemaToolbarContext = createContext<any>({});
|
||||
SchemaToolbarContext.displayName = 'SchemaToolbarContext';
|
||||
|
@ -1,5 +1,6 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { ISchema } from '@tachybase/schema';
|
||||
|
||||
import { useComponent, useDesignable } from '../../../schema-component';
|
||||
import { SchemaToolbar, SchemaToolbarProps } from '../../../schema-settings/GeneralSchemaDesigner';
|
||||
|
||||
|
@ -2,12 +2,12 @@
|
||||
// @ts-nocheck
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
import type { Require, RequireDefine } from './types'
|
||||
import type { Require, RequireDefine } from './types';
|
||||
|
||||
export interface RequireJS {
|
||||
require: Require
|
||||
requirejs: Require
|
||||
define: RequireDefine
|
||||
require: Require;
|
||||
requirejs: Require;
|
||||
define: RequireDefine;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -15,10 +15,18 @@ export interface RequireJS {
|
||||
*/
|
||||
export function getRequireJs(): RequireJS {
|
||||
var requirejs, require, define;
|
||||
var req, s, head, baseElement, dataMain, src,
|
||||
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
||||
var req,
|
||||
s,
|
||||
head,
|
||||
baseElement,
|
||||
dataMain,
|
||||
src,
|
||||
interactiveScript,
|
||||
currentlyAddingScript,
|
||||
mainScript,
|
||||
subPath,
|
||||
version = '2.3.6',
|
||||
commentRegExp = /\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/mg,
|
||||
commentRegExp = /\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/gm,
|
||||
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
||||
jsSuffixRegExp = /\.js$/,
|
||||
currDirRegExp = /^\.\//,
|
||||
@ -31,8 +39,7 @@ export function getRequireJs(): RequireJS {
|
||||
//specifically. Sequence is 'loading', 'loaded', execution,
|
||||
// then 'complete'. The UA check is unfortunate, but not sure how
|
||||
//to feature test w/o causing perf issues.
|
||||
readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
|
||||
/^complete$/ : /^(complete|loaded)$/,
|
||||
readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ? /^complete$/ : /^(complete|loaded)$/,
|
||||
defContextName = '_',
|
||||
//Oh the tragedy, detecting opera. See the usage of isOpera for reason.
|
||||
isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
|
||||
@ -116,10 +123,14 @@ export function getRequireJs(): RequireJS {
|
||||
if (source) {
|
||||
eachProp(source, function (value, prop) {
|
||||
if (force || !hasProp(target, prop)) {
|
||||
if (deepStringMixin && typeof value === 'object' && value &&
|
||||
!isArray(value) && !isFunction(value) &&
|
||||
!(value instanceof RegExp)) {
|
||||
|
||||
if (
|
||||
deepStringMixin &&
|
||||
typeof value === 'object' &&
|
||||
value &&
|
||||
!isArray(value) &&
|
||||
!isFunction(value) &&
|
||||
!(value instanceof RegExp)
|
||||
) {
|
||||
if (!target[prop]) {
|
||||
target[prop] = {};
|
||||
}
|
||||
@ -203,7 +214,10 @@ export function getRequireJs(): RequireJS {
|
||||
}
|
||||
|
||||
function newContext(contextName) {
|
||||
var inCheckLoaded, Module, context, handlers,
|
||||
var inCheckLoaded,
|
||||
Module,
|
||||
context,
|
||||
handlers,
|
||||
checkLoadedTimeoutId,
|
||||
config = {
|
||||
//Defaults. Do not set a default for map
|
||||
@ -215,7 +229,7 @@ export function getRequireJs(): RequireJS {
|
||||
bundles: {},
|
||||
pkgs: {},
|
||||
shim: {},
|
||||
config: {}
|
||||
config: {},
|
||||
},
|
||||
registry = {},
|
||||
//registry of just enabled modules, to speed
|
||||
@ -273,9 +287,19 @@ export function getRequireJs(): RequireJS {
|
||||
* @returns {String} normalized name
|
||||
*/
|
||||
function normalize(name, baseName, applyMap) {
|
||||
var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,
|
||||
foundMap, foundI, foundStarMap, starI, normalizedBaseParts,
|
||||
baseParts = (baseName && baseName.split('/')),
|
||||
var pkgMain,
|
||||
mapValue,
|
||||
nameParts,
|
||||
i,
|
||||
j,
|
||||
nameSegment,
|
||||
lastIndex,
|
||||
foundMap,
|
||||
foundI,
|
||||
foundStarMap,
|
||||
starI,
|
||||
normalizedBaseParts,
|
||||
baseParts = baseName && baseName.split('/'),
|
||||
map = config.map,
|
||||
starMap = map && map['*'];
|
||||
|
||||
@ -364,8 +388,10 @@ export function getRequireJs(): RequireJS {
|
||||
function removeScript(name) {
|
||||
if (isBrowser) {
|
||||
each(scripts(), function (scriptNode) {
|
||||
if (scriptNode.getAttribute('data-requiremodule') === name &&
|
||||
scriptNode.getAttribute('data-requirecontext') === context.contextName) {
|
||||
if (
|
||||
scriptNode.getAttribute('data-requiremodule') === name &&
|
||||
scriptNode.getAttribute('data-requirecontext') === context.contextName
|
||||
) {
|
||||
scriptNode.parentNode.removeChild(scriptNode);
|
||||
return true;
|
||||
}
|
||||
@ -384,7 +410,7 @@ export function getRequireJs(): RequireJS {
|
||||
//Custom require that does not do map translation, since
|
||||
//ID is "absolute", already mapped/resolved.
|
||||
context.makeRequire(null, {
|
||||
skipMap: true
|
||||
skipMap: true,
|
||||
})([id]);
|
||||
|
||||
return true;
|
||||
@ -420,7 +446,10 @@ export function getRequireJs(): RequireJS {
|
||||
* @returns {Object}
|
||||
*/
|
||||
function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
|
||||
var url, pluginModule, suffix, nameParts,
|
||||
var url,
|
||||
pluginModule,
|
||||
suffix,
|
||||
nameParts,
|
||||
prefix = null,
|
||||
parentName = parentModuleMap ? parentModuleMap.name : null,
|
||||
originalName = name,
|
||||
@ -461,9 +490,7 @@ export function getRequireJs(): RequireJS {
|
||||
// loaded and all normalizations to allow for async
|
||||
// loading of a loader plugin. But for now, fixes the
|
||||
// common uses. Details in #1131
|
||||
normalizedName = name.indexOf('!') === -1 ?
|
||||
normalize(name, parentName, applyMap) :
|
||||
name;
|
||||
normalizedName = name.indexOf('!') === -1 ? normalize(name, parentName, applyMap) : name;
|
||||
}
|
||||
} else {
|
||||
//A regular module.
|
||||
@ -484,9 +511,7 @@ export function getRequireJs(): RequireJS {
|
||||
//If the id is a plugin id that cannot be determined if it needs
|
||||
//normalization, stamp it with a unique ID so two matching relative
|
||||
//ids that may conflict can be separate.
|
||||
suffix = prefix && !pluginModule && !isNormalized ?
|
||||
'_unnormalized' + (unnormalizedCounter += 1) :
|
||||
'';
|
||||
suffix = prefix && !pluginModule && !isNormalized ? '_unnormalized' + (unnormalizedCounter += 1) : '';
|
||||
|
||||
return {
|
||||
prefix: prefix,
|
||||
@ -496,9 +521,7 @@ export function getRequireJs(): RequireJS {
|
||||
url: url,
|
||||
originalName: originalName,
|
||||
isDefine: isDefine,
|
||||
id: (prefix ?
|
||||
prefix + '!' + normalizedName :
|
||||
normalizedName) + suffix
|
||||
id: (prefix ? prefix + '!' + normalizedName : normalizedName) + suffix,
|
||||
};
|
||||
}
|
||||
|
||||
@ -517,8 +540,7 @@ export function getRequireJs(): RequireJS {
|
||||
var id = depMap.id,
|
||||
mod = getOwn(registry, id);
|
||||
|
||||
if (hasProp(defined, id) &&
|
||||
(!mod || mod.defineEmitComplete)) {
|
||||
if (hasProp(defined, id) && (!mod || mod.defineEmitComplete)) {
|
||||
if (name === 'defined') {
|
||||
fn(defined[id]);
|
||||
}
|
||||
@ -576,14 +598,14 @@ export function getRequireJs(): RequireJS {
|
||||
}
|
||||
|
||||
handlers = {
|
||||
'require': function (mod) {
|
||||
require: function (mod) {
|
||||
if (mod.require) {
|
||||
return mod.require;
|
||||
} else {
|
||||
return (mod.require = context.makeRequire(mod.map));
|
||||
}
|
||||
},
|
||||
'exports': function (mod) {
|
||||
exports: function (mod) {
|
||||
mod.usingExports = true;
|
||||
if (mod.map.isDefine) {
|
||||
if (mod.exports) {
|
||||
@ -593,7 +615,7 @@ export function getRequireJs(): RequireJS {
|
||||
}
|
||||
}
|
||||
},
|
||||
'module': function (mod) {
|
||||
module: function (mod) {
|
||||
if (mod.module) {
|
||||
return mod.module;
|
||||
} else {
|
||||
@ -603,10 +625,10 @@ export function getRequireJs(): RequireJS {
|
||||
config: function () {
|
||||
return getOwn(config.config, mod.map.id) || {};
|
||||
},
|
||||
exports: mod.exports || (mod.exports = {})
|
||||
exports: mod.exports || (mod.exports = {}),
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function cleanRegistry(id) {
|
||||
@ -644,10 +666,11 @@ export function getRequireJs(): RequireJS {
|
||||
}
|
||||
|
||||
function checkLoaded() {
|
||||
var err, usingPathFallback,
|
||||
var err,
|
||||
usingPathFallback,
|
||||
waitInterval = config.waitSeconds * 1000,
|
||||
//It is possible to disable the wait interval by using waitSeconds of 0.
|
||||
expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
|
||||
expired = waitInterval && context.startTime + waitInterval < new Date().getTime(),
|
||||
noLoads = [],
|
||||
reqCalls = [],
|
||||
stillLoading = false,
|
||||
@ -813,7 +836,7 @@ export function getRequireJs(): RequireJS {
|
||||
}
|
||||
this.fetched = true;
|
||||
|
||||
context.startTime = (new Date()).getTime();
|
||||
context.startTime = new Date().getTime();
|
||||
|
||||
var map = this.map;
|
||||
|
||||
@ -821,10 +844,13 @@ export function getRequireJs(): RequireJS {
|
||||
//ask the plugin to load it now.
|
||||
if (this.shim) {
|
||||
context.makeRequire(this.map, {
|
||||
enableBuildCallback: true
|
||||
})(this.shim.deps || [], bind(this, function () {
|
||||
enableBuildCallback: true,
|
||||
})(
|
||||
this.shim.deps || [],
|
||||
bind(this, function () {
|
||||
return map.prefix ? this.callPlugin() : this.load();
|
||||
}));
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
//Regular dependency.
|
||||
return map.prefix ? this.callPlugin() : this.load();
|
||||
@ -850,7 +876,8 @@ export function getRequireJs(): RequireJS {
|
||||
return;
|
||||
}
|
||||
|
||||
var err, cjsModule,
|
||||
var err,
|
||||
cjsModule,
|
||||
id = this.map.id,
|
||||
depExports = this.depExports,
|
||||
exports = this.exports,
|
||||
@ -878,8 +905,7 @@ export function getRequireJs(): RequireJS {
|
||||
//errbacks should not be called for failures in
|
||||
//their callbacks (#699). However if a global
|
||||
//onError is set, use that.
|
||||
if ((this.events.error && this.map.isDefine) ||
|
||||
req.onError !== defaultOnError) {
|
||||
if ((this.events.error && this.map.isDefine) || req.onError !== defaultOnError) {
|
||||
try {
|
||||
exports = context.execCb(id, factory, depExports, exports);
|
||||
} catch (e) {
|
||||
@ -908,7 +934,6 @@ export function getRequireJs(): RequireJS {
|
||||
err.requireType = this.map.isDefine ? 'define' : 'require';
|
||||
return onError((this.error = err));
|
||||
}
|
||||
|
||||
} else {
|
||||
//Just a literal value
|
||||
exports = factory;
|
||||
@ -944,7 +969,6 @@ export function getRequireJs(): RequireJS {
|
||||
this.emit('defined', this.exports);
|
||||
this.defineEmitComplete = true;
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@ -958,13 +982,18 @@ export function getRequireJs(): RequireJS {
|
||||
//can be traced for cycles.
|
||||
this.depMaps.push(pluginMap);
|
||||
|
||||
on(pluginMap, 'defined', bind(this, function (plugin) {
|
||||
var load, normalizedMap, normalizedMod,
|
||||
on(
|
||||
pluginMap,
|
||||
'defined',
|
||||
bind(this, function (plugin) {
|
||||
var load,
|
||||
normalizedMap,
|
||||
normalizedMod,
|
||||
bundleId = getOwn(bundlesMap, this.map.id),
|
||||
name = this.map.name,
|
||||
parentName = this.map.parentMap ? this.map.parentMap.name : null,
|
||||
localRequire = context.makeRequire(map.parentMap, {
|
||||
enableBuildCallback: true
|
||||
enableBuildCallback: true,
|
||||
});
|
||||
|
||||
//If current map is not normalized, wait for that
|
||||
@ -972,24 +1001,33 @@ export function getRequireJs(): RequireJS {
|
||||
if (this.map.unnormalized) {
|
||||
//Normalize the ID if the plugin allows it.
|
||||
if (plugin.normalize) {
|
||||
name = plugin.normalize(name, function (name) {
|
||||
name =
|
||||
plugin.normalize(name, function (name) {
|
||||
return normalize(name, parentName, true);
|
||||
}) || '';
|
||||
}
|
||||
|
||||
//prefix and name should already be normalized, no need
|
||||
//for applying map config again either.
|
||||
normalizedMap = makeModuleMap(map.prefix + '!' + name,
|
||||
this.map.parentMap,
|
||||
true);
|
||||
on(normalizedMap,
|
||||
'defined', bind(this, function (value) {
|
||||
normalizedMap = makeModuleMap(map.prefix + '!' + name, this.map.parentMap, true);
|
||||
on(
|
||||
normalizedMap,
|
||||
'defined',
|
||||
bind(this, function (value) {
|
||||
this.map.normalizedMap = normalizedMap;
|
||||
this.init([], function () { return value; }, null, {
|
||||
this.init(
|
||||
[],
|
||||
function () {
|
||||
return value;
|
||||
},
|
||||
null,
|
||||
{
|
||||
enabled: true,
|
||||
ignore: true
|
||||
});
|
||||
}));
|
||||
ignore: true,
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
normalizedMod = getOwn(registry, normalizedMap.id);
|
||||
if (normalizedMod) {
|
||||
@ -998,9 +1036,12 @@ export function getRequireJs(): RequireJS {
|
||||
this.depMaps.push(normalizedMap);
|
||||
|
||||
if (this.events.error) {
|
||||
normalizedMod.on('error', bind(this, function (err) {
|
||||
normalizedMod.on(
|
||||
'error',
|
||||
bind(this, function (err) {
|
||||
this.emit('error', err);
|
||||
}));
|
||||
}),
|
||||
);
|
||||
}
|
||||
normalizedMod.enable();
|
||||
}
|
||||
@ -1017,9 +1058,16 @@ export function getRequireJs(): RequireJS {
|
||||
}
|
||||
|
||||
load = bind(this, function (value) {
|
||||
this.init([], function () { return value; }, null, {
|
||||
enabled: true
|
||||
});
|
||||
this.init(
|
||||
[],
|
||||
function () {
|
||||
return value;
|
||||
},
|
||||
null,
|
||||
{
|
||||
enabled: true,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
load.error = bind(this, function (err) {
|
||||
@ -1072,11 +1120,7 @@ export function getRequireJs(): RequireJS {
|
||||
try {
|
||||
req.exec(text);
|
||||
} catch (e) {
|
||||
return onError(makeError('fromtexteval',
|
||||
'fromText eval for ' + id +
|
||||
' failed: ' + e,
|
||||
e,
|
||||
[id]));
|
||||
return onError(makeError('fromtexteval', 'fromText eval for ' + id + ' failed: ' + e, e, [id]));
|
||||
}
|
||||
|
||||
if (hasInteractive) {
|
||||
@ -1099,7 +1143,8 @@ export function getRequireJs(): RequireJS {
|
||||
//could be some weird string with no path that actually wants to
|
||||
//reference the parentName's path.
|
||||
plugin.load(map.name, localRequire, load, config);
|
||||
}));
|
||||
}),
|
||||
);
|
||||
|
||||
context.enable(pluginMap, this);
|
||||
this.pluginMaps[pluginMap.id] = pluginMap;
|
||||
@ -1116,16 +1161,15 @@ export function getRequireJs(): RequireJS {
|
||||
this.enabling = true;
|
||||
|
||||
//Enable each dependency
|
||||
each(this.depMaps, bind(this, function (depMap, i) {
|
||||
each(
|
||||
this.depMaps,
|
||||
bind(this, function (depMap, i) {
|
||||
var id, mod, handler;
|
||||
|
||||
if (typeof depMap === 'string') {
|
||||
//Dependency needs to be converted to a depMap
|
||||
//and wired up to this module.
|
||||
depMap = makeModuleMap(depMap,
|
||||
(this.map.isDefine ? this.map : this.map.parentMap),
|
||||
false,
|
||||
!this.skipMap);
|
||||
depMap = makeModuleMap(depMap, this.map.isDefine ? this.map : this.map.parentMap, false, !this.skipMap);
|
||||
this.depMaps[i] = depMap;
|
||||
|
||||
handler = getOwn(handlers, depMap.id);
|
||||
@ -1137,13 +1181,17 @@ export function getRequireJs(): RequireJS {
|
||||
|
||||
this.depCount += 1;
|
||||
|
||||
on(depMap, 'defined', bind(this, function (depExports) {
|
||||
on(
|
||||
depMap,
|
||||
'defined',
|
||||
bind(this, function (depExports) {
|
||||
if (this.undefed) {
|
||||
return;
|
||||
}
|
||||
this.defineDep(i, depExports);
|
||||
this.check();
|
||||
}));
|
||||
}),
|
||||
);
|
||||
|
||||
if (this.errback) {
|
||||
on(depMap, 'error', bind(this, this.errback));
|
||||
@ -1151,9 +1199,13 @@ export function getRequireJs(): RequireJS {
|
||||
// No direct errback on this module, but something
|
||||
// else is listening for errors, so be sure to
|
||||
// propagate the error correctly.
|
||||
on(depMap, 'error', bind(this, function (err) {
|
||||
on(
|
||||
depMap,
|
||||
'error',
|
||||
bind(this, function (err) {
|
||||
this.emit('error', err);
|
||||
}));
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1166,16 +1218,20 @@ export function getRequireJs(): RequireJS {
|
||||
if (!hasProp(handlers, id) && mod && !mod.enabled) {
|
||||
context.enable(depMap, this);
|
||||
}
|
||||
}));
|
||||
}),
|
||||
);
|
||||
|
||||
//Enable each plugin that is used in
|
||||
//a dependency
|
||||
eachProp(this.pluginMaps, bind(this, function (pluginMap) {
|
||||
eachProp(
|
||||
this.pluginMaps,
|
||||
bind(this, function (pluginMap) {
|
||||
var mod = getOwn(registry, pluginMap.id);
|
||||
if (mod && !mod.enabled) {
|
||||
context.enable(pluginMap, this);
|
||||
}
|
||||
}));
|
||||
}),
|
||||
);
|
||||
|
||||
this.enabling = false;
|
||||
|
||||
@ -1200,7 +1256,7 @@ export function getRequireJs(): RequireJS {
|
||||
//can stay around for a while in the registry.
|
||||
delete this.events[name];
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function callGetModule(args) {
|
||||
@ -1243,7 +1299,7 @@ export function getRequireJs(): RequireJS {
|
||||
|
||||
return {
|
||||
node: node,
|
||||
id: node && node.getAttribute('data-requiremodule')
|
||||
id: node && node.getAttribute('data-requiremodule'),
|
||||
};
|
||||
}
|
||||
|
||||
@ -1257,8 +1313,7 @@ export function getRequireJs(): RequireJS {
|
||||
while (defQueue.length) {
|
||||
args = defQueue.shift();
|
||||
if (args[0] === null) {
|
||||
return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' +
|
||||
args[args.length - 1]));
|
||||
return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
|
||||
} else {
|
||||
//args are id, deps, factory. Should be normalized by the
|
||||
//define() function.
|
||||
@ -1308,7 +1363,7 @@ export function getRequireJs(): RequireJS {
|
||||
paths: true,
|
||||
bundles: true,
|
||||
config: true,
|
||||
map: true
|
||||
map: true,
|
||||
};
|
||||
|
||||
eachProp(cfg, function (value, prop) {
|
||||
@ -1339,7 +1394,7 @@ export function getRequireJs(): RequireJS {
|
||||
//Normalize the structure
|
||||
if (isArray(value)) {
|
||||
value = {
|
||||
deps: value
|
||||
deps: value,
|
||||
};
|
||||
}
|
||||
if ((value.exports || value.init) && !value.exportsFn) {
|
||||
@ -1368,9 +1423,8 @@ export function getRequireJs(): RequireJS {
|
||||
//and remove any trailing .js, since different package
|
||||
//envs have different conventions: some use a module name,
|
||||
//some use a file name.
|
||||
config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main')
|
||||
.replace(currDirRegExp, '')
|
||||
.replace(jsSuffixRegExp, '');
|
||||
config.pkgs[name] =
|
||||
pkgObj.name + '/' + (pkgObj.main || 'main').replace(currDirRegExp, '').replace(jsSuffixRegExp, '');
|
||||
});
|
||||
}
|
||||
|
||||
@ -1439,11 +1493,16 @@ export function getRequireJs(): RequireJS {
|
||||
id = map.id;
|
||||
|
||||
if (!hasProp(defined, id)) {
|
||||
return onError(makeError('notloaded', 'Module name "' +
|
||||
return onError(
|
||||
makeError(
|
||||
'notloaded',
|
||||
'Module name "' +
|
||||
id +
|
||||
'" has not been loaded yet for context: ' +
|
||||
contextName +
|
||||
(relMap ? '' : '. Use require([])')));
|
||||
(relMap ? '' : '. Use require([])'),
|
||||
),
|
||||
);
|
||||
}
|
||||
return defined[id];
|
||||
}
|
||||
@ -1464,7 +1523,7 @@ export function getRequireJs(): RequireJS {
|
||||
requireMod.skipMap = options.skipMap;
|
||||
|
||||
requireMod.init(deps, callback, errback, {
|
||||
enabled: true
|
||||
enabled: true,
|
||||
});
|
||||
|
||||
checkLoaded();
|
||||
@ -1494,8 +1553,7 @@ export function getRequireJs(): RequireJS {
|
||||
moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
|
||||
}
|
||||
|
||||
return context.nameToUrl(normalize(moduleNamePlusExt,
|
||||
relMap && relMap.id, true), ext, true);
|
||||
return context.nameToUrl(normalize(moduleNamePlusExt, relMap && relMap.id, true), ext, true);
|
||||
},
|
||||
|
||||
defined: function (id) {
|
||||
@ -1505,7 +1563,7 @@ export function getRequireJs(): RequireJS {
|
||||
specified: function (id) {
|
||||
id = makeModuleMap(id, relMap, false, true).id;
|
||||
return hasProp(defined, id) || hasProp(registry, id);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
//Only allow undef on top level require calls
|
||||
@ -1571,7 +1629,9 @@ export function getRequireJs(): RequireJS {
|
||||
* @param {String} moduleName the name of the module to potentially complete.
|
||||
*/
|
||||
completeLoad: function (moduleName) {
|
||||
var found, args, mod,
|
||||
var found,
|
||||
args,
|
||||
mod,
|
||||
shim = getOwn(config.shim, moduleName) || {},
|
||||
shExports = shim.exports;
|
||||
|
||||
@ -1606,15 +1666,12 @@ export function getRequireJs(): RequireJS {
|
||||
if (hasPathFallback(moduleName)) {
|
||||
return;
|
||||
} else {
|
||||
return onError(makeError('nodefine',
|
||||
'No define call for ' + moduleName,
|
||||
null,
|
||||
[moduleName]));
|
||||
return onError(makeError('nodefine', 'No define call for ' + moduleName, null, [moduleName]));
|
||||
}
|
||||
} else {
|
||||
//A script that does not call define(), so just simulate
|
||||
//the call for it.
|
||||
callGetModule([moduleName, (shim.deps || []), shim.exportsFn]);
|
||||
callGetModule([moduleName, shim.deps || [], shim.exportsFn]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1629,8 +1686,13 @@ export function getRequireJs(): RequireJS {
|
||||
* internal API, not a public one. Use toUrl for the public API.
|
||||
*/
|
||||
nameToUrl: function (moduleName, ext, skipExt) {
|
||||
var paths, syms, i, parentModule, url,
|
||||
parentPath, bundleId,
|
||||
var paths,
|
||||
syms,
|
||||
i,
|
||||
parentModule,
|
||||
url,
|
||||
parentPath,
|
||||
bundleId,
|
||||
pkgMain = getOwn(config.pkgs, moduleName);
|
||||
|
||||
if (pkgMain) {
|
||||
@ -1677,12 +1739,11 @@ export function getRequireJs(): RequireJS {
|
||||
|
||||
//Join the path parts together, then figure out if baseUrl is needed.
|
||||
url = syms.join('/');
|
||||
url += (ext || (/^data\:|^blob\:|\?/.test(url) || skipExt ? '' : '.js'));
|
||||
url += ext || (/^data\:|^blob\:|\?/.test(url) || skipExt ? '' : '.js');
|
||||
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
|
||||
}
|
||||
|
||||
return config.urlArgs && !/^blob\:/.test(url) ?
|
||||
url + config.urlArgs(moduleName, url) : url;
|
||||
return config.urlArgs && !/^blob\:/.test(url) ? url + config.urlArgs(moduleName, url) : url;
|
||||
},
|
||||
|
||||
//Delegates to req.load. Broken out as a separate function to
|
||||
@ -1712,8 +1773,7 @@ export function getRequireJs(): RequireJS {
|
||||
//Using currentTarget instead of target for Firefox 2.0's sake. Not
|
||||
//all old browsers will be supported, but this one was easy enough
|
||||
//to support and still makes sense.
|
||||
if (evt.type === 'load' ||
|
||||
(readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
|
||||
if (evt.type === 'load' || readyRegExp.test((evt.currentTarget || evt.srcElement).readyState)) {
|
||||
//Reset interactive script so a script node is not held onto for
|
||||
//to long.
|
||||
interactiveScript = null;
|
||||
@ -1741,12 +1801,16 @@ export function getRequireJs(): RequireJS {
|
||||
});
|
||||
}
|
||||
});
|
||||
return onError(makeError('scripterror', 'Script error for "' + data.id +
|
||||
(parents.length ?
|
||||
'", needed by: ' + parents.join(', ') :
|
||||
'"'), evt, [data.id]));
|
||||
}
|
||||
return onError(
|
||||
makeError(
|
||||
'scripterror',
|
||||
'Script error for "' + data.id + (parents.length ? '", needed by: ' + parents.join(', ') : '"'),
|
||||
evt,
|
||||
[data.id],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
context.require = context.makeRequire();
|
||||
@ -1768,9 +1832,9 @@ export function getRequireJs(): RequireJS {
|
||||
* name for minification/local scope use.
|
||||
*/
|
||||
req = requirejs = function (deps, callback, errback, optional) {
|
||||
|
||||
//Find the right context, use default
|
||||
var context, config,
|
||||
var context,
|
||||
config,
|
||||
contextName = defContextName;
|
||||
|
||||
// Determine if have config object in the call.
|
||||
@ -1817,9 +1881,14 @@ export function getRequireJs(): RequireJS {
|
||||
* that have a better solution than setTimeout.
|
||||
* @param {Function} fn function to execute later.
|
||||
*/
|
||||
req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) {
|
||||
req.nextTick =
|
||||
typeof setTimeout !== 'undefined'
|
||||
? function (fn) {
|
||||
setTimeout(fn, 4);
|
||||
} : function (fn) { fn(); };
|
||||
}
|
||||
: function (fn) {
|
||||
fn();
|
||||
};
|
||||
|
||||
/**
|
||||
* Export require as a global, but only if it does not already exist.
|
||||
@ -1835,19 +1904,14 @@ export function getRequireJs(): RequireJS {
|
||||
req.isBrowser = isBrowser;
|
||||
s = req.s = {
|
||||
contexts: contexts,
|
||||
newContext: newContext
|
||||
newContext: newContext,
|
||||
};
|
||||
|
||||
//Create default context.
|
||||
req({});
|
||||
|
||||
//Exports some context-sensitive methods on global require.
|
||||
each([
|
||||
'toUrl',
|
||||
'undef',
|
||||
'defined',
|
||||
'specified'
|
||||
], function (prop) {
|
||||
each(['toUrl', 'undef', 'defined', 'specified'], function (prop) {
|
||||
//Reference from contexts instead of early binding to default context,
|
||||
//so that during builds, the latest instance of the default context
|
||||
//with its config gets used.
|
||||
@ -1879,9 +1943,9 @@ export function getRequireJs(): RequireJS {
|
||||
* Creates the node for the load command. Only used in browser envs.
|
||||
*/
|
||||
req.createNode = function (config, moduleName, url) {
|
||||
var node = config.xhtml ?
|
||||
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
|
||||
document.createElement('script');
|
||||
var node = config.xhtml
|
||||
? document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script')
|
||||
: document.createElement('script');
|
||||
node.type = config.scriptType || 'text/javascript';
|
||||
node.charset = 'utf-8';
|
||||
node.async = true;
|
||||
@ -1915,7 +1979,8 @@ export function getRequireJs(): RequireJS {
|
||||
//https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
|
||||
//UNFORTUNATELY Opera implements attachEvent but does not follow the script
|
||||
//script execution mode.
|
||||
if (node.attachEvent &&
|
||||
if (
|
||||
node.attachEvent &&
|
||||
//Check if node.attachEvent is artificially added by custom script or
|
||||
//natively supported by browser
|
||||
//read https://github.com/requirejs/requirejs/issues/187
|
||||
@ -1924,7 +1989,8 @@ export function getRequireJs(): RequireJS {
|
||||
//Note the test for "[native code" with no closing brace, see:
|
||||
//https://github.com/requirejs/requirejs/issues/273
|
||||
!(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
|
||||
!isOpera) {
|
||||
!isOpera
|
||||
) {
|
||||
//Probably IE. IE (at least 6-8) do not fire
|
||||
//script onload right after executing the script, so
|
||||
//we cannot tie the anonymous define call to a name.
|
||||
@ -1987,11 +2053,9 @@ export function getRequireJs(): RequireJS {
|
||||
//Account for anonymous modules
|
||||
context.completeLoad(moduleName);
|
||||
} catch (e) {
|
||||
context.onError(makeError('importscripts',
|
||||
'importScripts failed for ' +
|
||||
moduleName + ' at ' + url,
|
||||
e,
|
||||
[moduleName]));
|
||||
context.onError(
|
||||
makeError('importscripts', 'importScripts failed for ' + moduleName + ' at ' + url, e, [moduleName]),
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -2132,7 +2196,7 @@ export function getRequireJs(): RequireJS {
|
||||
};
|
||||
|
||||
define.amd = {
|
||||
jQuery: true
|
||||
jQuery: true,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -2150,6 +2214,8 @@ export function getRequireJs(): RequireJS {
|
||||
req(cfg);
|
||||
|
||||
return {
|
||||
requirejs, require, define
|
||||
}
|
||||
requirejs,
|
||||
require,
|
||||
define,
|
||||
};
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { FC, ReactNode } from 'react';
|
||||
import { CollectionProvider } from '../data-source/collection/CollectionProvider';
|
||||
import { CollectionManagerProvider } from '../data-source/collection/CollectionManagerProvider';
|
||||
import React, { FC, ReactNode } from 'react';
|
||||
|
||||
import { CollectionOptions } from '../data-source/collection/Collection';
|
||||
import React from 'react';
|
||||
import { CollectionManagerProvider } from '../data-source/collection/CollectionManagerProvider';
|
||||
import { CollectionProvider } from '../data-source/collection/CollectionProvider';
|
||||
|
||||
/**
|
||||
* @deprecated use `CollectionProvider` instead
|
||||
|
@ -1,17 +1,18 @@
|
||||
import { DownOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { ArrayTable } from '@tachybase/components';
|
||||
import { ISchema, useField, useForm } from '@tachybase/schema';
|
||||
import { uid } from '@tachybase/schema';
|
||||
import { ISchema, uid, useField, useForm } from '@tachybase/schema';
|
||||
|
||||
import { DownOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import { Button, Dropdown, MenuProps } from 'antd';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useRequest } from '../../api-client';
|
||||
import { RecordProvider, useRecord } from '../../record-provider';
|
||||
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import { useCancelAction } from '../action-hooks';
|
||||
import { useCollectionManager_deprecated } from '../hooks';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import * as components from './components';
|
||||
import { TemplateSummary } from './components/TemplateSummary';
|
||||
|
||||
|
@ -1,19 +1,20 @@
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import { ArrayTable } from '@tachybase/components';
|
||||
import { useField, useForm } from '@tachybase/schema';
|
||||
import { uid } from '@tachybase/schema';
|
||||
import { uid, useField, useForm } from '@tachybase/schema';
|
||||
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import { Button, Dropdown, MenuProps } from 'antd';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useRequest } from '../../api-client';
|
||||
import { RecordProvider, useRecord } from '../../record-provider';
|
||||
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import { useCancelAction } from '../action-hooks';
|
||||
import { useCollectionManager_deprecated } from '../hooks';
|
||||
import useDialect from '../hooks/useDialect';
|
||||
import { IField } from '../interfaces/types';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import * as components from './components';
|
||||
import { useFieldInterfaceOptions } from './interfaces';
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { ArrayTable } from '@tachybase/components';
|
||||
import { ISchema } from '@tachybase/schema';
|
||||
import { uid } from '@tachybase/schema';
|
||||
import { ISchema, uid } from '@tachybase/schema';
|
||||
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import { Button, Dropdown, MenuProps } from 'antd';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useRequest } from '../../api-client';
|
||||
import { useCollectionRecordData } from '../../data-source';
|
||||
import { RecordProvider } from '../../record-provider';
|
||||
|
@ -1,17 +1,18 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { ArrayTable } from '@tachybase/components';
|
||||
import { ISchema, useForm } from '@tachybase/schema';
|
||||
import { uid } from '@tachybase/schema';
|
||||
import { ISchema, uid, useForm } from '@tachybase/schema';
|
||||
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import omit from 'lodash/omit';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useAPIClient, useRequest } from '../../api-client';
|
||||
import { RecordProvider, useRecord } from '../../record-provider';
|
||||
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import { useCancelAction } from '../action-hooks';
|
||||
import { useCollectionManager_deprecated } from '../hooks';
|
||||
import { IField } from '../interfaces/types';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import * as components from './components';
|
||||
|
||||
const getSchema = (schema: IField, record: any, compile, getContainer): ISchema => {
|
||||
|
@ -1,20 +1,21 @@
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { ArrayTable } from '@tachybase/components';
|
||||
import { ISchema, useForm } from '@tachybase/schema';
|
||||
import { uid } from '@tachybase/schema';
|
||||
import { ISchema, uid, useForm } from '@tachybase/schema';
|
||||
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import omit from 'lodash/omit';
|
||||
import set from 'lodash/set';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useAPIClient, useRequest } from '../../api-client';
|
||||
import { useCollectionParentRecordData } from '../../data-source/collection-record/CollectionRecordProvider';
|
||||
import { RecordProvider, useRecord } from '../../record-provider';
|
||||
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import { useCancelAction } from '../action-hooks';
|
||||
import { useCollectionManager_deprecated } from '../hooks';
|
||||
import useDialect from '../hooks/useDialect';
|
||||
import { IField } from '../interfaces/types';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import * as components from './components';
|
||||
|
||||
const getSchema = (schema: IField, record: any, compile, getContainer): ISchema => {
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { ArrayTable } from '@tachybase/components';
|
||||
import { ISchema, useForm } from '@tachybase/schema';
|
||||
import { uid } from '@tachybase/schema';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import React, { useState } from 'react';
|
||||
import { ArrayTable } from '@tachybase/components';
|
||||
import { ISchema, uid, useForm } from '@tachybase/schema';
|
||||
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useAPIClient, useRequest } from '../../api-client';
|
||||
import { useRecord } from '../../record-provider';
|
||||
import { ActionContextProvider, SchemaComponent } from '../../schema-component';
|
||||
|
@ -1,18 +1,19 @@
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { ArrayTable } from '@tachybase/components';
|
||||
import { ISchema, useForm } from '@tachybase/schema';
|
||||
import { uid } from '@tachybase/schema';
|
||||
import { ISchema, uid, useForm } from '@tachybase/schema';
|
||||
|
||||
import { omit, set } from 'lodash';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useAPIClient, useRequest } from '../../api-client';
|
||||
import { useCollectionParentRecordData } from '../../data-source';
|
||||
import { RecordProvider, useRecord } from '../../record-provider';
|
||||
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import { useCancelAction } from '../action-hooks';
|
||||
import { useCollectionManager_deprecated } from '../hooks';
|
||||
import { IField } from '../interfaces/types';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import * as components from './components';
|
||||
|
||||
const getSchema = (schema: IField, record: any, compile, getContainer): ISchema => {
|
||||
|
@ -1,18 +1,19 @@
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import React, { useState } from 'react';
|
||||
import { ArrayTable } from '@tachybase/components';
|
||||
import { useField, useForm } from '@tachybase/schema';
|
||||
import { uid } from '@tachybase/schema';
|
||||
import { uid, useField, useForm } from '@tachybase/schema';
|
||||
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import { Button } from 'antd';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useAPIClient, useRequest } from '../../api-client';
|
||||
import { RecordProvider, useRecord } from '../../record-provider';
|
||||
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import { useCancelAction } from '../action-hooks';
|
||||
import { useCollectionManager_deprecated } from '../hooks';
|
||||
import { IField } from '../interfaces/types';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import { PreviewFields } from '../templates/components/PreviewFields';
|
||||
import { PreviewTable } from '../templates/components/PreviewTable';
|
||||
import * as components from './components';
|
||||
|
@ -1,18 +1,18 @@
|
||||
import { SyncOutlined } from '@ant-design/icons';
|
||||
import { FormLayout } from '@tachybase/components';
|
||||
import { createForm } from '@tachybase/schema';
|
||||
import { useField, useForm } from '@tachybase/schema';
|
||||
import { uid } from '@tachybase/schema';
|
||||
import { Button } from 'antd';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { FormLayout } from '@tachybase/components';
|
||||
import { createForm, uid, useField, useForm } from '@tachybase/schema';
|
||||
|
||||
import { SyncOutlined } from '@ant-design/icons';
|
||||
import { Button } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useAPIClient } from '../../api-client';
|
||||
import { useCollectionParentRecordData } from '../../data-source/collection-record/CollectionRecordProvider';
|
||||
import { RecordProvider, useRecord } from '../../record-provider';
|
||||
import { ActionContextProvider, FormProvider, SchemaComponent, useActionContext } from '../../schema-component';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import { useCancelAction } from '../action-hooks';
|
||||
import { useCollectionManager_deprecated } from '../hooks/useCollectionManager_deprecated';
|
||||
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
|
||||
import { FieldsConfigure, PreviewTable, SQLRequestProvider } from '../templates/components/sql-collection';
|
||||
|
||||
const schema = {
|
||||
|
@ -1,10 +1,11 @@
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { ArrayTable } from '@tachybase/components';
|
||||
import { ISchema } from '@tachybase/schema';
|
||||
import { uid } from '@tachybase/schema';
|
||||
import { ISchema, uid } from '@tachybase/schema';
|
||||
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import set from 'lodash/set';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useAPIClient, useRequest } from '../../api-client';
|
||||
import { useCollectionParentRecordData } from '../../data-source';
|
||||
import { RecordProvider, useRecord } from '../../record-provider';
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { observer } from '@tachybase/schema';
|
||||
import { Tag } from 'antd';
|
||||
import React from 'react';
|
||||
import { observer } from '@tachybase/schema';
|
||||
|
||||
import { Tag } from 'antd';
|
||||
|
||||
import { useCompile } from '../../../schema-component';
|
||||
|
||||
export const CollectionCategory = observer(
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { observer } from '@tachybase/schema';
|
||||
import { Tag } from 'antd';
|
||||
import React from 'react';
|
||||
import { observer } from '@tachybase/schema';
|
||||
|
||||
import { Tag } from 'antd';
|
||||
|
||||
import { useCompile } from '../../../schema-component';
|
||||
import { useCollectionManager_deprecated } from '../../hooks';
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { observer } from '@tachybase/schema';
|
||||
import { Tag } from 'antd';
|
||||
import React from 'react';
|
||||
import { observer } from '@tachybase/schema';
|
||||
|
||||
import { Tag } from 'antd';
|
||||
|
||||
import { useCompile } from '../../../schema-component';
|
||||
import { useCollectionManager_deprecated } from '../../hooks';
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useCollectionManager_deprecated } from '../../hooks';
|
||||
import Summary from './Summary';
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { observer } from '@tachybase/schema';
|
||||
|
||||
import { Tag } from 'antd';
|
||||
import { useAntdToken } from 'antd-style';
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { useCompile } from '../../../schema-component';
|
||||
|
||||
const Summary = observer(
|
||||
|
@ -1,5 +1,7 @@
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useCollectionManager_deprecated } from '../../hooks';
|
||||
import Summary from './Summary';
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { Field } from '@tachybase/schema';
|
||||
import { observer, useField, useForm } from '@tachybase/schema';
|
||||
import { Select, AutoComplete } from 'antd';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Field, observer, useField, useForm } from '@tachybase/schema';
|
||||
|
||||
import { AutoComplete, Select } from 'antd';
|
||||
|
||||
import { useRecord } from '../../../record-provider';
|
||||
import { useCompile } from '../../../schema-component';
|
||||
import { useCollectionManager_deprecated } from '../../hooks';
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface';
|
||||
import { useDataSourceManager } from '../../data-source/data-source/DataSourceManagerProvider';
|
||||
|
||||
export const getOptions = (
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { useField } from '@tachybase/schema';
|
||||
import { Result } from 'ahooks/es/useRequest/src/types';
|
||||
import React, { createContext, useContext, useEffect } from 'react';
|
||||
import { useField } from '@tachybase/schema';
|
||||
|
||||
import { Result } from 'ahooks/es/useRequest/src/types';
|
||||
|
||||
import { useCollectionManager_deprecated } from '.';
|
||||
import { CollectionProvider_deprecated, useRecord } from '..';
|
||||
import { useAPIClient, useRequest } from '../api-client';
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { FormItem, Input } from '@tachybase/components';
|
||||
import { ISchema, observer, useForm } from '@tachybase/schema';
|
||||
import React from 'react';
|
||||
import {
|
||||
Action,
|
||||
CollectionField,
|
||||
@ -8,7 +7,8 @@ import {
|
||||
SchemaComponent,
|
||||
SchemaComponentProvider,
|
||||
} from '@tachybase/client';
|
||||
import React from 'react';
|
||||
import { FormItem, Input } from '@tachybase/components';
|
||||
import { ISchema, observer, useForm } from '@tachybase/schema';
|
||||
|
||||
export default observer(() => {
|
||||
const collection = {
|
||||
|
@ -8,6 +8,7 @@ import {
|
||||
RecordProvider,
|
||||
useCollectionField_deprecated,
|
||||
} from '@tachybase/client';
|
||||
|
||||
import MockAdapter from 'axios-mock-adapter';
|
||||
|
||||
const apiClient = new APIClient();
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { ISchema } from '@tachybase/schema';
|
||||
import React from 'react';
|
||||
import {
|
||||
AntdSchemaComponentProvider,
|
||||
ExtendCollectionsProvider,
|
||||
SchemaComponent,
|
||||
SchemaComponentProvider,
|
||||
} from '@tachybase/client';
|
||||
import React from 'react';
|
||||
import { ISchema } from '@tachybase/schema';
|
||||
|
||||
const schema: ISchema = {
|
||||
type: 'object',
|
||||
|
@ -1,14 +1,10 @@
|
||||
import { FormDrawer, FormLayout } from '@tachybase/components';
|
||||
import { createForm } from '@tachybase/schema';
|
||||
import { ISchema } from '@tachybase/schema';
|
||||
import { FormContext, SchemaOptionsContext } from '@tachybase/schema';
|
||||
import { uid } from '@tachybase/schema';
|
||||
import React, { useContext } from 'react';
|
||||
import {
|
||||
AntdSchemaComponentProvider,
|
||||
Application,
|
||||
CardItem,
|
||||
CollectionManagerProvider_deprecated,
|
||||
CollectionManagerProvider,
|
||||
CollectionManagerProvider_deprecated,
|
||||
CollectionProvider_deprecated,
|
||||
FormItem,
|
||||
Grid,
|
||||
@ -20,13 +16,15 @@ import {
|
||||
SchemaComponentOptions,
|
||||
SchemaInitializer,
|
||||
SchemaInitializerItem,
|
||||
useCollectionManager_deprecated,
|
||||
useCollectionManager,
|
||||
useCollectionManager_deprecated,
|
||||
useSchemaInitializer,
|
||||
useSchemaInitializerItem,
|
||||
} from '@tachybase/client';
|
||||
import { FormDrawer, FormLayout } from '@tachybase/components';
|
||||
import { createForm, FormContext, ISchema, SchemaOptionsContext, uid } from '@tachybase/schema';
|
||||
|
||||
import { cloneDeep } from 'lodash';
|
||||
import React, { useContext } from 'react';
|
||||
|
||||
const collection: any = {
|
||||
name: 'posts',
|
||||
|
@ -1,14 +1,16 @@
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { uid } from '@tachybase/schema';
|
||||
|
||||
import { CascaderProps } from 'antd';
|
||||
import _ from 'lodash';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { useCompile, useSchemaComponentContext } from '../../schema-component';
|
||||
import { CollectionFieldOptions_deprecated, CollectionOptions } from '../types';
|
||||
import { InheritanceCollectionMixin } from '../mixins/InheritanceCollectionMixin';
|
||||
import { uid } from '@tachybase/schema';
|
||||
|
||||
import { useCollectionManager } from '../../data-source/collection/CollectionManagerProvider';
|
||||
import { DEFAULT_DATA_SOURCE_KEY } from '../../data-source/data-source/DataSourceManager';
|
||||
import { useDataSourceManager } from '../../data-source/data-source/DataSourceManagerProvider';
|
||||
import { useDataSource } from '../../data-source/data-source/DataSourceProvider';
|
||||
import { DEFAULT_DATA_SOURCE_KEY } from '../../data-source/data-source/DataSourceManager';
|
||||
import { useCollectionManager } from '../../data-source/collection/CollectionManagerProvider';
|
||||
import { useCompile, useSchemaComponentContext } from '../../schema-component';
|
||||
import { InheritanceCollectionMixin } from '../mixins/InheritanceCollectionMixin';
|
||||
import { CollectionFieldOptions_deprecated, CollectionOptions } from '../types';
|
||||
|
||||
/**
|
||||
* @deprecated use `useCollectionManager` instead
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { SchemaKey } from '@tachybase/schema';
|
||||
import { useAPIClient } from '../../api-client';
|
||||
import { InheritanceCollectionMixin } from '../mixins/InheritanceCollectionMixin';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { SchemaKey } from '@tachybase/schema';
|
||||
|
||||
import { useAPIClient } from '../../api-client';
|
||||
import { useCollection } from '../../data-source/collection/CollectionProvider';
|
||||
import { InheritanceCollectionMixin } from '../mixins/InheritanceCollectionMixin';
|
||||
|
||||
export type Collection_deprecated = ReturnType<typeof useCollection_deprecated>;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { render, screen, waitFor } from '@tachybase/test/client';
|
||||
import React from 'react';
|
||||
import { render, screen, waitFor } from '@tachybase/test/client';
|
||||
|
||||
import { CurrentAppInfoContext } from '../../../appInfo';
|
||||
import { Checkbox } from '../../../schema-component/antd/checkbox';
|
||||
import { Input } from '../../../schema-component/antd/input';
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { ISchema } from '@tachybase/schema';
|
||||
|
||||
import { defaultProps, operators } from '../';
|
||||
import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface';
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user