@gct-paas/core-web 0.1.6-dev.26 → 0.1.6-dev.28
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/{JsBarcode-C59VuLXw.js → JsBarcode-DE8o6I-K.js} +2 -2
- package/dist/{chunk-nnRweTwY.js → chunk-CX2JmffE.js} +1 -1
- package/dist/{cropper-DkC8Lj6t.js → cropper-DQCF-0tX.js} +2 -2
- package/dist/{de_DE-CCCBplzz.js → de_DE-CfysT014.js} +2 -2
- package/dist/{defineProperty-H7yj0Lwd.js → defineProperty-pV6dqtHR.js} +1 -1
- package/dist/{diagram-config-item-DXaMeTTn.js → diagram-config-item-BXua-XYj.js} +2 -2
- package/dist/{diagram-config-item-reverse-CiHkpN3T.js → diagram-config-item-reverse-DQnUmeJW.js} +2 -2
- package/dist/{diagram-config-item-virtual-NIrT-XVh.js → diagram-config-item-virtual-CcCGSH5B.js} +2 -2
- package/dist/{en_US-CQ4_Spda.js → en_US-C0wKXMZ6.js} +2 -2
- package/dist/{es_ES-DuPUUU-Q.js → es_ES-UwddM5kZ.js} +2 -2
- package/dist/{fr_FR-Cg_QXVJc.js → fr_FR-C5cuw2JY.js} +2 -2
- package/dist/{hooks-C7hT-7VW.js → hooks-CNfpnR1K.js} +2 -2
- package/dist/icon-next-picker-Bb5ykSyg.js +2 -0
- package/dist/index.min.css +1 -1
- package/dist/{ja_JP-Dvy3bEdd.js → ja_JP-Wo05fzZm.js} +2 -2
- package/dist/loader.esm.min.js +2 -2
- package/dist/{monaco-editor-CuAEOwme.js → monaco-editor-C6bervdr.js} +2 -2
- package/dist/{objectSpread2-CSFXrJkx.js → objectSpread2-BKnUTlKF.js} +1 -1
- package/dist/{overlayscrollbars-vue-BRqvuXoX.js → overlayscrollbars-vue-BIUSLPix.js} +1 -1
- package/dist/{pt_PT-BRtm188V.js → pt_PT-BsyxA-IP.js} +2 -2
- package/dist/{relationship-diagram-config-DtXrLWdL.js → relationship-diagram-config-DHDncMmS.js} +2 -2
- package/dist/{rich-editor-CIJ5pYsf.js → rich-editor-B7zlLLB8.js} +2 -2
- package/dist/{ru_RU-nH7t68Ol.js → ru_RU-CgfUMDyw.js} +2 -2
- package/dist/{tr_TR-Biu14RrZ.js → tr_TR-cXp1vsuZ.js} +2 -2
- package/dist/{useMonacoEditor-DNR9Amfs.js → useMonacoEditor-DjoOtehA.js} +2 -2
- package/dist/{vi_VN-U-5xTu3o.js → vi_VN-DFeeg6d8.js} +2 -2
- package/dist/{zh_CN-XeIwBgrs.js → zh_CN-GAAT3Jfj.js} +2 -2
- package/dist/{zh_TW-D0amRIJG.js → zh_TW-Cexu0ajm.js} +2 -2
- package/es/components/design-view-layout/design-view-layout.mjs +1 -1
- package/es/components/icon-next-picker/icon-next-picker.vue_vue_type_script_setup_true_name_IconNextPicker_lang.mjs +2 -4
- package/es/components/label-design/components/widgets/index.mjs +4 -1
- package/es/hooks/index.d.ts +0 -1
- package/es/hooks/index.mjs +0 -1
- package/es/index.d.ts +1 -0
- package/es/index.mjs +3 -2
- package/es/modules/data-rules-container/src/hooks/useRole.d.ts +0 -1
- package/es/modules/online-control/content.vue.d.ts +8 -0
- package/es/modules/online-control/content.vue.mjs +5 -0
- package/es/modules/online-control/content.vue_vue_type_script_setup_true_lang.mjs +48 -0
- package/es/modules/online-control/index.d.ts +8 -0
- package/es/modules/online-control/index.mjs +1 -0
- package/es/modules/online-control/model-control.d.ts +25 -0
- package/es/modules/online-control/model-control.mjs +61 -0
- package/es/modules/online-control/online-broadcast.d.ts +2 -0
- package/es/modules/online-control/online-broadcast.mjs +30 -0
- package/es/modules/online-control/online-control.const.d.ts +32 -0
- package/es/modules/online-control/online-control.const.mjs +36 -0
- package/es/modules/online-control/online-control.d.ts +63 -0
- package/es/modules/online-control/online-control.interface.d.ts +21 -0
- package/es/modules/online-control/online-control.mjs +125 -0
- package/es/modules/picture-cropper/src/CropperFree.vue.mjs +2 -2
- package/es/modules/picture-cropper/src/CropperFree.vue_vue_type_script_setup_true_name_CropperPhoto_lang.mjs +3 -4
- package/es/modules/picture-cropper/src/{CropperFree.vue_vue_type_style_index_0_scoped_c731e25e_lang.css → CropperFree.vue_vue_type_style_index_0_scoped_c2cff308_lang.css} +16 -16
- package/package.json +9 -9
- package/dist/icon-next-picker-Di7Ma1ct.js +0 -2
- package/es/hooks/useTheme.d.ts +0 -8
- package/es/hooks/useTheme.mjs +0 -16
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { GCT_EVENT_TYPE } from "./online-control.const.mjs";
|
|
2
|
+
import { onlineBroadcast } from "./online-broadcast.mjs";
|
|
3
|
+
import { ModelControl } from "./model-control.mjs";
|
|
4
|
+
import { throttle } from "lodash-es";
|
|
5
|
+
import { AuthUtil, usePlatformConfigStore } from "@gct-paas/core";
|
|
6
|
+
//#region src/modules/online-control/online-control.ts
|
|
7
|
+
/**
|
|
8
|
+
* 用户活动节流回调(4 秒一次)
|
|
9
|
+
*
|
|
10
|
+
* 检测到 mousemove / keydown 后:
|
|
11
|
+
* 1. 广播 GCT_MOUSEMOVE,通知其他标签页同步重置倒计时
|
|
12
|
+
* 2. 延迟启动本页倒计时(setTimeout 避免与 throttle Leading 边界冲突)
|
|
13
|
+
*/
|
|
14
|
+
var throttleMoverEvent = throttle(() => {
|
|
15
|
+
onlineBroadcast.postMessage({ type: GCT_EVENT_TYPE.GCT_MOUSEMOVE });
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
OnlineControl.startTimer();
|
|
18
|
+
});
|
|
19
|
+
}, 4e3);
|
|
20
|
+
/**
|
|
21
|
+
* 在线会话控制器
|
|
22
|
+
*
|
|
23
|
+
* 根据平台安全设置(无操作保留时长、提前预警时长)监听用户活动,
|
|
24
|
+
* 超时前弹出警告,倒计时结束后强制登出;多标签页通过 BroadcastChannel 同步状态。
|
|
25
|
+
*
|
|
26
|
+
* @export
|
|
27
|
+
* @class OnlineControl
|
|
28
|
+
*/
|
|
29
|
+
var OnlineControl = class {
|
|
30
|
+
/** 警告弹窗应弹出的目标时间戳(毫秒) */
|
|
31
|
+
static startRunTime = 0;
|
|
32
|
+
/** 无操作保留总时长(秒),来自 securitySetting.noOpRetainHour + noOpRetainMinute */
|
|
33
|
+
static noOpRetain = 0;
|
|
34
|
+
/** 提前预警时长(秒),弹窗内倒计时即为该时长,来自 earlyAlarmMinute + earlyAlarmSecond */
|
|
35
|
+
static earlyAlarm = 0;
|
|
36
|
+
/** 轮询检测是否到达预警时间的定时器 ID */
|
|
37
|
+
static timer = null;
|
|
38
|
+
/**
|
|
39
|
+
* 初始化并开始监听用户活动
|
|
40
|
+
*
|
|
41
|
+
* 从平台配置读取安全策略,换算为秒后写入静态字段;
|
|
42
|
+
* 仅当 noOpRetain > 0 时启用监听,并广播 GCT_SAVELOGIN 同步其他标签页。
|
|
43
|
+
*/
|
|
44
|
+
static runListener() {
|
|
45
|
+
this.timer = null;
|
|
46
|
+
const { securitySetting } = usePlatformConfigStore();
|
|
47
|
+
const { noOpRetainHour, noOpRetainMinute, earlyAlarmMinute, earlyAlarmSecond } = securitySetting;
|
|
48
|
+
this.earlyAlarm = earlyAlarmMinute * 60 + earlyAlarmSecond;
|
|
49
|
+
this.noOpRetain = noOpRetainHour * 60 * 60 + noOpRetainMinute * 60;
|
|
50
|
+
if (this.noOpRetain > 0) {
|
|
51
|
+
onlineBroadcast.postMessage({ type: GCT_EVENT_TYPE.GCT_SAVELOGIN });
|
|
52
|
+
this.addListener();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 注册用户活动监听器
|
|
57
|
+
*
|
|
58
|
+
* 监听 mousemove、keydown,并通过 throttleMoverEvent 节流处理;
|
|
59
|
+
* 立即调用一次 throttleMoverEvent,使首次加载也计入活动并重置倒计时。
|
|
60
|
+
*/
|
|
61
|
+
static addListener() {
|
|
62
|
+
throttleMoverEvent();
|
|
63
|
+
document.addEventListener("mousemove", throttleMoverEvent);
|
|
64
|
+
document.addEventListener("keydown", throttleMoverEvent);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 启动或重置无操作检测定时器
|
|
68
|
+
*
|
|
69
|
+
* 计算 startRunTime = 当前时间 + (noOpRetain - earlyAlarm),
|
|
70
|
+
* 即「总无操作时长减去预警时长」后应弹出警告的时刻;
|
|
71
|
+
* 每 3 秒轮询一次,到达该时刻后触发 emitMoverEvent。
|
|
72
|
+
*
|
|
73
|
+
* 跳过条件:timer 未就绪、未配置保留时长、或当前页面在 iframe 内(个别嵌入页不启用)。
|
|
74
|
+
*/
|
|
75
|
+
static startTimer() {
|
|
76
|
+
if (this.timer == "stop" || !this.noOpRetain || window.self !== window.top)
|
|
77
|
+
/** 个别页面不需要开启 */
|
|
78
|
+
return;
|
|
79
|
+
this.startRunTime = (/* @__PURE__ */ new Date()).getTime() + this.noOpRetain * 1e3 - this.earlyAlarm * 1e3;
|
|
80
|
+
clearInterval(this.timer);
|
|
81
|
+
this.timer = setInterval(() => {
|
|
82
|
+
const nowTime = (/* @__PURE__ */ new Date()).getTime();
|
|
83
|
+
if (this.startRunTime < nowTime) {
|
|
84
|
+
this.emitMoverEvent();
|
|
85
|
+
clearInterval(this.timer);
|
|
86
|
+
}
|
|
87
|
+
}, 3e3);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 到达无操作阈值,弹出警告弹窗
|
|
91
|
+
*
|
|
92
|
+
* 移除活动监听,避免弹窗展示期间重复触发;由 ModelControl 负责 UI 与后续登出。
|
|
93
|
+
*/
|
|
94
|
+
static emitMoverEvent() {
|
|
95
|
+
this.removeListener();
|
|
96
|
+
ModelControl.showModel();
|
|
97
|
+
}
|
|
98
|
+
/** 移除 document 上的 mousemove / keydown 监听 */
|
|
99
|
+
static removeListener() {
|
|
100
|
+
document.removeEventListener("mousemove", throttleMoverEvent);
|
|
101
|
+
document.removeEventListener("keydown", throttleMoverEvent);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 关闭控制器
|
|
105
|
+
*
|
|
106
|
+
* 清除轮询定时器并移除活动监听,用于登出或模块卸载场景。
|
|
107
|
+
*/
|
|
108
|
+
static closeControl() {
|
|
109
|
+
clearInterval(this.timer);
|
|
110
|
+
this.timer = "stop";
|
|
111
|
+
this.removeListener();
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* 执行登出
|
|
115
|
+
*
|
|
116
|
+
* 仅在警告弹窗仍展示时生效:广播 GCT_LOGINOUT 同步其他标签页,并调用 AuthUtil 登出。
|
|
117
|
+
*/
|
|
118
|
+
static loginOutEvent() {
|
|
119
|
+
if (!ModelControl.show) return;
|
|
120
|
+
onlineBroadcast.postMessage({ type: GCT_EVENT_TYPE.GCT_LOGINOUT });
|
|
121
|
+
AuthUtil.getInstance().logout(true);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
export { OnlineControl };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
2
2
|
import CropperFree_vue_vue_type_script_setup_true_name_CropperPhoto_lang_default from "./CropperFree.vue_vue_type_script_setup_true_name_CropperPhoto_lang.mjs";
|
|
3
|
-
import './CropperFree.
|
|
3
|
+
import './CropperFree.vue_vue_type_style_index_0_scoped_c2cff308_lang.css';/* empty css */
|
|
4
4
|
//#region src/modules/picture-cropper/src/CropperFree.vue
|
|
5
|
-
var CropperFree_default = /* @__PURE__ */ _plugin_vue_export_helper_default(CropperFree_vue_vue_type_script_setup_true_name_CropperPhoto_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var CropperFree_default = /* @__PURE__ */ _plugin_vue_export_helper_default(CropperFree_vue_vue_type_script_setup_true_name_CropperPhoto_lang_default, [["__scopeId", "data-v-c2cff308"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { CropperFree_default as default };
|
|
@@ -109,7 +109,7 @@ var CropperFree_vue_vue_type_script_setup_true_name_CropperPhoto_lang_default =
|
|
|
109
109
|
closeModal
|
|
110
110
|
});
|
|
111
111
|
return (_ctx, _cache) => {
|
|
112
|
-
const
|
|
112
|
+
const _component_plus_outlined = resolveComponent("plus-outlined");
|
|
113
113
|
return openBlock(), createElementBlock("div", {
|
|
114
114
|
id: "dropzone",
|
|
115
115
|
class: normalizeClass([prefixCls, disabled.value && "not-allow"])
|
|
@@ -143,10 +143,9 @@ var CropperFree_vue_vue_type_script_setup_true_name_CropperPhoto_lang_default =
|
|
|
143
143
|
class: normalizeClass(`${prefixCls}__trigger`),
|
|
144
144
|
onClick: handleClick
|
|
145
145
|
}, [
|
|
146
|
-
__props.icon ? (openBlock(), createElementBlock("i", _hoisted_2)) : (openBlock(), createBlock(
|
|
146
|
+
__props.icon ? (openBlock(), createElementBlock("i", _hoisted_2)) : (openBlock(), createBlock(_component_plus_outlined, {
|
|
147
147
|
key: 1,
|
|
148
|
-
|
|
149
|
-
size: 36
|
|
148
|
+
style: { "font-size": "36px" }
|
|
150
149
|
})),
|
|
151
150
|
__props.isDrag ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [createElementVNode("p", _hoisted_3, toDisplayString(unref(t)("sys.pageDesigner.clickOrDragToUpload")), 1), __props.accept ? (openBlock(), createElementBlock("p", _hoisted_4, toDisplayString(`支持${__props.accept?.join("、")}图片格式,大小100KB以内`), 1)) : createCommentVNode("", true)], 64)) : createCommentVNode("", true),
|
|
152
151
|
!__props.auxiliary ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [createTextVNode(toDisplayString(unref(t)("sys.clickToDoSth", { sth: unref(t)("sys.add") })), 1)], 64)) : createCommentVNode("", true)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.cropper-photo[data-v-
|
|
1
|
+
.cropper-photo[data-v-c2cff308] {
|
|
2
2
|
display: inline-block;
|
|
3
3
|
position: relative;
|
|
4
4
|
width: var(--width, 200px);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
text-align: center;
|
|
8
8
|
cursor: pointer;
|
|
9
9
|
}
|
|
10
|
-
.cropper-photo__trigger[data-v-
|
|
10
|
+
.cropper-photo__trigger[data-v-c2cff308] {
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
align-items: center;
|
|
@@ -19,25 +19,25 @@
|
|
|
19
19
|
background: #fbfbfc;
|
|
20
20
|
color: #9b9b9b;
|
|
21
21
|
}
|
|
22
|
-
.cropper-photo__trigger .iconfont[data-v-
|
|
22
|
+
.cropper-photo__trigger .iconfont[data-v-c2cff308] {
|
|
23
23
|
color: #c3c3c3;
|
|
24
24
|
font-size: 32px;
|
|
25
25
|
}
|
|
26
|
-
.cropper-photo__trigger .ant-icon[data-v-
|
|
26
|
+
.cropper-photo__trigger .ant-icon[data-v-c2cff308] {
|
|
27
27
|
margin-bottom: 3px;
|
|
28
28
|
color: #666;
|
|
29
29
|
}
|
|
30
|
-
.cropper-photo__trigger .prompt[data-v-
|
|
31
|
-
.cropper-photo__trigger .auxiliary[data-v-
|
|
30
|
+
.cropper-photo__trigger .prompt[data-v-c2cff308],
|
|
31
|
+
.cropper-photo__trigger .auxiliary[data-v-c2cff308] {
|
|
32
32
|
margin: 0;
|
|
33
33
|
}
|
|
34
|
-
.cropper-photo__trigger .prompt[data-v-
|
|
34
|
+
.cropper-photo__trigger .prompt[data-v-c2cff308] {
|
|
35
35
|
color: #797a7d;
|
|
36
36
|
}
|
|
37
|
-
.cropper-photo__trigger .auxiliary[data-v-
|
|
37
|
+
.cropper-photo__trigger .auxiliary[data-v-c2cff308] {
|
|
38
38
|
color: #c3c3c3;
|
|
39
39
|
}
|
|
40
|
-
.cropper-photo__mask[data-v-
|
|
40
|
+
.cropper-photo__mask[data-v-c2cff308] {
|
|
41
41
|
display: flex;
|
|
42
42
|
position: absolute;
|
|
43
43
|
top: 0;
|
|
@@ -51,31 +51,31 @@
|
|
|
51
51
|
opacity: 0;
|
|
52
52
|
background: rgba(0, 0, 0, 0.4);
|
|
53
53
|
}
|
|
54
|
-
.cropper-photo__mask .anticon[data-v-
|
|
54
|
+
.cropper-photo__mask .anticon[data-v-c2cff308] {
|
|
55
55
|
margin-right: 20px;
|
|
56
56
|
}
|
|
57
|
-
.cropper-photo__mask .anticon[data-v-
|
|
57
|
+
.cropper-photo__mask .anticon[data-v-c2cff308]:last-child {
|
|
58
58
|
margin-right: 0;
|
|
59
59
|
}
|
|
60
|
-
.cropper-photo__mask[data-v-
|
|
60
|
+
.cropper-photo__mask[data-v-c2cff308]:hover {
|
|
61
61
|
opacity: 40;
|
|
62
62
|
}
|
|
63
|
-
.cropper-photo__wrapper[data-v-
|
|
63
|
+
.cropper-photo__wrapper[data-v-c2cff308] {
|
|
64
64
|
width: 100%;
|
|
65
65
|
height: 100%;
|
|
66
66
|
border: 1px solid var(--gct-color-border);
|
|
67
67
|
border-radius: 4px;
|
|
68
68
|
}
|
|
69
|
-
.cropper-photo__wrapper img[data-v-
|
|
69
|
+
.cropper-photo__wrapper img[data-v-c2cff308] {
|
|
70
70
|
width: 100%;
|
|
71
71
|
height: 100%;
|
|
72
72
|
object-fit: contain;
|
|
73
73
|
}
|
|
74
|
-
.not-allow[data-v-
|
|
74
|
+
.not-allow[data-v-c2cff308] {
|
|
75
75
|
cursor: default;
|
|
76
76
|
pointer-events: none;
|
|
77
77
|
}
|
|
78
|
-
.defult-img[data-v-
|
|
78
|
+
.defult-img[data-v-c2cff308] {
|
|
79
79
|
position: absolute;
|
|
80
80
|
z-index: 2;
|
|
81
81
|
border: 1px solid #d9d9d9;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/core-web",
|
|
3
|
-
"version": "0.1.6-dev.
|
|
3
|
+
"version": "0.1.6-dev.28",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台网页端核心包",
|
|
6
6
|
"loader": "dist/loader.esm.min.js",
|
|
@@ -65,20 +65,20 @@
|
|
|
65
65
|
"vxe-table": "npm:@gct-paas/vxe-table@4.6.19",
|
|
66
66
|
"wujie": "^1.0.29",
|
|
67
67
|
"wujie-vue3": "^1.0.29",
|
|
68
|
-
"@gct-paas/core": "0.1.6-dev.
|
|
69
|
-
"@gct-paas/
|
|
70
|
-
"@gct-paas/
|
|
71
|
-
"@gct-paas/
|
|
68
|
+
"@gct-paas/core": "0.1.6-dev.28",
|
|
69
|
+
"@gct-paas/v-ben": "0.1.6-dev.28",
|
|
70
|
+
"@gct-paas/scss": "0.1.6-dev.28",
|
|
71
|
+
"@gct-paas/core-components": "0.1.6-dev.28"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@gct-paas/api": "^0.1.6-dev.14",
|
|
75
75
|
"@types/sortablejs": "^1.15.1",
|
|
76
76
|
"vant": ">=4",
|
|
77
77
|
"vue": ">=3",
|
|
78
|
-
"@gct-paas/core": "0.1.6-dev.
|
|
79
|
-
"@gct-paas/core-components": "0.1.6-dev.
|
|
80
|
-
"@gct-paas/
|
|
81
|
-
"@gct-paas/
|
|
78
|
+
"@gct-paas/core": "0.1.6-dev.28",
|
|
79
|
+
"@gct-paas/core-components": "0.1.6-dev.28",
|
|
80
|
+
"@gct-paas/v-ben": "0.1.6-dev.28",
|
|
81
|
+
"@gct-paas/scss": "0.1.6-dev.28"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@types/bwip-js": "^3.2.3",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! @gct-paas/core-web v0.1.6-dev.26 */
|
|
2
|
-
import{usePlatformConfigStore as e}from"@gct-paas/core";import{Fragment as l,computed as a,createBlock as o,createCommentVNode as n,createElementBlock as t,createElementVNode as i,createVNode as c,defineComponent as u,nextTick as r,normalizeClass as s,normalizeStyle as d,openBlock as v,ref as p,renderList as k,resolveComponent as _,toDisplayString as g,unref as m,vModelText as f,withCtx as y,withDirectives as h}from"vue";import{cloneDeep as b,debounce as C}from"lodash-es";import{Empty as x,Form as F}from"ant-design-vue";import{IconNamespaceEnum as w,IconNext as I,useIconAsset as S,useIconPark as E,useIconPlatform as B}from"@gct-paas/core-components";var A={class:"icon-picker-next"},V={class:"p-12px"},z={class:"flex icon-picker-next__container"},P={class:"icon-picker-next__cats"},j=["title","data-id","onClick"],D={class:"icon-picker-next__panel"},R={class:"icon-picker-next__icons"},U={class:"icon__list"},L=["title","data-id","onClick"],M={key:0,class:"color__setting"},N={class:"color__list"},O=["onClick"],T={class:"color__input"},q={key:1,class:"color__setting"},G={class:"color__list"},W=["onClick"],H={class:"color__input"},J={key:1,class:"flex items-center justify-center h-full"},K="#FFFFFF",Q=/* @__PURE__ */u({__name:"icon-next-picker",props:{value:{type:String,required:!0},disabled:{type:Boolean,default:!1},color:{type:String,default:"#FFFFFF"},size:{type:Number,default:30},showColor:{type:Boolean,default:!1},background:{type:String},showBackground:{type:Boolean,default:!1}},emits:["update:value","update:color","update:background"],setup(u,{emit:Q}){const{themeSetting:X}=e(),Y=u,Z=Q,{getIconAssetCats:$}=S(),{getIconParkCats:ee}=E(),{getIconPlatformCats:le}=B(),{onFieldChange:ae}=F.useInjectFormItemContext(),oe=p(),ne=p(),te=p(!1),ie=["#3370FF","#0DAA9C","#EF3232","#EFA332","#18C8D3","#A33FF2"],ce=[K,...ie],ue=["transparent",...ie],re=p(K),se=p(!1),de=p(K),ve=p(!1);let pe=[];const ke=p([]),_e=p([]),ge=p([]),me=p(""),fe=a(()=>_e.value.length>0&&!_e.value[0].id.startsWith(w.Asset)),ye=()=>{let e,l=ke.value[0]||{};var a;l&&(e=l.icons?l:null===(a=l.children)||void 0===a?void 0:a[0]),e?(ge.value=[e.id],_e.value=e.icons):(ge.value=[],_e.value=[])},he=async e=>{if(e){if(te.value=!0,pe.length>0)ke.value=pe;else{const e=ee(),l=await $(),a=le();pe=l.concat(e).concat(a),ke.value=pe}Y.color?ce.includes(Y.color)?(re.value=K,se.value=!1):(re.value=Y.color,se.value=!0):Z("update:color",K),Y.background?ue.includes(Y.background)?(de.value=K,ve.value=!1):(de.value=Y.background,ve.value=!0):Z("update:background","#3370FF"),(async()=>{if(Y.value){let a=ke.value.reduce((e,l)=>("children"in l?e.push(...l.children):e.push(l),e),[]).find(e=>e.icons.map(e=>e.id).includes(Y.value));var e,l;a?(ge.value=[a.id],_e.value=a.icons,await r(),null===(e=oe.value)||void 0===e||null===(e=e.getElement())||void 0===e||e.scrollIntoView({block:"center"}),null===(l=ne.value)||void 0===l||null===(l=l.getElement())||void 0===l||l.scrollIntoView({block:"center"})):ye()}else ye()})(),te.value=!1}else me.value=""};function be(e,l){return e.map(e=>{const a=["children","icons"].find(l=>!!e[l]);return a?(e[a]=be(e[a],l),e[a].length>0?e:void 0):e._filter_.some(e=>e.includes(l))?e:void 0}).filter(Boolean)}const Ce=C(e=>{var l;te.value=!0;const a=null===(l=e.target.value)||void 0===l?void 0:l.trim();ke.value=a?be(b(pe),a):pe,ye(),te.value=!1},500),xe=(e,l=!1)=>{se.value=l,Z("update:color",e),ae()},Fe=()=>{se.value&&(Z("update:color",re.value),ae())},we=(e,l=!1)=>{ve.value=l,Z("update:background",e),ae()},Ie=()=>{ve.value&&(Z("update:background",de.value),ae())};return(e,a)=>{const r=_("a-input"),p=_("a-tree"),b=_("OverlayScrollbarsComponent"),C=_("overlayScrollbarsComponent"),F=_("CheckOutlined"),w=_("a-empty"),S=_("a-spin"),E=_("a-popover");return v(),t("div",A,[c(E,{placement:"bottomLeft",trigger:"click","overlay-class-name":"icon-picker-next__popover",onVisibleChange:he},{content:y(()=>[i("div",V,[c(r,{value:me.value,"onUpdate:value":a[0]||(a[0]=e=>me.value=e),class:"icon-picker-next__search",placeholder:"搜索图标","allow-clear":"",onChange:a[1]||(a[1]=e=>{te.value=!0,m(Ce)(e)})},{prefix:y(()=>[...a[6]||(a[6]=[i("i",{class:"iconfont icon-sousuo1"},null,-1)])]),_:1},8,["value"])]),c(S,{spinning:te.value},{default:y(()=>{var e;return[i("div",z,[i("div",P,[c(b,{ref_key:"TreeScrollRef",ref:oe,class:"icon-picker-next__scrollbar"},{default:y(()=>[ke.value.length>0?(v(),o(p,{key:0,"selected-keys":ge.value,"default-expand-all":"","block-node":"","field-names":{children:"children",title:"name",key:"id"},"tree-data":ke.value},{title:y(({data:e})=>[i("div",{class:"ell",title:e.name,"data-id":e.id,onClick:l=>(e=>{(null==e?void 0:e.children)&&(null==e?void 0:e.children.length)||(_e.value=e.icons??[],ge.value=[e.id])})(e)},g(e.name),9,j)]),_:1},8,["selected-keys","tree-data"])):n("",!0)]),_:1},512)]),i("div",D,[(null===(e=_e.value)||void 0===e?void 0:e.length)>0?(v(),t(l,{key:0},[i("div",R,[c(C,{ref_key:"IconsScrollRef",ref:ne,class:"icon-picker-next__scrollbar"},{default:y(()=>[i("ul",U,[(v(!0),t(l,null,k(_e.value,e=>(v(),t("li",{key:e.name,style:d({"--background":u.background||m(X).themeColor}),class:s({"icon-picker-next--selected":e.id===u.value}),title:e.name,"data-id":e.id,onClick:l=>function(e){Z("update:value",e),ae()}(e.id)},[c(m(I),{value:e.id,color:e.id===u.value?u.color:K},null,8,["value","color"])],14,L))),128))])]),_:1},512)]),u.showBackground?(v(),t("div",M,[a[7]||(a[7]=i("div",{class:"color__title"},"背景颜色",-1)),i("div",N,[(v(),t(l,null,k(ue,e=>i("span",{key:e,class:s(["color__item","color__item--"+e]),style:d({backgroundColor:e}),onClick:()=>we(e)},[u.background===e?(v(),o(F,{key:0})):n("",!0)],14,O)),64))]),i("div",T,[i("div",{class:"color__preview",style:d({"--custom-bg":de.value}),onClick:a[2]||(a[2]=()=>we(de.value,!0))},[ve.value?(v(),o(F,{key:0})):n("",!0)],4),h(i("input",{"onUpdate:modelValue":a[3]||(a[3]=e=>de.value=e),type:"text",onBlur:Ie},null,544),[[f,de.value]])])])):n("",!0),u.showColor&&fe.value?(v(),t("div",q,[a[8]||(a[8]=i("div",{class:"color__title"},"图标色",-1)),i("div",G,[(v(),t(l,null,k(ce,e=>i("span",{key:e,class:"color__item",style:d({backgroundColor:e}),onClick:()=>xe(e)},[u.color===e?(v(),o(F,{key:0})):n("",!0)],12,W)),64))]),i("div",H,[i("div",{class:"color__preview",style:d({"--custom-bg":re.value}),onClick:a[4]||(a[4]=()=>xe(re.value,!0))},[se.value?(v(),o(F,{key:0})):n("",!0)],4),h(i("input",{"onUpdate:modelValue":a[5]||(a[5]=e=>re.value=e),type:"text",onBlur:Fe},null,544),[[f,re.value]])])])):n("",!0)],64)):(v(),t("div",J,[c(w,{image:m(x).PRESENTED_IMAGE_SIMPLE,description:null},null,8,["image"])]))])])]}),_:1},8,["spinning"])]),default:y(()=>[i("div",{class:s(["icon-picker-next__trigger cursor-pointer",{"icon-picker-next--selected":u.value}]),style:d({"--background":u.background||m(X).themeColor})},[u.value?(v(),o(m(I),{key:0,value:u.value,size:u.size,color:u.color},null,8,["value","size","color"])):n("",!0),a[9]||(a[9]=i("div",null,[i("i",{class:"iconfont icon-bianji"})],-1))],6)]),_:1})])}}});export{Q as default};
|
package/es/hooks/useTheme.d.ts
DELETED
package/es/hooks/useTheme.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { reactive } from "vue";
|
|
2
|
-
import { ConfigProvider } from "ant-design-vue";
|
|
3
|
-
//#region src/hooks/useTheme.ts
|
|
4
|
-
var themeVars = reactive({});
|
|
5
|
-
function useTheme() {
|
|
6
|
-
function setPrimaryColor(color) {
|
|
7
|
-
themeVars.primaryColor = color;
|
|
8
|
-
ConfigProvider.config({ theme: { primaryColor: color } });
|
|
9
|
-
}
|
|
10
|
-
return {
|
|
11
|
-
themeVars,
|
|
12
|
-
setPrimaryColor
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { useTheme };
|