@gct-paas/render 0.1.5-test.2 → 0.1.6-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.css +1 -1
- package/dist/loader.esm.min.js +1 -1
- package/es/Event/Dependency/displayRule.d.ts +1 -1
- package/es/Event/Dependency/displayRule.mjs +1 -1
- package/es/Event/Dependency/useDependencyToShow.d.ts +2 -2
- package/es/Event/Dependency/useDependencyToShow.mjs +7 -4
- package/es/Event/baseEvent.d.ts +4 -4
- package/es/Event/baseEvent.mjs +1 -1
- package/es/Event/bizServiceRequest.d.ts +4 -4
- package/es/Event/bizServiceRequest.mjs +19 -10
- package/es/components/card-view-render/card-view-render.css +71 -0
- package/es/components/card-view-render/card-view-render.d.ts +38 -0
- package/es/components/card-view-render/card-view-render.mjs +85 -0
- package/es/components/design-render/design-render.css +71 -0
- package/es/components/design-render/design-render.d.ts +41 -0
- package/es/components/design-render/design-render.mjs +121 -0
- package/es/components/design-render-item/design-render-item.d.ts +13 -0
- package/es/components/design-render-item/design-render-item.mjs +22 -0
- package/es/components/index.d.ts +3 -2
- package/es/components/index.mjs +2 -0
- package/es/hooks/index.mjs +1 -1
- package/es/index.d.ts +0 -1
- package/es/index.mjs +8 -14
- package/es/locale/sys/process.d.ts +8 -0
- package/es/locale/sys.d.ts +4 -0
- package/es/register/render-register/render-register.mjs +3 -1
- package/es/utils/expression/index.mjs +2 -1
- package/es/utils/expression/regularExpression/methods.mjs +1 -1
- package/es/utils/index.mjs +1 -1
- package/package.json +11 -11
|
@@ -7,7 +7,7 @@ interface DisplayRule {
|
|
|
7
7
|
id?: number;
|
|
8
8
|
}
|
|
9
9
|
/**单组件显隐控制 */
|
|
10
|
-
export declare function useVisibileByRuleHook(props: DisplayRule, id: string):
|
|
10
|
+
export declare function useVisibileByRuleHook(props: DisplayRule, id: string): Readonly<import('vue').Ref<boolean, boolean>>;
|
|
11
11
|
/**
|
|
12
12
|
* 需要做控制的数组组件
|
|
13
13
|
* @param optopns 被控制的数组
|
|
@@ -8,7 +8,7 @@ import { watchDebounced } from "@vueuse/core";
|
|
|
8
8
|
/**单组件显隐控制 */
|
|
9
9
|
function useVisibileByRuleHook(props, id) {
|
|
10
10
|
/**按钮权限 */
|
|
11
|
-
if (!getPremission(id)) return false;
|
|
11
|
+
if (!getPremission(id)) return ref(false);
|
|
12
12
|
else if (props.displayType === DisplayType.CONFIG) return toRef(() => !props.hidden);
|
|
13
13
|
else return useDisplayRule(props);
|
|
14
14
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { LowCodeWidget } from '@gct-paas/schema';
|
|
3
|
-
export declare function useDependencyToShow(widget: LowCodeWidget.BasicSchema):
|
|
4
|
-
export declare function dependencyToShow(widget: LowCodeWidget.BasicSchema, rowData?: object):
|
|
3
|
+
export declare function useDependencyToShow(widget: LowCodeWidget.BasicSchema): Readonly<Ref<boolean, boolean>>;
|
|
4
|
+
export declare function dependencyToShow(widget: LowCodeWidget.BasicSchema, rowData?: object): Ref<boolean>;
|
|
5
5
|
/**直接返回计算结果的依赖显隐逻辑 */
|
|
6
6
|
export declare function dependencyToShowSync(widget: LowCodeWidget.BasicSchema, rowData?: object): Promise<boolean>;
|
|
7
7
|
/**组件集合处理 */
|
|
@@ -3,7 +3,7 @@ import "../utils/processRovedInfo.mjs";
|
|
|
3
3
|
import { calculateDepResult, insetDep } from "./controller.mjs";
|
|
4
4
|
import { useVisibileByRuleHook } from "./displayRule.mjs";
|
|
5
5
|
import { Dependency_ENUM, DisplayType } from "@gct-paas/core";
|
|
6
|
-
import { inject, toRef } from "vue";
|
|
6
|
+
import { inject, ref, toRef } from "vue";
|
|
7
7
|
//#region src/Event/Dependency/useDependencyToShow.ts
|
|
8
8
|
function useDependencyToShow(widget) {
|
|
9
9
|
if (widget.props?.displayRule && widget.props?.displayType === DisplayType.RULE)
|
|
@@ -12,17 +12,20 @@ function useDependencyToShow(widget) {
|
|
|
12
12
|
else return dependencyToShow(widget);
|
|
13
13
|
}
|
|
14
14
|
function dependencyToShow(widget, rowData) {
|
|
15
|
-
if (!widget.id)
|
|
15
|
+
if (!widget.id) {
|
|
16
|
+
widget.props.hidden = true;
|
|
17
|
+
return ref(false);
|
|
18
|
+
}
|
|
16
19
|
if (!getPremission(widget.id)) {
|
|
17
20
|
/**权限不存在就直接返回false */
|
|
18
21
|
widget.props.hidden = true;
|
|
19
|
-
return false;
|
|
22
|
+
return ref(false);
|
|
20
23
|
}
|
|
21
24
|
const useProcessFieldEvent = inject("useProcessFieldEvent", void 0);
|
|
22
25
|
if (useProcessFieldEvent) {
|
|
23
26
|
/**流程节点隐藏的字段 */
|
|
24
27
|
useProcessFieldEvent.useFieldToShow(widget);
|
|
25
|
-
return !widget.props.hidden;
|
|
28
|
+
return toRef(() => !widget.props.hidden);
|
|
26
29
|
}
|
|
27
30
|
const { displayType, displayRule } = widget.props || {};
|
|
28
31
|
const { value, expression } = (widget.props.componentDependency?.configDependency || {})[Dependency_ENUM.HIDDEN] || {};
|
package/es/Event/baseEvent.d.ts
CHANGED
|
@@ -88,10 +88,10 @@ export declare class Context {
|
|
|
88
88
|
$closeModal?: () => void;
|
|
89
89
|
/**调用第三方服务 */
|
|
90
90
|
$customBizService: {
|
|
91
|
-
post: (path: import('./bizServiceRequest').PathType, query?: IObject,
|
|
92
|
-
get: (path: import('./bizServiceRequest').PathType, query?: IObject,
|
|
93
|
-
put: (path: import('./bizServiceRequest').PathType, query?: IObject,
|
|
94
|
-
delete: (path: import('./bizServiceRequest').PathType, query?: IObject,
|
|
91
|
+
post: ((path: import('./bizServiceRequest').PathType, data?: IObject, query?: IObject, config?: import('axios').AxiosRequestConfig) => Promise<unknown>) | ((path: import('./bizServiceRequest').PathType, query?: IObject, config?: import('axios').AxiosRequestConfig) => Promise<unknown>);
|
|
92
|
+
get: ((path: import('./bizServiceRequest').PathType, data?: IObject, query?: IObject, config?: import('axios').AxiosRequestConfig) => Promise<unknown>) | ((path: import('./bizServiceRequest').PathType, query?: IObject, config?: import('axios').AxiosRequestConfig) => Promise<unknown>);
|
|
93
|
+
put: ((path: import('./bizServiceRequest').PathType, data?: IObject, query?: IObject, config?: import('axios').AxiosRequestConfig) => Promise<unknown>) | ((path: import('./bizServiceRequest').PathType, query?: IObject, config?: import('axios').AxiosRequestConfig) => Promise<unknown>);
|
|
94
|
+
delete: ((path: import('./bizServiceRequest').PathType, data?: IObject, query?: IObject, config?: import('axios').AxiosRequestConfig) => Promise<unknown>) | ((path: import('./bizServiceRequest').PathType, query?: IObject, config?: import('axios').AxiosRequestConfig) => Promise<unknown>);
|
|
95
95
|
};
|
|
96
96
|
/**组件id和widget 的map */
|
|
97
97
|
gctWidgets: Record<string, LowCodeWidget.BasicSchema>;
|
package/es/Event/baseEvent.mjs
CHANGED
|
@@ -8,9 +8,9 @@ import { FormComponents, INNER_EVENT, t } from "@gct-paas/core";
|
|
|
8
8
|
import dayjs from "dayjs";
|
|
9
9
|
import { toRaw } from "vue";
|
|
10
10
|
import { useStyleTag } from "@vueuse/core";
|
|
11
|
-
import BigNumberJS from "bignumber.js";
|
|
12
11
|
import * as _ from "lodash-es";
|
|
13
12
|
import { cloneDeep, differenceBy } from "lodash-es";
|
|
13
|
+
import BigNumberJS from "bignumber.js";
|
|
14
14
|
//#region src/Event/baseEvent.ts
|
|
15
15
|
var Events = class {
|
|
16
16
|
context;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BizServiceEnum, EntityModelCategoryEnum } from '@gct-paas/core';
|
|
2
2
|
import { AxiosRequestConfig } from 'axios';
|
|
3
3
|
export declare const BizService: {
|
|
4
|
-
post: (path: PathType, query?: IObject,
|
|
5
|
-
get: (path: PathType, query?: IObject,
|
|
6
|
-
put: (path: PathType, query?: IObject,
|
|
7
|
-
delete: (path: PathType, query?: IObject,
|
|
4
|
+
post: ((path: PathType, data?: IObject, query?: IObject, config?: AxiosRequestConfig) => Promise<unknown>) | ((path: PathType, query?: IObject, config?: AxiosRequestConfig) => Promise<unknown>);
|
|
5
|
+
get: ((path: PathType, data?: IObject, query?: IObject, config?: AxiosRequestConfig) => Promise<unknown>) | ((path: PathType, query?: IObject, config?: AxiosRequestConfig) => Promise<unknown>);
|
|
6
|
+
put: ((path: PathType, data?: IObject, query?: IObject, config?: AxiosRequestConfig) => Promise<unknown>) | ((path: PathType, query?: IObject, config?: AxiosRequestConfig) => Promise<unknown>);
|
|
7
|
+
delete: ((path: PathType, data?: IObject, query?: IObject, config?: AxiosRequestConfig) => Promise<unknown>) | ((path: PathType, query?: IObject, config?: AxiosRequestConfig) => Promise<unknown>);
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* 系统内置业务服务请求
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import { BizServiceEnum, EntityModelCategoryEnum } from "@gct-paas/core";
|
|
2
2
|
//#region src/Event/bizServiceRequest.ts
|
|
3
|
-
var bizServiceRequestHook = (api
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
var bizServiceRequestHook = (api, method) => {
|
|
4
|
+
if (["post", "put"].includes(method)) return (path, data = {}, query = {}, config = {}) => {
|
|
5
|
+
return api({
|
|
6
|
+
modelKey: path.key,
|
|
7
|
+
bsKey: path.action,
|
|
8
|
+
modelCategory: path.modelCategory ?? EntityModelCategoryEnum.ENTITY
|
|
9
|
+
}, query, data, config);
|
|
10
|
+
};
|
|
11
|
+
else return (path, query = {}, config = {}) => {
|
|
12
|
+
return api({
|
|
13
|
+
modelKey: path.key,
|
|
14
|
+
bsKey: path.action,
|
|
15
|
+
modelCategory: path.modelCategory ?? EntityModelCategoryEnum.ENTITY
|
|
16
|
+
}, query, config);
|
|
17
|
+
};
|
|
9
18
|
};
|
|
10
19
|
var BizService = {
|
|
11
|
-
post: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey),
|
|
12
|
-
get: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.getBizServiceModelCategoryModelKeyBsKey),
|
|
13
|
-
put: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.putBizServiceModelCategoryModelKeyBsKey),
|
|
14
|
-
delete: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.deleteBizServiceModelCategoryModelKeyBsKey)
|
|
20
|
+
post: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey, "post"),
|
|
21
|
+
get: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.getBizServiceModelCategoryModelKeyBsKey, "get"),
|
|
22
|
+
put: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.putBizServiceModelCategoryModelKeyBsKey, "put"),
|
|
23
|
+
delete: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.deleteBizServiceModelCategoryModelKeyBsKey, "delete")
|
|
15
24
|
};
|
|
16
25
|
/**
|
|
17
26
|
* 系统内置业务服务请求
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/* stylelint-disable scss/no-global-function-names */
|
|
3
|
+
/* bem('block', 'element', 'modifier') => 'ibiz-block__element--modifier' */
|
|
4
|
+
/**
|
|
5
|
+
* 定义 Block 块
|
|
6
|
+
* @param {String} $block - Block 块名称
|
|
7
|
+
* @example
|
|
8
|
+
* @include b('button') {
|
|
9
|
+
* padding: 10px;
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 定义 Element 元素
|
|
14
|
+
* @param {String|List} $element - Element 元素名称,支持单个或多个
|
|
15
|
+
* @example
|
|
16
|
+
* @include b('button') {
|
|
17
|
+
* @include e('text') {
|
|
18
|
+
* color: #000;
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* // 或传入多个元素
|
|
22
|
+
* @include b('button') {
|
|
23
|
+
* @include e(('text', 'icon')) {
|
|
24
|
+
* margin: 5px;
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* 定义 Modifier 修饰符
|
|
30
|
+
* @param {String|List} $modifier - Modifier 修饰符名称,支持单个或多个
|
|
31
|
+
* @example
|
|
32
|
+
* @include b('button') {
|
|
33
|
+
* @include m('primary') {
|
|
34
|
+
* background: blue;
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* // 或传入多个修饰符
|
|
38
|
+
* @include b('button') {
|
|
39
|
+
* @include m(('primary', 'large')) {
|
|
40
|
+
* background: blue;
|
|
41
|
+
* font-size: 16px;
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* 定义状态选择器
|
|
47
|
+
* @param {String} $state - 状态名称
|
|
48
|
+
* @example
|
|
49
|
+
* @include b('button') {
|
|
50
|
+
* @include when('disabled') {
|
|
51
|
+
* opacity: 0.5;
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* 深色主题样式
|
|
57
|
+
* @param {String} $block - Block 块名称
|
|
58
|
+
* @example
|
|
59
|
+
* @include dark('button') {
|
|
60
|
+
* background: #333;
|
|
61
|
+
* color: #fff;
|
|
62
|
+
* }
|
|
63
|
+
*/
|
|
64
|
+
/* stylelint-disable scss/no-global-function-names */
|
|
65
|
+
.gct-card-view-render {
|
|
66
|
+
position: relative;
|
|
67
|
+
}
|
|
68
|
+
.gct-card-view-render .gct-design-render {
|
|
69
|
+
width: auto;
|
|
70
|
+
height: auto;
|
|
71
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
export declare const CardViewRender: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
3
|
+
id: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
required: true;
|
|
6
|
+
};
|
|
7
|
+
modelKey: {
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
fetch: {
|
|
12
|
+
type: PropType<() => Promise<IObject>>;
|
|
13
|
+
};
|
|
14
|
+
preview: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "mounted"[], "mounted", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
19
|
+
id: {
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
required: true;
|
|
22
|
+
};
|
|
23
|
+
modelKey: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
fetch: {
|
|
28
|
+
type: PropType<() => Promise<IObject>>;
|
|
29
|
+
};
|
|
30
|
+
preview: {
|
|
31
|
+
type: BooleanConstructor;
|
|
32
|
+
default: boolean;
|
|
33
|
+
};
|
|
34
|
+
}>> & Readonly<{
|
|
35
|
+
onMounted?: ((...args: any[]) => any) | undefined;
|
|
36
|
+
}>, {
|
|
37
|
+
preview: boolean;
|
|
38
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { DesignRenderViewPrefix } from "../../constant/index.mjs";
|
|
2
|
+
import { DesignRender } from "../design-render/design-render.mjs";
|
|
3
|
+
import './card-view-render.css';/* empty css */
|
|
4
|
+
import { gctMemoizeAsync, useNamespace } from "@gct-paas/core";
|
|
5
|
+
import { computed, createVNode, defineComponent, nextTick, ref } from "vue";
|
|
6
|
+
//#region src/components/card-view-render/card-view-render.tsx
|
|
7
|
+
var loadModelAsync = gctMemoizeAsync(_api.apaas.commonInfoCard.getGetById);
|
|
8
|
+
var CardViewRender = /* @__PURE__ */ defineComponent({
|
|
9
|
+
name: "CardViewRender",
|
|
10
|
+
props: {
|
|
11
|
+
id: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
modelKey: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true
|
|
18
|
+
},
|
|
19
|
+
fetch: { type: Function },
|
|
20
|
+
preview: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
emits: ["mounted"],
|
|
26
|
+
setup(props, { emit, slots }) {
|
|
27
|
+
const ns = useNamespace("card-view-render");
|
|
28
|
+
const isLoading = ref(false);
|
|
29
|
+
const isLoaded = ref(false);
|
|
30
|
+
const json = ref(null);
|
|
31
|
+
const data = ref({});
|
|
32
|
+
const style = computed(() => {
|
|
33
|
+
if (json.value) return { width: json.value.pageNode?.data.width ? `${json.value.pageNode.data.width}px` : "" };
|
|
34
|
+
return {};
|
|
35
|
+
});
|
|
36
|
+
async function loadModel() {
|
|
37
|
+
const res = await loadModelAsync({
|
|
38
|
+
id: props.id,
|
|
39
|
+
modelKey: props.modelKey,
|
|
40
|
+
type: "CARD"
|
|
41
|
+
});
|
|
42
|
+
if (res && res.designerJson) json.value = JSON.parse(decodeURIComponent(res.designerJson));
|
|
43
|
+
}
|
|
44
|
+
async function onInit() {
|
|
45
|
+
if (!props.id) return;
|
|
46
|
+
try {
|
|
47
|
+
isLoading.value = true;
|
|
48
|
+
await loadModel();
|
|
49
|
+
if (props.preview !== true && props.fetch) data.value = await props.fetch() || {};
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error(error);
|
|
52
|
+
} finally {
|
|
53
|
+
isLoading.value = false;
|
|
54
|
+
}
|
|
55
|
+
isLoaded.value = true;
|
|
56
|
+
await nextTick();
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
emit("mounted", json.value?.pageNode?.data);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
onInit();
|
|
62
|
+
return () => {
|
|
63
|
+
return createVNode("div", {
|
|
64
|
+
"class": ns.b(),
|
|
65
|
+
"style": style.value
|
|
66
|
+
}, [isLoading.value && slots.loading ? slots.loading?.() : null, !json.value || !isLoaded.value ? null : createVNode(DesignRender, {
|
|
67
|
+
"context": {
|
|
68
|
+
data: data.value,
|
|
69
|
+
id: props.id,
|
|
70
|
+
modelKey: props.modelKey
|
|
71
|
+
},
|
|
72
|
+
"model": {
|
|
73
|
+
nodes: json.value.nodes,
|
|
74
|
+
pageNode: json.value.pageNode,
|
|
75
|
+
tree: json.value.tree,
|
|
76
|
+
type: DesignRenderViewPrefix.CARD_VIEW
|
|
77
|
+
},
|
|
78
|
+
"prefix": DesignRenderViewPrefix.CARD_VIEW,
|
|
79
|
+
"preview": props.preview
|
|
80
|
+
}, null)]);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
//#endregion
|
|
85
|
+
export { CardViewRender };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/* stylelint-disable scss/no-global-function-names */
|
|
3
|
+
/* bem('block', 'element', 'modifier') => 'ibiz-block__element--modifier' */
|
|
4
|
+
/**
|
|
5
|
+
* 定义 Block 块
|
|
6
|
+
* @param {String} $block - Block 块名称
|
|
7
|
+
* @example
|
|
8
|
+
* @include b('button') {
|
|
9
|
+
* padding: 10px;
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 定义 Element 元素
|
|
14
|
+
* @param {String|List} $element - Element 元素名称,支持单个或多个
|
|
15
|
+
* @example
|
|
16
|
+
* @include b('button') {
|
|
17
|
+
* @include e('text') {
|
|
18
|
+
* color: #000;
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* // 或传入多个元素
|
|
22
|
+
* @include b('button') {
|
|
23
|
+
* @include e(('text', 'icon')) {
|
|
24
|
+
* margin: 5px;
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* 定义 Modifier 修饰符
|
|
30
|
+
* @param {String|List} $modifier - Modifier 修饰符名称,支持单个或多个
|
|
31
|
+
* @example
|
|
32
|
+
* @include b('button') {
|
|
33
|
+
* @include m('primary') {
|
|
34
|
+
* background: blue;
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* // 或传入多个修饰符
|
|
38
|
+
* @include b('button') {
|
|
39
|
+
* @include m(('primary', 'large')) {
|
|
40
|
+
* background: blue;
|
|
41
|
+
* font-size: 16px;
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* 定义状态选择器
|
|
47
|
+
* @param {String} $state - 状态名称
|
|
48
|
+
* @example
|
|
49
|
+
* @include b('button') {
|
|
50
|
+
* @include when('disabled') {
|
|
51
|
+
* opacity: 0.5;
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* 深色主题样式
|
|
57
|
+
* @param {String} $block - Block 块名称
|
|
58
|
+
* @example
|
|
59
|
+
* @include dark('button') {
|
|
60
|
+
* background: #333;
|
|
61
|
+
* color: #fff;
|
|
62
|
+
* }
|
|
63
|
+
*/
|
|
64
|
+
/* stylelint-disable scss/no-global-function-names */
|
|
65
|
+
.gct-design-render {
|
|
66
|
+
position: relative;
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
overflow: hidden auto;
|
|
70
|
+
background-color: #f7f8fa;
|
|
71
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { IDesignData } from '@gct-paas/schema';
|
|
3
|
+
export declare const DesignRender: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
|
+
model: {
|
|
5
|
+
type: PropType<IDesignData>;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
prefix: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
preview: {
|
|
13
|
+
type: BooleanConstructor;
|
|
14
|
+
default: boolean;
|
|
15
|
+
};
|
|
16
|
+
context: {
|
|
17
|
+
type: PropType<IContext>;
|
|
18
|
+
default: () => {};
|
|
19
|
+
};
|
|
20
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
21
|
+
model: {
|
|
22
|
+
type: PropType<IDesignData>;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
prefix: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
default: string;
|
|
28
|
+
};
|
|
29
|
+
preview: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
default: boolean;
|
|
32
|
+
};
|
|
33
|
+
context: {
|
|
34
|
+
type: PropType<IContext>;
|
|
35
|
+
default: () => {};
|
|
36
|
+
};
|
|
37
|
+
}>> & Readonly<{}>, {
|
|
38
|
+
prefix: string;
|
|
39
|
+
preview: boolean;
|
|
40
|
+
context: IContext;
|
|
41
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { RenderNodeRegister } from "../../register/node/node.register.mjs";
|
|
2
|
+
import "../../register/index.mjs";
|
|
3
|
+
import { DesignRenderItem } from "../design-render-item/design-render-item.mjs";
|
|
4
|
+
import './design-render.css';/* empty css */
|
|
5
|
+
import { useDesignRenderController } from "../../hooks/use-design-render-controller/use-design-render-controller.mjs";
|
|
6
|
+
import "../../hooks/index.mjs";
|
|
7
|
+
import { calcStyle, useNamespace } from "@gct-paas/core";
|
|
8
|
+
import { computed, createTextVNode, createVNode, defineComponent, h, resolveComponent, watch } from "vue";
|
|
9
|
+
import { DesignNodeMode } from "@gct-paas/schema";
|
|
10
|
+
//#region src/components/design-render/design-render.tsx
|
|
11
|
+
var DesignRender = /* @__PURE__ */ defineComponent({
|
|
12
|
+
name: "DesignRender",
|
|
13
|
+
props: {
|
|
14
|
+
model: {
|
|
15
|
+
type: Object,
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
prefix: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: ""
|
|
21
|
+
},
|
|
22
|
+
preview: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false
|
|
25
|
+
},
|
|
26
|
+
context: {
|
|
27
|
+
type: Object,
|
|
28
|
+
default: () => {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
setup(props) {
|
|
34
|
+
const ns = useNamespace("design-render");
|
|
35
|
+
const c = useDesignRenderController();
|
|
36
|
+
c.prefix = props.prefix;
|
|
37
|
+
c.preview = props.preview;
|
|
38
|
+
c.setNodes(props.model.nodes);
|
|
39
|
+
c.setTree(props.model.tree);
|
|
40
|
+
watch(() => props.context, () => {
|
|
41
|
+
c.state.context = props.context;
|
|
42
|
+
}, { immediate: true });
|
|
43
|
+
const style = computed(() => {
|
|
44
|
+
if (props.model.pageNode) return calcStyle(props.model.pageNode.data);
|
|
45
|
+
return {};
|
|
46
|
+
});
|
|
47
|
+
const rootNodes = c.getNodes();
|
|
48
|
+
function renderNodeItem(node, parent) {
|
|
49
|
+
const provider = RenderNodeRegister.get(node.type, c.prefix);
|
|
50
|
+
const itemC = c.getController(node.id);
|
|
51
|
+
return h(resolveComponent(provider.component), {
|
|
52
|
+
key: node.id,
|
|
53
|
+
c: itemC,
|
|
54
|
+
model: node,
|
|
55
|
+
parent,
|
|
56
|
+
preview: props.preview,
|
|
57
|
+
context: c.state.context,
|
|
58
|
+
pageModel: props.model.pageNode
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function renderNodeContainer(node, parent) {
|
|
62
|
+
const provider = RenderNodeRegister.get(node.type, c.prefix);
|
|
63
|
+
const items = c.getNodes(node.id);
|
|
64
|
+
const itemC = c.getController(node.id);
|
|
65
|
+
return h(resolveComponent(provider.component), {
|
|
66
|
+
key: node.id,
|
|
67
|
+
c: itemC,
|
|
68
|
+
model: node,
|
|
69
|
+
parent,
|
|
70
|
+
preview: props.preview,
|
|
71
|
+
context: c.state.context,
|
|
72
|
+
pageModel: props.model.pageNode
|
|
73
|
+
}, items.map((_) => {
|
|
74
|
+
return renderNode(_, node);
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
function renderNode(node, parent) {
|
|
78
|
+
const provider = RenderNodeRegister.get(node.type, c.prefix);
|
|
79
|
+
if (!provider) {
|
|
80
|
+
console.warn(`未找到节点类型为${node.type}的渲染器`);
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
let content = null;
|
|
84
|
+
if (provider.mode === DesignNodeMode.CONTAINER) content = renderNodeContainer(node, parent);
|
|
85
|
+
else if (provider.mode === DesignNodeMode.ITEM) content = renderNodeItem(node, parent);
|
|
86
|
+
else content = createVNode("div", null, [
|
|
87
|
+
createTextVNode("未支持的适配器模式["),
|
|
88
|
+
provider.mode,
|
|
89
|
+
createTextVNode("]")
|
|
90
|
+
]);
|
|
91
|
+
return createVNode(DesignRenderItem, { "model": node }, { default: () => content });
|
|
92
|
+
}
|
|
93
|
+
function renderPageNode(child) {
|
|
94
|
+
if (!props.model.pageNode) return child;
|
|
95
|
+
const provider = RenderNodeRegister.get(props.model.pageNode.type, c.prefix);
|
|
96
|
+
if (!provider) {
|
|
97
|
+
console.warn(`未找到页面节点类型为${props.model.pageNode.type}的渲染器`);
|
|
98
|
+
return child;
|
|
99
|
+
}
|
|
100
|
+
const itemC = c.getController(props.model.pageNode.id);
|
|
101
|
+
return h(resolveComponent(provider.component), {
|
|
102
|
+
key: props.model.pageNode.id,
|
|
103
|
+
c: itemC,
|
|
104
|
+
model: props.model.pageNode,
|
|
105
|
+
parent: void 0,
|
|
106
|
+
preview: props.preview,
|
|
107
|
+
context: c.state.context
|
|
108
|
+
}, child);
|
|
109
|
+
}
|
|
110
|
+
return () => {
|
|
111
|
+
return createVNode("div", {
|
|
112
|
+
"class": ns.b(),
|
|
113
|
+
"style": style.value
|
|
114
|
+
}, [renderPageNode(rootNodes.map((node) => {
|
|
115
|
+
return renderNode(node);
|
|
116
|
+
}))]);
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
//#endregion
|
|
121
|
+
export { DesignRender };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { IDesignNode } from '@gct-paas/schema';
|
|
3
|
+
export declare const DesignRenderItem: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
|
+
model: {
|
|
5
|
+
type: PropType<IDesignNode>;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
9
|
+
model: {
|
|
10
|
+
type: PropType<IDesignNode>;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { calcStyle, useNamespace } from "@gct-paas/core";
|
|
2
|
+
import { createVNode, defineComponent } from "vue";
|
|
3
|
+
//#region src/components/design-render-item/design-render-item.tsx
|
|
4
|
+
var DesignRenderItem = /* @__PURE__ */ defineComponent({
|
|
5
|
+
name: "DesignRenderItem",
|
|
6
|
+
props: { model: {
|
|
7
|
+
type: Object,
|
|
8
|
+
required: true
|
|
9
|
+
} },
|
|
10
|
+
setup(props, { slots }) {
|
|
11
|
+
const ns = useNamespace("design-render-item");
|
|
12
|
+
const style = calcStyle(props.model.data);
|
|
13
|
+
return () => {
|
|
14
|
+
return createVNode("div", {
|
|
15
|
+
"class": ns.b(),
|
|
16
|
+
"style": style
|
|
17
|
+
}, [slots.default?.()]);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
export { DesignRenderItem };
|
package/es/components/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
export { CardViewRender } from './card-view-render/card-view-render';
|
|
2
|
+
export { DesignRender } from './design-render/design-render';
|
|
3
|
+
export { default as HandwritingPad } from './HandwritingPad.vue';
|
package/es/components/index.mjs
CHANGED
package/es/hooks/index.mjs
CHANGED
package/es/index.d.ts
CHANGED