Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3ce54a

Browse files
committed
copy from client and rename it as viewer
1 parent 715ff05 commit e3ce54a

File tree

5,275 files changed

+437205
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,275 files changed

+437205
-0
lines changed

viewer/.gitignore

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/packages/*/node_modules
6+
/packages/*/dist
7+
/packages/*/tsdoc-metadata.json
8+
/.pnp
9+
.pnp.js
10+
11+
# testing
12+
/**/coverage
13+
14+
15+
# production
16+
/build
17+
/packages/lowcoder/build
18+
19+
# misc
20+
.DS_Store
21+
.env.local
22+
.env.development.local
23+
.env.test.local
24+
.env.production.local
25+
26+
npm-debug.log*
27+
yarn-debug.log*
28+
yarn-error.log*
29+
30+
/out
31+
/public/fonts/*
32+
/src/assets/icons/fonts/*
33+
.idea
34+
.storybook-out/
35+
cypress/videos
36+
cypress/screenshots
37+
/cypress.env.json
38+
39+
storybook-static/*
40+
build-storybook.log
41+
42+
TODO
43+
44+
.yarn/*
45+
!.yarn/cache
46+
!.yarn/patches
47+
!.yarn/plugins
48+
!.yarn/releases
49+
!.yarn/sdks
50+
!.yarn/versions
51+
52+
/ossutil_output
53+
package-lock.json
54+
55+
op.mjs
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
diff --git a/lib/rules/only-ascii.js b/lib/rules/only-ascii.js
2+
index 7d76f9d37a99be35bab91d7a437073b112e2e985..b6ccac270f309232471d8e26ad8ec1bb782079f7 100644
3+
--- a/lib/rules/only-ascii.js
4+
+++ b/lib/rules/only-ascii.js
5+
@@ -39,7 +39,7 @@ function create (context) {
6+
7+
// Get tokens which include non-ascii characters
8+
var sourceCode = context.getSourceCode();
9+
- var tokens = sourceCode.getTokens(node);
10+
+ var tokens = sourceCode.tokensAndComments;
11+
12+
tokens.forEach(function (token) {
13+
var value = token.value;
14+
diff --git a/package.json b/package.json
15+
index b6a4e0e402ed2c934cca2124e8ab9d2b43a198a2..d781a469e7a7d502a20e0dab27fc9c8adad4ffd8 100644
16+
--- a/package.json
17+
+++ b/package.json
18+
@@ -16,11 +16,14 @@
19+
"requireindex": "~1.1.0"
20+
},
21+
"devDependencies": {
22+
- "eslint": "~3.9.1",
23+
+ "eslint": "^8.0.0",
24+
"mocha": "^3.1.2"
25+
},
26+
"engines": {
27+
"node": ">=0.10.0"
28+
},
29+
- "license": "ISC"
30+
+ "license": "ISC",
31+
+ "peerDependencies": {
32+
+ "eslint": "8"
33+
+ }
34+
}
35+
diff --git a/tests/lib/rules/only-ascii.js b/tests/lib/rules/only-ascii.js
36+
index 21cca9c932ac41804bb36ccd35787cdf121b4f16..a84c5a5dbf7ddb89637b88059432484b215ae098 100644
37+
--- a/tests/lib/rules/only-ascii.js
38+
+++ b/tests/lib/rules/only-ascii.js
39+
@@ -8,15 +8,19 @@ var ruleTester = new RuleTester();
40+
ruleTester.run('no-japanese', rule, {
41+
42+
valid : [
43+
- { code : 'console.log("hello")', options : [] },
44+
+ { code : 'console.log("hello") // ok', options : [] },
45+
{ code : 'console.log("hello☆")', options : [{ allowedChars : '☆' }] },
46+
{ code : 'console.log("☆")', filename : 'foo', options : [{ excludePaths : ['foo'] }] },
47+
],
48+
49+
- invalid : [{
50+
+ invalid : [
51+
+ {
52+
+ code : 'console.info("hello"); // console.log("ハロー")',
53+
+ errors : [{ message : 'Non-ascii character "ハロー" found' }],
54+
+ },{
55+
code : 'console.log("ハロー")',
56+
errors : [{ message : 'Non-ascii character "ハロー" found' }],
57+
- }, {
58+
+ },{
59+
code : 'console.log("ハロー☆")',
60+
options : [{ allowedChars : '☆' }],
61+
errors : [{ message : 'Non-ascii character "ハロー" found' }],
62+
@@ -25,5 +29,6 @@ ruleTester.run('no-japanese', rule, {
63+
filename : 'foo',
64+
options : [{ excludePaths : ['bar'] }],
65+
errors : [{ message : 'Non-ascii character "☆" found' }],
66+
- }],
67+
+ }
68+
+ ],
69+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
diff --git a/dist/es/WindowScroller/utils/onScroll.js b/dist/es/WindowScroller/utils/onScroll.js
2+
index d00f0f18c6596e4e57f4f762f91fed4282610c91..c8496e8eabafdf9cf6071986ec446839d7b65556 100644
3+
--- a/dist/es/WindowScroller/utils/onScroll.js
4+
+++ b/dist/es/WindowScroller/utils/onScroll.js
5+
@@ -71,4 +71,3 @@ export function unregisterScrollListener(component, element) {
6+
}
7+
}
8+
}
9+
\ No newline at end of file
10+
-import { bpfrpt_proptype_WindowScroller } from "../WindowScroller.js";
11+
\ No newline at end of file

viewer/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Lines changed: 28 additions & 0 deletions
Large diffs are not rendered by default.

viewer/.yarn/releases/yarn-3.6.4.cjs

Lines changed: 874 additions & 0 deletions
Large diffs are not rendered by default.

viewer/.yarnrc.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
nodeLinker: node-modules
2+
3+
npmRegistryServer: "https://registry.npmjs.org"
4+
5+
plugins:
6+
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
7+
spec: "@yarnpkg/plugin-workspace-tools"
8+
9+
yarnPath: .yarn/releases/yarn-3.6.4.cjs

viewer/README.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Lowcoder frontend
2+
3+
## How to contribute
4+
5+
### Start a local backend server
6+
7+
#### Use prebuilt docker image
8+
9+
Simply run the below command to start a backend server.
10+
11+
```bash
12+
docker run -d --name lowcoder -p 3000:3000 -v "$PWD/stacks:/lowcoder-stacks" lowcoderorg/lowcoder-ce
13+
```
14+
15+
For more information, view our [docs](https://docs.lowcoder.cloud/lowcoder-documentation/setup-and-run/self-hosting)
16+
17+
#### Build Docker image from source
18+
19+
1. Check out the source code and change to source dir.
20+
2. Use the command below to build a Docker image :
21+
22+
```bash
23+
docker build -f ./deploy/docker/Dockerfile -t lowcoder-dev .
24+
```
25+
26+
3. Start
27+
28+
```bash
29+
docker run -d --name lowcoder-dev -p 3000:3000 -v "$PWD/stacks:/lowcoder-stacks" lowcoder-dev
30+
```
31+
32+
### Start develop
33+
34+
35+
1. Check out source code.
36+
2. Change to **/client** dir in the source dir.
37+
38+
```bash
39+
cd client
40+
```
41+
3. Run yarn to install dependencies.
42+
43+
```bash
44+
yarn install
45+
```
46+
47+
4. Start dev server:
48+
49+
```bash
50+
LOWCODER_API_SERVICE_URL=http://localhost:3000 yarn start
51+
```
52+
53+
5. After dev server starts successfully, it will be automatically opened in the default browser.
54+
55+
### Before submitting a pull request
56+
57+
In addition, before submitting a pull request, please make sure the following is done:
58+
59+
1. If you’ve fixed a bug or added code that should be tested and add unit test suite.
60+
2. Run test and ensure all test suites pass.
61+
62+
```bash
63+
yarn test
64+
```
65+
66+
3. If you add new dependency, use the yarn worspace tool to make sure yarn.lock is also updated.
67+
68+
```bash
69+
yarn workspace lowcoder <package name>
70+
```
71+
72+
### Developing and publishung UI components for Lowcoder
73+
74+
1. Initialization
75+
76+
Project initiation
77+
78+
```bash
79+
yarn create Lowcoder-plugin <your plugin name>
80+
```
81+
82+
Go to the project root
83+
84+
```bash
85+
cd my-plugin
86+
```
87+
88+
Start the development environment
89+
90+
```bash
91+
yarn start
92+
```
93+
94+
After executing yarn start, the browser is automatically opened and you enter the component development environment.
95+
Please find more information in our [docs](https://docs.lowcoder.cloud/lowcoder-documentation/lowcoder-extension/develop-ui-components-for-apps)
96+
97+
2. Export components
98+
99+
To export all the components, use src/index.ts, for example:
100+
101+
```bash
102+
import HelloWorldComp from "./HelloWorldComp";
103+
104+
export default {
105+
hello_world: HelloWorldComp,
106+
};
107+
```
108+
109+
import HelloWorldComp from "./HelloWorldComp";
110+
111+
3. Publish plugins
112+
113+
When you finish developing and testing the plugin, you can publish it into the npm registry. Login in to the npm registry locally, and then execute the following command:
114+
115+
```bash
116+
yarn build --publish
117+
```
118+
119+
You can check a code demo here: [Code Demo on Github](https://github.com/lowcoder-org/lowcoder/tree/main/client/packages/lowcoder-plugin-demo)

viewer/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.4.5

viewer/config/test/jest.config.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import path, { dirname } from "node:path";
2+
import { fileURLToPath } from "node:url";
3+
import { buildVars } from "../../scripts/buildVars.js";
4+
5+
export function currentDirName(importMetaUrl) {
6+
return dirname(fileURLToPath(importMetaUrl));
7+
}
8+
9+
const globals = {};
10+
buildVars.forEach(({ name, defaultValue }) => {
11+
globals[name] = process.env[name] || defaultValue;
12+
});
13+
const currentDir = currentDirName(import.meta.url);
14+
15+
export default {
16+
testEnvironment: "jsdom",
17+
moduleNameMapper: {
18+
"react-markdown": path.resolve(currentDir, "./mocks/react-markdown.js"),
19+
"\\.md\\?url$": path.resolve(currentDir, "./mocks/markdown-url-module.js"),
20+
"^@lowcoder-ee(.*)$": path.resolve(
21+
currentDir, "../../packages/lowcoder/src/$1"
22+
),
23+
"lowcoder-sdk": path.resolve(currentDir, "../../packages/lowcoder/src/index.sdk"),
24+
},
25+
globals,
26+
// roots: ["<rootDir>/src"],
27+
modulePaths: [
28+
"<rootDir>/src",
29+
path.resolve(currentDir, "../../packages/lowcoder/src"),
30+
path.resolve(currentDir, "../../packages/lowcoder-comps/src"),
31+
path.resolve(currentDir, "../../packages/lowcoder-design/src"),
32+
],
33+
setupFiles: [path.resolve(currentDir, "./jest.setup.js")],
34+
setupFilesAfterEnv: [path.resolve(currentDir, "./jest.setup-after-env.js"), 'jest-canvas-mock'],
35+
transform: {
36+
"^.+\\.(js|jsx|mjs|cjs|ts|tsx)$": path.resolve(currentDir, "./transform/babelTransform.js"),
37+
"^.+\\.css$": path.resolve(currentDir, "./transform/cssTransform.js"),
38+
"^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)": path.resolve(
39+
currentDir,
40+
"./transform/fileTransform.js"
41+
),
42+
},
43+
transformIgnorePatterns: [],
44+
resetMocks: true,
45+
};
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// jest-dom adds custom jest matchers for asserting on DOM nodes.
2+
// allows you to do things like:
3+
// expect(element).toHaveTextContent(/react/i)
4+
// learn more: https://github.com/testing-library/jest-dom
5+
import "@testing-library/jest-dom";
6+
7+
// implementation of window.resizeTo for dispatching event
8+
window.resizeTo = function resizeTo(width, height) {
9+
Object.assign(this, {
10+
innerWidth: width,
11+
innerHeight: height,
12+
outerWidth: width,
13+
outerHeight: height,
14+
}).dispatchEvent(new this.Event("resize"));
15+
};
16+
17+
window.ResizeObserver = function () {
18+
return {
19+
observe: () => {},
20+
unobserve: () => {},
21+
disconnect: () => {},
22+
};
23+
};
24+
25+
Object.defineProperty(window, 'ImageData', { value: 'yourValue' });
26+
Object.defineProperty(window, 'MediaStreamTrack', { value: 'yourValue' });
27+
Object.defineProperty(window, 'URL', {
28+
writable: true,
29+
value: {
30+
createObjectURL: jest.fn(),
31+
}
32+
});
33+
Object.defineProperty(window, "navigator", {
34+
writable: true,
35+
value: {
36+
mediaDevices: {
37+
enumerateDevices: jest.fn(),
38+
},
39+
userAgent: '',
40+
language: '',
41+
browserLanguage: '',
42+
},
43+
});
44+
45+
class Worker {
46+
constructor(stringUrl) {
47+
this.url = stringUrl;
48+
this.onmessage = () => {};
49+
}
50+
51+
postMessage(msg) {
52+
this.onmessage(msg);
53+
}
54+
}
55+
56+
window.Worker = Worker;

viewer/config/test/jest.setup.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if (typeof window !== "undefined") {
2+
require("whatwg-fetch");
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default "";
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function ReactMarkdown({ children }) {
2+
return <>{children}</>;
3+
}
4+
5+
export default ReactMarkdown;

0 commit comments

Comments
 (0)