├── .editorconfig ├── .eslintrc.js ├── .gitignore ├── .npmrc ├── .prettierrc ├── .stylelintrc.js ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── build.json ├── build.plugin.js ├── package.json ├── pnpm-lock.yaml ├── public ├── index.html ├── js │ ├── vue-renderer.d.ts │ ├── vue-renderer.js │ ├── vue-renderer.js.map │ ├── vue-simulator-renderer.css │ ├── vue-simulator-renderer.js │ ├── vue-simulator-renderer.js.map │ └── vue.runtime.global.js ├── mock │ └── info.json └── preview.html ├── src ├── assets │ ├── assets.json │ └── schema.json ├── components │ └── logo │ │ ├── logo.less │ │ └── logo.tsx ├── editor.less ├── editor.ts ├── plugins │ ├── actions.ts │ ├── init.ts │ ├── registry.ts │ └── setter.ts ├── utils │ └── store.ts └── vue │ └── preview.ts └── tsconfig.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | 8 | [*.md] 9 | trim_trailing_whitespace = false 10 | 11 | [*.{ts,tsx,vue,less}] 12 | indent_size = 2 13 | 14 | trim_trailing_whitespace = true 15 | insert_final_newline = true 16 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | settings: { 3 | react: { 4 | version: '16.9', 5 | }, 6 | }, 7 | env: { 8 | node: true, 9 | es2021: true, 10 | browser: true, 11 | }, 12 | extends: [ 13 | 'eslint:recommended', 14 | 'plugin:react/recommended', 15 | 'plugin:prettier/recommended', 16 | ], 17 | parser: '@typescript-eslint/parser', 18 | parserOptions: { 19 | ecmaFeatures: { 20 | jsx: true, 21 | }, 22 | ecmaVersion: 'latest', 23 | sourceType: 'module', 24 | }, 25 | plugins: ['react', '@typescript-eslint'], 26 | rules: { 27 | 'react/react-in-jsx-scope': 'off', 28 | }, 29 | }; 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | .ice 11 | node_modules 12 | .DS_Store 13 | es 14 | lib 15 | dist 16 | temp 17 | dist-ssr 18 | coverage 19 | 20 | /cypress/videos/ 21 | /cypress/screenshots/ 22 | 23 | # Editor directories and files 24 | .vscode/* 25 | !.vscode/settings.json 26 | !.vscode/extensions.json 27 | .idea 28 | *.suo 29 | *.ntvs* 30 | *.njsproj 31 | *.sln 32 | *.sw? -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | shamefully-hoist=true 2 | strict-peer-dependencies=false -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "proseWrap": "preserve", 4 | "tabWidth": 2, 5 | "useTabs": false, 6 | "endOfLine": "auto", 7 | "bracketSpacing": true, 8 | "stylelintIntegration": true, 9 | "eslintIntegration": true, 10 | "semi": true, 11 | "vueIndentScriptAndStyle": false, 12 | "printWidth": 90 13 | } 14 | -------------------------------------------------------------------------------- /.stylelintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: [ 3 | 'stylelint-config-standard', 4 | 'stylelint-config-prettier', 5 | 'stylelint-config-rational-order', 6 | 'stylelint-config-recommended-vue', 7 | 'stylelint-config-recommended-less', 8 | ], 9 | rules: { 10 | 'at-rule-no-unknown': null, 11 | 'no-descending-specificity': null, 12 | 'color-no-invalid-hex': true, 13 | 'less/color-no-invalid-hex': true, 14 | 'selector-pseudo-element-no-unknown': [true, { ignorePseudoElements: ['v-deep'] }], 15 | 'selector-pseudo-class-no-unknown': [true, { ignorePseudoClasses: ['deep'] }], 16 | 'no-descending-specificity': null, 17 | 'declaration-block-trailing-semicolon': null, 18 | 'font-family-no-missing-generic-family-keyword': null, 19 | }, 20 | overrides: [ 21 | { 22 | files: ['**/*.less'], 23 | customSyntax: 'postcss-less', 24 | }, 25 | ], 26 | }; 27 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "editor.defaultFormatter": "esbenp.prettier-vscode", 4 | "editor.codeActionsOnSave": { 5 | "source.fixAll.eslint": true, 6 | "source.fixAll.stylelint": true 7 | }, 8 | "css.validate": false, 9 | "less.validate": false, 10 | "scss.validate": false, 11 | "prettier.enable": true, 12 | "eslint.validate": ["vue", "ts", "tsx"], 13 | "volar.autoCompleteRefs": false, 14 | "volar.codeLens.scriptSetupTools": false, 15 | "volar.codeLens.references": false, 16 | "volar.completion.autoImportComponent": false, 17 | "volar.completion.preferredTagNameCase": "kebab", 18 | "stylelint.validate": ["css", "less", "postcss", "vue"] 19 | } 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 KNX 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lowcode-engine-demo 2 | 3 | Lowcode Engine Vue demo,[在线演示](https://knxcloud.github.io/lowcode-engine-demo/) 4 | 5 | ## 运行演示 6 | 7 | ```bash 8 | git clone git@github.com:KNXCloud/lowcode-engine-demo.git 9 | cd lowcode-engine-demo 10 | pnpm install 11 | pnpm start 12 | ``` 13 | 14 | ## 使用注意事项 15 | 16 | 使用变量时: 17 | 18 | - `this.props.xxx` -> `this.xxx` 19 | - `this.state.xxx` -> `this.xxx` 20 | 21 | 现阶段 vue 代码编辑器还未适配,可以直接使用 react 代码编辑器编辑代码 22 | 23 | - state 内容会自动转化为 vue data 24 | - lifecycle 自动适配为 vue lifecycle 25 | - `componentDidMount` -> `onMounted` 26 | - `componentDidCatch` -> `onErrorCaptured` 27 | - `shouldComponentUpdate` -> `onBeforeUpdate` 28 | - `componentWillUnmount` -> `onBeforeUnmount` 29 | - 其余方法自动转化为 vue methods 30 | -------------------------------------------------------------------------------- /build.json: -------------------------------------------------------------------------------- 1 | { 2 | "entry": { 3 | "preview": "./src/vue/preview.ts" 4 | }, 5 | "publicPath": "/", 6 | "externals": { 7 | "@alifd/next": "var window.Next", 8 | "@alilc/lowcode-engine": "var window.AliLowCodeEngine", 9 | "@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt", 10 | "@alilc/lowcode-editor-core": "var window.AliLowCodeEngine.common.editorCabin", 11 | "@alilc/lowcode-designer": "var window.AliLowCodeEngine.common.designerCabin", 12 | "@alilc/lowcode-editor-skeleton": "var window.AliLowCodeEngine.common.skeletonCabin", 13 | "@knxcloud/lowcode-vue-renderer": "var window.LCVueRenderer", 14 | "@knxcloud/lowcode-vue-simulator-renderer": "var window.LCVueSimulatorRenderer", 15 | "lodash": "var window._", 16 | "moment": "var window.moment", 17 | "prop-types": "var window.PropTypes", 18 | "react": "var window.React", 19 | "react-dom": "var window.ReactDOM", 20 | "vue": "var window.Vue", 21 | "naive-ui": "naive" 22 | }, 23 | "outputDir": "dist", 24 | "vendor": false, 25 | "plugins": ["build-plugin-react-app", "./build.plugin.js"] 26 | } 27 | -------------------------------------------------------------------------------- /build.plugin.js: -------------------------------------------------------------------------------- 1 | const HtmlWebpackPlugin = require('html-webpack-plugin'); 2 | const path = require('path'); 3 | 4 | module.exports = ({ onGetWebpackConfig }) => { 5 | onGetWebpackConfig((config) => { 6 | config.merge({ 7 | node: { 8 | fs: 'empty', 9 | }, 10 | }); 11 | 12 | config.module // fixes https://github.com/graphql/graphql-js/issues/1272 13 | .rule('mjs$') 14 | .test(/\.mjs$/) 15 | .include.add(/node_modules/) 16 | .end() 17 | .type('javascript/auto'); 18 | 19 | config.merge({ 20 | entry: { 21 | editor: require.resolve('./src/editor.ts'), 22 | }, 23 | }); 24 | 25 | config.plugin('editor').use(HtmlWebpackPlugin, [ 26 | { 27 | inject: false, 28 | template: require.resolve('./public/index.html'), 29 | filename: 'index.html', 30 | }, 31 | ]); 32 | 33 | config.plugin('preview').use(HtmlWebpackPlugin, [ 34 | { 35 | inject: false, 36 | template: require.resolve('./public/preview.html'), 37 | filename: 'preview.html', 38 | }, 39 | ]); 40 | 41 | config.resolve.merge({ 42 | alias: { 43 | '@': path.resolve(__dirname, 'src'), 44 | }, 45 | }); 46 | }); 47 | }; 48 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "start": "build-scripts start --disable-reload --port 5557", 4 | "build": "build-scripts build" 5 | }, 6 | "dependencies": { 7 | "@alilc/lowcode-plugin-components-pane": "^1.0.7", 8 | "@alilc/lowcode-plugin-datasource-pane": "^1.0.10", 9 | "@alilc/lowcode-plugin-inject": "^1.2.2", 10 | "@alilc/lowcode-plugin-schema": "^1.0.5", 11 | "@alilc/lowcode-plugin-undo-redo": "^1.0.0", 12 | "@alilc/lowcode-types": "^1.1.7", 13 | "@knxcloud/lowcode-plugin-vue-code-editor": "0.0.2", 14 | "@knxcloud/lowcode-utils": "^1.6.0-beta.6", 15 | "@knxcloud/lowcode-vue-renderer": "^1.6.0-beta.9", 16 | "@knxcloud/lowcode-vue-simulator-renderer": "^1.6.0-beta.9", 17 | "module": "^1.2.5" 18 | }, 19 | "devDependencies": { 20 | "@alib/build-scripts": "^0.1.32", 21 | "@alilc/lowcode-engine": "^1.1.7", 22 | "@alilc/lowcode-engine-ext": "^1.0.5", 23 | "@babel/core": "^7.21.0", 24 | "@rushstack/eslint-patch": "^1.2.0", 25 | "@types/node": "^17.0.45", 26 | "@types/prop-types": "^15.7.5", 27 | "@types/react": "^16.14.35", 28 | "@types/react-dom": "^16.9.18", 29 | "@typescript-eslint/eslint-plugin": "^5.53.0", 30 | "@typescript-eslint/parser": "^5.53.0", 31 | "build-plugin-component": "^1.12.1", 32 | "build-plugin-moment-locales": "^0.1.3", 33 | "build-plugin-react-app": "^1.8.5", 34 | "eslint": "^8.34.0", 35 | "eslint-config-prettier": "^8.6.0", 36 | "eslint-plugin-prettier": "^4.2.1", 37 | "eslint-plugin-react": "^7.32.2", 38 | "postcss": "8.4.14", 39 | "postcss-html": "^1.5.0", 40 | "postcss-less": "^6.0.0", 41 | "prettier": "^2.8.4", 42 | "stylelint": "^14.16.1", 43 | "stylelint-config-prettier": "^9.0.5", 44 | "stylelint-config-rational-order": "^0.1.2", 45 | "stylelint-config-recommended-less": "^1.0.4", 46 | "stylelint-config-recommended-vue": "^1.4.0", 47 | "stylelint-config-standard": "^25.0.0", 48 | "stylelint-less": "^1.0.6", 49 | "typescript": "^4.9.5", 50 | "vue": "^3.2.47" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 低代码引擎 8 | 9 | 10 | 14 | 18 | 19 | 23 | 24 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /public/js/vue-renderer.d.ts: -------------------------------------------------------------------------------- 1 | import { AllowedComponentProps } from 'vue'; 2 | import { Component } from 'vue'; 3 | import { ComponentCustomProps } from 'vue'; 4 | import { ComponentOptionsMixin } from 'vue'; 5 | import { ComponentPublicInstance } from 'vue'; 6 | import { ComputedOptions } from 'vue'; 7 | import { ComputedRef } from 'vue'; 8 | import { DataSource } from '@knxcloud/lowcode-data-source'; 9 | import { DefineComponent } from 'vue'; 10 | import { DesignMode } from '@knxcloud/lowcode-hooks'; 11 | import type { ExtractDefaultPropTypes } from 'vue'; 12 | import { ExtractPropTypes } from 'vue'; 13 | import { Fragment } from 'vue'; 14 | import { INode } from '@knxcloud/lowcode-hooks'; 15 | import { IPublicTypeContainerSchema } from '@alilc/lowcode-types'; 16 | import type { IPublicTypeI18nData } from '@alilc/lowcode-types'; 17 | import type { IPublicTypeJSExpression } from '@alilc/lowcode-types'; 18 | import type { IPublicTypeJSFunction } from '@alilc/lowcode-types'; 19 | import type { IPublicTypeNodeData } from '@alilc/lowcode-types'; 20 | import type { IPublicTypeNodeSchema } from '@alilc/lowcode-types'; 21 | import { MethodOptions } from 'vue'; 22 | import { PropType } from 'vue'; 23 | import { Ref } from 'vue'; 24 | import { RendererElement } from 'vue'; 25 | import { RendererNode } from 'vue'; 26 | import type { RequestHandler } from '@alilc/lowcode-types'; 27 | import type { Router } from 'vue-router'; 28 | import { Slot } from 'vue'; 29 | import { Slots } from 'vue'; 30 | import { VNode } from 'vue'; 31 | import { VNodeChild } from 'vue'; 32 | import { VNodeProps } from 'vue'; 33 | 34 | export declare const baseRendererPropKeys: ("__scope" | "__locale" | ("__parser" | "__schema" | "__appHelper" | "__designMode" | "__components" | "__messages" | "__getNode" | "__triggerCompGetCtx" | "__thisRequiredInJSE" | "__requestHandlersMap" | "__props"))[]; 35 | 36 | export declare interface BlockScope { 37 | [x: string | symbol]: unknown; 38 | } 39 | 40 | export declare const cleanCacledModules: () => void; 41 | 42 | export declare class Config { 43 | private renderers; 44 | private configProvider; 45 | setConfigProvider(comp: any): void; 46 | getConfigProvider(): any; 47 | setRenderers(renderers: RendererModules): void; 48 | getRenderers(): RendererModules; 49 | } 50 | 51 | export declare const config: Config; 52 | 53 | export declare type ExtractPublicPropTypes = Omit, keyof ExtractDefaultPropTypes> & Partial>; 54 | 55 | export declare type I18nMessages = { 56 | [locale: string]: Record; 57 | }; 58 | 59 | export declare type LeafComponent = DefineComponent; 60 | 61 | export declare const leafPropKeys: ("__scope" | "__comp" | ("__schema" | "__vnodeProps" | "__isRootNode"))[]; 62 | 63 | export declare type LeafProps = ExtractPropTypes; 64 | 65 | export declare const leafProps: { 66 | readonly __comp: null; 67 | readonly __scope: null; 68 | readonly __schema: { 69 | readonly type: PropType; 70 | readonly default: () => {}; 71 | }; 72 | readonly __vnodeProps: { 73 | readonly type: PropType>; 74 | readonly default: () => {}; 75 | }; 76 | readonly __isRootNode: BooleanConstructor; 77 | }; 78 | 79 | export declare const LOWCODE_ROUTE_META: unique symbol; 80 | 81 | export declare type MaybeArray = T | T[]; 82 | 83 | export declare function mergeScope(scope: RuntimeScope, ...blockScope: MaybeArray[]): RuntimeScope; 84 | 85 | export declare function mergeScope(...blockScope: MaybeArray[]): BlockScope; 86 | 87 | declare type RenderComponent = (nodeSchema: IPublicTypeNodeData, scope: RuntimeScope, comp?: Component | typeof Fragment) => VNode | VNode[] | null; 88 | 89 | export declare type RendererComponent = DefineComponent; 90 | 91 | export declare type RendererModules = Record; 92 | 93 | export declare type RendererProps = ExtractPropTypes; 94 | 95 | export declare const rendererProps: { 96 | readonly __scope: { 97 | readonly type: PropType; 98 | readonly default: undefined; 99 | }; 100 | readonly __schema: { 101 | readonly type: PropType; 102 | readonly required: true; 103 | }; 104 | readonly __appHelper: { 105 | readonly type: PropType>; 106 | readonly default: () => {}; 107 | }; 108 | readonly __designMode: { 109 | readonly type: PropType<"live" | "design">; 110 | readonly default: "live"; 111 | }; 112 | readonly __components: { 113 | readonly type: PropType>>; 114 | readonly required: true; 115 | }; 116 | readonly __locale: { 117 | readonly type: StringConstructor; 118 | readonly default: undefined; 119 | }; 120 | readonly __messages: { 121 | readonly type: PropType; 122 | readonly default: () => {}; 123 | }; 124 | readonly __getNode: { 125 | readonly type: PropType<(id: string) => INode | null>; 126 | readonly required: true; 127 | }; 128 | readonly __triggerCompGetCtx: { 129 | readonly type: PropType<(schema: IPublicTypeNodeSchema, ref: ComponentPublicInstance) => void>; 130 | readonly required: true; 131 | }; 132 | readonly __thisRequiredInJSE: { 133 | readonly type: BooleanConstructor; 134 | readonly default: true; 135 | }; 136 | readonly __requestHandlersMap: { 137 | readonly type: PropType>>; 138 | readonly default: () => {}; 139 | }; 140 | readonly __props: { 141 | readonly type: ObjectConstructor; 142 | readonly default: () => {}; 143 | }; 144 | readonly __parser: { 145 | readonly type: PropType; 146 | readonly required: true; 147 | }; 148 | }; 149 | 150 | export declare interface RuntimeScope extends BlockScope, ComponentPublicInstance { 151 | i18n(key: string, values: any): string; 152 | currentLocale: string; 153 | dataSourceMap: Record; 154 | reloadDataSource(): Promise; 155 | __parser: SchemaParser; 156 | __thisRequired: boolean; 157 | __loopScope?: boolean; 158 | __loopRefIndex?: number; 159 | __loopRefOffset?: number; 160 | } 161 | 162 | export declare class SchemaParser { 163 | static cacheModules: Record; 164 | static cleanCachedModules(): void; 165 | private createFunction; 166 | private exports; 167 | constructor(options?: SchemaParserOptions); 168 | initModule(schema: IPublicTypeContainerSchema): this; 169 | parseSlotScope(args: unknown[], params: string[]): BlockScope; 170 | parseI18n(i18nInfo: IPublicTypeI18nData, scope?: RuntimeScope | boolean): string | undefined; 171 | parseSchema(schema: IPublicTypeI18nData, scope?: RuntimeScope | boolean): string | undefined; 172 | parseSchema(schema: IPublicTypeJSFunction, scope?: RuntimeScope | boolean): CallableFunction; 173 | parseSchema(schema: IPublicTypeJSExpression, scope?: RuntimeScope | boolean): unknown; 174 | parseSchema(schema: T, scope: RuntimeScope | boolean): { 175 | [K in keyof T]: T[K] extends IPublicTypeI18nData ? string : T[K] extends IPublicTypeJSFunction ? CallableFunction : T[K] extends IPublicTypeJSExpression ? unknown : T[K] extends IPublicTypeJSExpression | IPublicTypeJSFunction ? CallableFunction | unknown : T[K]; 176 | }; 177 | parseSchema(schema: unknown, scope?: RuntimeScope | boolean): T; 178 | parseOnlyJsValue(schema: unknown): T; 179 | parseOnlyJsValue(schema: unknown): unknown; 180 | parseExpression(str: IPublicTypeJSFunction, scope?: RuntimeScope | boolean): CallableFunction; 181 | parseExpression(str: IPublicTypeJSExpression, scope?: RuntimeScope | boolean): unknown; 182 | parseExpression(str: IPublicTypeJSExpression | IPublicTypeJSFunction, scope?: RuntimeScope | boolean): CallableFunction | unknown; 183 | } 184 | 185 | export declare interface SchemaParserOptions { 186 | thisRequired?: boolean; 187 | } 188 | 189 | export declare function setupLowCodeRouteGuard(router: Router, options?: SetupLowCodeRouteGuardOptions): (() => void) | undefined; 190 | 191 | export declare interface SetupLowCodeRouteGuardOptions extends SchemaParserOptions { 192 | /** 193 | * @default 'runtimeScope' 194 | */ 195 | scopePath?: string; 196 | /** 197 | * 等待异步 setup 以及 init dataSource 的超时时间,默认为 1 分钟 198 | * @default 60000 ms 199 | */ 200 | timeout?: number; 201 | } 202 | 203 | export declare type SlotSchemaMap = { 204 | [x: string]: unknown; 205 | }; 206 | 207 | export declare function useLeaf(leafProps: LeafProps, onChildShowChange?: (schema: IPublicTypeNodeSchema, show: boolean) => void): { 208 | node: INode | null; 209 | locked: Ref; 210 | isRootNode: boolean; 211 | getNode: (id: string) => INode | null; 212 | renderComp: RenderComponent; 213 | buildProps: (propsSchema: Record, scope: RuntimeScope, node?: INode | null, blockScope?: BlockScope | null, extraProps?: Record) => any; 214 | buildSlots: (slots: SlotSchemaMap, scope: RuntimeScope, node?: INode | null) => Slots; 215 | }; 216 | 217 | export declare function useRenderer(rendererProps: RendererProps, scope: RuntimeScope): { 218 | node: INode | null; 219 | locked: Ref; 220 | isRootNode: boolean; 221 | getNode: (id: string) => INode | null; 222 | renderComp: RenderComponent; 223 | buildProps: (propsSchema: Record, scope: RuntimeScope, node?: INode | null | undefined, blockScope?: BlockScope | null | undefined, extraProps?: Record | undefined) => any; 224 | buildSlots: (slots: SlotSchemaMap, scope: RuntimeScope, node?: INode | null | undefined) => Readonly<{ 225 | [name: string]: Slot | undefined; 226 | }>; 227 | scope: RuntimeScope; 228 | schemaRef: ComputedRef; 229 | designModeRef: ComputedRef<"live" | "design">; 230 | componentsRef: ComputedRef>>; 231 | }; 232 | 233 | export declare function useRootScope(rendererProps: RendererProps, setupConext: object): { 234 | scope: RuntimeScope; 235 | wrapRender: (render: () => VNodeChild | null) => (() => VNodeChild | null) | Promise<() => VNodeChild | null>; 236 | }; 237 | 238 | declare const VueRenderer: DefineComponent< { 239 | readonly scope: PropType; 240 | readonly schema: { 241 | readonly type: PropType; 242 | readonly required: true; 243 | }; 244 | readonly passProps: PropType>; 245 | readonly components: { 246 | readonly type: PropType>>; 247 | readonly required: true; 248 | }; 249 | /** 设计模式,可选值:live、design */ 250 | readonly designMode: { 251 | readonly type: PropType; 252 | readonly default: "live"; 253 | }; 254 | /** 设备信息 */ 255 | readonly device: StringConstructor; 256 | /** 语言 */ 257 | readonly locale: StringConstructor; 258 | readonly messages: { 259 | readonly type: PropType; 260 | readonly default: () => {}; 261 | }; 262 | readonly getNode: PropType<(id: string) => INode | null>; 263 | /** 组件获取 ref 时触发的钩子 */ 264 | readonly onCompGetCtx: PropType<(schema: IPublicTypeNodeSchema, ref: ComponentPublicInstance) => void>; 265 | readonly thisRequiredInJSE: { 266 | readonly type: BooleanConstructor; 267 | readonly default: true; 268 | }; 269 | readonly disableCompMock: { 270 | readonly type: PropType; 271 | readonly default: false; 272 | }; 273 | readonly appHelper: ObjectConstructor; 274 | readonly requestHandlersMap: ObjectConstructor; 275 | }, () => VNode | null, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly; 279 | readonly schema: { 280 | readonly type: PropType; 281 | readonly required: true; 282 | }; 283 | readonly passProps: PropType>; 284 | readonly components: { 285 | readonly type: PropType>>; 286 | readonly required: true; 287 | }; 288 | /** 设计模式,可选值:live、design */ 289 | readonly designMode: { 290 | readonly type: PropType; 291 | readonly default: "live"; 292 | }; 293 | /** 设备信息 */ 294 | readonly device: StringConstructor; 295 | /** 语言 */ 296 | readonly locale: StringConstructor; 297 | readonly messages: { 298 | readonly type: PropType; 299 | readonly default: () => {}; 300 | }; 301 | readonly getNode: PropType<(id: string) => INode | null>; 302 | /** 组件获取 ref 时触发的钩子 */ 303 | readonly onCompGetCtx: PropType<(schema: IPublicTypeNodeSchema, ref: ComponentPublicInstance) => void>; 304 | readonly thisRequiredInJSE: { 305 | readonly type: BooleanConstructor; 306 | readonly default: true; 307 | }; 308 | readonly disableCompMock: { 309 | readonly type: PropType; 310 | readonly default: false; 311 | }; 312 | readonly appHelper: ObjectConstructor; 313 | readonly requestHandlersMap: ObjectConstructor; 314 | }>>, { 315 | readonly designMode: DesignMode; 316 | readonly thisRequiredInJSE: boolean; 317 | readonly messages: I18nMessages; 318 | readonly disableCompMock: boolean | string[]; 319 | }>; 320 | export default VueRenderer; 321 | 322 | export declare type VueRendererProps = ExtractPublicPropTypes; 323 | 324 | export declare const vueRendererProps: { 325 | readonly scope: PropType; 326 | readonly schema: { 327 | readonly type: PropType; 328 | readonly required: true; 329 | }; 330 | readonly passProps: PropType>; 331 | readonly components: { 332 | readonly type: PropType>>; 333 | readonly required: true; 334 | }; 335 | /** 设计模式,可选值:live、design */ 336 | readonly designMode: { 337 | readonly type: PropType; 338 | readonly default: "live"; 339 | }; 340 | /** 设备信息 */ 341 | readonly device: StringConstructor; 342 | /** 语言 */ 343 | readonly locale: StringConstructor; 344 | readonly messages: { 345 | readonly type: PropType; 346 | readonly default: () => {}; 347 | }; 348 | readonly getNode: PropType<(id: string) => INode | null>; 349 | /** 组件获取 ref 时触发的钩子 */ 350 | readonly onCompGetCtx: PropType<(schema: IPublicTypeNodeSchema, ref: ComponentPublicInstance) => void>; 351 | readonly thisRequiredInJSE: { 352 | readonly type: BooleanConstructor; 353 | readonly default: true; 354 | }; 355 | readonly disableCompMock: { 356 | readonly type: PropType; 357 | readonly default: false; 358 | }; 359 | readonly appHelper: ObjectConstructor; 360 | readonly requestHandlersMap: ObjectConstructor; 361 | }; 362 | 363 | export { } 364 | -------------------------------------------------------------------------------- /public/js/vue-renderer.js: -------------------------------------------------------------------------------- 1 | (function(L,h){typeof exports=="object"&&typeof module!="undefined"?h(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],h):(L=typeof globalThis!="undefined"?globalThis:L||self,h(L.LCVueRenderer={},L.Vue))})(this,function(L,h){"use strict";var uo=Object.defineProperty;var ho=(L,h,X)=>h in L?uo(L,h,{enumerable:!0,configurable:!0,writable:!0,value:X}):L[h]=X;var re=(L,h,X)=>(ho(L,typeof h!="symbol"?h+"":h,X),X);const X={__scope:{type:Object,default:void 0},__schema:{type:Object,required:!0},__appHelper:{type:Object,default:()=>({})},__designMode:{type:String,default:"live"},__components:{type:Object,required:!0},__locale:{type:String,default:void 0},__messages:{type:Object,default:()=>({})},__getNode:{type:Function,required:!0},__triggerCompGetCtx:{type:Function,required:!0},__thisRequiredInJSE:{type:Boolean,default:!0},__requestHandlersMap:{type:Object,default:()=>({})},__props:{type:Object,default:()=>({})},__parser:{type:Object,required:!0}},rn=Object.keys(X),ae={__comp:null,__scope:null,__schema:{type:Object,default:()=>({})},__vnodeProps:{type:Object,default:()=>({})},__isRootNode:Boolean},et=Object.keys(ae);var Oe=function(e,t){return Oe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},Oe(e,t)};function ue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Oe(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var I=function(){return I=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0}),n=[],r=0,o=t;r1)throw new RangeError("integer-width stems only accept a single optional option");o.options[0].replace(pn,function(f,l,c,d,a,p){if(l)t.minimumIntegerDigits=c.length;else{if(d&&a)throw new Error("We currently do not support maximum integer digits");if(p)throw new Error("We currently do not support exact integer digits")}return""});continue}if(ft.test(o.stem)){t.minimumIntegerDigits=o.stem.length;continue}if(lt.test(o.stem)){if(o.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");o.stem.replace(lt,function(f,l,c,d,a,p){return c==="*"?t.minimumFractionDigits=l.length:d&&d[0]==="#"?t.maximumFractionDigits=d.length:a&&p?(t.minimumFractionDigits=a.length,t.maximumFractionDigits=a.length+p.length):(t.minimumFractionDigits=l.length,t.maximumFractionDigits=l.length),""});var i=o.options[0];i==="w"?t=I(I({},t),{trailingZeroDisplay:"stripIfInteger"}):i&&(t=I(I({},t),pt(i)));continue}if(ct.test(o.stem)){t=I(I({},t),pt(o.stem));continue}var s=dt(o.stem);s&&(t=I(I({},t),s));var u=dn(o.stem);u&&(t=I(I({},t),u))}return t}var he={"001":["H","h"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["H","h","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["H","hB","h","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["H","h","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["H","h","hB","hb"],CU:["H","h","hB","hb"],CV:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["H","hB","h","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["H","h","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["H","h","hB","hb"],HR:["H","hB"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","h","K"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MW:["h","hb","H","hB"],MX:["H","h","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["H","h","hB","hb"],NL:["H","hB"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["H","hB","h","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["H","h","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["H","h","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TL:["H","hB","hb","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["H","h","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"es-BO":["H","h","hB","hb"],"es-BR":["H","h","hB","hb"],"es-EC":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"es-PE":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function _n(e,t){for(var n="",r=0;r>1),f="a",l=bn(t);for((l=="H"||l=="k")&&(u=0);u-- >0;)n+=f;for(;s-- >0;)n=l+n}else o==="J"?n+="H":n+=o}return n}function bn(e){var t=e.hourCycle;if(t===void 0&&e.hourCycles&&e.hourCycles.length&&(t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var n=e.language,r;n!=="root"&&(r=e.maximize().region);var o=he[r||""]||he[n||""]||he["".concat(n,"-001")]||he["001"];return o[0]}var ve,En=new RegExp("^".concat(ht.source,"*")),gn=new RegExp("".concat(ht.source,"*$"));function P(e,t){return{start:e,end:t}}var xn=!!String.prototype.startsWith,yn=!!String.fromCodePoint,Sn=!!Object.fromEntries,Cn=!!String.prototype.codePointAt,Tn=!!String.prototype.trimStart,On=!!String.prototype.trimEnd,Rn=!!Number.isSafeInteger,Hn=Rn?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},Pe=!0;try{var vn=gt("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");Pe=((ve=vn.exec("a"))===null||ve===void 0?void 0:ve[0])==="a"}catch(e){Pe=!1}var _t=xn?function(t,n,r){return t.startsWith(n,r)}:function(t,n,r){return t.slice(r,r+n.length)===n},Be=yn?String.fromCodePoint:function(){for(var t=[],n=0;ni;){if(s=t[i++],s>1114111)throw RangeError(s+" is not a valid code point");r+=s<65536?String.fromCharCode(s):String.fromCharCode(((s-=65536)>>10)+55296,s%1024+56320)}return r},bt=Sn?Object.fromEntries:function(t){for(var n={},r=0,o=t;r=r)){var o=t.charCodeAt(n),i;return o<55296||o>56319||n+1===r||(i=t.charCodeAt(n+1))<56320||i>57343?o:(o-55296<<10)+(i-56320)+65536}},Pn=Tn?function(t){return t.trimStart()}:function(t){return t.replace(En,"")},Bn=On?function(t){return t.trimEnd()}:function(t){return t.replace(gn,"")};function gt(e,t){return new RegExp(e,t)}var Ne;if(Pe){var xt=gt("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");Ne=function(t,n){var r;xt.lastIndex=n;var o=xt.exec(t);return(r=o[1])!==null&&r!==void 0?r:""}}else Ne=function(t,n){for(var r=[];;){var o=Et(t,n);if(o===void 0||yt(o)||wn(o))break;r.push(o),n+=o>=65536?2:1}return Be.apply(void 0,r)};var Nn=function(){function e(t,n){n===void 0&&(n={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!n.ignoreTag,this.locale=n.locale,this.requiresOtherClause=!!n.requiresOtherClause,this.shouldParseSkeletons=!!n.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(t,n,r){for(var o=[];!this.isEOF();){var i=this.char();if(i===123){var s=this.parseArgument(t,r);if(s.err)return s;o.push(s.val)}else{if(i===125&&t>0)break;if(i===35&&(n==="plural"||n==="selectordinal")){var u=this.clonePosition();this.bump(),o.push({type:U.pound,location:P(u,this.clonePosition())})}else if(i===60&&!this.ignoreTag&&this.peek()===47){if(r)break;return this.error(H.UNMATCHED_CLOSING_TAG,P(this.clonePosition(),this.clonePosition()))}else if(i===60&&!this.ignoreTag&&Ie(this.peek()||0)){var s=this.parseTag(t,n);if(s.err)return s;o.push(s.val)}else{var s=this.parseLiteral(t,n);if(s.err)return s;o.push(s.val)}}}return{val:o,err:null}},e.prototype.parseTag=function(t,n){var r=this.clonePosition();this.bump();var o=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:U.literal,value:"<".concat(o,"/>"),location:P(r,this.clonePosition())},err:null};if(this.bumpIf(">")){var i=this.parseMessage(t+1,n,!0);if(i.err)return i;var s=i.val,u=this.clonePosition();if(this.bumpIf("")?{val:{type:U.tag,value:o,children:s,location:P(r,this.clonePosition())},err:null}:this.error(H.INVALID_TAG,P(u,this.clonePosition())))}else return this.error(H.UNCLOSED_TAG,P(r,this.clonePosition()))}else return this.error(H.INVALID_TAG,P(r,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&An(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,n){for(var r=this.clonePosition(),o="";;){var i=this.tryParseQuote(n);if(i){o+=i;continue}var s=this.tryParseUnquoted(t,n);if(s){o+=s;continue}var u=this.tryParseLeftAngleBracket();if(u){o+=u;continue}break}var f=P(r,this.clonePosition());return{val:{type:U.literal,value:o,location:f},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!In(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();var n=[this.char()];for(this.bump();!this.isEOF();){var r=this.char();if(r===39)if(this.peek()===39)n.push(39),this.bump();else{this.bump();break}else n.push(r);this.bump()}return Be.apply(void 0,n)},e.prototype.tryParseUnquoted=function(t,n){if(this.isEOF())return null;var r=this.char();return r===60||r===123||r===35&&(n==="plural"||n==="selectordinal")||r===125&&t>0?null:(this.bump(),Be(r))},e.prototype.parseArgument=function(t,n){var r=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(H.EXPECT_ARGUMENT_CLOSING_BRACE,P(r,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(H.EMPTY_ARGUMENT,P(r,this.clonePosition()));var o=this.parseIdentifierIfPossible().value;if(!o)return this.error(H.MALFORMED_ARGUMENT,P(r,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(H.EXPECT_ARGUMENT_CLOSING_BRACE,P(r,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:U.argument,value:o,location:P(r,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(H.EXPECT_ARGUMENT_CLOSING_BRACE,P(r,this.clonePosition())):this.parseArgumentOptions(t,n,o,r);default:return this.error(H.MALFORMED_ARGUMENT,P(r,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),n=this.offset(),r=Ne(this.message,n),o=n+r.length;this.bumpTo(o);var i=this.clonePosition(),s=P(t,i);return{value:r,location:s}},e.prototype.parseArgumentOptions=function(t,n,r,o){var i,s=this.clonePosition(),u=this.parseIdentifierIfPossible().value,f=this.clonePosition();switch(u){case"":return this.error(H.EXPECT_ARGUMENT_TYPE,P(s,f));case"number":case"date":case"time":{this.bumpSpace();var l=null;if(this.bumpIf(",")){this.bumpSpace();var c=this.clonePosition(),d=this.parseSimpleArgStyleIfPossible();if(d.err)return d;var a=Bn(d.val);if(a.length===0)return this.error(H.EXPECT_ARGUMENT_STYLE,P(this.clonePosition(),this.clonePosition()));var p=P(c,this.clonePosition());l={style:a,styleLocation:p}}var _=this.tryParseArgumentClose(o);if(_.err)return _;var E=P(o,this.clonePosition());if(l&&_t(l==null?void 0:l.style,"::",0)){var y=Pn(l.style.slice(2));if(u==="number"){var d=this.parseNumberSkeletonFromString(y,l.styleLocation);return d.err?d:{val:{type:U.number,value:r,location:E,style:d.val},err:null}}else{if(y.length===0)return this.error(H.EXPECT_DATE_TIME_SKELETON,E);var B=y;this.locale&&(B=_n(y,this.locale));var a={type:Q.dateTime,pattern:B,location:l.styleLocation,parsedOptions:this.shouldParseSkeletons?hn(B):{}},R=u==="date"?U.date:U.time;return{val:{type:R,value:r,location:E,style:a},err:null}}}return{val:{type:u==="number"?U.number:u==="date"?U.date:U.time,value:r,location:E,style:(i=l==null?void 0:l.style)!==null&&i!==void 0?i:null},err:null}}case"plural":case"selectordinal":case"select":{var w=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(H.EXPECT_SELECT_ARGUMENT_OPTIONS,P(w,I({},w)));this.bumpSpace();var M=this.parseIdentifierIfPossible(),m=0;if(u!=="select"&&M.value==="offset"){if(!this.bumpIf(":"))return this.error(H.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,P(this.clonePosition(),this.clonePosition()));this.bumpSpace();var d=this.tryParseDecimalInteger(H.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,H.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(d.err)return d;this.bumpSpace(),M=this.parseIdentifierIfPossible(),m=d.val}var g=this.tryParsePluralOrSelectOptions(t,u,n,M);if(g.err)return g;var _=this.tryParseArgumentClose(o);if(_.err)return _;var S=P(o,this.clonePosition());return u==="select"?{val:{type:U.select,value:r,options:bt(g.val),location:S},err:null}:{val:{type:U.plural,value:r,options:bt(g.val),offset:m,pluralType:u==="plural"?"cardinal":"ordinal",location:S},err:null}}default:return this.error(H.INVALID_ARGUMENT_TYPE,P(s,f))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(H.EXPECT_ARGUMENT_CLOSING_BRACE,P(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,n=this.clonePosition();!this.isEOF();){var r=this.char();switch(r){case 39:{this.bump();var o=this.clonePosition();if(!this.bumpUntil("'"))return this.error(H.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,P(o,this.clonePosition()));this.bump();break}case 123:{t+=1,this.bump();break}case 125:{if(t>0)t-=1;else return{val:this.message.slice(n.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(n.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,n){var r=[];try{r=cn(t)}catch(o){return this.error(H.INVALID_NUMBER_SKELETON,n)}return{val:{type:Q.number,tokens:r,location:n,parsedOptions:this.shouldParseSkeletons?mn(r):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,n,r,o){for(var i,s=!1,u=[],f=new Set,l=o.value,c=o.location;;){if(l.length===0){var d=this.clonePosition();if(n!=="select"&&this.bumpIf("=")){var a=this.tryParseDecimalInteger(H.EXPECT_PLURAL_ARGUMENT_SELECTOR,H.INVALID_PLURAL_ARGUMENT_SELECTOR);if(a.err)return a;c=P(d,this.clonePosition()),l=this.message.slice(d.offset,this.offset())}else break}if(f.has(l))return this.error(n==="select"?H.DUPLICATE_SELECT_ARGUMENT_SELECTOR:H.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,c);l==="other"&&(s=!0),this.bumpSpace();var p=this.clonePosition();if(!this.bumpIf("{"))return this.error(n==="select"?H.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:H.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,P(this.clonePosition(),this.clonePosition()));var _=this.parseMessage(t+1,n,r);if(_.err)return _;var E=this.tryParseArgumentClose(p);if(E.err)return E;u.push([l,{value:_.val,location:P(p,this.clonePosition())}]),f.add(l),this.bumpSpace(),i=this.parseIdentifierIfPossible(),l=i.value,c=i.location}return u.length===0?this.error(n==="select"?H.EXPECT_SELECT_ARGUMENT_SELECTOR:H.EXPECT_PLURAL_ARGUMENT_SELECTOR,P(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!s?this.error(H.MISSING_OTHER_CLAUSE,P(this.clonePosition(),this.clonePosition())):{val:u,err:null}},e.prototype.tryParseDecimalInteger=function(t,n){var r=1,o=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(r=-1);for(var i=!1,s=0;!this.isEOF();){var u=this.char();if(u>=48&&u<=57)i=!0,s=s*10+(u-48),this.bump();else break}var f=P(o,this.clonePosition());return i?(s*=r,Hn(s)?{val:s,err:null}:this.error(n,f)):this.error(t,f)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");var n=Et(this.message,t);if(n===void 0)throw Error("Offset ".concat(t," is at invalid UTF-16 code unit boundary"));return n},e.prototype.error=function(t,n){return{val:null,err:{kind:t,message:this.message,location:n}}},e.prototype.bump=function(){if(!this.isEOF()){var t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}},e.prototype.bumpIf=function(t){if(_t(this.message,t,this.offset())){for(var n=0;n=0?(this.bumpTo(r),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(t){if(this.offset()>t)throw Error("targetOffset ".concat(t," must be greater than or equal to the current offset ").concat(this.offset()));for(t=Math.min(t,this.message.length);;){var n=this.offset();if(n===t)break;if(n>t)throw Error("targetOffset ".concat(t," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&yt(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),n=this.offset(),r=this.message.charCodeAt(n+(t>=65536?2:1));return r!=null?r:null},e}();function Ie(e){return e>=97&&e<=122||e>=65&&e<=90}function In(e){return Ie(e)||e===47}function An(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function yt(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function wn(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}function Ae(e){e.forEach(function(t){if(delete t.location,it(t)||st(t))for(var n in t.options)delete t.options[n].location,Ae(t.options[n].value);else nt(t)&&ut(t.style)||(rt(t)||ot(t))&&He(t.style)?delete t.style.location:at(t)&&Ae(t.children)})}function Ln(e,t){t===void 0&&(t={}),t=I({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var n=new Nn(e,t).parse();if(n.err){var r=SyntaxError(H[n.err.kind]);throw r.location=n.err.location,r.originalMessage=n.err.message,r}return t!=null&&t.captureLocation||Ae(n.val),n.val}function we(e,t){var n=t&&t.cache?t.cache:jn,r=t&&t.serializer?t.serializer:Fn,o=t&&t.strategy?t.strategy:Un;return o(e,{cache:n,serializer:r})}function Mn(e){return e==null||typeof e=="number"||typeof e=="boolean"}function St(e,t,n,r){var o=Mn(r)?r:n(r),i=t.get(o);return typeof i=="undefined"&&(i=e.call(this,r),t.set(o,i)),i}function Ct(e,t,n){var r=Array.prototype.slice.call(arguments,3),o=n(r),i=t.get(o);return typeof i=="undefined"&&(i=e.apply(this,r),t.set(o,i)),i}function Le(e,t,n,r,o){return n.bind(t,e,r,o)}function Un(e,t){var n=e.length===1?St:Ct;return Le(e,this,n,t.cache.create(),t.serializer)}function Dn(e,t){return Le(e,this,Ct,t.cache.create(),t.serializer)}function Gn(e,t){return Le(e,this,St,t.cache.create(),t.serializer)}var Fn=function(){return JSON.stringify(arguments)};function Me(){this.cache=Object.create(null)}Me.prototype.get=function(e){return this.cache[e]},Me.prototype.set=function(e,t){this.cache[e]=t};var jn={create:function(){return new Me}},Ue={variadic:Dn,monadic:Gn},ee;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(ee||(ee={}));var le=function(e){ue(t,e);function t(n,r,o){var i=e.call(this,n)||this;return i.code=r,i.originalMessage=o,i}return t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),Tt=function(e){ue(t,e);function t(n,r,o,i){return e.call(this,'Invalid values for "'.concat(n,'": "').concat(r,'". Options are "').concat(Object.keys(o).join('", "'),'"'),ee.INVALID_VALUE,i)||this}return t}(le),Vn=function(e){ue(t,e);function t(n,r,o){return e.call(this,'Value for "'.concat(n,'" must be of type ').concat(r),ee.INVALID_VALUE,o)||this}return t}(le),kn=function(e){ue(t,e);function t(n,r){return e.call(this,'The intl string context variable "'.concat(n,'" was not provided to the string "').concat(r,'"'),ee.MISSING_VALUE,r)||this}return t}(le),k;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(k||(k={}));function $n(e){return e.length<2?e:e.reduce(function(t,n){var r=t[t.length-1];return!r||r.type!==k.literal||n.type!==k.literal?t.push(n):r.value+=n.value,t},[])}function Xn(e){return typeof e=="function"}function ce(e,t,n,r,o,i,s){if(e.length===1&&tt(e[0]))return[{type:k.literal,value:e[0].value}];for(var u=[],f=0,l=e;f0?new Intl.Locale(n[0]):new Intl.Locale(typeof t=="string"?t:t[0])}},e.__parse=Ln,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}();function Zn(e,t={},n="zh-CN",r={}){return!r||!r[n]||!r[n][e]?"":new zn(r[n][e],n).format(t)}const Ot=()=>{};function Yn(e){const t={};for(const n of e)G(n)&&n.length>=2&&(t[n[0]]=n[1]);return t}function Rt(e,t){let n=null;return t?function(){n&&clearTimeout(n),n=setTimeout(()=>{n=null,e.apply(this)},t)}:function(){n||(n=setTimeout(()=>{n=null,e.apply(this)}))}}const Ge=e=>Object.prototype.toString.call(e);function Kn(e){return new Promise(t=>setTimeout(t,e))}const Fe=e=>{const t=new Set(q(e)?e.split(","):G(e)?e:[]),n=A(e)?e:r=>t.has(r);return r=>{const o=Object.keys(r);if(o.every(f=>!n(f)))return[{},r,0];let i=0;const s={},u={};for(const f of o)n(f)?(s[f]=r[f],i++):u[f]=r[f];return[s,u,i]}};function J(e){return e==null}function Ht(e){return e===void 0}function q(e){return typeof e=="string"}function D(e){return!J(e)&&typeof e=="object"}function vt(e){return typeof e=="boolean"}function G(e){return Array.isArray(e)}function A(e){return typeof e=="function"}function je(e){return D(e)&&A(e.then)&&A(e.catch)}function W(e){return!J(e)&&Ge(e)==="[object Object]"}function Qn(e){return e&&(Reflect.get(e,"__esModule")||Reflect.get(e,Symbol.toStringTag)==="Module")}function fe(e){return e?D(e)&&(e.type==="JSFunction"||e.extType==="function"):!1}function pe(e){return D(e)&&e.type==="JSSlot"}function oe(e){return D(e)&&e.type==="JSExpression"&&e.extType!=="function"}function Ve(e){return D(e)&&e.type==="i18n"}function de(e){return e&&e.componentName}function ke(e){return de(e)&&e.componentName==="Slot"}function er(e){return de(e)&&(e.componentName==="Block"||e.componentName==="Page"||e.componentName==="Component")}var te=function(e){return e[e.Environment=1]="Environment",e[e.Library=2]="Library",e[e.Theme=3]="Theme",e[e.Runtime=4]="Runtime",e[e.Components=5]="Components",e[e.App=6]="App",e}({});te.Environment,te.Library,te.Theme,te.Runtime,te.Components,te.App;function me(e){return e&&e.replace(/-[a-zA-Z]/g,t=>t.charAt(1).toLocaleUpperCase())}$e=void 0;var tr=function(e){return e.Render="render",e.Serilize="serilize",e.Save="save",e.Clone="clone",e.Init="init",e.Upgrade="upgrade",e}({}),$e=tr;function Xe(e){if(D(e)){if(A(e.export))return e.export($e.Render);if(A(e.exportSchema))return e.exportSchema($e.Render)}return null}function ne(e){console.warn("[vue-renderer]: "+e)}const Pt={};function nr(e){!Pt[e]&&(Pt[e]=!0)&&ne(e)}var F=(e=>(e[e.OTHER=0]="OTHER",e[e.SETUP=1]="SETUP",e[e.DATA=2]="DATA",e[e.PROPS=3]="PROPS",e[e.CONTEXT=4]="CONTEXT",e))(F||{});function Bt(e,t){switch(t){case 1:return e.$.setupState.__lcSetup?e.$.setupState:e.$.setupState=h.proxyRefs(Object.create(null,{__lcSetup:{get:()=>!0,enumerable:!1,configurable:!1}}));case 2:return h.isReactive(e.$.data)?e.$.data:e.$.data=h.reactive({});case 3:return e.$.props;default:return e.$.ctx}}function V(e,t,n,r,o=!0){const i=e.$,s=Bt(e,t);if(r){const u=Object.getOwnPropertyDescriptors(n);for(const f in u){if(f in s){ne("重复定义 key: "+f);continue}Object.defineProperty(s,f,u[f]),i.accessCache[f]=t}}else for(const u in n){if(u in s){ne("重复定义 key: "+u);continue}s[u]=Reflect.get(n,u),i.accessCache[u]=t}if(t===3&&Object.keys(n).length>0&&o){const{propsOptions:[u,f]}=i,l={},c=[];for(const d in n){if(u[d])continue;const a=Reflect.get(n,d);vt(a)?(l[d]={0:!0,1:!0,type:Boolean,default:a},c.push(d)):Ht(a)?l[d]={0:!1,1:!1,type:null}:(l[d]={0:!0,1:!1,type:null,default:a},c.push(d))}Object.keys(l).length>0&&(i.propsOptions=[{...u,...l},[...f,...c]])}}function Je(e){return"$"in e}function rr(e){return!e||!D(e)?!1:!!(Je(e)||Object.keys(e).length>0)}function ie(...e){const t=[];if(e.flat().forEach(o=>{rr(o)&&t.push(o)}),t.length<=1)return t[0];const[n,...r]=t;return r.reduce((o,i)=>{if(Je(i)){if(Je(o))return i;{const u=o;o=i,i=u}}const s=Object.getOwnPropertyDescriptors(i);return o=Object.create(o,s),h.isProxy(i)?h.reactive(o):o},n)}function z(e){return e?G(e)?e:[e]:[]}const or={JSEXPRESSION:"JSExpression",JSFUNCTION:"JSFunction",JSSLOT:"JSSlot",JSBLOCK:"JSBlock",I18N:"i18n"},Ke=class{constructor(t){re(this,"createFunction");re(this,"exports",{});this.createFunction=t&&!t.thisRequired?n=>new Function("__exports__","__scope__",`with(__exports__) { with(__scope__) { ${n} } }`):n=>new Function("__exports__",`with(__exports__) { ${n} }`)}static cleanCachedModules(){this.cacheModules={}}initModule(t){var o;const n=(o=t.lifeCycles)==null?void 0:o.initModule,r=n&&this.parseSchema(n,!1);return this.exports=A(r)?r(Ke.cacheModules,window):{},this}parseSlotScope(t,n){const r={};return z(n).forEach((o,i)=>{r[o]=t[i]}),r}parseI18n(t,n){return this.parseExpression({type:or.JSEXPRESSION,value:`this.$t(${JSON.stringify(t.key)})`},n)}parseSchema(t,n){if(oe(t)||fe(t))return this.parseExpression(t,n);if(Ve(t))return this.parseI18n(t,n);if(q(t))return t.trim();if(G(t))return t.map(r=>this.parseSchema(r,n));if(A(t))return t.bind(n);if(W(t)){if(!t)return t;const r={};return Object.keys(t).forEach(o=>{o.startsWith("__")||(r[o]=this.parseSchema(t[o],n))}),r}return t}parseOnlyJsValue(t){if(!(oe(t)||Ve(t))){{if(fe(t))return this.parseExpression(t,!1);if(G(t))return t.map(n=>this.parseOnlyJsValue(n));if(W(t))return Object.keys(t).reduce((n,r)=>(r.startsWith("__")||(n[r]=this.parseOnlyJsValue(t[r])),n),{})}return t}}parseExpression(t,n){try{const r=['"use strict";'];let o;return o=(t.value||"").trim(),n!==!1&&!o.match(/^\([^)]*\)\s*=>/)&&(o=o.replace(/this(\W|$)/g,(s,u)=>`__self${u}`),r.push("var __self = arguments[1];")),r.push("return "),o=r.join(` 4 | `)+o,this.createFunction(o)(this.exports,n||{})}catch(r){console.warn("parseExpression.error",r,t,self);return}}};let K=Ke;re(K,"cacheModules",{});function ir(){let e=window.__currentNode;return e||(e=Symbol("__currentNode"),window.__currentNode=e),e}function Nt(){let e=window.__rendererContext;return e||(e=Symbol("__rendererContext"),window.__rendererContext=e),e}function _e(){const e=Nt();return h.inject(e,()=>{var t,n;const r=(n=(t=h.getCurrentInstance())==null?void 0:t.props)!=null?n:{};return{rerender:()=>{},thisRequiredInJSE:!0,components:be(r,"components",{}),designMode:be(r,"designMode","live"),getNode:be(r,"getNode",()=>null),wrapLeafComp:(o,i,s)=>s,triggerCompGetCtx:be(r,"triggerCompGetCtx",()=>{})}},!0)}function be(e,t,n){return e[t]||e[`__${t}`]||n}const It=Symbol("hocNode"),sr=e=>{const{rerender:t}=_e(),n=h.inject(It,null),r=Rt(e);return h.provide(It,{rerenderSlots:r}),n?{rerender:r,rerenderRoot:t,rerenderParent:n.rerenderSlots}:{rerender:r,rerenderRoot:t,rerenderParent:t}},ar=h.defineComponent({name:"Hoc",inheritAttrs:!1,props:ae,setup(e,{slots:t,attrs:n}){const r=h.shallowRef(!0),o=h.shallowRef(e.__schema),i=h.shallowRef(),s=y=>{o.value=y,i.value=qt(y,a).slots},{rerender:u,rerenderRoot:f,rerenderParent:l}=sr(()=>{const y=a?Xe(a):null;y&&s(y)}),c={};h.onUnmounted(()=>Object.keys(c).forEach(y=>{c[y](),delete c[y]}));const{locked:d,node:a,buildSlots:p,getNode:_,isRootNode:E}=ze(e,(y,B)=>{const R=y.id;if(R){if(B&&c[R])c[R](),delete c[R];else if(!B&&!c[R]){const w=_(R);if(w){const M=w.onVisibleChange(()=>u()),m=w.onPropChange(()=>u());c[R]=()=>{M(),m()}}}}});if(a){const y=a.onChildrenChange(()=>{f()});y&&h.onUnmounted(y),h.onUnmounted(a.onPropChange(B=>{const{key:R,prop:w,newValue:M,oldValue:m}=B;w.path.length===1?R==="___isLocked___"?d.value=M:pe(M)||pe(m)?f():l():l()})),h.onUnmounted(a.onVisibleChange(B=>{E?r.value=B:l()})),s(Xe(a))}return h.watch(()=>e.__schema,y=>s(y)),()=>{var m;const y=h.toRaw(e.__comp),B=h.toRaw(e.__scope),R={...e.__vnodeProps},w=Zt(n)[1];if(E&&!r.value)return null;const M=i.value?p(i.value,B,a):t;return y?ge(y)?h.h(h.Fragment,(m=M.default)==null?void 0:m.call(M)):h.h(y,h.mergeProps(w,R),M):h.h("div","component not found")}}}),ur=h.defineComponent({inheritAttrs:!1,props:ae,setup:(e,{attrs:t,slots:n})=>()=>{const r=h.toRaw(e.__comp),o={...e.__vnodeProps},i=Zt(t)[1];return ge(r)?h.renderSlot(n,"default",t):r?h.h(r,h.mergeProps(i,o),n):null}});function At(e){const t=[];return Object.keys(e).forEach(n=>{const r=e[n];r==null||r===""||(typeof r=="object"?t.push(`${n}=${encodeURIComponent(JSON.stringify(r))}`):t.push(`${n}=${encodeURIComponent(String(r))}`))}),t.join("&")}function hr(e,t){if(!t)return e;const n=At(t);return n?e.indexOf("?")>0?`${e}&${n}`:`${e}?${n}`:e}function lr(e,t){for(const n in e)if(n.toLowerCase()===t)return[e[n],n];return[]}function cr(e){return q(e)&&["arrayBuffer","blob","formData","json","text"].includes(e)}function fr(e){const t=new FormData;for(const n in e){const r=e[n];r instanceof Blob?t.append(n,r):t.append(n,String(r))}return t}const wt={"application/json":e=>JSON.stringify(e),"multipart/form-data":e=>W(e)?fr(e):e,"application/x-www-form-urlencoded":e=>At(e)};function pr(e,t){const n=Object.keys(wt).find(r=>e.includes(r));return n?wt[n](t):t}class se extends Error{constructor(t,n,r){super(t),this.code=n,this.data=r}}class Lt{constructor(t,n){this.code=t,this.data=n}}async function Mt(e){const{uri:t,method:n,timeout:r,params:o={},headers:i={},isCors:s,responseType:u="json",...f}=e;let l;const c={Accept:"application/json",...i},d={method:n,headers:c,credentials:"include",...f};if(s&&(d.mode="cors"),n==="GET"||n==="DELETE"||n==="OPTIONS")l=hr(t,o);else{l=t;const[_,E]=lr(c,"content-type");d.body=pr(_!=null?_:"application/json",o),_==="multipart/form-data"&&E&&delete c[E]}if(r){const _=new AbortController;d.signal=_.signal,setTimeout(()=>_.abort(),r)}const a=await fetch(l,d),p=a.status;if(p>=200&&p<300)if(p===204){if(n==="DELETE")return new Lt(p,null);throw new se(a.statusText,p)}else{if(!cr(u))throw new se(`invalid response type: ${u}`,-1);return new Lt(p,await a[u]())}else if(p>=400)try{const _=await a.json();throw new se(a.statusText,p,_)}catch(_){throw new se(a.statusText,p)}throw new se(a.statusText,p)}function dr(e,{state:t,setState:n},r){const o=h.shallowRef(),i=h.shallowRef(),s=h.ref("init"),u=h.computed(()=>s.value==="loading"),f=h.computed(()=>e.isInit?Ee(e.isInit,t):!1),l=h.computed(()=>e.isSync?Ee(e.isSync,t):!1),{willFetch:c=mr,shouldFetch:d=_r,dataHandler:a=E=>E&&Reflect.get(E,"data"),errorHandler:p=br}=e,_=async(E,y={})=>{try{const{type:B,options:R,id:w}=e,M=Er(e,r);if(!M)throw new Error("unsupport fetch type: "+B);if(!d())throw new Error(`the ${w} request should not fetch, please check the condition`);const{inputHeaders:m={},assignToScope:g=!0,...S}=y;s.value="loading";const{params:T,headers:N,...b}=Ee(R,t),x=await c({...b,...S,params:W(T)&&W(E)?{...T,...E}:E!=null?E:T,headers:{...W(N)?N:{},...W(m)?m:{}}}),v=await M(x,{state:t,setState:n}),C=o.value=a(v);return!Ht(C)&&g&&n({[w]:C}),s.value="loading",C}catch(B){s.value="error",i.value=B,p(B)}};return h.reactive({data:o,error:i,loading:u,status:s,isInit:f,isSync:l,load:_})}const mr=e=>e,_r=()=>!0,br=e=>{throw e};function Ee(e,t){return A(e)?e.call(t,t):W(e)?Object.keys(e).reduce((n,r)=>(Reflect.set(n,r,Ee(e[r],t)),n),{}):e}function Er(e,t){var n,r;const{type:o,requestHandler:i}=e;return o?o==="custom"&&i?i:o==="fetch"?(n=t[o])!=null?n:Mt:(r=t[o])!=null?r:null:Mt}function gr(e,t,n={}){const r={},o={},{list:i,dataHandler:s}=e;for(const l of i){const c={dataHandler:s,...l},d=dr(c,t,n),a=(p,_)=>{const E={assignToScope:!1,..._};return d.load(p,E)};r[l.id]=a,o[l.id]=d}return{dataSource:r,dataSourceMap:o,reloadDataSource:(l,c,d)=>{if(l){const E=o[l];if(!E)throw new Error("dataSource not found, id: "+l);return E.load(c,d)}const a=[],p=[];Object.keys(o).map(E=>o[E]).filter(E=>E.isInit).forEach(E=>{E.isSync?a.push(E):p.push(E)});const _=[...p.map(E=>E.load()),a.reduce((E,y)=>E.then(()=>y.load()),Promise.resolve(null))];return Promise.all(_)},shouldInit:()=>Object.keys(o).some(l=>o[l].isInit)}}function xr(e,t,n){const r=t.__parser,o=r.parseSchema(e.dataHandler,t),i=e.list.map(({isInit:s=!1,isSync:u=!1,requestHandler:f,dataHandler:l,errorHandler:c,willFetch:d,shouldFetch:a,options:p,..._})=>({...r.parseSchema(_,t),isInit:Ut(s,r,t),isSync:Ut(u,r,t),requestHandler:r.parseSchema(f,t),dataHandler:r.parseSchema(l,t),errorHandler:r.parseSchema(c,t),willFetch:r.parseSchema(d,t),shouldFetch:r.parseSchema(a,t),options:()=>r.parseSchema(p,t)}));return gr({list:i,dataHandler:o},{state:t,setState(s){const u={};for(const f in s)f in t?t[f]=s[f]:u[f]=s[f];Object.keys(u).length>0&&(V(t,F.CONTEXT,u),t.$forceUpdate())},forceUpdate:()=>t.$forceUpdate()},n)}function Ut(e,t,n){return oe(e)?t.parseSchema({type:"JSFunction",value:`function () { return ${e.value} }`},n):fe(e)?t.parseSchema(e,n):e}function yr(e,t,n){const r=e.parseSchema(t,!1);if(!W(r))return;const o={};for(const i in r){const s=r[i],u=A(s)?s.bind(n):A(s.get)?s.get.bind(n):Ot,f=!A(s)&&A(s.set)?s.set.bind(n):Ot,l=h.computed({get:u,set:f});Object.defineProperty(o,i,{enumerable:!0,configurable:!0,get:()=>l.value,set:c=>l.value=c})}V(n,F.CONTEXT,o,!0)}function Dt(e){const t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:e===null?"null":""}function Gt(e,t){return Dt(e)===Dt(t)}function Ft(e,t){return G(t)?t.findIndex(n=>Gt(n,e)):A(t)&&Gt(t,e)?0:-1}function Sr(e,t,n){const r=e.parseSchema(t,!1);if(!r||!D(r)&&!G(r)||D(r)&&Object.keys(r).length===0||G(r)&&r.length===0)return;const o=n.$,{propsOptions:[i,s]}=o,u={},f=[];for(const l in r){const c=r[l];let d,a;if(q(c)?(d=me(c),a={}):(d=me(l),a=G(c)||A(c)?{type:c}:c),i[d]){ne("prop "+d+"声明重复");continue}const p=Ft(Boolean,a.type),_=Ft(String,a.type);u[d]={0:p>-1,1:_<0||p<_,...a},(p>-1||"default"in a)&&f.push(d)}if(Object.keys(u).length>0){o.propsOptions=[{...i,...u},[...s,...f]];const{props:l,attrs:c}=o,d=Object.keys(u).reduce((a,p)=>(a[p]=Cr(u,{...l,...a},p,c[p],o,f.includes(p)),a),{});Object.keys(d).length>0&&V(n,F.PROPS,d,!1,!1)}}function Cr(e,t,n,r,o,i){const s=e[n];if(s!=null){const u=Reflect.has(s,"default");if(u&&r===void 0){const f=s.default;if(s.type!==Function&&!s.skipFactory&&A(f)){const{propsDefaults:l}=o;n in l?r=l[n]:r=l[n]=h.withCtx(()=>f.call(null,t),o)()}else r=f}s[0]&&(i&&!u?r=!1:s[1]&&(r===""||r===Rr(n))&&(r=!0))}return r}const Tr=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},Or=/\B([A-Z])/g,Rr=Tr(e=>e.replace(Or,"-$1").toLowerCase());function Hr(e,t,n){const r=e.parseSchema(t,!1),o=G(r)?r.reduce((i,s)=>(i[s]=null,i),{}):D(r)?r:null;!o||Object.keys(o).length===0||(n.$.emitsOptions=Object.create(n.$.emitsOptions,Object.getOwnPropertyDescriptors(o)))}function vr(e,t,n){const r=e.parseSchema(t,!1),o=A(r)?r.call(n):D(r)?r:null;!o||Object.keys(o).length===0||V(n,F.DATA,o)}function Pr(e,t){const n=t.split(".");return()=>{let r=e;for(let o=0;on[r];if(q(e)){const i=t[e];A(i)?h.watch(o,i):h.warn(`Invalid watch handler specified by key "${e}"`,i)}else if(A(e))h.watch(o,e.bind(n));else if(D(e))if(G(e))e.forEach(i=>jt(i,t,n,r));else{const i=A(e.handler)?e.handler.bind(n):q(e.handler)?t[e.handler]:null;A(i)?h.watch(o,i,e):h.warn(`Invalid watch handler specified by key "${e.handler}"`,i)}else h.warn(`Invalid watch option: "${r}"`,e)}function Br(e,t,n){const r=e.parseSchema(t,!1);if(!r||!D(r)||Object.keys(r).length===0)return;const o=Bt(n,F.CONTEXT);for(const i in r)jt(r[i],o,n,i)}function Nr(e,t,n){const r=e.parseSchema(t,!1);let o;if(G(r))o=r.reduce((s,u)=>(s[u]=u,s),{});else if(D(r))o=r;else return;const i={};for(const s in o){const u=o[s];let f;if(D(u)){const l=u.from||s;"default"in u?f=h.inject(l,u.default,!0):f=h.inject(l)}else f=h.inject(u);h.isRef(f)?Object.defineProperty(i,s,{enumerable:!0,configurable:!0,get:()=>f.value,set:l=>f.value=l}):i[s]=f}V(n,F.CONTEXT,i,!0)}function Ir(e,t,n){const r=e.parseSchema(t,n),o=A(r)?r():r;D(o)&&Reflect.ownKeys(o).forEach(i=>{const s=Reflect.get(o,i);h.provide(i,s)})}function Ar(e,t,n,[r,o]){const i=e.parseSchema(t,!1);if(!A(i))return;const s=i.apply(void 0,[r,o]);if(je(s))return s.then(u=>Vt(u,n));Vt(s,n)}function Vt(e,t){if(!J(e)){if(!D(e)){ne("不支持的 setup 返回值类型, type: "+Ge(e));return}V(t,F.SETUP,h.toRaw(e))}}function wr(e,t,n){const r=e.parseSchema(t,!1);A(r)&&r.call(n)}function Lr(e,t,n){const r=e.parseSchema(t,!1);A(r)&&r.call(n)}const kt=Symbol(),$t=e=>void(e[kt]=!0),qe=e=>kt in e,Mr=e=>A(e),Ur=["beforeRouteEnter","beforeRouteUpdate","beforeRouteLeave"],Xt=Symbol("LOWCODE_ROUTE_META");function Dr(e){const t=e.split(".");return n=>{let r=n;for(let o=0;o0?Object.create(d,Object.getOwnPropertyDescriptors(_)):d}function s(c,d){return d.length<3?function(a,p){const _=o(this);return u(d.call(_,a,p))}:function(a,p,_){const E=o(this);return u(d.call(E,a,p,_))}}const u=c=>A(c)?async d=>{let a;const p=Date.now();for(;!(a=o(d));){if(Date.now()-p>=n)throw new Error("lowcode guard wait timeout");await Kn()}return c(a)}:je(c)?c.then(u):c;return e.beforeEach((c,d,a)=>{if(c.matched.every(p=>qe(p)))return a();Promise.all(c.matched.map(async p=>{var B;if(qe(p))return;const _=(B=p.components)!=null?B:{},E=_.default,y=p.meta[Xt];if(E&&er(y)){let R;Mr(E)?(R=await E(),Qn(R)&&(R=R.default)):R=E,_.default=i(p,R,y,r.initModule(y))}$t(p)})).then(()=>a())})}const Fr={setup:Ar,created:wr,beforeCreate:Lr,initInject:Nr,initProvide:Ir,initEmits:Hr,initProps:Sr,initData:vr,initWatch:Br,initComputed:yr};function jr(e,t,n){function r(o,i,s){var c;const f=((c=e.lifeCycles)!=null?c:{})[o],l=Fr[o];if(f&&l)return l(n,f,t,[i,s])}return r}const Vr=ir(),kr={beforeMount:h.onBeforeMount,mounted:h.onMounted,beforeUpdate:h.onBeforeUpdate,updated:h.onUpdated,activated:h.onActivated,deactivated:h.onDeactivated,beforeUnmount:h.onBeforeUnmount,renderTracked:h.onRenderTracked,renderTriggered:h.onRenderTriggered,unmounted:h.onUnmounted,errorCaptured:h.onErrorCaptured,serverPrefetch:h.onServerPrefetch},$r={componentDidMount:h.onMounted,componentDidCatch:h.onErrorCaptured,shouldComponentUpdate:h.onBeforeUpdate,componentWillUnmount:h.onBeforeUnmount},We={...kr,...$r};function ge(e){return e===h.Fragment}function Xr(e){return e in We}function Jr(e){const t={};if(D(e))for(const n in e)n in We&&(t[n]=e[n]);return t}const Jt=Symbol("IS_LOCKED"),xe=Symbol("IS_ROOT_NODE");function qr(e){const t=h.ref(e),n=h.inject(Jt,null),r=h.computed({get:()=>(n==null?void 0:n.value)||t.value,set:o=>t.value=o});return h.provide(Jt,r),r}function Wr(e){return e?h.provide(xe,!0):(e=h.inject(xe,null),e==null?h.provide(xe,e=!0):e&&h.provide(xe,!1)),e}function ze(e,t=()=>{}){const n=_e(),{getNode:r,wrapLeafComp:o,designMode:i,thisRequiredInJSE:s}=n,u=new K({thisRequired:s}),f=e.__schema.id?r(e.__schema.id):null,l=f?qr(f.isLocked):h.ref(!1),c=i==="design";h.provide(Vr,{mode:i,node:f,isDesignerEnv:c});const d=(m,g,S,T)=>{var Te;if(q(m))return h.createTextVNode(m);if(J(m))return null;if(!de(m)){const $=u.parseSchema(m,S);return h.createTextVNode(h.toDisplayString($))}const{show:N,scence:b}=M(m,S,c);if(!N)return h.createCommentVNode(`${b} ${N}`);const x=m.id?r(m.id):null,{componentName:v}=m;if(!T&&(T=n.components[v],!T)){if(v==="Slot")return z(m.children).flatMap($=>d($,g,S)).filter($=>!J($));if(c)return h.h("div",`component[${v}] not found`);T={setup($,{slots:Y}){return nr("组件未找到, 组件名:"+v),h.h("div",h.mergeProps($,{class:"lc-component-not-found"}),Y)}}}g=o(v,T,g);const C=$=>{n.triggerCompGetCtx(m,$)},{props:O,slots:j}=qt(m),{loop:Z,buildLoopScope:Ce}=w(m,S);if(!Z){const $=R(O,S,x,null,{ref:C}),[Y,Qe]=zt($);return h.h(g,{key:(Te=Y.key)!=null?Te:m.id,__comp:T,__scope:S,__schema:m,__vnodeProps:Y,...Qe},E(j,S,x))}return G(Z)?Z.map(($,Y,Qe)=>{var nn;const Qt=Ce($,Y,Qe.length),so=R(O,S,x,Qt,{ref:C}),[en,ao]=zt(so),tn=ie(S,Qt);return h.h(g,{key:(nn=en.key)!=null?nn:`${m.id}--${Y}`,__comp:T,__scope:tn,__schema:m,__vnodeProps:en,...ao},E(j,tn,x))}):(ne("循环对象必须是数组, type: "+Ge(Z)),null)},_=c?(m,g,S)=>{const T=d(m,ar,g,S);return de(m)&&h.isVNode(T)&&(T.type===h.Comment?t(m,!1):t(m,!0)),T}:(m,g,S)=>d(m,ur,g,S),E=(m,g,S)=>Object.keys(m).reduce((T,N)=>{let b=m[N];const x=N==="default";if(J(b)&&!x||x&&!(S!=null&&S.isContainerNode)&&(G(b)&&b.length===0||J(b)))return T;let v;return G(b)&&b.length===0&&(b=b[0]),G(b)?v=Ze(b,C=>()=>C.map(O=>_(O,g)).filter(O=>!J(O))):ke(b)?v=Ze(b,C=>(...O)=>{var Z;const j=_(C,ie(g,u.parseSlotScope(O,(Z=C.params)!=null?Z:[])));return z(j)}):v=Ze(b,C=>()=>z(_(C,g))),T[N]=x&&c&&(S!=null&&S.isContainerNode)?Zr(v,l):v,T},{}),y=(m,g,S,T,N)=>{var x,v;const b=T?N==null?void 0:N.getProp(T,!1):null;if(oe(m)||fe(m))return u.parseExpression(m,g);if(Ve(m))return u.parseI18n(m,g);if(pe(m)){let C,O;return b!=null&&b.slotNode?(O=b.slotNode.schema,C=ke(O)?(x=O.params)!=null?x:[]:[]):(O=z(m.value),C=(v=m.params)!=null?v:[]),(...j)=>{const Z=u.parseSlotScope(j,C),Ce=[];return z(O).forEach(Te=>{const $=_(Te,ie(g,S,Z));z($).forEach(Y=>Ce.push(Y))}),Ce}}else{if(G(m))return m.map((C,O)=>y(C,g,S,`${T}.${O}`,N));if(m&&D(m)){const C={};return Object.keys(m).forEach(O=>{if(O.startsWith("__"))return;const j=m[O];C[O]=y(j,g,S,`${T}.${O}`,N)}),C}}return m},B=(m,g,S,T,N)=>{if(q(m)){const b=m;let x=null;return v=>{let C=g.$.refs;if(Object.keys(C).length===0&&(C=g.$.refs={}),J(g.__loopRefIndex))C[b]=v,b in g&&(g[b]=v);else{let O=C[b];if(!G(O))O=C[b]=[],b in g&&(O=g[b]=O);else if(b in g){const j=g[b];!G(j)||h.toRaw(j)!==O?O=g[b]=O:O=j}if(J(v)){const j=O.indexOf(x);j>=0&&O.splice(j,1)}else O[g.__loopRefIndex]=v}x=v}}else{const b=y(m,g,S,T,N);return q(b)?B(b,g,S,T,N):b}},R=(m,g,S,T,N)=>{const b={};Object.keys(m).forEach(C=>{Wt(b,C,m[C])});const x={},v=T?ie(g,T):g;return Object.keys(b).forEach(C=>{const O=b[C];x[C]=C==="ref"?B(O,v,T,C,S):y(O,v,T,C,S)}),N&&Object.keys(N).forEach(C=>{Wt(x,C,N[C])}),x},w=(m,g)=>{let S=null;const T=["item","index"];return m.loop&&(S=m.loop),m.loopArgs&&m.loopArgs.forEach((N,b)=>{T[b]=N}),{loop:S?u.parseSchema(S,g):null,loopArgs:T,buildLoopScope(N,b,x){var j;const v=(j=g.__loopRefOffset)!=null?j:0,[C,O]=T;return{[C]:N,[O]:b,__loopScope:!0,__loopRefIndex:v+b,__loopRefOffset:x*b}}}},M=(m,g,S)=>{var b,x;const T=S&&(b=m.hidden)!=null?b:!1,N=(x=m.condition)!=null?x:!0;return T?{scence:"hidden",show:!1}:{scence:"condition",show:typeof N=="boolean"?N:!!u.parseSchema(N,g)}};return{node:f,locked:l,isRootNode:Wr(e.__isRootNode),getNode:r,renderComp:_,buildProps:R,buildSlots:E}}function ye(e,t){const n=h.computed(()=>e.__schema),r={__comp:null,__scope:t,__isRootNode:!0,__vnodeProps:{},__schema:e.__schema},o=h.computed(()=>{var s;return(s=e.__designMode)!=null?s:"live"}),i=h.computed(()=>e.__components);return{scope:t,schemaRef:n,designModeRef:o,componentsRef:i,...ze(r)}}function Se(e,t){var N;const{__schema:n,__scope:r,__parser:o,__appHelper:i,__requestHandlersMap:s}=e,{props:u,state:f,methods:l,lifeCycles:c}=n!=null?n:{},d=h.getCurrentInstance(),a=d.proxy,p=jr(n,a,o);if(p("initEmits"),p("beforeCreate"),p("initProps"),u){const b=o.parseOnlyJsValue(u);V(a,F.PROPS,b)}const _=p("setup",d.props,t);if(p("initInject"),l){const b=o.parseSchema(l,a);b&&V(a,F.CONTEXT,b)}if(p("initData"),f){const b=o.parseSchema(f);b&&V(a,F.DATA,b)}p("initComputed"),p("initWatch"),p("initProvide");const E=o.parseSchema(Jr(c),a);Object.keys(E).length>0&&Object.keys(E).forEach(b=>{if(Xr(b)){const x=E[b];A(x)&&We[b](x,d)}}),zr(n.css,n.id);const y=(b,x)=>{const{__locale:v,__messages:C}=e;return Zn(b,x,v,C)},B=h.computed(()=>e.__locale);V(a,F.CONTEXT,{i18n:y,$t:y}),V(a,F.DATA,{currentLocale:B});const{dataSource:R,dataSourceMap:w,reloadDataSource:M,shouldInit:m}=xr((N=n.dataSource)!=null?N:{list:[],dataHandler:void 0},a,s),g=Object.keys(w).filter(b=>!(b in a)).map(b=>[b,h.ref()]);V(a,F.CONTEXT,{dataSource:R,dataSourceMap:w,reloadDataSource:M}),V(a,F.SETUP,Yn(g)),r&&V(a,F.SETUP,r),p("created");const S=b=>{const x=[];return je(_)&&x.push(_),m()&&x.push(M()),x.length>0?Promise.all(x).then(()=>b):b};V(a,F.CONTEXT,{__loopScope:!1,__loopRefIndex:null,__loopRefOffset:0}),V(a,F.CONTEXT,Object.keys(i).reduce((b,x)=>{const v=x.startsWith("$")?x:"$"+x;return b[v]=i[x],b},{}));const T={_:!0,$:!0};return{scope:new Proxy({},{get(b,x){return x===Symbol.toStringTag?"[object RuntimeScope]":x===Symbol.unscopables?T:Reflect.get(a,x,a)},set(b,x,v){return Reflect.set(a,x,v,a)},has(b,x){return Reflect.has(a,x)},defineProperty(b,x,v){return Reflect.defineProperty(a,x,v)},ownKeys:()=>Array.from(new Set([...Reflect.ownKeys(a.$.props),...Reflect.ownKeys(a.$.data),...Reflect.ownKeys(a.$.setupState),...Reflect.ownKeys(a.$.ctx)]))}),wrapRender:S}}function zr(e,t){var r;let n=null;t&&(n=document.querySelector(`style[data-id="${t}"]`)),e?(n||(n=document.createElement("style"),t&&n.setAttribute("data-id",t),(document.head||document.getElementsByTagName("head")[0]).appendChild(n)),n.innerHTML!==e&&(n.innerHTML=e)):n&&((r=n.parentElement)==null||r.removeChild(n))}const qt=(e,t)=>{var i;const n={},r={};n.default=G(e.children)&&e.children.length===1?e.children[0]:e.children;const o=s=>s==="children"?"default":s;return Object.entries((i=e.props)!=null?i:{}).forEach(([s,u])=>{if(pe(u)){const f=t==null?void 0:t.getProp(s,!1);if(f&&f.slotNode){const l=f.slotNode.schema;ke(l)&&(n[o(s)]=l)}else u.value&&(n[o(s)]={componentName:"Slot",params:u.params,children:u.value})}else s==="className"?r.class=u:s==="children"?n.default=u:r[s]=u}),{props:r,slots:n}},Ze=(e,t)=>t(e),Wt=(e,t,n)=>{var r;if(t.startsWith("v-model")){const o=t.match(/v-model(?::(\w+))?$/);if(!o)return e;const i=me((r=o[1])!=null?r:"modelValue"),s=`onUpdate:${i}`;if(oe(n)){const u={type:"JSFunction",value:`function ($event) {${n.value} = $event}`};e[s]=s in e?z(e[s]).concat(u):u}e[i]=n}else if(!t.startsWith("v-"))if(t.match(/^on[A-Z]/)){const o=t.match(/onUpdate(?::?(\w+))$/);o&&(t=`onUpdate:${me(o[1])}`),e[t]=t in e?z(e[t]).concat(n):n}else if(t==="ref"&&"ref"in e){const o=n,i=e.ref;A(i)&&A(o)?e.ref=(...s)=>{o(...s),i(...s)}:e.ref=[i,o].filter(A).pop()}else e[t]=n},Zr=(e,t)=>(...n)=>{const r=e(...n).filter(Boolean);if(!r.length){const o=t.value,i={"lc-container-locked":o,"lc-container-placeholder":!0},s=o?"锁定元素及子元素无法编辑":"拖拽组件或模板到这里";r.push(h.h("div",{class:i},s))}return r},zt=Fe("key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Zt=Fe(et),Yr=h.defineComponent((e,{slots:t})=>()=>h.h("div",{class:"lc-page",style:{height:"100%"},...e},t)),Kr=h.defineComponent({name:"PageRenderer",props:X,__renderer__:!0,setup(e,t){const{scope:n,wrapRender:r}=Se(e,t),{renderComp:o,componentsRef:i,schemaRef:s}=ye(e,n);return r(()=>o(s.value,n,i.value.Page||Yr))}}),Qr=h.defineComponent({name:"BlockRenderer",props:X,__renderer__:!0,setup(e,t){const{scope:n,wrapRender:r}=Se(e,t),{triggerCompGetCtx:o}=_e(),{renderComp:i,schemaRef:s,componentsRef:u}=ye(e,n),f=u.value[s.value.componentName]||h.Fragment,l=h.getCurrentInstance();return ge(f)&&h.onMounted(()=>{l!=null&&l.proxy&&o(s.value,l.proxy)}),r(()=>i(s.value,n,u.value.Block||h.Fragment))}}),eo=h.defineComponent({name:"ComponentRenderer",props:X,__renderer__:!0,setup(e,t){const{scope:n,wrapRender:r}=Se(e,t),{triggerCompGetCtx:o}=_e(),{renderComp:i,schemaRef:s,componentsRef:u}=ye(e,n),f=u.value[s.value.componentName]||h.Fragment,l=h.getCurrentInstance();return ge(f)&&h.onMounted(()=>{l!=null&&l.proxy&&o(s.value,l.proxy)}),r(()=>i(s.value,n,f))}}),Yt={PageRenderer:Kr,BlockRenderer:Qr,ComponentRenderer:eo};class to{constructor(){re(this,"renderers",{...Yt});re(this,"configProvider",null)}setConfigProvider(t){this.configProvider=t}getConfigProvider(){return this.configProvider}setRenderers(t){this.renderers=t}getRenderers(){return this.renderers}}const Ye=new to,Kt={scope:Object,schema:{type:Object,required:!0},passProps:Object,components:{type:Object,required:!0},designMode:{type:String,default:"live"},device:String,locale:String,messages:{type:Object,default:()=>({})},getNode:Function,onCompGetCtx:Function,thisRequiredInJSE:{type:Boolean,default:!0},disableCompMock:{type:[Array,Boolean],default:!1},appHelper:Object,requestHandlersMap:Object},no=Fe(e=>!e.match(/^[a-z]+([A-Z][a-z]+)*$/)),ro=e=>e&&e.name==="AsyncComponentWrapper",oo=h.defineComponent({props:Kt,setup(e,{slots:t,expose:n}){const r=new K({thisRequired:e.thisRequiredInJSE}).initModule(e.schema),o=(a,p)=>{var _;p&&((_=e.onCompGetCtx)==null||_.call(e,a,p))},i=a=>{var p,_;return(_=(p=e.getNode)==null?void 0:p.call(e,a))!=null?_:null},s=h.shallowRef(e.schema);h.watch(()=>e.schema,()=>s.value=e.schema);let u=()=>!0;h.watchEffect(()=>{const a=e.disableCompMock;vt(a)?u=a?()=>!1:()=>!0:a&&(u=p=>!a.includes(p))});const f=new Map,l=h.reactive({designMode:h.computed(()=>e.designMode),components:h.computed(()=>({...Ye.getRenderers(),...e.components})),thisRequiredInJSE:h.computed(()=>e.thisRequiredInJSE),getNode:a=>{var p,_;return(_=(p=e.getNode)==null?void 0:p.call(e,a))!=null?_:null},triggerCompGetCtx:(a,p)=>{var _;(_=e.onCompGetCtx)==null||_.call(e,a,p)},rerender:Rt(()=>{const a=e.schema.id,p=a&&i(a);if(p){const _=Xe(p);_&&(s.value=_)}h.triggerRef(s)}),wrapLeafComp:(a,p,_)=>{let E=f.get(_);if(E){if(E.has(p))return E.get(p)}else E=new Map,f.set(_,E);if(u(a)&&!ro(p)){const[y,B,R]=no(p);R&&(_=Object.create(_,Object.getOwnPropertyDescriptors(y)))}return E.set(p,_),_}});h.provide(Nt(),l);const c=h.ref();n({runtimeScope:c});const d=()=>{const{components:a}=l,{scope:p,locale:_,messages:E,designMode:y,thisRequiredInJSE:B,requestHandlersMap:R,passProps:w,appHelper:M}=e,{value:m}=s;if(!m)return null;const{componentName:g}=m;let S=a[g]||a[`${g}Renderer`];return S&&!S.__renderer__&&(S=Yt[`${g}Renderer`]),S?h.h(S,{key:m.__ctx?`${m.__ctx.lceKey}_${m.__ctx.idx||"0"}`:m.id,...w,...r.parseOnlyJsValue(m.props),ref:c,__parser:r,__scope:p,__schema:m,__locale:_,__messages:E,__appHelper:M,__components:a,__designMode:y,__thisRequiredInJSE:B,__requestHandlersMap:R,__getNode:i,__triggerCompGetCtx:o},t):null};return()=>{const{device:a,locale:p}=e,_=Ye.getConfigProvider();return _?h.h(_,{device:a,locale:p},{default:d}):d()}}}),io=()=>{K.cleanCachedModules()};L.LOWCODE_ROUTE_META=Xt,L.SchemaParser=K,L.baseRendererPropKeys=rn,L.cleanCacledModules=io,L.config=Ye,L.default=oo,L.leafPropKeys=et,L.leafProps=ae,L.mergeScope=ie,L.rendererProps=X,L.setupLowCodeRouteGuard=Gr,L.useLeaf=ze,L.useRenderer=ye,L.useRootScope=Se,L.vueRendererProps=Kt,Object.defineProperties(L,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); 5 | //# sourceMappingURL=vue-renderer.js.map 6 | -------------------------------------------------------------------------------- /public/js/vue-simulator-renderer.css: -------------------------------------------------------------------------------- 1 | body,html{display:block;margin:0;padding:0;background:white}html.engine-design-mode{padding-bottom:0}html.engine-cursor-move,html.engine-cursor-move *{cursor:grabbing!important}html.engine-cursor-copy,html.engine-cursor-copy *{cursor:copy!important}html.engine-cursor-ew-resize,html.engine-cursor-ew-resize *{cursor:ew-resize!important}html.lc-cursor-dragging,html.lc-cursor-dragging *{cursor:move!important}html.lc-cursor-x-resizing,html.lc-cursor-x-resizing *{cursor:col-resize}html.lc-cursor-y-resizing,html.lc-cursor-y-resizing *{cursor:row-resize}html.lc-cursor-copy,html.lc-cursor-copy *{cursor:copy!important}::-webkit-scrollbar{width:5px;height:5px}::-webkit-scrollbar-thumb{background-color:#0000004d;border-radius:5px}.lc-container{height:100%}.lc-container:empty{display:flex;align-items:center;min-width:140px;height:66px;max-height:100%;overflow:hidden;color:#a7b1bd;text-align:center;background:#f2f3f5;outline:1px dashed rgba(31,56,88,.2);outline-offset:-1px!important}.lc-container:empty:before{z-index:1;width:100%;font-size:14px;white-space:nowrap;content:"拖拽组件或模板到这里"}.lc-container-placeholder{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:60px;color:#a7b1bd;font-size:14px;background-color:#f0f0f0;border:1px dotted}.lc-container-placeholder.lc-container-locked{background:#eccfcf}body.engine-document:after,body.engine-document:before{display:table;content:""}body.engine-document:after{clear:both}.engine-live-editing{outline:none;box-shadow:0 0 0 2px #66bc5c;cursor:text;user-select:text}#app{height:100vh} 2 | -------------------------------------------------------------------------------- /public/mock/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": "Hello AliLowCode!!11111111111", 3 | "user": { 4 | "username": "user.name", 5 | "password": "abc123_" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /public/preview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Lowcode Engine Preview 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/assets/assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | { 4 | "package": "naive-ui", 5 | "version": "2.32.0", 6 | "urls": ["https://unpkg.com/naive-ui@2.32.0/dist/index.prod.js"], 7 | "library": "naive" 8 | } 9 | ], 10 | "components": [ 11 | { 12 | "title": "页面", 13 | "componentName": "Page", 14 | "props": [ 15 | { 16 | "name": "style", 17 | "propType": "object", 18 | "defaultValue": { 19 | "padding": 12 20 | } 21 | } 22 | ], 23 | "configure": { 24 | "supports": { 25 | "style": true 26 | }, 27 | "component": { 28 | "isContainer": true, 29 | "disableBehaviors": "*" 30 | } 31 | } 32 | }, 33 | { 34 | "title": "插槽", 35 | "componentName": "Slot", 36 | "configure": { 37 | "component": { 38 | "isContainer": true, 39 | "disableBehaviors": "*" 40 | } 41 | } 42 | }, 43 | { 44 | "title": "头像", 45 | "category": "基础组件", 46 | "componentName": "NAvatar", 47 | "npm": { 48 | "package": "naive-ui", 49 | "version": "2.30.6", 50 | "exportName": "NAvatar", 51 | "destructuring": true 52 | }, 53 | "props": [ 54 | { 55 | "name": "src", 56 | "propType": "string" 57 | }, 58 | { 59 | "name": "circle", 60 | "propType": "bool" 61 | }, 62 | { 63 | "name": "round", 64 | "propType": "bool" 65 | }, 66 | { 67 | "name": "bordered", 68 | "propType": "bool" 69 | }, 70 | { 71 | "name": "size", 72 | "propType": { 73 | "type": "oneOfType", 74 | "value": ["string", "number"] 75 | } 76 | } 77 | ], 78 | "configure": { 79 | "props": [ 80 | { 81 | "name": "src", 82 | "title": "图片链接地址", 83 | "setter": "StringSetter" 84 | }, 85 | { 86 | "name": "circle", 87 | "title": "是否为原型", 88 | "setter": "BoolSetter" 89 | }, 90 | { 91 | "name": "round", 92 | "title": "是否显示圆角", 93 | "setter": "BoolSetter" 94 | }, 95 | { 96 | "name": "bordered", 97 | "title": "是否带边框", 98 | "setter": "BoolSetter" 99 | }, 100 | { 101 | "name": "size", 102 | "title": "头像大小", 103 | "setter": { 104 | "componentName": "MixedSetter", 105 | "props": { 106 | "setters": [ 107 | { 108 | "componentName": "RadioGroupSetter", 109 | "props": { 110 | "options": [ 111 | { "label": "small", "value": "small" }, 112 | { "label": "medium", "value": "medium" }, 113 | { "label": "large", "value": "large" } 114 | ], 115 | "defaultValue": "medium" 116 | } 117 | }, 118 | "NumberSetter" 119 | ] 120 | } 121 | } 122 | } 123 | ], 124 | "supports": { 125 | "style": true, 126 | "events": ["onClick", "onError"] 127 | } 128 | } 129 | }, 130 | { 131 | "title": "卡片", 132 | "category": "布局组件", 133 | "componentName": "NCard", 134 | "npm": { 135 | "package": "naive-ui", 136 | "version": "2.30.6", 137 | "exportName": "NCard", 138 | "destructuring": true 139 | }, 140 | "props": [ 141 | { 142 | "name": "title", 143 | "propType": "string" 144 | }, 145 | { 146 | "name": "size", 147 | "propType": { 148 | "type": "oneOf", 149 | "value": ["small", "medium", "large", "huge"] 150 | } 151 | }, 152 | { 153 | "name": "bordered", 154 | "propType": "bool" 155 | }, 156 | { 157 | "name": "closable", 158 | "propType": "bool" 159 | }, 160 | { 161 | "name": "hoverable", 162 | "propType": "bool" 163 | }, 164 | { 165 | "name": "segmented", 166 | "propType": "object" 167 | }, 168 | { 169 | "name": "header", 170 | "propType": "node" 171 | }, 172 | { 173 | "name": "action", 174 | "propType": "node" 175 | }, 176 | { 177 | "name": "footer", 178 | "propType": "node" 179 | }, 180 | { 181 | "name": "header-extra", 182 | "propType": "node" 183 | } 184 | ], 185 | "configure": { 186 | "supports": { 187 | "style": true, 188 | "events": ["onClose"], 189 | "loop": false 190 | }, 191 | "component": { 192 | "isContainer": true 193 | }, 194 | "props": [ 195 | { 196 | "type": "group", 197 | "title": "卡片样式", 198 | "extraProps": { 199 | "display": "block" 200 | }, 201 | "items": [ 202 | { 203 | "name": "size", 204 | "title": "卡片尺寸", 205 | "setter": { 206 | "componentName": "RadioGroupSetter", 207 | "props": { 208 | "options": [ 209 | { "label": "small", "value": "small" }, 210 | { "label": "medium", "value": "medium" }, 211 | { "label": "large", "value": "large" }, 212 | { "label": "huge", "value": "huge" } 213 | ], 214 | "defaultValue": "medium" 215 | } 216 | } 217 | }, 218 | { 219 | "name": "bordered", 220 | "title": "显示边框", 221 | "setter": "BoolSetter" 222 | }, 223 | { 224 | "name": "closable", 225 | "title": "显示关闭图标", 226 | "setter": "BoolSetter" 227 | }, 228 | { 229 | "name": "hoverable", 230 | "title": "可悬浮", 231 | "setter": "BoolSetter" 232 | } 233 | ] 234 | }, 235 | { 236 | "type": "group", 237 | "title": "分割线", 238 | "extraProps": { 239 | "display": "block" 240 | }, 241 | "items": [ 242 | { 243 | "name": "segmented.content", 244 | "title": "内容分割线", 245 | "setter": { 246 | "componentName": "BoolSetter", 247 | "initialValue": false 248 | } 249 | }, 250 | { 251 | "name": "segmented.footer", 252 | "title": "底部分割线", 253 | "setter": { 254 | "componentName": "BoolSetter", 255 | "initialValue": false 256 | } 257 | }, 258 | { 259 | "name": "segmented.action", 260 | "title": "操作区分割线", 261 | "setter": { 262 | "componentName": "BoolSetter", 263 | "initialValue": false 264 | } 265 | } 266 | ] 267 | }, 268 | { 269 | "title": "卡片内容", 270 | "type": "group", 271 | "extraProps": { 272 | "display": "block" 273 | }, 274 | "items": [ 275 | { 276 | "name": "title", 277 | "title": "标题内容", 278 | "setter": "StringSetter" 279 | }, 280 | { 281 | "name": "header", 282 | "title": "头部", 283 | "setter": { 284 | "componentName": "SlotSetter", 285 | "initialValue": { 286 | "type": "JSSlot", 287 | "title": "头部", 288 | "value": [] 289 | } 290 | } 291 | }, 292 | { 293 | "name": "header-extra", 294 | "title": "头部附加", 295 | "setter": { 296 | "componentName": "SlotSetter", 297 | "initialValue": { 298 | "type": "JSSlot", 299 | "title": "头部附加", 300 | "value": [] 301 | } 302 | } 303 | }, 304 | { 305 | "name": "footer", 306 | "title": "底部", 307 | "setter": { 308 | "componentName": "SlotSetter", 309 | "initialValue": { 310 | "type": "JSSlot", 311 | "title": "底部", 312 | "value": [] 313 | } 314 | } 315 | }, 316 | { 317 | "name": "action", 318 | "title": "操作区", 319 | "setter": { 320 | "componentName": "SlotSetter", 321 | "initialValue": { 322 | "type": "JSSlot", 323 | "title": "操作区", 324 | "value": [] 325 | } 326 | } 327 | } 328 | ] 329 | } 330 | ] 331 | } 332 | }, 333 | { 334 | "title": "文本", 335 | "category": "基础组件", 336 | "componentName": "NText", 337 | "npm": { 338 | "package": "naive-ui", 339 | "version": "2.30.6", 340 | "exportName": "NText", 341 | "destructuring": true 342 | }, 343 | "props": [ 344 | { 345 | "name": "children", 346 | "propType": "string" 347 | }, 348 | { 349 | "name": "type", 350 | "propType": "string" 351 | }, 352 | { 353 | "name": "strong", 354 | "propType": "bool" 355 | }, 356 | { 357 | "name": "italic", 358 | "propType": "bool" 359 | }, 360 | { 361 | "name": "underline", 362 | "propType": "bool" 363 | }, 364 | { 365 | "name": "delete", 366 | "propType": "bool" 367 | }, 368 | { 369 | "name": "code", 370 | "propType": "bool" 371 | }, 372 | { 373 | "name": "depth", 374 | "propType": "string" 375 | } 376 | ], 377 | "configure": { 378 | "supports": { 379 | "style": true 380 | }, 381 | "props": [ 382 | { 383 | "name": "children", 384 | "title": "文本内容", 385 | "setter": "StringSetter" 386 | }, 387 | { 388 | "name": "type", 389 | "title": "排印类型", 390 | "setter": { 391 | "componentName": "SelectSetter", 392 | "props": { 393 | "options": [ 394 | { "label": "default", "value": "default" }, 395 | { "label": "success", "value": "success" }, 396 | { "label": "info", "value": "info" }, 397 | { "label": "warning", "value": "warning" }, 398 | { "label": "error", "value": "error" } 399 | ] 400 | }, 401 | "initialValue": "default" 402 | } 403 | }, 404 | { 405 | "name": "strong", 406 | "title": "加粗", 407 | "setter": "BoolSetter" 408 | }, 409 | { 410 | "name": "italic", 411 | "title": "斜体", 412 | "setter": "BoolSetter" 413 | }, 414 | { 415 | "name": "underline", 416 | "title": "下划线", 417 | "setter": "BoolSetter" 418 | }, 419 | { 420 | "name": "delete", 421 | "title": "删除线", 422 | "setter": "BoolSetter" 423 | }, 424 | { 425 | "name": "code", 426 | "title": "代码模式", 427 | "setter": "BoolSetter" 428 | }, 429 | { 430 | "name": "depth", 431 | "title": "文字深度", 432 | "setter": { 433 | "componentName": "RadioGroupSetter", 434 | "props": { 435 | "options": [ 436 | { "label": "1", "value": "1" }, 437 | { "label": "2", "value": "2" }, 438 | { "label": "3", "value": "3" } 439 | ] 440 | } 441 | } 442 | }, 443 | { 444 | "name": "tag", 445 | "title": "DOM 标签", 446 | "setter": { 447 | "componentName": "SelectSetter", 448 | "props": { 449 | "options": [ 450 | { "label": "p", "value": "p" }, 451 | { "label": "span", "value": "span" }, 452 | { "label": "label", "value": "label" } 453 | ] 454 | }, 455 | "initialValue": "span" 456 | } 457 | } 458 | ] 459 | } 460 | }, 461 | { 462 | "title": "间距", 463 | "category": "布局组件", 464 | "componentName": "NSpace", 465 | "npm": { 466 | "package": "naive-ui", 467 | "version": "2.30.6", 468 | "exportName": "NSpace", 469 | "destructuring": true 470 | }, 471 | "props": [ 472 | { 473 | "name": "align", 474 | "propType": "string" 475 | }, 476 | { 477 | "name": "wrap-item", 478 | "propType": "bool" 479 | }, 480 | { 481 | "name": "justify", 482 | "propType": "string" 483 | }, 484 | { 485 | "name": "size", 486 | "propType": { 487 | "type": "oneOfType", 488 | "value": ["string", "number"] 489 | } 490 | }, 491 | { 492 | "name": "inline", 493 | "propType": "bool" 494 | }, 495 | { 496 | "name": "vertical", 497 | "propType": "bool" 498 | }, 499 | { 500 | "name": "wrap", 501 | "propType": "bool" 502 | }, 503 | { 504 | "name": "item-style", 505 | "propType": "string" 506 | } 507 | ], 508 | "configure": { 509 | "component": { 510 | "isContainer": true 511 | }, 512 | "props": [ 513 | { 514 | "name": "align", 515 | "title": "垂直排列方式", 516 | "setter": { 517 | "componentName": "SelectSetter", 518 | "props": { 519 | "options": [ 520 | { "title": "start", "value": "start" }, 521 | { "title": "end", "value": "end" }, 522 | { "title": "center", "value": "center" }, 523 | { "title": "baseline", "value": "baseline" }, 524 | { "title": "stretch", "value": "stretch" } 525 | ] 526 | } 527 | }, 528 | "defaultValue": "start" 529 | }, 530 | { 531 | "name": "justify", 532 | "title": "水平排列方式", 533 | "setter": { 534 | "componentName": "SelectSetter", 535 | "props": { 536 | "options": [ 537 | { "title": "start", "value": "start" }, 538 | { "title": "end", "value": "end" }, 539 | { "title": "center", "value": "center" }, 540 | { "title": "space-around", "value": "space-around" }, 541 | { "title": "space-between", "value": "space-between" }, 542 | { "title": "space-evenly", "value": "space-evenly" } 543 | ] 544 | } 545 | }, 546 | "defaultValue": "start" 547 | }, 548 | { 549 | "name": "size", 550 | "title": { 551 | "label": "间距大小", 552 | "tip": "为数字时,是水平和垂直间距;为数组时,是 [水平间距, 垂直间距]" 553 | }, 554 | "setter": { 555 | "componentName": "MixedSetter", 556 | "props": { 557 | "setters": [ 558 | { 559 | "componentName": "RadioGroupSetter", 560 | "props": { 561 | "options": [ 562 | { "label": "small", "value": "small" }, 563 | { "label": "medium", "value": "medium" }, 564 | { "label": "large", "value": "large" } 565 | ] 566 | } 567 | }, 568 | "NumberSetter" 569 | ] 570 | } 571 | }, 572 | "defaultValue": "medium" 573 | }, 574 | { 575 | "name": "wrap-item", 576 | "title": "是否包裹元素", 577 | "setter": "BoolSetter" 578 | }, 579 | { 580 | "name": "inline", 581 | "title": "是否为行内元素", 582 | "setter": "BoolSetter" 583 | }, 584 | { 585 | "name": "vertical", 586 | "title": "是否垂直布局", 587 | "setter": "BoolSetter" 588 | }, 589 | { 590 | "name": "wrap", 591 | "title": "是否超出换行", 592 | "setter": "BoolSetter" 593 | }, 594 | { 595 | "name": "item-style", 596 | "title": "节点样式", 597 | "setter": "StringSetter" 598 | } 599 | ] 600 | } 601 | }, 602 | { 603 | "title": "栅格", 604 | "category": "布局组件", 605 | "componentName": "NGrid", 606 | "npm": { 607 | "package": "naive-ui", 608 | "version": "2.30.6", 609 | "exportName": "NGrid", 610 | "destructuring": true 611 | }, 612 | "configure": { 613 | "component": { 614 | "isContainer": true 615 | }, 616 | "props": [ 617 | { 618 | "name": "cols", 619 | "title": "显示的栅格数量", 620 | "setter": { 621 | "componentName": "MixedSetter", 622 | "props": { 623 | "setters": ["NumberSetter", "StringSetter"] 624 | } 625 | }, 626 | "defaultValue": 24 627 | }, 628 | { 629 | "name": "collapsed", 630 | "title": "是否默认折叠", 631 | "setter": "BoolSetter", 632 | "defaultValue": false 633 | }, 634 | { 635 | "name": "collapsed-rows", 636 | "title": "默认展示的行数", 637 | "setter": "NumberSetter", 638 | "defaultValue": 1 639 | }, 640 | { 641 | "name": "responsive", 642 | "title": "响应式策略", 643 | "setter": { 644 | "componentName": "RadioGroupSetter", 645 | "props": { 646 | "options": [ 647 | { "label": "自身宽度", "value": "self" }, 648 | { "label": "屏幕宽度", "value": "screen" } 649 | ] 650 | } 651 | }, 652 | "defaultValue": "self" 653 | }, 654 | { 655 | "name": "item-responsive", 656 | "title": "子元素响应式宽度", 657 | "setter": "BoolSetter", 658 | "defaultValue": false 659 | }, 660 | { 661 | "name": "x-gap", 662 | "title": "横向间隔槽", 663 | "setter": { 664 | "componentName": "MixedSetter", 665 | "props": { 666 | "setters": ["NumberSetter", "StringSetter"] 667 | } 668 | }, 669 | "defaultValue": 0 670 | }, 671 | { 672 | "name": "y-gap", 673 | "title": "纵向间隔槽", 674 | "setter": { 675 | "componentName": "MixedSetter", 676 | "props": { 677 | "setters": ["NumberSetter", "StringSetter"] 678 | } 679 | }, 680 | "defaultValue": 0 681 | } 682 | ] 683 | } 684 | }, 685 | { 686 | "title": "栅格项", 687 | "category": "布局组件", 688 | "componentName": "NGridItem", 689 | "npm": { 690 | "package": "naive-ui", 691 | "version": "2.30.6", 692 | "exportName": "NGridItem", 693 | "destructuring": true 694 | }, 695 | "configure": { 696 | "component": { 697 | "isContainer": true 698 | }, 699 | "props": [ 700 | { 701 | "name": "offset", 702 | "title": "栅格左侧的间隔格数", 703 | "setter": { 704 | "componentName": "MixedSetter", 705 | "props": { 706 | "setters": ["NumberSetter", "StringSetter"] 707 | } 708 | }, 709 | "defaultValue": 0 710 | }, 711 | { 712 | "name": "span", 713 | "title": "栅格占据的列数", 714 | "setter": { 715 | "componentName": "MixedSetter", 716 | "props": { 717 | "setters": ["NumberSetter", "StringSetter"] 718 | } 719 | }, 720 | "defaultValue": 1 721 | }, 722 | { 723 | "name": "suffix", 724 | "title": "栅格后缀", 725 | "setter": "BoolSetter", 726 | "defaultValue": false 727 | } 728 | ] 729 | } 730 | }, 731 | { 732 | "category": "基础组件", 733 | "componentName": "NButton", 734 | "npm": { 735 | "package": "naive-ui", 736 | "version": "2.30.6", 737 | "exportName": "NButton", 738 | "destructuring": true 739 | }, 740 | "props": [ 741 | { 742 | "name": "children", 743 | "propType": "string" 744 | }, 745 | { 746 | "name": "text", 747 | "propType": "bool" 748 | }, 749 | { 750 | "name": "color", 751 | "propType": "string" 752 | }, 753 | { 754 | "name": "type", 755 | "propType": "string" 756 | }, 757 | { 758 | "name": "size", 759 | "propType": "string" 760 | }, 761 | { 762 | "name": "text-color", 763 | "propType": "string" 764 | }, 765 | { 766 | "name": "dashed", 767 | "propType": "bool" 768 | }, 769 | { 770 | "name": "secondary", 771 | "propType": "bool" 772 | }, 773 | { 774 | "name": "circle", 775 | "propType": "bool" 776 | }, 777 | { 778 | "name": "round", 779 | "propType": "bool" 780 | }, 781 | { 782 | "name": "disabled", 783 | "propType": "bool" 784 | }, 785 | { 786 | "name": "ghost", 787 | "propType": "bool" 788 | }, 789 | { 790 | "name": "loading", 791 | "propType": "bool" 792 | }, 793 | { 794 | "name": "strong", 795 | "propType": "bool" 796 | }, 797 | { 798 | "name": "attr-type", 799 | "propType": "string" 800 | } 801 | ], 802 | "configure": { 803 | "props": [ 804 | { 805 | "title": "按钮功能", 806 | "type": "group", 807 | "extraProps": { 808 | "display": "block" 809 | }, 810 | "items": [ 811 | { 812 | "name": "children", 813 | "title": "按钮内容", 814 | "setter": "StringSetter" 815 | }, 816 | { 817 | "name": "disabled", 818 | "title": "是否禁用", 819 | "setter": "BoolSetter" 820 | }, 821 | { 822 | "name": "loading", 823 | "title": "显示加载状态", 824 | "setter": "BoolSetter" 825 | }, 826 | { 827 | "name": "attr-type", 828 | "title": { 829 | "label": "按钮原生类型", 830 | "tip": "按钮的 DOM 的 type 属性" 831 | }, 832 | "setter": { 833 | "componentName": "RadioGroupSetter", 834 | "props": { 835 | "options": [ 836 | { "title": "button", "value": "button" }, 837 | { "title": "submit", "value": "submit" }, 838 | { "title": "reset", "value": "reset" } 839 | ] 840 | } 841 | }, 842 | "defaultValue": "button" 843 | } 844 | ] 845 | }, 846 | { 847 | "title": "按钮样式", 848 | "type": "group", 849 | "extraProps": { 850 | "display": "block" 851 | }, 852 | "items": [ 853 | { 854 | "name": "type", 855 | "title": "按钮的类型", 856 | "setter": { 857 | "componentName": "SelectSetter", 858 | "props": { 859 | "options": [ 860 | { "title": "default", "value": "default" }, 861 | { "title": "tertiary", "value": "tertiary" }, 862 | { "title": "primary", "value": "primary" }, 863 | { "title": "success", "value": "success" }, 864 | { "title": "info", "value": "info" }, 865 | { "title": "warning", "value": "warning" }, 866 | { "title": "error", "value": "error" } 867 | ] 868 | } 869 | }, 870 | "defaultValue": "default" 871 | }, 872 | { 873 | "name": "text", 874 | "title": "文本按钮", 875 | "setter": "BoolSetter" 876 | }, 877 | { 878 | "name": "link", 879 | "title": "链接按钮", 880 | "setter": "BoolSetter" 881 | }, 882 | { 883 | "name": "size", 884 | "title": "按钮的尺寸", 885 | "setter": { 886 | "componentName": "RadioGroupSetter", 887 | "props": { 888 | "options": [ 889 | { "label": "tiny", "value": "tiny" }, 890 | { "label": "small", "value": "small" }, 891 | { "label": "medium", "value": "medium" }, 892 | { "label": "large", "value": "large" } 893 | ] 894 | } 895 | }, 896 | "defaultValue": "medium" 897 | }, 898 | { 899 | "name": "bordered", 900 | "title": "显示边框", 901 | "setter": "BoolSetter", 902 | "defaultValue": true 903 | }, 904 | { 905 | "name": "circle", 906 | "title": "是否为圆形", 907 | "setter": "BoolSetter" 908 | }, 909 | { 910 | "name": "color", 911 | "title": "按钮颜色", 912 | "setter": "ColorSetter" 913 | }, 914 | { 915 | "name": "text-color", 916 | "title": "按钮文本颜色", 917 | "setter": "ColorSetter" 918 | }, 919 | { 920 | "name": "dashed", 921 | "title": "虚线边框", 922 | "setter": "BoolSetter" 923 | }, 924 | { 925 | "name": "ghost", 926 | "title": "是否透明", 927 | "setter": "BoolSetter" 928 | }, 929 | { 930 | "name": "round", 931 | "title": "是否显示圆角", 932 | "setter": "BoolSetter" 933 | }, 934 | { 935 | "name": "secondary", 936 | "title": "是否是次要按钮", 937 | "setter": "BoolSetter" 938 | }, 939 | { 940 | "name": "strong", 941 | "title": "文字是否加粗", 942 | "setter": "BoolSetter" 943 | } 944 | ] 945 | } 946 | ], 947 | "supports": { 948 | "style": true, 949 | "loop": true, 950 | "events": ["onClick"] 951 | } 952 | } 953 | }, 954 | { 955 | "category": "数据录入", 956 | "title": "表单", 957 | "componentName": "NForm", 958 | "npm": { 959 | "package": "naive-ui", 960 | "version": "2.30.6", 961 | "exportName": "NForm", 962 | "destructuring": true 963 | }, 964 | "props": [ 965 | { 966 | "name": "disabled", 967 | "propType": "bool" 968 | }, 969 | { 970 | "name": "inline", 971 | "propType": "bool" 972 | }, 973 | { 974 | "name": "label-width", 975 | "propType": { 976 | "type": "oneOfType", 977 | "value": ["string", "number"] 978 | } 979 | }, 980 | { 981 | "name": "label-align", 982 | "propType": { 983 | "type": "oneOf", 984 | "value": ["left", "right"] 985 | } 986 | }, 987 | { 988 | "name": "label-placement", 989 | "propType": { 990 | "type": "oneOf", 991 | "value": ["left", "top"] 992 | } 993 | }, 994 | { 995 | "name": "model", 996 | "propType": "object" 997 | }, 998 | { 999 | "name": "rules", 1000 | "propType": "object" 1001 | }, 1002 | { 1003 | "name": "show-feedback", 1004 | "propType": "bool" 1005 | }, 1006 | { 1007 | "name": "show-label", 1008 | "propType": "bool" 1009 | }, 1010 | { 1011 | "name": "show-require-mark", 1012 | "propType": "bool" 1013 | }, 1014 | { 1015 | "name": "require-mark-placement", 1016 | "propType": { 1017 | "type": "oneOf", 1018 | "value": ["left", "right", "right-hanging"] 1019 | } 1020 | } 1021 | ], 1022 | "configure": { 1023 | "supports": { 1024 | "style": true, 1025 | "events": ["onSubmit"] 1026 | }, 1027 | "component": { 1028 | "isContainer": true 1029 | }, 1030 | "props": [ 1031 | { 1032 | "name": "model", 1033 | "title": "表项值对象", 1034 | "setter": "ExpressionSetter" 1035 | }, 1036 | { 1037 | "name": "rules", 1038 | "title": "表项值对象", 1039 | "setter": { 1040 | "componentName": "MixedSetter", 1041 | "props": { 1042 | "setters": ["ExpressionSetter", "JsonSetter"] 1043 | } 1044 | } 1045 | }, 1046 | { 1047 | "name": "disabled", 1048 | "title": "是否禁用", 1049 | "setter": "BoolSetter" 1050 | }, 1051 | { 1052 | "name": "inline", 1053 | "title": "行内表单", 1054 | "setter": "BoolSetter" 1055 | }, 1056 | { 1057 | "name": "label-width", 1058 | "title": { 1059 | "label": "标签宽度", 1060 | "tip": "在 label-placement 是 'left' 的时候可能会有用,'auto' 意味着 label width 会被自动调整" 1061 | }, 1062 | "setter": { 1063 | "componentName": "MixedSetter", 1064 | "props": { 1065 | "setters": ["StringSetter", "NumberSetter"] 1066 | } 1067 | }, 1068 | "defaultValue": "auto" 1069 | }, 1070 | { 1071 | "name": "label-align", 1072 | "title": "标签文本对齐方式", 1073 | "setter": { 1074 | "componentName": "RadioGroupSetter", 1075 | "props": { 1076 | "options": [ 1077 | { "title": "left", "value": "left" }, 1078 | { "title": "right", "value": "right" } 1079 | ] 1080 | } 1081 | }, 1082 | "defaultValue": "left" 1083 | }, 1084 | { 1085 | "name": "label-placement", 1086 | "title": "标签位置", 1087 | "setter": { 1088 | "componentName": "RadioGroupSetter", 1089 | "props": { 1090 | "options": [ 1091 | { "title": "left", "value": "left" }, 1092 | { "title": "top", "value": "top" } 1093 | ] 1094 | } 1095 | }, 1096 | "defaultValue": "left" 1097 | }, 1098 | { 1099 | "name": "show-feedback", 1100 | "title": "展示校验反馈", 1101 | "setter": "BoolSetter" 1102 | }, 1103 | { 1104 | "name": "show-label", 1105 | "title": "展示标签", 1106 | "setter": "BoolSetter" 1107 | }, 1108 | { 1109 | "name": "show-require-mark", 1110 | "title": "展示必填星号", 1111 | "setter": "BoolSetter" 1112 | }, 1113 | { 1114 | "name": "require-mark-placement", 1115 | "title": "星号位置", 1116 | "setter": { 1117 | "componentName": "RadioGroupSetter", 1118 | "props": { 1119 | "options": [ 1120 | { "title": "left", "value": "left" }, 1121 | { "title": "right", "value": "right" }, 1122 | { "title": "right-hanging", "value": "right-hanging" } 1123 | ] 1124 | } 1125 | }, 1126 | "defaultValue": "right" 1127 | } 1128 | ] 1129 | } 1130 | }, 1131 | { 1132 | "title": "表单项", 1133 | "category": "数据录入", 1134 | "componentName": "NFormItem", 1135 | "npm": { 1136 | "package": "naive-ui", 1137 | "version": "2.30.6", 1138 | "exportName": "NFormItem", 1139 | "destructuring": true 1140 | }, 1141 | "props": [ 1142 | { 1143 | "name": "feedback", 1144 | "propType": "string" 1145 | }, 1146 | { 1147 | "name": "label", 1148 | "propType": "string" 1149 | }, 1150 | { 1151 | "name": "label-align", 1152 | "propType": "string" 1153 | }, 1154 | { 1155 | "name": "label-width", 1156 | "propType": { 1157 | "type": "oneOfType", 1158 | "value": ["string", "number"] 1159 | } 1160 | }, 1161 | { 1162 | "name": "label-placement", 1163 | "propType": "string" 1164 | }, 1165 | { 1166 | "name": "label-style", 1167 | "propType": { 1168 | "type": "oneOfType", 1169 | "value": ["string", "object"] 1170 | } 1171 | }, 1172 | { 1173 | "name": "path", 1174 | "propType": "string" 1175 | }, 1176 | { 1177 | "name": "rule", 1178 | "propType": "array" 1179 | }, 1180 | { 1181 | "name": "rule-path", 1182 | "propType": "string" 1183 | }, 1184 | { 1185 | "name": "show-feedback", 1186 | "propType": "bool" 1187 | }, 1188 | { 1189 | "name": "show-label", 1190 | "propType": "bool" 1191 | }, 1192 | { 1193 | "name": "show-require-mark", 1194 | "propType": "bool" 1195 | }, 1196 | { 1197 | "name": "require-mark-placement", 1198 | "propType": "string" 1199 | }, 1200 | { 1201 | "name": "size", 1202 | "propType": "string" 1203 | }, 1204 | { 1205 | "name": "validation-status", 1206 | "propType": "string" 1207 | } 1208 | ], 1209 | "configure": { 1210 | "component": { 1211 | "isContainer": true 1212 | }, 1213 | "supports": { 1214 | "loop": true, 1215 | "style": true 1216 | }, 1217 | "props": [ 1218 | { 1219 | "name": "path", 1220 | "title": "值路径", 1221 | "setter": "StringSetter" 1222 | }, 1223 | { 1224 | "name": "size", 1225 | "title": "尺寸", 1226 | "setter": { 1227 | "componentName": "RadioGroupSetter", 1228 | "props": { 1229 | "options": [ 1230 | { "title": "small", "value": "small" }, 1231 | { "title": "medium", "value": "medium" }, 1232 | { "title": "large", "value": "large" } 1233 | ] 1234 | } 1235 | }, 1236 | "defaultValue": "medium" 1237 | }, 1238 | { 1239 | "type": "group", 1240 | "title": "标签设置", 1241 | "extraProps": { 1242 | "display": "block" 1243 | }, 1244 | "items": [ 1245 | { 1246 | "name": "label", 1247 | "title": "标签内容", 1248 | "setter": "StringSetter" 1249 | }, 1250 | { 1251 | "name": "show-label", 1252 | "title": "显示标签", 1253 | "setter": "BoolSetter", 1254 | "defaultValue": true 1255 | }, 1256 | { 1257 | "name": "label-align", 1258 | "title": "文本对齐方式", 1259 | "setter": { 1260 | "componentName": "RadioGroupSetter", 1261 | "props": { 1262 | "options": [ 1263 | { "title": "left", "value": "left" }, 1264 | { "title": "right", "value": "right" } 1265 | ] 1266 | } 1267 | }, 1268 | "defaultValue": "left" 1269 | }, 1270 | { 1271 | "name": "label-width", 1272 | "title": { 1273 | "label": "标签宽度", 1274 | "tip": "在 label-placement 是 'left' 的时候可能会有用,'auto' 意味着 label width 会被自动调整" 1275 | }, 1276 | "setter": { 1277 | "componentName": "MixedSetter", 1278 | "props": { 1279 | "setters": ["StringSetter", "NumberSetter"] 1280 | } 1281 | }, 1282 | "defaultValue": "auto" 1283 | }, 1284 | { 1285 | "name": "label-placement", 1286 | "title": "标签位置", 1287 | "setter": { 1288 | "componentName": "RadioGroupSetter", 1289 | "props": { 1290 | "options": [ 1291 | { "title": "left", "value": "left" }, 1292 | { "title": "top", "value": "top" } 1293 | ] 1294 | } 1295 | }, 1296 | "defaultValue": "left" 1297 | }, 1298 | { 1299 | "name": "label-style", 1300 | "title": "标签样式", 1301 | "setter": { 1302 | "componentName": "MixedSetter", 1303 | "props": { 1304 | "setters": ["StringSetter", "JsonSetter"] 1305 | } 1306 | } 1307 | }, 1308 | { 1309 | "name": "show-require-mark", 1310 | "title": "显示必填星号", 1311 | "setter": "BoolSetter" 1312 | }, 1313 | { 1314 | "name": "require-mark-placement", 1315 | "title": "必填星号位置", 1316 | "setter": { 1317 | "componentName": "RadioGroupSetter", 1318 | "props": { 1319 | "options": [ 1320 | { "title": "left", "value": "left" }, 1321 | { "title": "right", "value": "right" }, 1322 | { "title": "right-hanging", "value": "right-hanging" } 1323 | ] 1324 | } 1325 | }, 1326 | "defaultValue": "right" 1327 | } 1328 | ] 1329 | }, 1330 | { 1331 | "type": "group", 1332 | "title": "校验设置", 1333 | "extraProps": { 1334 | "display": "block" 1335 | }, 1336 | "items": [ 1337 | { 1338 | "name": "rule", 1339 | "title": "校验规则", 1340 | "setter": { 1341 | "componentName": "MixedSetter", 1342 | "props": { 1343 | "setters": ["ExpressionSetter", "JsonSetter"] 1344 | } 1345 | } 1346 | }, 1347 | { 1348 | "name": "feedback", 1349 | "title": "校验错误信息", 1350 | "setter": "StringSetter" 1351 | }, 1352 | { 1353 | "name": "show-feedback", 1354 | "title": { 1355 | "label": "显示错误信息", 1356 | "tip": "当校验失败时,是否显示错误信息" 1357 | }, 1358 | "setter": "BoolSetter" 1359 | }, 1360 | { 1361 | "name": "rule-path", 1362 | "title": "规则路径", 1363 | "setter": "StringSetter" 1364 | }, 1365 | { 1366 | "name": "validation-status", 1367 | "title": "校验状态", 1368 | "setter": { 1369 | "componentName": "MixedSetter", 1370 | "props": { 1371 | "setters": [ 1372 | { 1373 | "componentName": "RadioGroupSetter", 1374 | "props": { 1375 | "options": [ 1376 | { "title": "error", "value": "error" }, 1377 | { "title": "success", "value": "success" }, 1378 | { "title": "warning", "value": "warning" } 1379 | ] 1380 | } 1381 | }, 1382 | "ExpressionSetter", 1383 | "StringSetter" 1384 | ] 1385 | } 1386 | } 1387 | } 1388 | ] 1389 | } 1390 | ] 1391 | } 1392 | }, 1393 | { 1394 | "category": "数据录入", 1395 | "title": "文本输入", 1396 | "componentName": "NInput", 1397 | "npm": { 1398 | "package": "naive-ui", 1399 | "version": "2.30.6", 1400 | "exportName": "NInput", 1401 | "destructuring": true 1402 | }, 1403 | "props": [ 1404 | { 1405 | "name": "autofocus", 1406 | "propType": "bool" 1407 | }, 1408 | { 1409 | "name": "disabled", 1410 | "propType": "bool" 1411 | }, 1412 | { 1413 | "name": "readonly", 1414 | "propType": "bool" 1415 | }, 1416 | { 1417 | "name": "clearable", 1418 | "propType": "bool" 1419 | }, 1420 | { 1421 | "name": "type", 1422 | "propType": { 1423 | "type": "oneOf", 1424 | "value": ["text", "password", "textarea"] 1425 | } 1426 | }, 1427 | { 1428 | "name": "status", 1429 | "propType": { 1430 | "type": "oneOf", 1431 | "value": ["success", "warning", "error"] 1432 | } 1433 | }, 1434 | { 1435 | "name": "placeholder", 1436 | "propType": "string" 1437 | }, 1438 | { 1439 | "name": "value", 1440 | "propType": "string" 1441 | }, 1442 | { 1443 | "name": "show-password-on", 1444 | "propType": { 1445 | "type": "oneOf", 1446 | "value": ["click", "mousedown"] 1447 | } 1448 | } 1449 | ], 1450 | "configure": { 1451 | "props": [ 1452 | { 1453 | "name": "placeholder", 1454 | "title": "输入占位符", 1455 | "setter": "StringSetter" 1456 | }, 1457 | { 1458 | "name": "v-model:value", 1459 | "title": "输入值", 1460 | "setter": "ExpressionSetter" 1461 | }, 1462 | { 1463 | "name": "type", 1464 | "title": "输入框类型", 1465 | "setter": { 1466 | "componentName": "RadioGroupSetter", 1467 | "props": { 1468 | "options": [ 1469 | { "title": "text", "value": "text" }, 1470 | { "title": "password", "value": "password" }, 1471 | { "title": "textarea", "value": "textarea" } 1472 | ] 1473 | } 1474 | } 1475 | }, 1476 | { 1477 | "name": "autofocus", 1478 | "title": "自动获取焦点", 1479 | "setter": "BoolSetter" 1480 | }, 1481 | { 1482 | "name": "disabled", 1483 | "title": "是否禁用", 1484 | "setter": "BoolSetter" 1485 | }, 1486 | { 1487 | "name": "readonly", 1488 | "title": "是否只读", 1489 | "setter": "BoolSetter" 1490 | }, 1491 | { 1492 | "name": "clearable", 1493 | "title": "是否可清空", 1494 | "setter": "BoolSetter" 1495 | }, 1496 | { 1497 | "name": "show-password-on", 1498 | "title": "显示密码的时机", 1499 | "setter": { 1500 | "componentName": "RadioGroupSetter", 1501 | "props": { 1502 | "options": [ 1503 | { "title": "click", "value": "click" }, 1504 | { "title": "mousedown", "value": "mousedown" } 1505 | ] 1506 | } 1507 | }, 1508 | "defaultValue": "click" 1509 | } 1510 | ], 1511 | "supports": { 1512 | "events": [ 1513 | "onMousedown", 1514 | "onKeydown", 1515 | "onKeydown", 1516 | "onKeyup", 1517 | "onInput", 1518 | "onFocus", 1519 | "onBlur", 1520 | "onClear", 1521 | "onClick", 1522 | "onChange", 1523 | "onUpdateValue" 1524 | ], 1525 | "loop": true, 1526 | "style": true 1527 | } 1528 | } 1529 | } 1530 | ], 1531 | "componentList": [ 1532 | { 1533 | "title": "基础组件", 1534 | "children": [ 1535 | { 1536 | "title": "文本", 1537 | "library": "naive-ui", 1538 | "snippets": [ 1539 | { 1540 | "title": "文本", 1541 | "screenshot": "https://helios-allpublic-1257616148.cos.ap-shanghai.myqcloud.com/img/text.svg", 1542 | "schema": { 1543 | "componentName": "NText", 1544 | "props": { 1545 | "children": "文本内容" 1546 | } 1547 | } 1548 | } 1549 | ] 1550 | }, 1551 | { 1552 | "componentName": "NAvatar", 1553 | "library": "naive-ui", 1554 | "title": "头像", 1555 | "snippets": [ 1556 | { 1557 | "title": "头像", 1558 | "screenshot": "https://helios-allpublic-1257616148.cos.ap-shanghai.myqcloud.com/img/avatar.png", 1559 | "schema": { 1560 | "componentName": "NAvatar", 1561 | "props": { 1562 | "circle": true, 1563 | "round": false, 1564 | "src": "https://v2.vuejs.org/images/logo.svg", 1565 | "size": "medium" 1566 | } 1567 | } 1568 | } 1569 | ] 1570 | }, 1571 | { 1572 | "componentName": "NButton", 1573 | "library": "naive-ui", 1574 | "title": "按钮", 1575 | "snippets": [ 1576 | { 1577 | "title": "按钮", 1578 | "screenshot": "https://helios-allpublic-1257616148.cos.ap-shanghai.myqcloud.com/img/button.png", 1579 | "schema": { 1580 | "componentName": "NButton", 1581 | "props": { 1582 | "children": "按钮" 1583 | } 1584 | } 1585 | } 1586 | ] 1587 | } 1588 | ] 1589 | }, 1590 | { 1591 | "title": "布局组件", 1592 | "children": [ 1593 | { 1594 | "componentName": "NCard", 1595 | "library": "naive-ui", 1596 | "snippets": [ 1597 | { 1598 | "screenshot": "https://helios-allpublic-1257616148.cos.ap-shanghai.myqcloud.com/img/card.png", 1599 | "title": "卡片", 1600 | "schema": { 1601 | "componentName": "NCard", 1602 | "children": [] 1603 | } 1604 | } 1605 | ] 1606 | }, 1607 | { 1608 | "componentName": "NSpace", 1609 | "library": "naive-ui", 1610 | "snippets": [ 1611 | { 1612 | "screenshot": "https://helios-allpublic-1257616148.cos.ap-shanghai.myqcloud.com/img/space.svg", 1613 | "title": "间距", 1614 | "schema": { 1615 | "componentName": "NSpace", 1616 | "children": [] 1617 | } 1618 | } 1619 | ] 1620 | }, 1621 | { 1622 | "componentName": "NGrid", 1623 | "library": "naive-ui", 1624 | "snippets": [ 1625 | { 1626 | "screenshot": "https://alifd.alicdn.com/fusion-cool/icons/icon-antd/1-1.png", 1627 | "title": "两栏栅格", 1628 | "schema": { 1629 | "componentName": "NGrid", 1630 | "props": { 1631 | "cols": 24 1632 | }, 1633 | "children": [ 1634 | { 1635 | "componentName": "NGridItem", 1636 | "props": { 1637 | "span": 12 1638 | } 1639 | }, 1640 | { 1641 | "componentName": "NGridItem", 1642 | "props": { 1643 | "span": 12 1644 | } 1645 | } 1646 | ] 1647 | } 1648 | } 1649 | ] 1650 | } 1651 | ] 1652 | }, 1653 | { 1654 | "title": "信息输入", 1655 | "children": [ 1656 | { 1657 | "componentName": "NForm", 1658 | "library": "naive-ui", 1659 | "snippets": [ 1660 | { 1661 | "screenshot": "https://helios-allpublic-1257616148.cos.ap-shanghai.myqcloud.com/img/form.png", 1662 | "title": "表单容器", 1663 | "schema": { 1664 | "componentName": "NForm", 1665 | "props": { 1666 | "label-width": 80 1667 | }, 1668 | "children": [ 1669 | { 1670 | "componentName": "NFormItem", 1671 | "props": { 1672 | "label": "用户名" 1673 | }, 1674 | "children": [ 1675 | { 1676 | "componentName": "NInput", 1677 | "props": { 1678 | "placeholder": "请输入用户名" 1679 | } 1680 | } 1681 | ] 1682 | }, 1683 | { 1684 | "componentName": "NFormItem", 1685 | "props": { 1686 | "label": "密码" 1687 | }, 1688 | "children": [ 1689 | { 1690 | "componentName": "NInput", 1691 | "props": { 1692 | "type": "password", 1693 | "placeholder": "请输入密码" 1694 | } 1695 | } 1696 | ] 1697 | } 1698 | ] 1699 | } 1700 | } 1701 | ] 1702 | }, 1703 | { 1704 | "componentName": "NFormItem", 1705 | "library": "naive-ui", 1706 | "snippets": [ 1707 | { 1708 | "screenshot": "https://helios-allpublic-1257616148.cos.ap-shanghai.myqcloud.com/img/input.png", 1709 | "title": "文本输入", 1710 | "schema": { 1711 | "componentName": "NFormItem", 1712 | "props": { 1713 | "label": "标签" 1714 | }, 1715 | "children": [ 1716 | { 1717 | "componentName": "NInput" 1718 | } 1719 | ] 1720 | } 1721 | } 1722 | ] 1723 | } 1724 | ] 1725 | } 1726 | ] 1727 | } 1728 | -------------------------------------------------------------------------------- /src/assets/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "componentName": "Page", 3 | "id": "node_dockcviv8fo1", 4 | "props": {}, 5 | "fileName": "/", 6 | "state": { 7 | "text": { 8 | "type": "JSExpression", 9 | "value": "\"outer\"" 10 | }, 11 | "isShowDialog": { 12 | "type": "JSExpression", 13 | "value": "false" 14 | }, 15 | "info": { 16 | "type": "JSExpression", 17 | "value": "{\n \"info\": \"\",\n \"user\": {\n \"username\": \"\",\n \"password\": \"\"\n }\n}" 18 | } 19 | }, 20 | "dataSource": { 21 | "list": [ 22 | { 23 | "type": "fetch", 24 | "isInit": true, 25 | "options": { 26 | "params": {}, 27 | "method": "GET", 28 | "isCors": true, 29 | "timeout": 5000, 30 | "headers": {}, 31 | "uri": "mock/info.json" 32 | }, 33 | "id": "info" 34 | }, 35 | { 36 | "type": "fetch", 37 | "isInit": false, 38 | "options": { 39 | "params": { 40 | "username": { 41 | "type": "JSExpression", 42 | "value": "this.info.user.username" 43 | }, 44 | "password": { 45 | "type": "JSExpression", 46 | "value": "this.info.user.password" 47 | } 48 | }, 49 | "method": "POST", 50 | "isCors": true, 51 | "timeout": 5000, 52 | "headers": { 53 | "Auth": { 54 | "type": "JSExpression", 55 | "value": "this.text" 56 | }, 57 | "Content-Type": "application/json" 58 | }, 59 | "uri": "/api/user/login" 60 | }, 61 | "id": "submit" 62 | } 63 | ] 64 | }, 65 | "css": "body {\n font-size: 12px;\n}\n\n.button {\n width: 100px;\n color: #ff00ff\n}", 66 | "lifeCycles": { 67 | "mounted": { 68 | "type": "JSFunction", 69 | "value": "function mounted() {\n console.log('did mount');\n}" 70 | }, 71 | "beforeMount": { 72 | "type": "JSFunction", 73 | "value": "function beforeMount() {\n console.log('will unmount');\n}" 74 | } 75 | }, 76 | "methods": { 77 | "testFunc": { 78 | "type": "JSFunction", 79 | "value": "function testFunc() {\n console.log('test func');\n}" 80 | } 81 | }, 82 | "originCode": "class LowcodeComponent extends Component {\n state = {\n \"text\": \"outer\",\n \"isShowDialog\": false,\n \"info\": {\n \"info\": \"\",\n \"user\": {\n \"username\": \"\",\n \"password\": \"\"\n }\n }\n }\n componentDidMount() {\n console.log('did mount');\n }\n componentWillUnmount() {\n console.log('will unmount');\n }\n testFunc() {\n console.log('test func');\n }\n onClick() {\n this.setState({\n isShowDialog: true\n })\n }\n closeDialog() {\n this.setState({\n isShowDialog: false\n })\n }\n\n\tonClick_new(){\n this.$message.success('hhhhhh')\n\t}\n\n\tonSubmit(ev){\n ev.preventDefault();\n this.dataSourceMap.submit.load()\n\t}\n}", 83 | "hidden": false, 84 | "title": "", 85 | "isLocked": false, 86 | "condition": true, 87 | "conditionGroup": "", 88 | "children": [ 89 | { 90 | "componentName": "NCard", 91 | "id": "node_ocl4goj8tm1", 92 | "props": { 93 | "segmented": { 94 | "content": false, 95 | "footer": false, 96 | "action": false 97 | }, 98 | "header": { 99 | "type": "JSSlot", 100 | "value": [ 101 | { 102 | "componentName": "NText", 103 | "id": "node_ocl4goj8tm3", 104 | "props": { 105 | "children": "用户登录", 106 | "type": "default", 107 | "tag": "span" 108 | }, 109 | "hidden": false, 110 | "title": "", 111 | "isLocked": false, 112 | "condition": true, 113 | "conditionGroup": "" 114 | } 115 | ], 116 | "title": "头部" 117 | } 118 | }, 119 | "hidden": false, 120 | "title": "", 121 | "isLocked": false, 122 | "condition": true, 123 | "conditionGroup": "", 124 | "children": [ 125 | { 126 | "componentName": "NForm", 127 | "id": "node_ocl4gmvfwx1", 128 | "props": { 129 | "label-width": 80, 130 | "label-align": "left", 131 | "label-placement": "left", 132 | "require-mark-placement": "right", 133 | "__events": { 134 | "eventDataList": [ 135 | { 136 | "type": "componentEvent", 137 | "name": "onSubmit", 138 | "relatedEventName": "onSubmit" 139 | } 140 | ], 141 | "eventList": [ 142 | { 143 | "name": "onSubmit", 144 | "disabled": true 145 | } 146 | ] 147 | }, 148 | "onSubmit": { 149 | "type": "JSFunction", 150 | "value": "function(){this.onSubmit.apply(this,Array.prototype.slice.call(arguments).concat([])) }" 151 | }, 152 | "model": { 153 | "type": "JSExpression", 154 | "value": "this.info.user", 155 | "mock": { 156 | "type": "JSExpression", 157 | "value": "this.info.user" 158 | } 159 | } 160 | }, 161 | "hidden": false, 162 | "title": "", 163 | "isLocked": false, 164 | "condition": true, 165 | "conditionGroup": "", 166 | "children": [ 167 | { 168 | "componentName": "NFormItem", 169 | "id": "node_ocl4i3antp2", 170 | "props": { 171 | "label": "用户名", 172 | "path": "username", 173 | "size": "medium", 174 | "show-label": true, 175 | "label-align": "left", 176 | "label-placement": "left", 177 | "require-mark-placement": "right", 178 | "rule": { 179 | "type": "string", 180 | "required": true, 181 | "trigger": ["input", "blur"], 182 | "message": "请输入用户名" 183 | }, 184 | "label-width": "auto" 185 | }, 186 | "hidden": false, 187 | "title": "", 188 | "isLocked": false, 189 | "condition": true, 190 | "conditionGroup": "", 191 | "children": [ 192 | { 193 | "componentName": "NInput", 194 | "id": "node_ocl4i3antp3", 195 | "props": { 196 | "placeholder": "请输入用户名", 197 | "v-model:value": { 198 | "type": "JSExpression", 199 | "value": "this.info.user.username" 200 | }, 201 | "show-password-on": "click" 202 | }, 203 | "hidden": false, 204 | "title": "", 205 | "isLocked": false, 206 | "condition": true, 207 | "conditionGroup": "" 208 | } 209 | ] 210 | }, 211 | { 212 | "componentName": "NFormItem", 213 | "id": "node_ocl4i3antp4", 214 | "props": { 215 | "label": "密码", 216 | "path": "password", 217 | "size": "medium", 218 | "show-label": true, 219 | "label-align": "left", 220 | "label-placement": "left", 221 | "require-mark-placement": "right", 222 | "rule": { 223 | "type": "string", 224 | "required": true, 225 | "trigger": ["input", "blur"], 226 | "message": "请输入密码" 227 | } 228 | }, 229 | "hidden": false, 230 | "title": "", 231 | "isLocked": false, 232 | "condition": true, 233 | "conditionGroup": "", 234 | "children": [ 235 | { 236 | "componentName": "NInput", 237 | "id": "node_ocl4i3antp5", 238 | "props": { 239 | "placeholder": "请输入密码", 240 | "v-model:value": { 241 | "type": "JSExpression", 242 | "value": "this.info.user.password" 243 | }, 244 | "type": "password", 245 | "show-password-on": "click" 246 | }, 247 | "hidden": false, 248 | "title": "", 249 | "isLocked": false, 250 | "condition": true, 251 | "conditionGroup": "" 252 | } 253 | ] 254 | }, 255 | { 256 | "componentName": "NSpace", 257 | "id": "node_ocl4goj8tm4", 258 | "props": { 259 | "align": "start", 260 | "justify": "center", 261 | "size": "medium" 262 | }, 263 | "hidden": false, 264 | "title": "", 265 | "isLocked": false, 266 | "condition": true, 267 | "conditionGroup": "", 268 | "children": [ 269 | { 270 | "componentName": "NButton", 271 | "id": "node_ocl4goj8tm6", 272 | "props": { 273 | "children": "登录", 274 | "icon-placement": "left", 275 | "attr-type": "submit", 276 | "type": "primary", 277 | "size": "medium", 278 | "bordered": true 279 | }, 280 | "hidden": false, 281 | "title": "", 282 | "isLocked": false, 283 | "condition": true, 284 | "conditionGroup": "" 285 | }, 286 | { 287 | "componentName": "NButton", 288 | "id": "node_ocl4goj8tm5", 289 | "props": { 290 | "children": "重置", 291 | "icon-placement": "left", 292 | "attr-type": "button", 293 | "type": "default", 294 | "size": "medium", 295 | "bordered": true 296 | }, 297 | "hidden": false, 298 | "title": "", 299 | "isLocked": false, 300 | "condition": true, 301 | "conditionGroup": "" 302 | } 303 | ] 304 | } 305 | ] 306 | } 307 | ] 308 | } 309 | ] 310 | } 311 | -------------------------------------------------------------------------------- /src/components/logo/logo.less: -------------------------------------------------------------------------------- 1 | .lowcode-plugin-logo { 2 | .logo { 3 | display: block; 4 | width: 139px; 5 | height: 26px; 6 | background-repeat: no-repeat; 7 | background-position: center; 8 | background-size: contain; 9 | cursor: pointer; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/components/logo/logo.tsx: -------------------------------------------------------------------------------- 1 | import { FC, ReactElement } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { PluginProps } from '@alilc/lowcode-types'; 4 | import './logo.less'; 5 | 6 | export interface IProps { 7 | logo?: string; 8 | href?: string; 9 | } 10 | 11 | export const Logo: FC = (props): ReactElement => { 12 | return ( 13 |
14 | 20 |
21 | ); 22 | }; 23 | 24 | Logo.propTypes = { 25 | logo: PropTypes.string, 26 | href: PropTypes.string, 27 | }; 28 | -------------------------------------------------------------------------------- /src/editor.less: -------------------------------------------------------------------------------- 1 | html { 2 | min-width: 1024px; 3 | } 4 | 5 | body { 6 | font-size: 12px; 7 | font-family: PingFangSC-Regular, Roboto, 'Helvetica Neue', Helvetica, Tahoma, Arial, 8 | 'PingFang SC-Light', 'Microsoft YaHei'; 9 | 10 | * { 11 | box-sizing: border-box; 12 | } 13 | } 14 | 15 | #lce-container { 16 | position: fixed; 17 | top: 0; 18 | right: 0; 19 | bottom: 0; 20 | left: 0; 21 | box-sizing: border-box; 22 | width: 100%; 23 | height: 100%; 24 | margin: 0; 25 | padding: 0; 26 | overflow: hidden; 27 | text-rendering: optimizelegibility; 28 | -webkit-user-drag: none; 29 | -webkit-touch-callout: none; 30 | -webkit-font-smoothing: antialiased; 31 | 32 | .lc-code-control { 33 | position: relative; 34 | height: calc(100% - 24px); 35 | overflow: visible; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/editor.ts: -------------------------------------------------------------------------------- 1 | import Inject from '@alilc/lowcode-plugin-inject'; 2 | import { init, plugins, project } from '@alilc/lowcode-engine'; 3 | import UndoRedoPlugin from '@alilc/lowcode-plugin-undo-redo'; 4 | import SchemaPlugin from '@alilc/lowcode-plugin-schema'; 5 | import DataSource from '@alilc/lowcode-plugin-datasource-pane'; 6 | import { setupHostEnvironment } from '@knxcloud/lowcode-utils'; 7 | import CodeEditor from '@knxcloud/lowcode-plugin-vue-code-editor'; 8 | import RegistryPlugin from './plugins/registry'; 9 | import InitPlugin from './plugins/init'; 10 | import SetterPlugin from './plugins/setter'; 11 | import Actions from './plugins/actions'; 12 | import './editor.less'; 13 | 14 | (async () => { 15 | const preference = new Map(); 16 | 17 | preference.set('DataSourcePane', { 18 | importPlugins: [], 19 | dataSourceTypes: [ 20 | { 21 | type: 'fetch', 22 | }, 23 | ], 24 | }); 25 | 26 | await plugins.register(Inject); 27 | await plugins.register(RegistryPlugin); 28 | await plugins.register(UndoRedoPlugin); 29 | await plugins.register(SchemaPlugin); 30 | await plugins.register(DataSource); 31 | await plugins.register(SetterPlugin); 32 | await plugins.register(InitPlugin); 33 | await plugins.register(CodeEditor); 34 | await plugins.register(Actions); 35 | 36 | setupHostEnvironment(project, '/js/vue.runtime.global.js'); 37 | 38 | await init( 39 | document.getElementById('lce-container')!, 40 | { 41 | enableCondition: true, 42 | enableCanvasLock: true, 43 | supportVariableGlobally: true, 44 | simulatorUrl: ['/js/vue-simulator-renderer.js', '/js/vue-simulator-renderer.css'], 45 | }, 46 | preference 47 | ); 48 | })(); 49 | -------------------------------------------------------------------------------- /src/plugins/actions.ts: -------------------------------------------------------------------------------- 1 | import { createElement as h } from 'react'; 2 | import { Button, Message } from '@alifd/next'; 3 | import { saveSchema } from '@/utils/store'; 4 | import { IPublicModelPluginContext } from '@alilc/lowcode-types'; 5 | 6 | const save = async () => { 7 | await saveSchema(); 8 | Message.success('成功保存到本地'); 9 | }; 10 | 11 | const preview = async () => { 12 | await saveSchema(); 13 | window.open('preview.html'); 14 | }; 15 | 16 | const savePlugin = (ctx: IPublicModelPluginContext) => { 17 | return { 18 | name: 'saveSample', 19 | async init() { 20 | const { skeleton, hotkey } = ctx; 21 | 22 | skeleton.add({ 23 | name: 'saveSample', 24 | area: 'topArea', 25 | type: 'Widget', 26 | props: { align: 'right' }, 27 | content: h(Button, { onClick: save }, '保存到本地'), 28 | }); 29 | 30 | skeleton.add({ 31 | name: 'previewSample', 32 | area: 'topArea', 33 | type: 'Widget', 34 | props: { align: 'right' }, 35 | content: h(Button, { onClick: preview }, '预览'), 36 | }); 37 | 38 | hotkey.bind('command+s', async (e) => { 39 | e.preventDefault(); 40 | save(); 41 | }); 42 | }, 43 | }; 44 | }; 45 | 46 | savePlugin.pluginName = 'saveSample'; 47 | 48 | export default savePlugin; 49 | -------------------------------------------------------------------------------- /src/plugins/init.ts: -------------------------------------------------------------------------------- 1 | import { injectAssets } from '@alilc/lowcode-plugin-inject'; 2 | import { getProjectSchemaToLocalStorage } from '@/utils/store'; 3 | import { IPublicModelPluginContext } from '@alilc/lowcode-types'; 4 | import assets from '@/assets/assets.json'; 5 | import originSchema from '@/assets/schema.json'; 6 | 7 | const editorInit = (ctx: IPublicModelPluginContext) => { 8 | return { 9 | name: 'editor-init', 10 | async init() { 11 | const { material, project } = ctx; 12 | const loadedAssets = await injectAssets(assets); 13 | material.setAssets(loadedAssets); 14 | 15 | const projectSchema = getProjectSchemaToLocalStorage(); 16 | const schema = projectSchema ? projectSchema['componentsTree'].pop() : originSchema; 17 | 18 | project.onSimulatorRendererReady(() => { 19 | project.openDocument(schema); 20 | }); 21 | }, 22 | }; 23 | }; 24 | 25 | editorInit.pluginName = 'editorInit'; 26 | 27 | export default editorInit; 28 | -------------------------------------------------------------------------------- /src/plugins/registry.ts: -------------------------------------------------------------------------------- 1 | import { IPublicModelPluginContext } from '@alilc/lowcode-types'; 2 | import ComponentsPane from '@alilc/lowcode-plugin-components-pane'; 3 | import { Logo } from '../components/logo/logo'; 4 | 5 | const builtinPluginRegistry = (ctx: IPublicModelPluginContext) => { 6 | return { 7 | name: 'builtin-plugin-registry', 8 | async init() { 9 | const { skeleton, project } = ctx; 10 | // 注册 logo 面板 11 | skeleton.add({ 12 | area: 'topArea', 13 | type: 'Widget', 14 | name: 'logo', 15 | content: Logo, 16 | contentProps: { 17 | logo: 'https://img.alicdn.com/imgextra/i4/O1CN013w2bmQ25WAIha4Hx9_!!6000000007533-55-tps-137-26.svg', 18 | href: 'https://lowcode-engine.cn', 19 | }, 20 | props: { 21 | align: 'left', 22 | }, 23 | }); 24 | 25 | // 注册组件面板 26 | const componentsPane = skeleton.add({ 27 | area: 'leftArea', 28 | type: 'PanelDock', 29 | name: 'componentsPane', 30 | content: ComponentsPane, 31 | props: { 32 | align: 'top', 33 | icon: 'zujianku', 34 | description: '组件库', 35 | }, 36 | }); 37 | componentsPane.disable(); 38 | project.onSimulatorRendererReady(() => { 39 | componentsPane.enable(); 40 | }); 41 | }, 42 | }; 43 | }; 44 | 45 | builtinPluginRegistry.pluginName = 'builtinPluginRegistry'; 46 | 47 | export default builtinPluginRegistry; 48 | -------------------------------------------------------------------------------- /src/plugins/setter.ts: -------------------------------------------------------------------------------- 1 | import { isJSExpression } from '@knxcloud/lowcode-utils'; 2 | import AliLowCodeEngineExt from '@alilc/lowcode-engine-ext'; 3 | import { IPublicModelPluginContext } from '@alilc/lowcode-types'; 4 | import { project } from '@alilc/lowcode-engine'; 5 | 6 | const setterRegistry = (ctx: IPublicModelPluginContext) => { 7 | const { setterMap, pluginMap } = AliLowCodeEngineExt; 8 | return { 9 | name: 'ext-setters-registry', 10 | async init() { 11 | const { setters, skeleton } = ctx; 12 | setters.registerSetter({ ...setterMap, ExpressionSetter } as any); 13 | // 注册插件 14 | // 注册事件绑定面板 15 | skeleton.add({ 16 | area: 'centerArea', 17 | type: 'Widget', 18 | content: pluginMap.EventBindDialog, 19 | name: 'eventBindDialog', 20 | props: {}, 21 | }); 22 | 23 | // 注册变量绑定面板 24 | skeleton.add({ 25 | area: 'centerArea', 26 | type: 'Widget', 27 | content: pluginMap.VariableBindDialog, 28 | name: 'variableBindDialog', 29 | props: {}, 30 | }); 31 | }, 32 | }; 33 | }; 34 | 35 | setterRegistry.pluginName = 'setterRegistry'; 36 | 37 | export default setterRegistry; 38 | 39 | const ReactExpressionSetter = AliLowCodeEngineExt.setterMap.ExpressionSetter; 40 | const ReactExpressionSetterView = ReactExpressionSetter.component; 41 | 42 | function isPlainObject(val: unknown): val is Record { 43 | return Object.prototype.toString.call(val) === '[object Object]'; 44 | } 45 | 46 | function flatObject( 47 | obj: unknown, 48 | parentPath: string[] = [], 49 | target: Record = {} 50 | ): Record { 51 | if (obj && isPlainObject(obj)) { 52 | for (const key in obj) { 53 | const value = obj[key]; 54 | const path = parentPath.concat(key); 55 | target[path.join('.')] = value; 56 | isPlainObject(value) && flatObject(value, path, target); 57 | } 58 | } 59 | return target; 60 | } 61 | 62 | class ExpressionSetterView extends ReactExpressionSetterView { 63 | getDataSource(): string[] { 64 | const schema = project.exportSchema(); 65 | const stateMap = schema.componentsTree[0].state; 66 | const dataSource = []; 67 | 68 | const datasourceMap = schema.componentsTree[0]?.dataSource; 69 | const list = datasourceMap?.list || []; 70 | 71 | for (const key in stateMap) { 72 | dataSource.push(`this.${key}`); 73 | 74 | const state = stateMap[key]; 75 | if (isJSExpression(state)) { 76 | try { 77 | const data = new Function(`return ${state.value}`)(); 78 | const flatted = flatObject(data, ['this', key]); 79 | if (isPlainObject(flatted)) { 80 | dataSource.push(...Object.keys(flatted)); 81 | } 82 | } catch (err) { 83 | console.warn('parse error', err); 84 | } 85 | } 86 | } 87 | 88 | for (const item of list) { 89 | if (item && item.id) { 90 | dataSource.push(`this.${item.id}`); 91 | } 92 | } 93 | 94 | return dataSource; 95 | } 96 | } 97 | 98 | const ExpressionSetter = { 99 | ...ReactExpressionSetter, 100 | component: ExpressionSetterView, 101 | }; 102 | -------------------------------------------------------------------------------- /src/utils/store.ts: -------------------------------------------------------------------------------- 1 | import { material, project } from '@alilc/lowcode-engine'; 2 | import { filterPackages } from '@alilc/lowcode-plugin-inject'; 3 | import { IPublicEnumTransformStage } from '@alilc/lowcode-types'; 4 | 5 | export const setPackgesToLocalStorage = async () => { 6 | const packages = await filterPackages(material.getAssets()!.packages); 7 | window.localStorage.setItem('packages', JSON.stringify(packages)); 8 | }; 9 | 10 | export const setProjectSchemaToLocalStorage = () => { 11 | window.localStorage.setItem( 12 | 'projectSchema', 13 | JSON.stringify(project.exportSchema(IPublicEnumTransformStage.Save)) 14 | ); 15 | }; 16 | 17 | export const getProjectSchemaToLocalStorage = () => { 18 | const data = window.localStorage.getItem('projectSchema'); 19 | return data && JSON.parse(data); 20 | }; 21 | 22 | export const saveSchema = async () => { 23 | setProjectSchemaToLocalStorage(); 24 | await setPackgesToLocalStorage(); 25 | }; 26 | -------------------------------------------------------------------------------- /src/vue/preview.ts: -------------------------------------------------------------------------------- 1 | import { Asset } from '@alilc/lowcode-types'; 2 | import VueRenderer from '@knxcloud/lowcode-vue-renderer'; 3 | import { buildComponents, AssetLoader, noop } from '@knxcloud/lowcode-utils'; 4 | import { h, createApp, toRaw, Suspense } from 'vue'; 5 | 6 | window['__VUE_HMR_RUNTIME__'] = { 7 | reload: noop, 8 | rerender: noop, 9 | createRecord: noop, 10 | }; 11 | 12 | const init = async () => { 13 | const packages = JSON.parse(window.localStorage.getItem('packages') || '[]'); 14 | const projectSchema = JSON.parse(window.localStorage.getItem('projectSchema') || '{}'); 15 | const { componentsMap: componentsMapArray = [], componentsTree = [] } = projectSchema; 16 | 17 | const componentsMap: any = {}; 18 | componentsMapArray.forEach((component: any) => { 19 | componentsMap[component.componentName] = component; 20 | }); 21 | 22 | const libraryMap = {}; 23 | const libraryAsset: Asset = []; 24 | packages.forEach(({ package: _package, library, urls, renderUrls }) => { 25 | libraryMap[_package] = library; 26 | if (renderUrls) { 27 | libraryAsset.push(renderUrls); 28 | } else if (urls) { 29 | libraryAsset.push(urls); 30 | } 31 | }); 32 | await new AssetLoader().load(libraryAsset); 33 | const components = await buildComponents(libraryMap, componentsMap); 34 | 35 | return { schema: componentsTree[0], components }; 36 | }; 37 | 38 | (async () => { 39 | const { schema, components } = await init(); 40 | const app = createApp(() => { 41 | return h('div', { class: 'lowcode-plugin-sample-preview' }, [ 42 | h(Suspense, null, { 43 | default: () => 44 | h(VueRenderer, { 45 | class: 'lowcode-plugin-sample-preview-content', 46 | schema: toRaw(schema), 47 | components: toRaw(components), 48 | }), 49 | fallback: () => 50 | h('div', { class: 'lowcode-plugin-sample-preview-loading' }, 'loading...'), 51 | }), 52 | ]); 53 | }); 54 | app.mount('#lce-container'); 55 | })(); 56 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "declaration": true, 5 | "lib": ["es2015", "dom"], 6 | "module": "ESNext", 7 | "moduleResolution": "Node", 8 | "resolveJsonModule": true, 9 | "useDefineForClassFields": true, 10 | "jsx": "preserve", 11 | "noImplicitThis": true, 12 | "strict": true, 13 | "preserveValueImports": true, 14 | "target": "ESNext", 15 | "esModuleInterop": true, 16 | "forceConsistentCasingInFileNames": true, 17 | "skipLibCheck": true, 18 | "paths": { 19 | "@/*": ["src/*"] 20 | } 21 | }, 22 | "include": ["./src/**/*.ts", "./src/**/*.tsx"], 23 | "exclude": ["node_modules", "./src/vue/**"] 24 | } 25 | --------------------------------------------------------------------------------