@gct-paas/render 0.1.4-dev.9 → 0.1.5-dev.0
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 +2 -0
- package/dist/loader.esm.min.js +1 -0
- package/es/Event/Dependency/controller.d.ts +1 -1
- package/es/Event/Dependency/controller.mjs +81 -94
- package/es/Event/Dependency/displayRule.mjs +130 -68
- package/es/Event/Dependency/useDependency.mjs +117 -0
- package/es/Event/Dependency/useDependencyToShow.d.ts +1 -1
- package/es/Event/Dependency/useDependencyToShow.mjs +100 -96
- package/es/Event/baseEvent.d.ts +28 -32
- package/es/Event/baseEvent.mjs +383 -439
- package/es/Event/bizServiceRequest.d.ts +1 -1
- package/es/Event/bizServiceRequest.mjs +29 -41
- package/es/Event/eventType.d.ts +1 -1
- package/es/Event/eventType.mjs +1 -0
- package/es/Event/index.d.ts +6 -3
- package/es/Event/index.mjs +7 -0
- package/es/Event/utils/appRedis.mjs +39 -49
- package/es/Event/utils/globalLoading.d.ts +13 -0
- package/es/Event/utils/globalLoading.mjs +104 -0
- package/es/Event/utils/processRovedInfo.mjs +228 -294
- package/es/Event/utils/runGlobalByPage.d.ts +4 -1
- package/es/Event/utils/runGlobalByPage.mjs +297 -301
- package/es/Event/utils/verificationVar.mjs +32 -38
- package/es/_virtual/_plugin-vue_export-helper.mjs +8 -0
- package/es/_virtual/_rolldown/runtime.mjs +13 -0
- package/es/components/HandwritingPad.vue.d.ts +27 -0
- package/es/components/HandwritingPad.vue.mjs +7 -0
- package/es/components/HandwritingPad.vue_vue_type_script_setup_true_name_HandwritingPad_lang.mjs +109 -0
- package/es/components/HandwritingPad.vue_vue_type_style_index_0_scoped_d5b980b7_lang.css +9 -0
- package/es/components/index.d.ts +2 -0
- package/es/components/index.mjs +1 -0
- package/es/constant/data-format.d.ts +52 -0
- package/es/constant/data-format.mjs +66 -0
- package/es/constant/date-time.d.ts +99 -0
- package/es/constant/date-time.mjs +187 -0
- package/es/constant/index.d.ts +94 -0
- package/es/constant/index.mjs +100 -0
- package/es/controller/design-render/design-render.controller.d.ts +18 -0
- package/es/controller/design-render/design-render.controller.mjs +78 -0
- package/es/controller/design-render-base/design-render-base.controller.d.ts +9 -0
- package/es/controller/design-render-base/design-render-base.controller.mjs +12 -0
- package/es/controller/design-render-container/design-render-container.controller.d.ts +4 -0
- package/es/controller/design-render-container/design-render-container.controller.mjs +5 -0
- package/es/controller/design-render-item/design-render-item.controller.d.ts +4 -0
- package/es/controller/design-render-item/design-render-item.controller.mjs +5 -0
- package/es/controller/index.d.ts +4 -0
- package/es/controller/index.mjs +4 -0
- package/es/enums/index.mjs +17 -5
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/index.mjs +2 -0
- package/es/hooks/use-design-render-controller/use-design-render-controller.d.ts +11 -0
- package/es/hooks/use-design-render-controller/use-design-render-controller.mjs +32 -0
- package/es/hooks/useStorageRef.mjs +35 -31
- package/es/index.d.ts +4 -0
- package/es/index.mjs +34 -21
- package/es/interface/controller/i-design-render-base.controller.d.ts +43 -0
- package/es/interface/controller/i-design-render-container.controller.d.ts +7 -0
- package/es/interface/controller/i-design-render-item.controller.d.ts +7 -0
- package/es/interface/controller/i-design-render.controller.d.ts +93 -0
- package/es/interface/index.d.ts +12 -0
- package/es/interface/provider/i-render-base-node.provider.d.ts +45 -0
- package/es/interface/provider/i-render-container-node.provider.d.ts +30 -0
- package/es/interface/provider/i-render-editor-node.provider.d.ts +29 -0
- package/es/interface/provider/i-render-item-node.provider.d.ts +30 -0
- package/es/interface/state/i-design-render-base.state.d.ts +19 -0
- package/es/interface/state/i-design-render-container.state.d.ts +11 -0
- package/es/interface/state/i-design-render-item.state.d.ts +11 -0
- package/es/interface/state/i-design-render.state.d.ts +18 -0
- package/es/loader.d.ts +1 -0
- package/es/register/index.d.ts +1 -0
- package/es/register/index.mjs +2 -0
- package/es/register/node/node.register.d.ts +92 -0
- package/es/register/node/node.register.mjs +116 -0
- package/es/register/render-register/render-register.mjs +63 -58
- package/es/state/design-render/design-render.state.d.ts +13 -0
- package/es/state/design-render/design-render.state.mjs +15 -0
- package/es/state/design-render-base/design-render-base.state.d.ts +4 -0
- package/es/state/design-render-base/design-render-base.state.mjs +6 -0
- package/es/state/design-render-container/design-render-container.state.d.ts +4 -0
- package/es/state/design-render-item/design-render-item.state.d.ts +4 -0
- package/es/state/index.d.ts +4 -0
- package/es/utils/cacheAdapter.mjs +62 -54
- package/es/utils/expression/index.d.ts +1 -1
- package/es/utils/expression/index.mjs +105 -122
- package/es/utils/expression/regularExpression/methods.mjs +426 -567
- package/es/utils/field-attrs/basicAttrs.mjs +56 -80
- package/es/utils/field-attrs/index.mjs +16 -13
- package/es/utils/get-ref-data.mjs +41 -59
- package/es/utils/getFieldSchema.mjs +66 -80
- package/es/utils/index.d.ts +6 -3
- package/es/utils/index.mjs +11 -0
- package/es/utils/model-transformer.mjs +74 -64
- package/es/utils/render-plugin-pkg-util/render-plugin-pkg-util.d.ts +43 -0
- package/es/utils/render-plugin-pkg-util/render-plugin-pkg-util.mjs +65 -0
- package/es/utils/search/index.d.ts +2 -0
- package/es/utils/search/index.mjs +2 -0
- package/es/utils/search/search-default-value.d.ts +7 -0
- package/es/utils/search/search-default-value.mjs +244 -0
- package/es/utils/search/search-hooks.d.ts +6 -0
- package/es/utils/search/search-hooks.mjs +67 -0
- package/es/utils/useStyle.d.ts +2 -2
- package/es/utils/useStyle.mjs +20 -15
- package/package.json +20 -17
- package/dist/index.esm.min.mjs +0 -7758
- package/dist/index.min.cjs +0 -9
- package/dist/index.system.min.js +0 -9
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { PluginModeEnum, PluginPgkUtil } from "@gct-paas/core";
|
|
2
|
+
//#region src/utils/render-plugin-pkg-util/render-plugin-pkg-util.ts
|
|
3
|
+
/**
|
|
4
|
+
* 插件包处理工具类
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @class RenderPluginPgkUtil
|
|
8
|
+
*/
|
|
9
|
+
var RenderPluginPgkUtil = class extends PluginPgkUtil {
|
|
10
|
+
/**
|
|
11
|
+
* 加载渲染态指定端插件包
|
|
12
|
+
*
|
|
13
|
+
* @static
|
|
14
|
+
* @param {PluginModeEnum} mode
|
|
15
|
+
* @param {PluginTenant['plugins']} [configs=[]]
|
|
16
|
+
* @return {*} {Promise<void>}
|
|
17
|
+
*/
|
|
18
|
+
static async loadRenderPlugin(mode, configs = []) {
|
|
19
|
+
try {
|
|
20
|
+
const moduleMap = await this.loadPlugins(mode, configs);
|
|
21
|
+
configs.forEach((plugin) => {
|
|
22
|
+
const key = plugin.key;
|
|
23
|
+
if (!moduleMap[key]) {
|
|
24
|
+
console.error(`${key} 插件加载失败,请检查插件配置是否正确`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
_gct.register.render.register(key, moduleMap[key].default);
|
|
28
|
+
});
|
|
29
|
+
} catch (error) {
|
|
30
|
+
console.error(error);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 加载渲染态移动端插件包
|
|
35
|
+
*
|
|
36
|
+
* @static
|
|
37
|
+
* @param {PluginTenant['plugins']} [configs=[]]
|
|
38
|
+
* @return {*} {Promise<void>}
|
|
39
|
+
*/
|
|
40
|
+
static loadMobilePlugin(configs = []) {
|
|
41
|
+
return this.loadRenderPlugin(PluginModeEnum.MOBILE, configs);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 加载渲染态平板端插件包
|
|
45
|
+
*
|
|
46
|
+
* @static
|
|
47
|
+
* @param {PluginTenant['plugins']} [configs=[]]
|
|
48
|
+
* @return {*} {Promise<void>}
|
|
49
|
+
*/
|
|
50
|
+
static loadPadPlugin(configs = []) {
|
|
51
|
+
return this.loadRenderPlugin(PluginModeEnum.PAD, configs);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 加载渲染态网页端插件包
|
|
55
|
+
*
|
|
56
|
+
* @static
|
|
57
|
+
* @param {PluginTenant['plugins']} [configs=[]]
|
|
58
|
+
* @return {*} {Promise<void>}
|
|
59
|
+
*/
|
|
60
|
+
static loadWebPlugin(configs = []) {
|
|
61
|
+
return this.loadRenderPlugin(PluginModeEnum.WEB, configs);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { RenderPluginPgkUtil };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ISearchSchema } from '@gct-paas/schema';
|
|
2
|
+
import { GetAppResponse } from '@gct-paas/api/apaas';
|
|
3
|
+
interface IParams {
|
|
4
|
+
appInfo?: GetAppResponse;
|
|
5
|
+
}
|
|
6
|
+
export declare const defaultValMap: Map<string, (widget: ISearchSchema, params?: IParams) => Promise<string | string[] | null | undefined | number | number[] | boolean>>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { DefaultDateTypeConst, FIELD_TYPE, isMultipleOperator } from "@gct-paas/core";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
//#region src/utils/search/search-default-value.ts
|
|
4
|
+
var defaultValMap = /* @__PURE__ */ new Map();
|
|
5
|
+
/**
|
|
6
|
+
* 组织选择默认值
|
|
7
|
+
*
|
|
8
|
+
* @author zhanghanrui
|
|
9
|
+
* @date 2024-09-11 17:09:35
|
|
10
|
+
* @param {*} widget
|
|
11
|
+
* @param {*} [_params={}]
|
|
12
|
+
* @return {*} {Promise<any>}
|
|
13
|
+
*/
|
|
14
|
+
async function org_and_org_multi(widget, _params = {}) {
|
|
15
|
+
const { defaultValue } = widget.props;
|
|
16
|
+
if (!defaultValue) return null;
|
|
17
|
+
if (Array.isArray(defaultValue)) {
|
|
18
|
+
if (!defaultValue.includes("CURRENT_ORG")) return null;
|
|
19
|
+
} else if (defaultValue !== "CURRENT_ORG") return null;
|
|
20
|
+
const orgInfo = await _api.platform.tenant.getUserInfo();
|
|
21
|
+
if (orgInfo) {
|
|
22
|
+
const res = await _api.apaas.designerCommon.getGetCanBeUsedOrgUser({
|
|
23
|
+
pageNo: 1,
|
|
24
|
+
pageSize: 999999999
|
|
25
|
+
});
|
|
26
|
+
if (res) {
|
|
27
|
+
const arr = res.data;
|
|
28
|
+
if (arr) {
|
|
29
|
+
if (arr.findIndex((item) => item.masterOrgId === orgInfo.masterOrgId) !== -1) return isMultipleOperator(widget.props.ope) ? [orgInfo.masterOrgId] : orgInfo.masterOrgId;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
defaultValMap.set(FIELD_TYPE.ORG, org_and_org_multi);
|
|
36
|
+
defaultValMap.set(FIELD_TYPE.ORG_MULTI, org_and_org_multi);
|
|
37
|
+
/**
|
|
38
|
+
* 人员选择默认值
|
|
39
|
+
*
|
|
40
|
+
* @author zhanghanrui
|
|
41
|
+
* @date 2024-09-11 17:09:20
|
|
42
|
+
* @param {*} widget
|
|
43
|
+
* @param {*} [_params={}]
|
|
44
|
+
* @return {*} {Promise<any>}
|
|
45
|
+
*/
|
|
46
|
+
async function user_and_user_multi(widget, _params = {}) {
|
|
47
|
+
const { defaultValue } = widget.props;
|
|
48
|
+
if (!defaultValue) return null;
|
|
49
|
+
if (Array.isArray(defaultValue)) {
|
|
50
|
+
if (!defaultValue.includes("CURRENT_USER")) return null;
|
|
51
|
+
} else if (defaultValue !== "CURRENT_USER") return null;
|
|
52
|
+
const userInfo = await _api.platform.user.getInfo();
|
|
53
|
+
if (userInfo) {
|
|
54
|
+
const res = await _api.apaas.designerCommon.getGetCanBeUsedOrgUser({
|
|
55
|
+
pageNo: 1,
|
|
56
|
+
pageSize: 999999999
|
|
57
|
+
});
|
|
58
|
+
if (res) {
|
|
59
|
+
const arr = res.data;
|
|
60
|
+
if (arr) {
|
|
61
|
+
if (arr.findIndex((item) => item.id === userInfo.userId) !== -1) return isMultipleOperator(widget.props.ope) ? [userInfo.userId] : userInfo.userId;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
defaultValMap.set(FIELD_TYPE.USER, user_and_user_multi);
|
|
68
|
+
defaultValMap.set(FIELD_TYPE.USER_MULTI, user_and_user_multi);
|
|
69
|
+
/**
|
|
70
|
+
* 枚举选择默认值
|
|
71
|
+
*
|
|
72
|
+
* @author zhanghanrui
|
|
73
|
+
* @date 2024-09-12 20:09:57
|
|
74
|
+
* @param {*} widget
|
|
75
|
+
* @param {*} [_params={}]
|
|
76
|
+
* @return {*} {Promise<any>}
|
|
77
|
+
*/
|
|
78
|
+
async function enum_and_enum_multi(widget, _params = {}) {
|
|
79
|
+
const { defaultValue } = widget.props;
|
|
80
|
+
if (!defaultValue || defaultValue.length === 0) return null;
|
|
81
|
+
return defaultValue;
|
|
82
|
+
}
|
|
83
|
+
defaultValMap.set(FIELD_TYPE.ENUM, enum_and_enum_multi);
|
|
84
|
+
defaultValMap.set(FIELD_TYPE.ENUM_MULTI, enum_and_enum_multi);
|
|
85
|
+
/**
|
|
86
|
+
* 数值默认值
|
|
87
|
+
*
|
|
88
|
+
* @author zhanghanrui
|
|
89
|
+
* @date 2024-09-12 20:09:57
|
|
90
|
+
* @param {*} widget
|
|
91
|
+
* @param {*} [_params={}]
|
|
92
|
+
* @return {*} {Promise<any>}
|
|
93
|
+
*/
|
|
94
|
+
async function number(widget, _params = {}) {
|
|
95
|
+
const { defaultValue } = widget.props;
|
|
96
|
+
if (defaultValue == null) return null;
|
|
97
|
+
return defaultValue;
|
|
98
|
+
}
|
|
99
|
+
defaultValMap.set(FIELD_TYPE.INTEGER, number);
|
|
100
|
+
defaultValMap.set(FIELD_TYPE.LONG, number);
|
|
101
|
+
defaultValMap.set(FIELD_TYPE.DOUBLE, number);
|
|
102
|
+
defaultValMap.set(FIELD_TYPE.DECIMAL, number);
|
|
103
|
+
/**
|
|
104
|
+
* 文本默认值
|
|
105
|
+
*
|
|
106
|
+
* @author zhanghanrui
|
|
107
|
+
* @date 2024-09-12 20:09:57
|
|
108
|
+
* @param {*} widget
|
|
109
|
+
* @param {*} [_params={}]
|
|
110
|
+
* @return {*} {Promise<any>}
|
|
111
|
+
*/
|
|
112
|
+
async function text(widget, _params = {}) {
|
|
113
|
+
const { defaultValue } = widget.props;
|
|
114
|
+
if (!defaultValue) return null;
|
|
115
|
+
return defaultValue;
|
|
116
|
+
}
|
|
117
|
+
defaultValMap.set(FIELD_TYPE.TEXT, text);
|
|
118
|
+
defaultValMap.set(FIELD_TYPE.LONG_TEXT, number);
|
|
119
|
+
/**
|
|
120
|
+
* 数值选择默认值
|
|
121
|
+
*
|
|
122
|
+
* @author zhanghanrui
|
|
123
|
+
* @date 2024-09-12 20:09:57
|
|
124
|
+
* @param {*} widget
|
|
125
|
+
* @param {*} [_params={}]
|
|
126
|
+
* @return {*} {Promise<any>}
|
|
127
|
+
*/
|
|
128
|
+
async function boolean(widget, _params = {}) {
|
|
129
|
+
const { defaultValue } = widget.props;
|
|
130
|
+
if (defaultValue == null || defaultValue === "") return null;
|
|
131
|
+
return defaultValue;
|
|
132
|
+
}
|
|
133
|
+
defaultValMap.set(FIELD_TYPE.BOOLEAN, boolean);
|
|
134
|
+
/**
|
|
135
|
+
* 日期选择默认值
|
|
136
|
+
*
|
|
137
|
+
* @author zhanghanrui
|
|
138
|
+
* @date 2024-09-12 20:09:57
|
|
139
|
+
* @param {*} widget
|
|
140
|
+
* @param {*} [_params={}]
|
|
141
|
+
* @return {*} {Promise<any>}
|
|
142
|
+
*/
|
|
143
|
+
async function date(widget, _params = {}) {
|
|
144
|
+
return date_and_date_time(widget, "YYYY-MM-DD");
|
|
145
|
+
}
|
|
146
|
+
defaultValMap.set(FIELD_TYPE.DATE, date);
|
|
147
|
+
/**
|
|
148
|
+
* 日期时间选择默认值
|
|
149
|
+
*
|
|
150
|
+
* @author zhanghanrui
|
|
151
|
+
* @date 2024-09-12 20:09:57
|
|
152
|
+
* @param {*} widget
|
|
153
|
+
* @param {*} [_params={}]
|
|
154
|
+
* @return {*} {Promise<any>}
|
|
155
|
+
*/
|
|
156
|
+
async function date_time(widget, _params = {}) {
|
|
157
|
+
return date_and_date_time(widget, "YYYY-MM-DD 00:00:00");
|
|
158
|
+
}
|
|
159
|
+
defaultValMap.set(FIELD_TYPE.DATE_TIME, date_time);
|
|
160
|
+
/**
|
|
161
|
+
* 日期时间+日期默认值初始化
|
|
162
|
+
*
|
|
163
|
+
* 举例:当前时间为2024-9-20
|
|
164
|
+
* 近0天:当天,2024-9-20至2024-9-20
|
|
165
|
+
* 近0周:本周,2024-9-16至2024-9-22
|
|
166
|
+
* 近0月:本月,2024-9-1至2024-9-30
|
|
167
|
+
* 近0年:本年,2024-1-1至2024-12-31
|
|
168
|
+
* 近1天:2024-9-19至 2024-9-19
|
|
169
|
+
* 近1周:2024-9-9至 2024-9-15
|
|
170
|
+
* 近1月:2024-8-1至 2024-8-31
|
|
171
|
+
* 近1年:2023-1-1至 2023-12-31
|
|
172
|
+
* 近2天:2024-9-18至 2024-9-19
|
|
173
|
+
* 近2周:2024-9-2至 2024-9-15
|
|
174
|
+
* 近2月:2024-7-1至 2024-8-31
|
|
175
|
+
* 近2年:2022-1-1至 2023-12-31
|
|
176
|
+
*
|
|
177
|
+
* @author zhanghanrui
|
|
178
|
+
* @date 2024-09-13 15:09:49
|
|
179
|
+
* @param {*} widget
|
|
180
|
+
* @param {string} format
|
|
181
|
+
* @param {*} [_params={}]
|
|
182
|
+
* @return {*} {*}
|
|
183
|
+
*/
|
|
184
|
+
function date_and_date_time(widget, _format, _params = {}) {
|
|
185
|
+
const { defaultValueType, defaultValue } = widget.props;
|
|
186
|
+
if (defaultValueType == null || defaultValueType == "") return null;
|
|
187
|
+
const { isRang, fieldType } = widget.props;
|
|
188
|
+
if (!isRang) {
|
|
189
|
+
const format = fieldType === FIELD_TYPE.DATE ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss";
|
|
190
|
+
switch (defaultValueType) {
|
|
191
|
+
case DefaultDateTypeConst.SystemDate: return dayjs(/* @__PURE__ */ new Date()).format(format);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (isRang) {
|
|
195
|
+
const fs = fieldType === FIELD_TYPE.DATE ? "YYYY-MM-DD" : "YYYY-MM-DD 00:00:00";
|
|
196
|
+
const fe = fieldType === FIELD_TYPE.DATE ? "YYYY-MM-DD" : "YYYY-MM-DD 23:59:59";
|
|
197
|
+
const num = defaultValue != null ? Number(defaultValue) : 0;
|
|
198
|
+
const now = dayjs();
|
|
199
|
+
switch (defaultValueType) {
|
|
200
|
+
case DefaultDateTypeConst.SystemDate: return isRang ? [now.format(fs), now.format(fe)] : now.format(fs);
|
|
201
|
+
case DefaultDateTypeConst.PastDays: return [now.subtract(num, "day").format(fs), now.subtract(num > 0 ? 1 : 0, "day").format(fe)];
|
|
202
|
+
case DefaultDateTypeConst.PastWeeks: return [now.subtract(num, "week").startOf("isoWeek").format(fs), now.subtract(num > 0 ? 1 : 0, "week").endOf("isoWeek").format(fe)];
|
|
203
|
+
case DefaultDateTypeConst.PastMonths: return [now.subtract(num, "month").startOf("month").format(fs), now.subtract(num > 0 ? 1 : 0, "month").endOf("month").format(fe)];
|
|
204
|
+
case DefaultDateTypeConst.PastYears: return [now.subtract(num, "year").startOf("year").format(fs), now.subtract(num > 0 ? 1 : 0, "year").endOf("year").format(fe)];
|
|
205
|
+
case DefaultDateTypeConst.Yesterday: {
|
|
206
|
+
const yester = now.subtract(1, "day");
|
|
207
|
+
return [yester.format(fs), yester.format(fe)];
|
|
208
|
+
}
|
|
209
|
+
case DefaultDateTypeConst.Past7Days: return [now.subtract(6, "day").format(fs), now.format(fe)];
|
|
210
|
+
case DefaultDateTypeConst.Past30Days: return [now.subtract(29, "day").format(fs), now.format(fe)];
|
|
211
|
+
case DefaultDateTypeConst.ThisWeek: return [now.startOf("isoWeek").format(fs), now.endOf("isoWeek").format(fe)];
|
|
212
|
+
case DefaultDateTypeConst.LastWeek: {
|
|
213
|
+
const lastWeek = now.subtract(1, "week");
|
|
214
|
+
return [lastWeek.startOf("isoWeek").format(fs), lastWeek.endOf("isoWeek").format(fe)];
|
|
215
|
+
}
|
|
216
|
+
case DefaultDateTypeConst.ThisMonth: return [now.startOf("month").format(fs), now.endOf("month").format(fe)];
|
|
217
|
+
case DefaultDateTypeConst.LastMonth: {
|
|
218
|
+
const lastMonth = now.subtract(1, "month");
|
|
219
|
+
return [lastMonth.startOf("month").format(fs), lastMonth.endOf("month").format(fe)];
|
|
220
|
+
}
|
|
221
|
+
case DefaultDateTypeConst.ThisYear: return [now.startOf("year").format(fs), now.endOf("year").format(fe)];
|
|
222
|
+
case DefaultDateTypeConst.LastYear: {
|
|
223
|
+
const lastYear = now.subtract(1, "year");
|
|
224
|
+
return [lastYear.startOf("year").format(fs), lastYear.endOf("year").format(fe)];
|
|
225
|
+
}
|
|
226
|
+
default: return null;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* 打印机
|
|
233
|
+
* @param widget
|
|
234
|
+
* @param _params
|
|
235
|
+
* @returns
|
|
236
|
+
*/
|
|
237
|
+
async function printer(widget, _params = {}) {
|
|
238
|
+
const { defaultValue } = widget.props;
|
|
239
|
+
if (!defaultValue || defaultValue.length === 0) return null;
|
|
240
|
+
return defaultValue;
|
|
241
|
+
}
|
|
242
|
+
defaultValMap.set(FIELD_TYPE.PRINTER, printer);
|
|
243
|
+
//#endregion
|
|
244
|
+
export { defaultValMap };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { FIELD_TYPE, SEARCH_SERVICE } from "@gct-paas/core";
|
|
2
|
+
//#region src/utils/search/search-hooks.ts
|
|
3
|
+
var isArrayOpe = [
|
|
4
|
+
SEARCH_SERVICE.CONTAINALL,
|
|
5
|
+
SEARCH_SERVICE.CONTAINANY,
|
|
6
|
+
SEARCH_SERVICE.IN,
|
|
7
|
+
SEARCH_SERVICE.NOTIN
|
|
8
|
+
];
|
|
9
|
+
/**查询组件body转化为算子 */
|
|
10
|
+
function useGetBodyBySearch(formState, cacheColumns, expStr) {
|
|
11
|
+
/**
|
|
12
|
+
* 转化为post请求的格式
|
|
13
|
+
* @param fieldWidget
|
|
14
|
+
* @param state
|
|
15
|
+
*/
|
|
16
|
+
function transformToBody(state) {
|
|
17
|
+
const body = {};
|
|
18
|
+
let exp = expStr || "";
|
|
19
|
+
cacheColumns.forEach((i) => {
|
|
20
|
+
const field = i.props.fieldSearchKey || i.props.field;
|
|
21
|
+
const ope = i.props.ope || [];
|
|
22
|
+
let value = state[i.id];
|
|
23
|
+
if (value !== null && value !== void 0 || i.props.useMore) ope.forEach((o) => {
|
|
24
|
+
value = getMultipleChoiceToArray(value, o);
|
|
25
|
+
const key = `${field}.${o}:${i.id}`, expkey = `${i.id}.${o}`;
|
|
26
|
+
body[key] = i.props.useMore ? null : value;
|
|
27
|
+
exp = exp.replace(expkey, key);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
body,
|
|
32
|
+
exp
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** rdo版本关联查询数据单独处理 */
|
|
36
|
+
function transformRdo(state, cacheColumns) {
|
|
37
|
+
if (!cacheColumns.length) return state;
|
|
38
|
+
const filterRdo = cacheColumns.filter((i) => {
|
|
39
|
+
return i.props.fieldType === FIELD_TYPE.RDO_REF;
|
|
40
|
+
});
|
|
41
|
+
if (!filterRdo.length) return state;
|
|
42
|
+
filterRdo.forEach((i) => {
|
|
43
|
+
if (!state[i.id]) return;
|
|
44
|
+
if (Array.isArray(state[i.id])) state[i.id] = state[i.id].map((p) => {
|
|
45
|
+
if (!p) return;
|
|
46
|
+
const [_fId, _cId] = p.split(":");
|
|
47
|
+
return _cId || _fId;
|
|
48
|
+
});
|
|
49
|
+
else {
|
|
50
|
+
const [_fId, _cId] = state[i.id].split(":");
|
|
51
|
+
return _cId || _fId;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return state;
|
|
55
|
+
}
|
|
56
|
+
const { body, exp } = transformToBody(transformRdo(formState, cacheColumns));
|
|
57
|
+
return {
|
|
58
|
+
query: body,
|
|
59
|
+
exp
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function getMultipleChoiceToArray(value, ope) {
|
|
63
|
+
if (isArrayOpe.indexOf(ope) > -1 && typeof value === "string") return value.split(",");
|
|
64
|
+
else return value;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { useGetBodyBySearch };
|
package/es/utils/useStyle.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LowCodeWidget } from '@gct-paas/schema';
|
|
2
|
-
export declare function useStyle(widget: LowCodeWidget.BasicSchema): {
|
|
1
|
+
import { LowCodeWidget, RuntimeModal } from '@gct-paas/schema';
|
|
2
|
+
export declare function useStyle(widget: LowCodeWidget.BasicSchema | RuntimeModal): {
|
|
3
3
|
wrapperStyle: IObject;
|
|
4
4
|
wStyle: IObject;
|
|
5
5
|
labelFont: IObject;
|
package/es/utils/useStyle.mjs
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { extractFontStyle, generateWrapperStyle, propsToStyle } from "@gct-paas/schema";
|
|
2
|
+
//#region src/utils/useStyle.ts
|
|
3
3
|
function useStyle(widget) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
contentFont
|
|
14
|
-
};
|
|
4
|
+
const { style = {} } = widget || {};
|
|
5
|
+
const ignoringStyle = "ignoringStyle" in widget ? widget.ignoringStyle ?? [] : [];
|
|
6
|
+
const wStyle = propsToStyle(style);
|
|
7
|
+
return {
|
|
8
|
+
wrapperStyle: generateWrapperStyle(style, ignoringStyle),
|
|
9
|
+
wStyle,
|
|
10
|
+
labelFont: extractFontStyle(style.labelFont),
|
|
11
|
+
contentFont: extractFontStyle(style.contentFont)
|
|
12
|
+
};
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
/**
|
|
15
|
+
* 将样式对象转换为字体样式
|
|
16
|
+
*
|
|
17
|
+
* @param schema - 样式配置对象
|
|
18
|
+
* @returns 转换后的字体样式对象
|
|
19
|
+
*/
|
|
20
|
+
var schemaToStyle = (schema) => extractFontStyle(schema);
|
|
21
|
+
//#endregion
|
|
22
|
+
export { schemaToStyle, useStyle };
|
package/package.json
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/render",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5-dev.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台网页端底包",
|
|
6
|
-
"
|
|
7
|
-
"module": "es/index.mjs",
|
|
6
|
+
"loader": "dist/loader.esm.min.js",
|
|
8
7
|
"types": "es/index.d.ts",
|
|
9
|
-
"system": "dist/index.system.min.js",
|
|
10
8
|
"exports": {
|
|
11
9
|
".": {
|
|
12
10
|
"types": "./es/index.d.ts",
|
|
13
|
-
"import": "./es/index.mjs"
|
|
14
|
-
"require": "./dist/index.min.cjs"
|
|
11
|
+
"import": "./es/index.mjs"
|
|
15
12
|
},
|
|
16
13
|
"./types": {
|
|
17
14
|
"types": "./es/types/index.d.ts"
|
|
@@ -45,11 +42,11 @@
|
|
|
45
42
|
"publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/"
|
|
46
43
|
},
|
|
47
44
|
"dependencies": {
|
|
48
|
-
"@gct-paas/api": "0.1.
|
|
49
|
-
"@gct-paas/core": "0.1.
|
|
50
|
-
"@gct-paas/core-web": "0.1.
|
|
51
|
-
"@gct-paas/schema": "0.1.
|
|
52
|
-
"@gct-paas/scss": "0.1.
|
|
45
|
+
"@gct-paas/api": "^0.1.2-dev.3",
|
|
46
|
+
"@gct-paas/core": "0.1.5-dev.0",
|
|
47
|
+
"@gct-paas/core-web": "0.1.5-dev.0",
|
|
48
|
+
"@gct-paas/schema": "0.1.5-dev.0",
|
|
49
|
+
"@gct-paas/scss": "0.1.5-dev.0",
|
|
53
50
|
"@vueuse/core": "^14.1.0",
|
|
54
51
|
"axios": "^1.13.2",
|
|
55
52
|
"bignumber.js": "^10.0.2",
|
|
@@ -57,16 +54,22 @@
|
|
|
57
54
|
"escodegen": "^2.1.0",
|
|
58
55
|
"esprima-next": "5.8.4",
|
|
59
56
|
"estraverse": "^5.3.0",
|
|
60
|
-
"qs": "^6.
|
|
57
|
+
"qs": "^6.15.0",
|
|
61
58
|
"qx-util": "^0.4.8",
|
|
62
|
-
"vue": "^3.5.
|
|
59
|
+
"vue": "^3.5.30"
|
|
63
60
|
},
|
|
64
61
|
"devDependencies": {
|
|
65
|
-
"@gct-paas/build": "^0.1.5-dev.8",
|
|
66
62
|
"@types/escodegen": "^0.0.10",
|
|
67
63
|
"@types/estraverse": "^5.1.7",
|
|
68
|
-
"@types/estree": "^1.0.8"
|
|
69
|
-
"@types/qs": "^6.14.0"
|
|
64
|
+
"@types/estree": "^1.0.8"
|
|
70
65
|
},
|
|
71
|
-
"
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"@gct-paas/api": "*",
|
|
68
|
+
"@gct-paas/core": "*",
|
|
69
|
+
"@gct-paas/core-web": "*",
|
|
70
|
+
"@gct-paas/schema": "*",
|
|
71
|
+
"@gct-paas/scss": "*",
|
|
72
|
+
"vue": ">=3"
|
|
73
|
+
},
|
|
74
|
+
"gitHead": "d5a1badfd34c55ceefd2cf33f2ee659454076e37"
|
|
72
75
|
}
|