@gct-paas/core 0.1.4-dev.8 → 0.1.4-dev.9
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.esm.min.mjs +3865 -1995
- package/dist/index.min.cjs +383 -11
- package/dist/index.system.min.js +383 -11
- package/es/constants/expression-type/BuiltOperators.d.ts +20 -0
- package/es/constants/expression-type/BuiltOperators.mjs +148 -0
- package/es/constants/expression-type/FunctionKeys.d.ts +1 -0
- package/es/constants/expression-type/FunctionKeys.mjs +81 -0
- package/es/constants/expression-type/editor.d.ts +8 -0
- package/es/constants/expression-type/editor.mjs +4 -0
- package/es/constants/expression-type/function.d.ts +7 -0
- package/es/constants/expression-type/function.mjs +875 -0
- package/es/constants/expression-type/index.d.ts +42 -0
- package/es/constants/expression-type/index.mjs +120 -0
- package/es/constants/expression-type/modeCfg.d.ts +30 -0
- package/es/constants/expression-type/modeCfg.mjs +268 -0
- package/es/constants/expression-type/variable.d.ts +12 -0
- package/es/constants/expression-type/variable.mjs +42 -0
- package/es/constants/index.d.ts +1 -0
- package/es/constants/index.mjs +5 -0
- package/es/create-app-vue.mjs +3 -10
- package/es/enums/appEnum.d.ts +5 -0
- package/es/enums/appEnum.mjs +6 -1
- package/es/enums/designEnum.d.ts +2 -2
- package/es/enums/designEnum.mjs +31 -31
- package/es/enums/developer-center/index.d.ts +1 -0
- package/es/enums/developer-center/integration.d.ts +4 -0
- package/es/enums/developer-center/integration.mjs +7 -0
- package/es/enums/expressionEnum.d.ts +130 -0
- package/es/enums/expressionEnum.mjs +75 -0
- package/es/enums/index.d.ts +11 -5
- package/es/enums/index.mjs +6 -8
- package/es/enums/page-designer/designer.d.ts +6 -0
- package/es/enums/page-designer/designer.mjs +6 -1
- package/es/enums/page-designer/panel.d.ts +78 -7
- package/es/enums/page-designer/panel.mjs +22 -3
- package/es/enums/processEnum.d.ts +54 -0
- package/es/enums/processEnum.mjs +36 -1
- package/es/global/gct/gct.d.ts +9 -13
- package/es/global/gct/gct.mjs +15 -20
- package/es/hooks/index.d.ts +0 -1
- package/es/hooks/use-overlay-scrollbars/use-overlay-scrollbars.d.ts +11 -0
- package/es/index.d.ts +1 -7
- package/es/index.mjs +26 -11
- package/es/interface/index.d.ts +1 -4
- package/es/interface/open-util/i-message-util/i-message-util.d.ts +54 -0
- package/es/interface/{i-modal → open-util/i-modal}/i-modal.d.ts +9 -10
- package/es/interface/{i-modal-data → open-util/i-modal-data}/i-modal-data.d.ts +6 -0
- package/es/interface/open-util/i-modal-options/i-modal-options.d.ts +12 -0
- package/es/interface/open-util/i-overlay-container/i-overlay-container.d.ts +36 -0
- package/es/interface/open-util/i-overlay-controller/i-overlay-controller.d.ts +36 -0
- package/es/interface/open-util/index.d.ts +7 -0
- package/es/locale/index.mjs +1 -0
- package/es/modules/user-stores/store/user.store.mjs +9 -2
- package/es/register/index.d.ts +0 -7
- package/es/setup-app.d.ts +8 -0
- package/es/setup-app.mjs +30 -0
- package/es/store/global-store.mjs +9 -3
- package/es/types/index.d.ts +4 -0
- package/es/utils/axios/interceptors.mjs +0 -1
- package/es/utils/cache-adapter/cache-adapter.d.ts +2 -0
- package/es/utils/cache-adapter/cache-adapter.mjs +59 -0
- package/es/utils/index.d.ts +6 -1
- package/es/utils/lowcode/utils.d.ts +1 -0
- package/es/utils/lowcode/utils.mjs +20 -0
- package/es/utils/lowcode/validate.d.ts +13 -0
- package/es/utils/lowcode/validate.mjs +29 -0
- package/es/utils/namespace/namespace.d.ts +8 -0
- package/es/utils/namespace/namespace.mjs +4 -1
- package/es/utils/openUtil/index.d.ts +2 -0
- package/es/utils/openUtil/modal/modal.d.ts +61 -0
- package/es/utils/openUtil/modal/modal.mjs +80 -0
- package/es/utils/openUtil/overlay-container/overlay-container.d.ts +100 -0
- package/es/utils/openUtil/overlay-container/overlay-container.mjs +139 -0
- package/es/utils/tools/tools.mjs +4 -0
- package/es/utils/treeHelper/treeHelper.d.ts +7 -0
- package/es/utils/treeHelper/treeHelper.mjs +14 -0
- package/es/utils/uuid/uuid.d.ts +3 -0
- package/es/utils/uuid/uuid.mjs +48 -0
- package/es/utils/value-helper/value-helper.mjs +2 -0
- package/es/utils/width-install/width-install.mjs +4 -0
- package/package.json +4 -3
- package/es/hooks/use-namespace/use-namespace.d.ts +0 -9
- package/es/hooks/use-namespace/use-namespace.mjs +0 -18
- package/es/interface/i-message-util/i-message-util.d.ts +0 -78
- package/es/register/render-register/render-register.d.ts +0 -59
- package/es/register/render-register/render-register.mjs +0 -63
package/es/utils/index.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
export { gctMemoizeAsync } from './cache-adapter/cache-adapter';
|
|
1
2
|
export { DictionaryUtil } from './dictionary/dictionary';
|
|
2
3
|
export { t } from './i18n';
|
|
3
4
|
export { LinkedList } from './linked-list/linked-list';
|
|
4
5
|
export { LinkedNode } from './linked-node/linked-node';
|
|
6
|
+
export { insertCustomCssToHead } from './lowcode/utils';
|
|
7
|
+
export { buildItemRules } from './lowcode/validate';
|
|
5
8
|
export { mitt } from './mitt/mitt';
|
|
6
9
|
export { modelLoader } from './model-loader/model-loader';
|
|
7
|
-
export { Namespace } from './namespace/namespace';
|
|
10
|
+
export { Namespace, useNamespace } from './namespace/namespace';
|
|
11
|
+
export * from './openUtil';
|
|
8
12
|
export { PluginStaticResource } from './plugin-static-resource/plugin-static-resource';
|
|
9
13
|
export { gctFormItemEditorProps } from './props';
|
|
10
14
|
export { getToken, setToken, getTenant, getTimezone, isMobile, setTenant, deepMerge, stringifyMatrixParams, parseMatrixParams, } from './tools/tools';
|
|
15
|
+
export * from './uuid/uuid';
|
|
11
16
|
export * from './value-helper/value-helper';
|
|
12
17
|
export { widthEditorInstall } from './width-install/width-install';
|
|
13
18
|
export { interceptors } from './axios/interceptors';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const insertCustomCssToHead: (cssCode: string, modalId?: string) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isEmpty } from 'lodash-es';
|
|
2
|
+
|
|
3
|
+
const insertCustomCssToHead = function(cssCode, modalId = "") {
|
|
4
|
+
const head = document.getElementsByTagName("head")[0];
|
|
5
|
+
const oldStyle = document.getElementById("gct-custom-css" + modalId);
|
|
6
|
+
if (oldStyle) {
|
|
7
|
+
head.removeChild(oldStyle);
|
|
8
|
+
}
|
|
9
|
+
const newStyle = document.createElement("style");
|
|
10
|
+
newStyle.id = "gct-custom-css" + modalId;
|
|
11
|
+
newStyle.type = "text/css";
|
|
12
|
+
if (isEmpty(modalId)) {
|
|
13
|
+
newStyle.innerHTML = cssCode;
|
|
14
|
+
} else {
|
|
15
|
+
newStyle.innerHTML = `#${modalId}{${cssCode}}`;
|
|
16
|
+
}
|
|
17
|
+
head.appendChild(newStyle);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { insertCustomCssToHead };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface Validation {
|
|
2
|
+
required?: boolean;
|
|
3
|
+
reg?: string | RegExp;
|
|
4
|
+
regHint?: string;
|
|
5
|
+
validateFn?: any;
|
|
6
|
+
}
|
|
7
|
+
interface Rule {
|
|
8
|
+
required?: boolean;
|
|
9
|
+
message?: string;
|
|
10
|
+
validator?: any;
|
|
11
|
+
}
|
|
12
|
+
export declare function buildItemRules(validation: Validation): Rule[];
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { t } from '../i18n/index.mjs';
|
|
2
|
+
|
|
3
|
+
function buildItemRules(validation) {
|
|
4
|
+
const rules = [];
|
|
5
|
+
if (validation.required) {
|
|
6
|
+
rules.push({
|
|
7
|
+
required: true,
|
|
8
|
+
message: t("sys.notNull")
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
if (validation.reg) {
|
|
12
|
+
const { reg, regHint } = validation;
|
|
13
|
+
const regExg = new RegExp(reg);
|
|
14
|
+
const validator = (val) => regExg.test(val);
|
|
15
|
+
rules.push({
|
|
16
|
+
validator,
|
|
17
|
+
message: regHint ?? t("sys.regError")
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const validateEvent = validation.validateFn;
|
|
21
|
+
if (validateEvent) {
|
|
22
|
+
rules.push({
|
|
23
|
+
validator: validateEvent
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return rules;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { buildItemRules };
|
|
@@ -114,3 +114,11 @@ export declare class Namespace {
|
|
|
114
114
|
*/
|
|
115
115
|
cssVarBlockName(name: string): string;
|
|
116
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* 获取 bem 操作类
|
|
119
|
+
*
|
|
120
|
+
* @export
|
|
121
|
+
* @param {string} block
|
|
122
|
+
* @return {*} {Namespace}
|
|
123
|
+
*/
|
|
124
|
+
export declare function useNamespace(block: string): Namespace;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { AsyncSeriesHook } from 'qx-util';
|
|
2
|
+
import { IModal, IModalData } from '../../../interface';
|
|
3
|
+
interface ConstructorOpts {
|
|
4
|
+
/**
|
|
5
|
+
* 注入的模态等组件实际的关闭操作,
|
|
6
|
+
*
|
|
7
|
+
* @author zhanghanrui
|
|
8
|
+
* @date 2024-03-19 21:03:00
|
|
9
|
+
*/
|
|
10
|
+
dismiss?: (data: IModalData) => void;
|
|
11
|
+
/**
|
|
12
|
+
* 修改属性
|
|
13
|
+
* @param data
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
setOptions?: (data: object) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare class Modal implements IModal {
|
|
19
|
+
ignoreDismissCheck: boolean;
|
|
20
|
+
state: {
|
|
21
|
+
okDisabled?: boolean;
|
|
22
|
+
cancelDisabled?: boolean;
|
|
23
|
+
};
|
|
24
|
+
hooks: {
|
|
25
|
+
shouldDismiss: AsyncSeriesHook<[], {
|
|
26
|
+
allowClose?: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
beforeDismiss: AsyncSeriesHook<[], IModalData>;
|
|
29
|
+
};
|
|
30
|
+
ok?: () => Promise<IModalData | null>;
|
|
31
|
+
setOptions?: (options: object) => void;
|
|
32
|
+
constructor(opts: ConstructorOpts);
|
|
33
|
+
cancel?: (() => Promise<boolean>) | undefined;
|
|
34
|
+
callback(ok?: () => Promise<IModalData | null>, cancel?: () => Promise<boolean>): void;
|
|
35
|
+
/**
|
|
36
|
+
* 外部注入的模态等组件实际的关闭操作
|
|
37
|
+
*
|
|
38
|
+
* @author zhanghanrui
|
|
39
|
+
* @date 2024-03-19 21:03:08
|
|
40
|
+
* @param {IModalData} data
|
|
41
|
+
*/
|
|
42
|
+
_dismiss: (data: IModalData) => void;
|
|
43
|
+
/**
|
|
44
|
+
* 注入模态等组件实际的关闭操作
|
|
45
|
+
*
|
|
46
|
+
* @author zhanghanrui
|
|
47
|
+
* @date 2024-03-19 21:03:13
|
|
48
|
+
* @param {(data: IModalData) => void} dismiss
|
|
49
|
+
*/
|
|
50
|
+
injectDismiss(dismiss: (data: IModalData) => void): void;
|
|
51
|
+
dismiss(data?: IModalData): Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* 执行完一次关闭后就会调销毁
|
|
54
|
+
*
|
|
55
|
+
* @author zhanghanrui
|
|
56
|
+
* @date 2024-03-19 21:03:22
|
|
57
|
+
* @protected
|
|
58
|
+
*/
|
|
59
|
+
protected destroy(): void;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { reactive } from 'vue';
|
|
2
|
+
import { AsyncSeriesHook } from 'qx-util';
|
|
3
|
+
|
|
4
|
+
class Modal {
|
|
5
|
+
ignoreDismissCheck = false;
|
|
6
|
+
state = reactive({
|
|
7
|
+
okDisabled: false,
|
|
8
|
+
cancelDisabled: false
|
|
9
|
+
});
|
|
10
|
+
hooks = {
|
|
11
|
+
shouldDismiss: new AsyncSeriesHook(),
|
|
12
|
+
beforeDismiss: new AsyncSeriesHook()
|
|
13
|
+
};
|
|
14
|
+
ok;
|
|
15
|
+
setOptions;
|
|
16
|
+
constructor(opts) {
|
|
17
|
+
if (opts.dismiss) {
|
|
18
|
+
this._dismiss = opts.dismiss;
|
|
19
|
+
}
|
|
20
|
+
if (opts.setOptions) {
|
|
21
|
+
this.setOptions = opts.setOptions;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
cancel;
|
|
25
|
+
callback(ok, cancel) {
|
|
26
|
+
if (ok) {
|
|
27
|
+
this.ok = ok;
|
|
28
|
+
}
|
|
29
|
+
if (cancel) {
|
|
30
|
+
this.cancel = cancel;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 外部注入的模态等组件实际的关闭操作
|
|
35
|
+
*
|
|
36
|
+
* @author zhanghanrui
|
|
37
|
+
* @date 2024-03-19 21:03:08
|
|
38
|
+
* @param {IModalData} data
|
|
39
|
+
*/
|
|
40
|
+
_dismiss = (data) => {
|
|
41
|
+
console.warn("外部关闭能力未注册", data);
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* 注入模态等组件实际的关闭操作
|
|
45
|
+
*
|
|
46
|
+
* @author zhanghanrui
|
|
47
|
+
* @date 2024-03-19 21:03:13
|
|
48
|
+
* @param {(data: IModalData) => void} dismiss
|
|
49
|
+
*/
|
|
50
|
+
injectDismiss(dismiss) {
|
|
51
|
+
this._dismiss = dismiss;
|
|
52
|
+
}
|
|
53
|
+
async dismiss(data = { ok: false, data: [] }) {
|
|
54
|
+
const context = {};
|
|
55
|
+
if (this.ignoreDismissCheck !== true) {
|
|
56
|
+
await this.hooks.shouldDismiss.call(context);
|
|
57
|
+
}
|
|
58
|
+
if (context.allowClose === false) {
|
|
59
|
+
console.warn("shouldDismiss结果为false,关闭中断。");
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
await this.hooks.beforeDismiss.call(data);
|
|
63
|
+
this._dismiss(data);
|
|
64
|
+
this.destroy();
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 执行完一次关闭后就会调销毁
|
|
69
|
+
*
|
|
70
|
+
* @author zhanghanrui
|
|
71
|
+
* @date 2024-03-19 21:03:22
|
|
72
|
+
* @protected
|
|
73
|
+
*/
|
|
74
|
+
destroy() {
|
|
75
|
+
this.hooks.shouldDismiss.clear();
|
|
76
|
+
this.hooks.beforeDismiss.clear();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { Modal };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { IOverlayContainer } from '../../../interface';
|
|
2
|
+
import { QXEvent } from 'qx-util';
|
|
3
|
+
import { App, Component, VNode } from 'vue';
|
|
4
|
+
/**
|
|
5
|
+
* 全局弹出承载组件
|
|
6
|
+
*
|
|
7
|
+
* @author zhanghanrui
|
|
8
|
+
* @date 2024-03-19 19:03:22
|
|
9
|
+
* @export
|
|
10
|
+
* @class OverlayContainer
|
|
11
|
+
* @implements {IOverlayContainer}
|
|
12
|
+
* @template O
|
|
13
|
+
*/
|
|
14
|
+
export declare class OverlayContainer<O> implements IOverlayContainer {
|
|
15
|
+
protected component: unknown;
|
|
16
|
+
protected render: (...args: any[]) => VNode;
|
|
17
|
+
protected opts?: O | undefined;
|
|
18
|
+
protected vm?: App;
|
|
19
|
+
/**
|
|
20
|
+
* 具体模态组件对象
|
|
21
|
+
*
|
|
22
|
+
* @author zhanghanrui
|
|
23
|
+
* @date 2024-03-19 19:03:45
|
|
24
|
+
* @protected
|
|
25
|
+
* @type {*}
|
|
26
|
+
*/
|
|
27
|
+
protected modal: any;
|
|
28
|
+
/**
|
|
29
|
+
* 调用dismiss时传的result结果
|
|
30
|
+
*
|
|
31
|
+
* @author zhanghanrui
|
|
32
|
+
* @date 2024-03-19 19:03:30
|
|
33
|
+
* @protected
|
|
34
|
+
* @type {unknown}
|
|
35
|
+
*/
|
|
36
|
+
protected result?: unknown;
|
|
37
|
+
/**
|
|
38
|
+
* 内部事件
|
|
39
|
+
*
|
|
40
|
+
* @author zhanghanrui
|
|
41
|
+
* @date 2024-03-19 19:03:44
|
|
42
|
+
* @protected
|
|
43
|
+
*/
|
|
44
|
+
protected evt: QXEvent<{
|
|
45
|
+
dismiss: (data?: unknown) => void;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* init 执行完毕的 Promise,用于确保 present/dismiss 调用时 init 已完成
|
|
49
|
+
*
|
|
50
|
+
* @protected
|
|
51
|
+
* @type {Promise<void>}
|
|
52
|
+
*/
|
|
53
|
+
protected _initPromise: Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* 创建全局呈现
|
|
56
|
+
*
|
|
57
|
+
* @author zhanghanrui
|
|
58
|
+
* @date 2024-03-19 19:03:51
|
|
59
|
+
* @param {unknown} component
|
|
60
|
+
* @param {(...args: any[]) => VNode} render
|
|
61
|
+
* @param {O} [opts]
|
|
62
|
+
*/
|
|
63
|
+
constructor(component: unknown, render: (...args: any[]) => VNode, opts?: O | undefined);
|
|
64
|
+
static createVueApp(rootComponent: Component, rootProps?: IData): Promise<App<Element>>;
|
|
65
|
+
/**
|
|
66
|
+
* 初始化飘窗
|
|
67
|
+
*
|
|
68
|
+
* @author zhanghanrui
|
|
69
|
+
* @date 2024-03-19 19:03:00
|
|
70
|
+
* @protected
|
|
71
|
+
* @return {*} {void}
|
|
72
|
+
*/
|
|
73
|
+
protected init(): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* 打开飘窗
|
|
76
|
+
*
|
|
77
|
+
* @author zhanghanrui
|
|
78
|
+
* @date 2024-03-19 19:03:14
|
|
79
|
+
* @return {*} {Promise<void>}
|
|
80
|
+
*/
|
|
81
|
+
present(): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* 手动调用关闭飘窗
|
|
84
|
+
*
|
|
85
|
+
* @author zhanghanrui
|
|
86
|
+
* @date 2024-03-19 19:03:19
|
|
87
|
+
* @param {unknown} [data]
|
|
88
|
+
* @return {*} {Promise<void>}
|
|
89
|
+
*/
|
|
90
|
+
dismiss(data?: unknown): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* 订阅窗口关闭
|
|
93
|
+
*
|
|
94
|
+
* @author zhanghanrui
|
|
95
|
+
* @date 2024-03-19 19:03:26
|
|
96
|
+
* @template T
|
|
97
|
+
* @return {*} {Promise<T>}
|
|
98
|
+
*/
|
|
99
|
+
onWillDismiss<T = unknown>(): Promise<T>;
|
|
100
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { QXEvent } from 'qx-util';
|
|
2
|
+
import { createApp, h, nextTick } from 'vue';
|
|
3
|
+
|
|
4
|
+
class OverlayContainer {
|
|
5
|
+
/**
|
|
6
|
+
* 创建全局呈现
|
|
7
|
+
*
|
|
8
|
+
* @author zhanghanrui
|
|
9
|
+
* @date 2024-03-19 19:03:51
|
|
10
|
+
* @param {unknown} component
|
|
11
|
+
* @param {(...args: any[]) => VNode} render
|
|
12
|
+
* @param {O} [opts]
|
|
13
|
+
*/
|
|
14
|
+
constructor(component, render, opts) {
|
|
15
|
+
this.component = component;
|
|
16
|
+
this.render = render;
|
|
17
|
+
this.opts = opts;
|
|
18
|
+
this._initPromise = this.init();
|
|
19
|
+
}
|
|
20
|
+
vm;
|
|
21
|
+
/**
|
|
22
|
+
* 具体模态组件对象
|
|
23
|
+
*
|
|
24
|
+
* @author zhanghanrui
|
|
25
|
+
* @date 2024-03-19 19:03:45
|
|
26
|
+
* @protected
|
|
27
|
+
* @type {*}
|
|
28
|
+
*/
|
|
29
|
+
modal;
|
|
30
|
+
/**
|
|
31
|
+
* 调用dismiss时传的result结果
|
|
32
|
+
*
|
|
33
|
+
* @author zhanghanrui
|
|
34
|
+
* @date 2024-03-19 19:03:30
|
|
35
|
+
* @protected
|
|
36
|
+
* @type {unknown}
|
|
37
|
+
*/
|
|
38
|
+
result;
|
|
39
|
+
/**
|
|
40
|
+
* 内部事件
|
|
41
|
+
*
|
|
42
|
+
* @author zhanghanrui
|
|
43
|
+
* @date 2024-03-19 19:03:44
|
|
44
|
+
* @protected
|
|
45
|
+
*/
|
|
46
|
+
evt = new QXEvent();
|
|
47
|
+
/**
|
|
48
|
+
* init 执行完毕的 Promise,用于确保 present/dismiss 调用时 init 已完成
|
|
49
|
+
*
|
|
50
|
+
* @protected
|
|
51
|
+
* @type {Promise<void>}
|
|
52
|
+
*/
|
|
53
|
+
_initPromise;
|
|
54
|
+
static async createVueApp(rootComponent, rootProps) {
|
|
55
|
+
console.error("没有注入createVueApp方法");
|
|
56
|
+
return createApp(rootComponent, rootProps);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 初始化飘窗
|
|
60
|
+
*
|
|
61
|
+
* @author zhanghanrui
|
|
62
|
+
* @date 2024-03-19 19:03:00
|
|
63
|
+
* @protected
|
|
64
|
+
* @return {*} {void}
|
|
65
|
+
*/
|
|
66
|
+
async init() {
|
|
67
|
+
const self = this;
|
|
68
|
+
const { render, opts } = this;
|
|
69
|
+
const container = document.createElement("div");
|
|
70
|
+
document.body.appendChild(container);
|
|
71
|
+
const vm = await OverlayContainer.createVueApp({
|
|
72
|
+
mounted() {
|
|
73
|
+
self.modal = this.$refs.root;
|
|
74
|
+
},
|
|
75
|
+
unmounted() {
|
|
76
|
+
document.body.removeChild(container);
|
|
77
|
+
self.evt.emit("dismiss", self.result);
|
|
78
|
+
},
|
|
79
|
+
render() {
|
|
80
|
+
return h(
|
|
81
|
+
self.component,
|
|
82
|
+
{
|
|
83
|
+
ref: "root",
|
|
84
|
+
opts,
|
|
85
|
+
onDismiss(data) {
|
|
86
|
+
self.result = data;
|
|
87
|
+
vm.unmount();
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{ default: render }
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
vm.mount(container);
|
|
95
|
+
this.vm = vm;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 打开飘窗
|
|
99
|
+
*
|
|
100
|
+
* @author zhanghanrui
|
|
101
|
+
* @date 2024-03-19 19:03:14
|
|
102
|
+
* @return {*} {Promise<void>}
|
|
103
|
+
*/
|
|
104
|
+
async present() {
|
|
105
|
+
await this._initPromise;
|
|
106
|
+
await nextTick();
|
|
107
|
+
return this.modal.present();
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* 手动调用关闭飘窗
|
|
111
|
+
*
|
|
112
|
+
* @author zhanghanrui
|
|
113
|
+
* @date 2024-03-19 19:03:19
|
|
114
|
+
* @param {unknown} [data]
|
|
115
|
+
* @return {*} {Promise<void>}
|
|
116
|
+
*/
|
|
117
|
+
async dismiss(data) {
|
|
118
|
+
await this.modal.dismiss(data);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* 订阅窗口关闭
|
|
122
|
+
*
|
|
123
|
+
* @author zhanghanrui
|
|
124
|
+
* @date 2024-03-19 19:03:26
|
|
125
|
+
* @template T
|
|
126
|
+
* @return {*} {Promise<T>}
|
|
127
|
+
*/
|
|
128
|
+
async onWillDismiss() {
|
|
129
|
+
return new Promise((resolve) => {
|
|
130
|
+
const callback = (data) => {
|
|
131
|
+
resolve(data);
|
|
132
|
+
this.evt.off("dismiss", callback);
|
|
133
|
+
};
|
|
134
|
+
this.evt.on("dismiss", callback);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { OverlayContainer };
|
package/es/utils/tools/tools.mjs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { getCookie, setCookie, clearCookie } from 'qx-util';
|
|
2
2
|
import { mergeWith, cloneDeep, unionWith, isEqual } from 'lodash-es';
|
|
3
|
+
import '../../constants/expression-type/modeCfg.mjs';
|
|
4
|
+
import '../../constants/expression-type/BuiltOperators.mjs';
|
|
5
|
+
import '../../constants/expression-type/function.mjs';
|
|
6
|
+
import '../../constants/expression-type/variable.mjs';
|
|
3
7
|
import { CoreConst } from '../../constants/core.mjs';
|
|
4
8
|
import '../../enums/app-designer/index.mjs';
|
|
5
9
|
import '../../enums/page-designer/designer.mjs';
|
|
@@ -113,5 +113,12 @@ export declare class TreeHelper {
|
|
|
113
113
|
* @return {*}
|
|
114
114
|
*/
|
|
115
115
|
static traverseAndBuildTree(treeData: IObject[], callback: (node: IObject) => IObject | unknown, config?: Partial<ITreeHelperConfig>): IObject[];
|
|
116
|
+
/**
|
|
117
|
+
* 递归遍历树结构
|
|
118
|
+
* @param treeData 树形结构数据
|
|
119
|
+
* @param callBack 回调函数
|
|
120
|
+
* @param parentNode 父节点
|
|
121
|
+
*/
|
|
122
|
+
static eachTree<T extends IObject = IObject>(treeData: T[], callBack: (node: T, parentNode?: T) => any, parentNode?: any): void;
|
|
116
123
|
}
|
|
117
124
|
export {};
|
|
@@ -215,6 +215,20 @@ class TreeHelper {
|
|
|
215
215
|
return newNode;
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* 递归遍历树结构
|
|
220
|
+
* @param treeData 树形结构数据
|
|
221
|
+
* @param callBack 回调函数
|
|
222
|
+
* @param parentNode 父节点
|
|
223
|
+
*/
|
|
224
|
+
static eachTree(treeData, callBack, parentNode = {}) {
|
|
225
|
+
treeData.forEach((element) => {
|
|
226
|
+
const newNode = callBack(element, parentNode) || element;
|
|
227
|
+
if (element.children) {
|
|
228
|
+
TreeHelper.eachTree(element.children, callBack, newNode);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
218
232
|
}
|
|
219
233
|
|
|
220
234
|
export { TreeHelper };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const hexList = [];
|
|
2
|
+
for (let i = 0; i <= 15; i++) {
|
|
3
|
+
hexList[i] = i.toString(16);
|
|
4
|
+
}
|
|
5
|
+
function buildUUID() {
|
|
6
|
+
let uuid = "";
|
|
7
|
+
for (let i = 1; i <= 36; i++) {
|
|
8
|
+
if (i === 9 || i === 14 || i === 19 || i === 24) {
|
|
9
|
+
uuid += "-";
|
|
10
|
+
} else if (i === 15) {
|
|
11
|
+
uuid += 4;
|
|
12
|
+
} else if (i === 20) {
|
|
13
|
+
uuid += hexList[Math.random() * 4 | 8];
|
|
14
|
+
} else {
|
|
15
|
+
uuid += hexList[Math.random() * 16 | 0];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return uuid.replace(/-/g, "");
|
|
19
|
+
}
|
|
20
|
+
let unique = 0;
|
|
21
|
+
function buildShortUUID(prefix = "") {
|
|
22
|
+
prefix = prefix.replaceAll("-", "");
|
|
23
|
+
const random = Math.floor(Math.random() * 1e9);
|
|
24
|
+
unique++;
|
|
25
|
+
return prefix + "_" + random + unique;
|
|
26
|
+
}
|
|
27
|
+
const uuid2 = (len, radix) => {
|
|
28
|
+
const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
|
|
29
|
+
const uuid = [];
|
|
30
|
+
let i;
|
|
31
|
+
radix = radix || chars.length;
|
|
32
|
+
if (len) {
|
|
33
|
+
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
|
|
34
|
+
} else {
|
|
35
|
+
let r;
|
|
36
|
+
uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
|
|
37
|
+
uuid[14] = "4";
|
|
38
|
+
for (i = 0; i < 36; i++) {
|
|
39
|
+
if (!uuid[i]) {
|
|
40
|
+
r = 0 | Math.random() * 16;
|
|
41
|
+
uuid[i] = chars[i == 19 ? r & 3 | 8 : r];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return uuid.join("");
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { buildShortUUID, buildUUID, uuid2 };
|
|
@@ -75,6 +75,7 @@ function computedEx(opts) {
|
|
|
75
75
|
clear = watch(
|
|
76
76
|
() => result.value,
|
|
77
77
|
(v) => {
|
|
78
|
+
console.info("computedEx:属性或者值修改", v);
|
|
78
79
|
opts.set(v);
|
|
79
80
|
},
|
|
80
81
|
{ deep: true }
|
|
@@ -86,6 +87,7 @@ function computedEx(opts) {
|
|
|
86
87
|
if (clear) {
|
|
87
88
|
clear();
|
|
88
89
|
}
|
|
90
|
+
console.info("computedEx:获取新值,重新监听", v);
|
|
89
91
|
result.value = v;
|
|
90
92
|
watchDeep();
|
|
91
93
|
},
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import '../../constants/expression-type/modeCfg.mjs';
|
|
2
|
+
import '../../constants/expression-type/BuiltOperators.mjs';
|
|
3
|
+
import '../../constants/expression-type/function.mjs';
|
|
4
|
+
import '../../constants/expression-type/variable.mjs';
|
|
1
5
|
import { EditorRegisterConst } from '../../constants/editor-register/editor-register.mjs';
|
|
2
6
|
|
|
3
7
|
function widthEditorInstall(providerTag, provider, com, comName) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/core",
|
|
3
|
-
"version": "0.1.4-dev.
|
|
3
|
+
"version": "0.1.4-dev.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"main": "dist/index.min.cjs",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"js-sha256": "^0.11.1",
|
|
58
58
|
"lodash-es": "^4.17.23",
|
|
59
59
|
"mitt": "^3.0.1",
|
|
60
|
+
"overlayscrollbars": "^2.14.0",
|
|
60
61
|
"path-browserify": "^1.0.1",
|
|
61
62
|
"pinia": "^3.0.4",
|
|
62
63
|
"qs": "^6.14.1",
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"wujie": "^1.0.29"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
71
|
-
"@gct-paas/build": "^0.1.5-dev.
|
|
72
|
+
"@gct-paas/build": "^0.1.5-dev.8",
|
|
72
73
|
"@types/lodash-es": "^4.17.12",
|
|
73
74
|
"@types/path-browserify": "^1.0.3",
|
|
74
75
|
"@types/qs": "^6.14.0",
|
|
@@ -84,5 +85,5 @@
|
|
|
84
85
|
"vite": "^7.3.1",
|
|
85
86
|
"vitest": "^4.0.18"
|
|
86
87
|
},
|
|
87
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "c51d9883f7d287433d2def4d7338a06773804fbf"
|
|
88
89
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import '../../utils/mitt/mitt.mjs';
|
|
2
|
-
import 'lodash-es';
|
|
3
|
-
import '../../enums/app-designer/index.mjs';
|
|
4
|
-
import '../../enums/page-designer/designer.mjs';
|
|
5
|
-
import '../../enums/breakpointEnum.mjs';
|
|
6
|
-
import { Namespace } from '../../utils/namespace/namespace.mjs';
|
|
7
|
-
import 'path-browserify';
|
|
8
|
-
import 'qx-util';
|
|
9
|
-
import 'qs';
|
|
10
|
-
import 'vue';
|
|
11
|
-
import 'axios';
|
|
12
|
-
import '@fingerprintjs/fingerprintjs';
|
|
13
|
-
|
|
14
|
-
function useNamespace(block) {
|
|
15
|
-
return new Namespace(block);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { useNamespace };
|