super-page-runtime 2.0.30 → 2.0.32
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/es/components/runtime/utils/form/date-shortcuts.d.ts +7 -0
- package/dist/es/components/runtime/utils/form/date-shortcuts.js +96 -0
- package/dist/es/components/runtime/utils/page-helper-util.d.ts +6 -0
- package/dist/es/components/runtime/utils/page-helper-util.js +22 -1
- package/dist/es/components/runtime/utils/page-init-util.d.ts +1 -1
- package/dist/es/components/runtime/utils/page-init-util.js +23 -11
- package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +37 -7
- package/dist/es/index.d.ts +2 -0
- package/dist/es/index.js +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
function getDateShortCuts(dateScopeDetails, dateType, rangeType) {
|
|
2
|
+
if (!dateScopeDetails) {
|
|
3
|
+
return void 0;
|
|
4
|
+
}
|
|
5
|
+
const shortcuts = [];
|
|
6
|
+
if (dateScopeDetails.includes("today") && !["week", "month", "year"].includes(dateType)) {
|
|
7
|
+
const dateParams = {
|
|
8
|
+
text: "今天",
|
|
9
|
+
value: () => {
|
|
10
|
+
return /* @__PURE__ */ new Date();
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
if (rangeType.endsWith("range")) {
|
|
14
|
+
dateParams.value = () => {
|
|
15
|
+
return [/* @__PURE__ */ new Date(), /* @__PURE__ */ new Date()];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
shortcuts.push(dateParams);
|
|
19
|
+
}
|
|
20
|
+
if (dateScopeDetails.includes("yesterday") && !["week", "month", "year"].includes(dateType)) {
|
|
21
|
+
const date = /* @__PURE__ */ new Date();
|
|
22
|
+
date.setTime(date.getTime() - 3600 * 1e3 * 24);
|
|
23
|
+
const dateParams = {
|
|
24
|
+
text: "昨天",
|
|
25
|
+
value: () => {
|
|
26
|
+
return date;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
if (rangeType.endsWith("range")) {
|
|
30
|
+
dateParams.value = () => {
|
|
31
|
+
return [date, /* @__PURE__ */ new Date()];
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
shortcuts.push(dateParams);
|
|
35
|
+
}
|
|
36
|
+
if (dateScopeDetails.includes("oneWeek") && !["month", "year"].includes(dateType)) {
|
|
37
|
+
const date = /* @__PURE__ */ new Date();
|
|
38
|
+
date.setTime(date.getTime() - 3600 * 1e3 * 24 * 7);
|
|
39
|
+
const dateParams = {
|
|
40
|
+
text: "一周前",
|
|
41
|
+
value: () => {
|
|
42
|
+
return date;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
if (rangeType.endsWith("range")) {
|
|
46
|
+
dateParams.text = "一周";
|
|
47
|
+
dateParams.value = () => {
|
|
48
|
+
return [date, /* @__PURE__ */ new Date()];
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
shortcuts.push(dateParams);
|
|
52
|
+
}
|
|
53
|
+
if (dateScopeDetails.includes("oneMonth") && !["year"].includes(dateType)) {
|
|
54
|
+
const date = /* @__PURE__ */ new Date();
|
|
55
|
+
if (date.getMonth() > 0) {
|
|
56
|
+
date.setMonth(date.getMonth() - 1);
|
|
57
|
+
} else {
|
|
58
|
+
date.setMonth(12);
|
|
59
|
+
date.setFullYear(date.getFullYear() - 1);
|
|
60
|
+
}
|
|
61
|
+
const dateParams = {
|
|
62
|
+
text: "一月前",
|
|
63
|
+
value: () => {
|
|
64
|
+
return date;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
if (rangeType.endsWith("range")) {
|
|
68
|
+
dateParams.text = "一月";
|
|
69
|
+
dateParams.value = () => {
|
|
70
|
+
return [date, /* @__PURE__ */ new Date()];
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
shortcuts.push(dateParams);
|
|
74
|
+
}
|
|
75
|
+
if (dateScopeDetails.includes("oneYear")) {
|
|
76
|
+
const date = /* @__PURE__ */ new Date();
|
|
77
|
+
date.setFullYear(date.getFullYear() - 1);
|
|
78
|
+
const dateParams = {
|
|
79
|
+
text: "一年前",
|
|
80
|
+
value: () => {
|
|
81
|
+
return date;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
if (rangeType.endsWith("range")) {
|
|
85
|
+
dateParams.text = "一年";
|
|
86
|
+
dateParams.value = () => {
|
|
87
|
+
return [date, /* @__PURE__ */ new Date()];
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
shortcuts.push(dateParams);
|
|
91
|
+
}
|
|
92
|
+
return shortcuts;
|
|
93
|
+
}
|
|
94
|
+
export {
|
|
95
|
+
getDateShortCuts
|
|
96
|
+
};
|
|
@@ -98,6 +98,12 @@ export declare function formatVariableValue(pageContext: PageContext, variable:
|
|
|
98
98
|
* @returns
|
|
99
99
|
*/
|
|
100
100
|
export declare function formatValueByType(value: any, formatType: string, formatInfo: any): any;
|
|
101
|
+
/**
|
|
102
|
+
* 根据变量获取值
|
|
103
|
+
* @param entity
|
|
104
|
+
* @param variable
|
|
105
|
+
*/
|
|
106
|
+
export declare function getValueFromVariable(entity: any, variable: string): any;
|
|
101
107
|
/**
|
|
102
108
|
* 从对象中获取值
|
|
103
109
|
* @param valueSource 源对象
|
|
@@ -477,7 +477,7 @@ function getValueFromVariable(entity, variable) {
|
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
function getValueFromSource(valueSource, paramName, paramType) {
|
|
480
|
-
if (!valueSource || !paramName) {
|
|
480
|
+
if (paramType != "context" && !valueSource || !paramName) {
|
|
481
481
|
return void 0;
|
|
482
482
|
}
|
|
483
483
|
const firstIndex = paramName.indexOf(".");
|
|
@@ -491,8 +491,28 @@ function getValueFromSource(valueSource, paramName, paramType) {
|
|
|
491
491
|
return getValueFromSource(childValue, newParamName, paramType);
|
|
492
492
|
} else {
|
|
493
493
|
if (paramType == "context") {
|
|
494
|
+
console.log("newDate", paramName);
|
|
494
495
|
if (paramName == "currentDate" || paramName == "currentTime") {
|
|
495
496
|
return /* @__PURE__ */ new Date();
|
|
497
|
+
} else if (paramName.startsWith("currentDate") && paramName.length > 11) {
|
|
498
|
+
const str = paramName.substring(11);
|
|
499
|
+
const symbol = str.substring(0, 1);
|
|
500
|
+
let num = parseInt(str.substring(1, str.length - 1), 10);
|
|
501
|
+
const unit = str.substring(str.length - 1);
|
|
502
|
+
const date = /* @__PURE__ */ new Date();
|
|
503
|
+
num = "+" === symbol ? num : -num;
|
|
504
|
+
if (unit === "d" || unit === "w") {
|
|
505
|
+
num = unit === "w" ? num * 7 : num;
|
|
506
|
+
date.setDate(date.getDate() + num);
|
|
507
|
+
} else if (unit === "m") {
|
|
508
|
+
date.setMonth(date.getMonth() + num);
|
|
509
|
+
} else if (unit === "y") {
|
|
510
|
+
date.setFullYear(date.getFullYear() + num);
|
|
511
|
+
}
|
|
512
|
+
return date;
|
|
513
|
+
}
|
|
514
|
+
if (!valueSource) {
|
|
515
|
+
return void 0;
|
|
496
516
|
}
|
|
497
517
|
}
|
|
498
518
|
return valueSource[paramName];
|
|
@@ -636,6 +656,7 @@ export {
|
|
|
636
656
|
getFormPropName,
|
|
637
657
|
getOptionDatasFromPage,
|
|
638
658
|
getValueFromSource,
|
|
659
|
+
getValueFromVariable,
|
|
639
660
|
getVariableValue,
|
|
640
661
|
monitorFieldChange,
|
|
641
662
|
queryOptionDatasources,
|
|
@@ -17,7 +17,7 @@ export declare function queryPageDesignByCode(pageCode: string): Promise<any>;
|
|
|
17
17
|
* @param pageDesign 页面设计对象
|
|
18
18
|
*/
|
|
19
19
|
export declare function convertToPageContext(pageDesign: PageDesign, pageRequest: object): PageContext | null;
|
|
20
|
-
export declare function getModelFields(pageContext: PageContext, formItemConfigure:
|
|
20
|
+
export declare function getModelFields(pageContext: PageContext, formItemConfigure: Component, prop?: string): string[];
|
|
21
21
|
/**
|
|
22
22
|
* 获取表单元素模型名称
|
|
23
23
|
* @param pageContext 页面对象
|
|
@@ -4,7 +4,9 @@ import { getAdditionalParamMap } from "./events/standard-event.js";
|
|
|
4
4
|
import { PageDimensions } from "./interfaces/page-design-types.js";
|
|
5
5
|
import { formatVariableValue, setVariableValue, getFormPropName } from "./page-helper-util.js";
|
|
6
6
|
function queryPageDesignByCode(pageCode) {
|
|
7
|
-
return http.get(
|
|
7
|
+
return http.get(
|
|
8
|
+
window["$vueApp"].config.globalProperties.baseAPI + "/component/super-page-design/runtime/" + pageCode
|
|
9
|
+
);
|
|
8
10
|
}
|
|
9
11
|
function convertToPageContext(pageDesign, pageRequest) {
|
|
10
12
|
if (pageDesign == null) {
|
|
@@ -109,15 +111,22 @@ function getRequestObject(pageRequest) {
|
|
|
109
111
|
return requestObj;
|
|
110
112
|
}
|
|
111
113
|
function getModelFields(pageContext, formItemConfigure, prop) {
|
|
114
|
+
if (!formItemConfigure) {
|
|
115
|
+
return ["temp"];
|
|
116
|
+
}
|
|
112
117
|
pageContext.entity;
|
|
113
118
|
let propsBase;
|
|
114
119
|
let propName = prop;
|
|
115
|
-
if (!prop
|
|
120
|
+
if (!prop) {
|
|
116
121
|
propsBase = formItemConfigure.props.base ? formItemConfigure.props.base : {};
|
|
117
122
|
propName = propsBase.prop;
|
|
118
123
|
}
|
|
119
124
|
let fields = null;
|
|
120
|
-
if (
|
|
125
|
+
if (prop) {
|
|
126
|
+
fields = ["data", prop];
|
|
127
|
+
} else if (!propName || !propName.startsWith("${")) {
|
|
128
|
+
fields = ["page", formItemConfigure.uuid];
|
|
129
|
+
} else if (propName.startsWith("${")) {
|
|
121
130
|
propName = propName.substring(2, propName.length - 1);
|
|
122
131
|
fields = propName.split(".");
|
|
123
132
|
if (formItemConfigure && fields.length < 2) {
|
|
@@ -132,13 +141,13 @@ function getModelFields(pageContext, formItemConfigure, prop) {
|
|
|
132
141
|
return fields;
|
|
133
142
|
}
|
|
134
143
|
function getFormModelFields(pageContext, formItemConfigure, prop) {
|
|
135
|
-
|
|
144
|
+
const fields = getModelFields(pageContext, formItemConfigure, prop);
|
|
136
145
|
const entity = pageContext.entity;
|
|
137
146
|
let propsBase;
|
|
138
147
|
if (formItemConfigure) {
|
|
139
148
|
propsBase = formItemConfigure.props.base ? formItemConfigure.props.base : {};
|
|
140
149
|
}
|
|
141
|
-
if (entity.data.ID == void 0 && entity.data.
|
|
150
|
+
if (entity.data.ID == void 0 && entity.data.id == void 0) {
|
|
142
151
|
if (propsBase && propsBase.defaultValue) {
|
|
143
152
|
let defaultValue = formatVariableValue(pageContext, propsBase.defaultValue);
|
|
144
153
|
if (defaultValue != null && defaultValue != void 0) {
|
|
@@ -194,12 +203,15 @@ function queryPageSuperGrids(pageDesign, pageContext, publishVersion) {
|
|
|
194
203
|
if (additionalParamMap && Object.keys(additionalParamMap) > 0) {
|
|
195
204
|
additionalParamMapJson = JSON.stringify(additionalParamMap);
|
|
196
205
|
}
|
|
197
|
-
return http.post(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
206
|
+
return http.post(
|
|
207
|
+
window["$vueApp"].config.globalProperties.baseAPI + "/component/super-page-design/super-grids",
|
|
208
|
+
{
|
|
209
|
+
tableRuntimes,
|
|
210
|
+
additionalParamMapJson,
|
|
211
|
+
pageCode,
|
|
212
|
+
publishVersion
|
|
213
|
+
}
|
|
214
|
+
);
|
|
203
215
|
}
|
|
204
216
|
function packageFormRules(pageContext, configure) {
|
|
205
217
|
const isWorkflow = pageContext.workflowCode ? true : false;
|
package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent, computed, ref, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createElementBlock, toDisplayString, createCommentVNode } from "vue";
|
|
2
2
|
import { getFormModelFields } from "../../../../utils/page-init-util.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getDateShortCuts } from "../../../../utils/form/date-shortcuts.js";
|
|
4
|
+
import { getVariableValue, setVariableValue, getValueFromVariable } from "../../../../utils/page-helper-util.js";
|
|
4
5
|
import { getCustomFunc, handleEvent } from "../../../../utils/events/event-util.js";
|
|
5
6
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
7
|
__name: "datepicker-runtime",
|
|
@@ -25,6 +26,34 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
25
26
|
const runtimeClass = runtimeInfo.class;
|
|
26
27
|
const headerStyle = runtimeInfo.headerStyle;
|
|
27
28
|
const designProperty = ref(runtimeInfo.props ? runtimeInfo.props : {});
|
|
29
|
+
if (designProperty.value.dateType && designProperty.value.dateType.includes("range")) {
|
|
30
|
+
let hisValue = getVariableValue(entity, dynamicFields);
|
|
31
|
+
if (hisValue && !Array.isArray(hisValue)) {
|
|
32
|
+
hisValue = [hisValue];
|
|
33
|
+
}
|
|
34
|
+
if (!entity.data || !entity.data.id && !entity.data.ID) {
|
|
35
|
+
if (designProperty.value.defaultValue2) {
|
|
36
|
+
const defaultValue2 = getValueFromVariable(entity, designProperty.value.defaultValue2);
|
|
37
|
+
hisValue = !hisValue ? [] : hisValue;
|
|
38
|
+
if (hisValue.length == 0) {
|
|
39
|
+
hisValue.push(void 0);
|
|
40
|
+
}
|
|
41
|
+
if (hisValue.length > 1) {
|
|
42
|
+
hisValue[1] = defaultValue2;
|
|
43
|
+
} else {
|
|
44
|
+
hisValue.push(defaultValue2);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
setVariableValue(entity, dynamicFields, hisValue);
|
|
49
|
+
}
|
|
50
|
+
const shortcuts = ref(
|
|
51
|
+
getDateShortCuts(
|
|
52
|
+
designProperty.value.dateScopeDetails,
|
|
53
|
+
designProperty.value.sourceType,
|
|
54
|
+
designProperty.value.dateType
|
|
55
|
+
)
|
|
56
|
+
);
|
|
28
57
|
if (designProperty.value.shortcutsFunc) {
|
|
29
58
|
const func = getCustomFunc(props.pageContext, designProperty.value.shortcutsFunc);
|
|
30
59
|
if (func) {
|
|
@@ -35,18 +64,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
35
64
|
}
|
|
36
65
|
]);
|
|
37
66
|
if (returns) {
|
|
38
|
-
if (
|
|
67
|
+
if (!Array.isArray(returns)) {
|
|
39
68
|
returns = [returns];
|
|
40
69
|
}
|
|
41
|
-
if (!
|
|
42
|
-
|
|
70
|
+
if (!shortcuts.value) {
|
|
71
|
+
shortcuts.value = [];
|
|
43
72
|
}
|
|
44
73
|
for (let r of returns) {
|
|
45
74
|
if (r.text && r.value) {
|
|
46
|
-
|
|
75
|
+
shortcuts.value.push(r);
|
|
47
76
|
}
|
|
48
77
|
}
|
|
49
78
|
}
|
|
79
|
+
console.log("shortcuts", shortcuts.value);
|
|
50
80
|
}
|
|
51
81
|
}
|
|
52
82
|
return (_ctx, _cache) => {
|
|
@@ -80,7 +110,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
80
110
|
format: designProperty.value.format,
|
|
81
111
|
modelValue: dynamicModelMethod.value,
|
|
82
112
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => dynamicModelMethod.value = $event),
|
|
83
|
-
shortcuts:
|
|
113
|
+
shortcuts: shortcuts.value,
|
|
84
114
|
type: designProperty.value.dateType,
|
|
85
115
|
onChange: _cache[1] || (_cache[1] = ($event) => unref(handleEvent)($event, _ctx.pageContext, _ctx.configure, "change")),
|
|
86
116
|
onBlur: _cache[2] || (_cache[2] = ($event) => unref(handleEvent)($event, _ctx.pageContext, _ctx.configure, "blur")),
|
|
@@ -100,7 +130,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
100
130
|
format: designProperty.value.format,
|
|
101
131
|
modelValue: dynamicModelMethod.value,
|
|
102
132
|
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => dynamicModelMethod.value = $event),
|
|
103
|
-
shortcuts:
|
|
133
|
+
shortcuts: shortcuts.value,
|
|
104
134
|
type: designProperty.value.dateType,
|
|
105
135
|
onChange: _cache[8] || (_cache[8] = ($event) => unref(handleEvent)($event, _ctx.pageContext, _ctx.configure, "change")),
|
|
106
136
|
onBlur: _cache[9] || (_cache[9] = ($event) => unref(handleEvent)($event, _ctx.pageContext, _ctx.configure, "blur")),
|
package/dist/es/index.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ import { getStandPermissionInfo, getFunctionInfo, FuncType } from './components/
|
|
|
4
4
|
import { getCustomTheme, getCustomThemeOptions, getNumFormatter } from './components/runtime/utils/charts/chart-util';
|
|
5
5
|
import { default as cn } from './i18n/langs/cn.js';
|
|
6
6
|
import { default as en } from './i18n/langs/en.js';
|
|
7
|
+
import { getDateShortCuts } from './components/runtime/utils/form/date-shortcuts';
|
|
7
8
|
|
|
8
9
|
export { SuperPageNew, SuperPageDialogNew, getComponentOptionConfigs };
|
|
9
10
|
export { getStandPermissionInfo, getFunctionInfo, FuncType };
|
|
10
11
|
export { getCustomTheme, getCustomThemeOptions, getNumFormatter as getNumFormatterForChart };
|
|
12
|
+
export { getDateShortCuts };
|
|
11
13
|
export { cn, en };
|
package/dist/es/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { FuncType, getFunctionInfo, getStandPermissionInfo } from "./components/
|
|
|
5
5
|
import { getCustomTheme, getCustomThemeOptions, getNumFormatter } from "./components/runtime/utils/charts/chart-util.js";
|
|
6
6
|
import { default as default4 } from "./i18n/langs/cn.js";
|
|
7
7
|
import { default as default5 } from "./i18n/langs/en.js";
|
|
8
|
+
import { getDateShortCuts } from "./components/runtime/utils/form/date-shortcuts.js";
|
|
8
9
|
export {
|
|
9
10
|
FuncType,
|
|
10
11
|
default3 as SuperPageDialogNew,
|
|
@@ -14,6 +15,7 @@ export {
|
|
|
14
15
|
getComponentOptionConfigs,
|
|
15
16
|
getCustomTheme,
|
|
16
17
|
getCustomThemeOptions,
|
|
18
|
+
getDateShortCuts,
|
|
17
19
|
getFunctionInfo,
|
|
18
20
|
getNumFormatter as getNumFormatterForChart,
|
|
19
21
|
getStandPermissionInfo
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "super-page-runtime",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.32",
|
|
4
4
|
"description": "AgileBuilder super page runtime",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "dist/es/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
|
49
49
|
"@vue/eslint-config-prettier": "^8.0.0",
|
|
50
50
|
"@vue/test-utils": "^2.4.4",
|
|
51
|
-
"agilebuilder-ui": "1.0.
|
|
51
|
+
"agilebuilder-ui": "1.0.23",
|
|
52
52
|
"axios": "^1.6.8",
|
|
53
53
|
"cypress": "^13.6.6",
|
|
54
54
|
"element-plus": "^2.6.1",
|