Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat support router subpage #935

Merged
merged 18 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
2322fc6
refactor(canvas/render): ts support, separate context functions from…
rhlin Dec 9, 2024
174b09a
feat(canvas/render): move context to page-block-function, unify parse…
rhlin Dec 10, 2024
c8f9a55
feat(canvas/render): add RouteView built-in component
rhlin Dec 13, 2024
0524ad6
fea(canvas/render): multiple instantiable RenderMain, handle multi pa…
rhlin Dec 13, 2024
48cc8b9
chore: modify eslint rules for ts files
rhlin Dec 13, 2024
0f3ee58
build(canvas): fix file extension name for build file
rhlin Dec 13, 2024
de509ef
feat(canvas/render): support router page data fetch and render
rhlin Dec 18, 2024
01dae0e
Merge remote-tracking branch 'upstream/feat/router-page' into feat-su…
rhlin Dec 21, 2024
cd18d18
fix(canvas/render): fix modify parent page and switch to child page, …
rhlin Dec 21, 2024
e9c3cd8
feat(canvas/render): add builtin router-link material
rhlin Dec 21, 2024
0c09f0f
Merge remote-tracking branch 'upstream/feat/router-page' into feat-su…
rhlin Dec 23, 2024
777a428
fix(canvas/render): fix when page ancestors contain number id cause r…
rhlin Dec 23, 2024
7db6504
fix(canvas/render): inactive page should not inject placeholder for…
rhlin Dec 24, 2024
3a31dda
feat(plugins/materials): useResource when no pageId, after fetching d…
rhlin Dec 24, 2024
36662cb
fix: fix review comments,enhance readability, remove unnecessary pack…
rhlin Dec 24, 2024
24e3192
fix(canvas/render): rename historyChanged to locationHistoryChanged
rhlin Dec 26, 2024
9401670
fix(canvas/render): fix review comments, remove unnecessary import, a…
rhlin Dec 26, 2024
0deea33
fix(canvas/render): rename historyChanged to locationHistoryChanged m…
rhlin Dec 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"devDependencies": {
"@babel/eslint-parser": "^7.21.3",
"@types/node": "^18.0.0",
"@vue/eslint-config-typescript": "^11.0.3",
"chokidar": "^3.5.3",
"concurrently": "^8.2.0",
"cross-env": "^7.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/build/vite-config/src/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const getDefaultConfig = (engineConfig) => {
base: './',
publicDir: path.resolve(root, './public'),
resolve: {
extensions: ['.js', '.jsx', '.vue'],
extensions: ['.js', '.jsx', '.vue', '.ts', '.tsx'],
alias: {}
},
server: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const getDevAlias = (useSourceAlias) => {
'@opentiny/tiny-engine-theme-light': path.resolve(basePath, 'packages/theme/light/index.less'),
'@opentiny/tiny-engine-theme-base': path.resolve(basePath, 'packages/theme/base/src/index.js'),
'@opentiny/tiny-engine-svgs': path.resolve(basePath, 'packages/svgs/index.js'),
'@opentiny/tiny-engine-canvas/render': path.resolve(basePath, 'packages/canvas/render/index.js'),
'@opentiny/tiny-engine-canvas/render': path.resolve(basePath, 'packages/canvas/render/index.ts'),
'@opentiny/tiny-engine-canvas': path.resolve(basePath, 'packages/canvas/index.js'),
'@opentiny/tiny-engine-utils': path.resolve(basePath, 'packages/utils/src/index.js'),
'@opentiny/tiny-engine-webcomponent-core': path.resolve(basePath, 'packages/webcomponent/src/lib.js'),
Expand Down
11 changes: 6 additions & 5 deletions packages/canvas/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,23 @@
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

module.exports = {
env: {
browser: true,
es2015: true,
node: true,
jest: true
},
extends: ['eslint:recommended', 'plugin:vue/vue3-essential'],
extends: ['eslint:recommended', 'plugin:vue/vue3-essential', '@vue/eslint-config-typescript'],
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@babel/eslint-parser',
parser: '@typescript-eslint/parser',
ecmaVersion: 'latest',
sourceType: 'module',
requireConfigFile: false,
babelOptions: {
parserOpts: {
plugins: ['jsx']
plugins: ['jsx', 'typescript']
}
}
},
Expand All @@ -37,6 +36,8 @@ module.exports = {
'space-before-function-paren': 'off',
'vue/multi-word-component-names': 'off',
'no-use-before-define': 'error',
'no-unused-vars': ['error', { ignoreRestSiblings: true, varsIgnorePattern: '^_', argsIgnorePattern: '^_' }]
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true, varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
'import/no-inner-modules': 'off'
}
}
34 changes: 32 additions & 2 deletions packages/canvas/DesignCanvas/src/DesignCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,22 @@
</template>

<script>
import { ref, watch, onUnmounted } from 'vue'
import { ref, watch, onUnmounted, onMounted } from 'vue'
import {
useProperties,
useCanvas,
useLayout,
useMaterial,
useHistory,
useModal,
usePage,
useMessage,
getMergeRegistry,
getMergeMeta,
getOptions,
getMetaApi,
META_SERVICE
META_SERVICE,
META_APP
} from '@opentiny/tiny-engine-meta-register'
import { constants } from '@opentiny/tiny-engine-utils'
import * as ast from '@opentiny/tiny-engine-common/js/ast'
Expand Down Expand Up @@ -169,6 +172,29 @@ export default {
canvasResizeObserver?.disconnect?.()
})

const { addToCallbackFns: addHistoryDataChangedCallback } = (function () {
const callbackFns = new Set()

const { subscribe, unsubscribe } = useMessage()
const topic = 'locationHistoryChanged'
const callback = (value) => callbackFns.forEach((cb) => cb(value))

onMounted(() => {
subscribe({ topic, callback })
})

onUnmounted(() => {
unsubscribe({ topic, callback })
})
function addToCallbackFns(cb) {
callbackFns.add(cb)
return () => callbackFns.delete(cb)
}
return {
addToCallbackFns
}
})()

return {
removeNode,
canvasSrc,
Expand All @@ -183,6 +209,10 @@ export default {
addHistory: useHistory().addHistory,
registerBlock: useMaterial().registerBlock,
request: getMetaApi(META_SERVICE.Http).getHttp(),
getPageById: getMetaApi(META_APP.AppManage).getPageById,
getPageAncestors: usePage().getAncestors,
getBaseInfo: () => getMetaApi(META_SERVICE.GlobalService).getBaseInfo(),
addHistoryDataChangedCallback,
ast
},
CanvasLayout,
Expand Down
5 changes: 4 additions & 1 deletion packages/canvas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@
"@babel/core": "7.18.13",
"@opentiny/tiny-engine-builtin-component": "workspace:*",
"@opentiny/tiny-engine-common": "workspace:*",
"@opentiny/tiny-engine-dsl-vue": "workspace:*",
"@opentiny/tiny-engine-i18n-host": "workspace:*",
"@opentiny/tiny-engine-meta-register": "workspace:*",
"@opentiny/tiny-engine-utils": "workspace:*",
"@opentiny/tiny-engine-webcomponent-core": "workspace:*",
"@vue/babel-plugin-jsx": "1.1.1",
"@vue/shared": "^3.3.4",
"@vueuse/core": "^9.6.0"
"@vueuse/core": "^9.6.0",
"postcss": "^8.4.31",
"postcss-selector-parser": "^7.0.0"
},
"devDependencies": {
"@opentiny/tiny-engine-vite-plugin-meta-comments": "workspace:*",
Expand Down
File renamed without changes.
Loading