@gct-paas/core-web 0.1.6-dev.4 → 0.1.6-dev.5

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.
Files changed (37) hide show
  1. package/dist/{components-4-8OfvJi.js → components-Dw_doMp_.js} +1 -1
  2. package/dist/index.min.css +1 -1
  3. package/dist/loader.esm.min.js +1 -1
  4. package/dist/template-tzWsbHZE.js +1 -0
  5. package/es/components/label-design/panels/widget/controls/ImageData.vue.mjs +2 -2
  6. package/es/components/label-design/panels/widget/controls/ImageData.vue_vue_type_script_setup_true_name_image-data_lang.mjs +2 -2
  7. package/es/components/label-design/panels/widget/controls/ImageData.vue_vue_type_style_index_0_scoped_3c4a9733_lang.css +3 -0
  8. package/es/components/label-design/panels/widget/controls/labelTemplate.vue.mjs +2 -2
  9. package/es/components/label-design/panels/widget/controls/labelTemplate.vue_vue_type_script_setup_true_lang.mjs +1 -16
  10. package/es/components/label-design/panels/widget/controls/labelTemplate.vue_vue_type_style_index_0_scoped_c628d318_lang.css +10 -0
  11. package/es/index.d.ts +2 -0
  12. package/es/index.mjs +6 -1
  13. package/es/modules/category/category-modal.vue.d.ts +11 -0
  14. package/es/modules/category/category-modal.vue.mjs +7 -0
  15. package/es/modules/category/category-modal.vue_vue_type_script_setup_true_name_category-modal_lang.mjs +53 -0
  16. package/es/modules/category/category-modal.vue_vue_type_style_index_0_scoped_b560615c_lang.css +67 -0
  17. package/es/modules/category/category-sider.vue.d.ts +337 -0
  18. package/es/modules/category/category-sider.vue.mjs +7 -0
  19. package/es/modules/category/category-sider.vue_vue_type_script_setup_true_name_category-sider_lang.mjs +239 -0
  20. package/es/modules/category/category-sider.vue_vue_type_style_index_0_scoped_5af8c1ba_lang.css +211 -0
  21. package/es/modules/category/hooks/useCategory.d.ts +20 -0
  22. package/es/modules/category/hooks/useCategory.mjs +139 -0
  23. package/es/modules/category/index.d.ts +2 -0
  24. package/es/modules/category/index.mjs +2 -0
  25. package/es/modules/category/type.d.ts +8 -0
  26. package/es/modules/print-tmpl/icon-print-folder.svg.mjs +4 -0
  27. package/es/modules/print-tmpl/icon-print-printer.svg.mjs +4 -0
  28. package/es/modules/print-tmpl/index.d.ts +2 -0
  29. package/es/modules/print-tmpl/index.mjs +1 -0
  30. package/es/modules/print-tmpl/print-tmpl-modal.vue.d.ts +31 -0
  31. package/es/modules/print-tmpl/print-tmpl-modal.vue.mjs +7 -0
  32. package/es/modules/print-tmpl/print-tmpl-modal.vue_vue_type_script_setup_true_name_print-tmpl-modal_lang.mjs +593 -0
  33. package/es/modules/print-tmpl/print-tmpl-modal.vue_vue_type_style_index_0_scoped_c60841b8_lang.css +143 -0
  34. package/package.json +9 -9
  35. package/dist/template-Cf-wq8-9.js +0 -1
  36. package/es/components/label-design/panels/widget/controls/ImageData.vue_vue_type_style_index_0_scoped_9232a443_lang.css +0 -3
  37. package/es/components/label-design/panels/widget/controls/labelTemplate.vue_vue_type_style_index_0_scoped_992e00bb_lang.css +0 -10
@@ -0,0 +1,337 @@
1
+ import { BasicAction } from '@gct-paas/core';
2
+ import { CategoryModuleEnum } from './type';
3
+ import { ITreeNode, TreeExDropEvent } from '../../components';
4
+ type __VLS_Props = {
5
+ module: CategoryModuleEnum;
6
+ value?: string;
7
+ siderTitle: string;
8
+ readonly: boolean;
9
+ isTree: boolean;
10
+ needFolderIcon: boolean;
11
+ customDelFunc?: Fn;
12
+ customDelTips?: string;
13
+ hasTitle?: boolean;
14
+ draggable?: boolean;
15
+ ignoreCase?: number;
16
+ hasPerBtns?: BasicAction[];
17
+ };
18
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {
19
+ getCategoryData: () => ITreeNode[];
20
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
21
+ changeCategory: (value?: string | undefined) => void;
22
+ changeValue: (value?: object | undefined) => void;
23
+ "update:value": (value?: string | undefined) => void;
24
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
25
+ onChangeCategory?: ((value?: string | undefined) => any) | undefined;
26
+ onChangeValue?: ((value?: object | undefined) => any) | undefined;
27
+ "onUpdate:value"?: ((value?: string | undefined) => any) | undefined;
28
+ }>, {
29
+ hasTitle: boolean;
30
+ draggable: boolean;
31
+ hasPerBtns: BasicAction[];
32
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
33
+ treeExRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
34
+ draggable: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
38
+ data: {
39
+ type: import('vue').PropType<ITreeNode[]>;
40
+ required: true;
41
+ };
42
+ filter: {
43
+ type: StringConstructor;
44
+ default: undefined;
45
+ };
46
+ selectedKeys: {
47
+ type: {
48
+ (arrayLength: number): string[];
49
+ (...items: string[]): string[];
50
+ new (arrayLength: number): string[];
51
+ new (...items: string[]): string[];
52
+ isArray(arg: any): arg is any[];
53
+ readonly prototype: any[];
54
+ from<T>(arrayLike: ArrayLike<T>): T[];
55
+ from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
56
+ from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
57
+ from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
58
+ of<T>(...items: T[]): T[];
59
+ readonly [Symbol.species]: ArrayConstructor;
60
+ fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
61
+ fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
62
+ };
63
+ default: undefined;
64
+ };
65
+ checkedKeys: {
66
+ type: {
67
+ (arrayLength: number): string[];
68
+ (...items: string[]): string[];
69
+ new (arrayLength: number): string[];
70
+ new (...items: string[]): string[];
71
+ isArray(arg: any): arg is any[];
72
+ readonly prototype: any[];
73
+ from<T>(arrayLike: ArrayLike<T>): T[];
74
+ from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
75
+ from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
76
+ from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
77
+ of<T>(...items: T[]): T[];
78
+ readonly [Symbol.species]: ArrayConstructor;
79
+ fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
80
+ fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
81
+ };
82
+ default: undefined;
83
+ };
84
+ expandedKeys: {
85
+ type: {
86
+ (arrayLength: number): string[];
87
+ (...items: string[]): string[];
88
+ new (arrayLength: number): string[];
89
+ new (...items: string[]): string[];
90
+ isArray(arg: any): arg is any[];
91
+ readonly prototype: any[];
92
+ from<T>(arrayLike: ArrayLike<T>): T[];
93
+ from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
94
+ from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
95
+ from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
96
+ of<T>(...items: T[]): T[];
97
+ readonly [Symbol.species]: ArrayConstructor;
98
+ fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
99
+ fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
100
+ };
101
+ default: undefined;
102
+ };
103
+ multiple: {
104
+ type: BooleanConstructor;
105
+ default: boolean;
106
+ };
107
+ lastSelectionLocked: {
108
+ type: BooleanConstructor;
109
+ default: boolean;
110
+ };
111
+ checkable: {
112
+ type: BooleanConstructor;
113
+ default: boolean;
114
+ };
115
+ checkStrictly: {
116
+ type: BooleanConstructor;
117
+ default: boolean;
118
+ };
119
+ autoExpandParent: {
120
+ type: BooleanConstructor;
121
+ default: boolean;
122
+ };
123
+ defaultExpandAll: {
124
+ type: BooleanConstructor;
125
+ default: boolean;
126
+ };
127
+ showLine: {
128
+ type: BooleanConstructor;
129
+ default: boolean;
130
+ };
131
+ ignoreCase: {
132
+ type: NumberConstructor;
133
+ default: number;
134
+ };
135
+ }>> & Readonly<{
136
+ onDrop?: ((event: TreeExDropEvent) => any) | undefined;
137
+ "onUpdate:checkedKeys"?: ((_val: string[]) => any) | undefined;
138
+ "onUpdate:expandedKeys"?: ((_val: string[]) => any) | undefined;
139
+ "onUpdate:selectedKeys"?: ((_val: string[]) => any) | undefined;
140
+ }>, {
141
+ ns: import('@gct-paas/core').Namespace;
142
+ selectedKeysValue: import('vue').WritableComputedRef<string[], string[]>;
143
+ checkedKeysValue: import('vue').WritableComputedRef<string[], string[]>;
144
+ expandedKeysValue: import('vue').WritableComputedRef<string[] | undefined, string[] | undefined>;
145
+ actualDraggable: import('vue').ComputedRef<boolean>;
146
+ filteredTreeData: import('vue').ComputedRef<ITreeNode[]>;
147
+ handleSelect: (sKeys: (string | number)[], { node }: {
148
+ node: import('ant-design-vue/es/tree').EventDataNode;
149
+ }) => void;
150
+ handleCheck: (checked: string[] | {
151
+ checked: string[];
152
+ halfChecked: string[];
153
+ }, info: import('ant-design-vue/es/vc-tree/props').CheckInfo) => void;
154
+ handleDrop: (info: import('ant-design-vue/es/tree').AntTreeNodeDropEvent) => Promise<void>;
155
+ collapseAll: () => void;
156
+ expandAll: () => void;
157
+ onExpand: (eKeys: (string | number)[], { expanded: _expanded, node: _node, }: {
158
+ expanded: boolean;
159
+ node: import('ant-design-vue/es/tree').EventDataNode;
160
+ }) => void;
161
+ expandNode: (key: string, isExpand?: boolean) => void;
162
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
163
+ "update:selectedKeys": (_val: string[]) => boolean;
164
+ "update:checkedKeys": (_val: string[]) => boolean;
165
+ "update:expandedKeys": (_val: string[]) => boolean;
166
+ drop: (event: TreeExDropEvent) => boolean;
167
+ }, import('vue').PublicProps, {
168
+ draggable: boolean;
169
+ filter: string;
170
+ selectedKeys: string[];
171
+ checkedKeys: string[];
172
+ expandedKeys: string[];
173
+ multiple: boolean;
174
+ lastSelectionLocked: boolean;
175
+ checkable: boolean;
176
+ checkStrictly: boolean;
177
+ autoExpandParent: boolean;
178
+ defaultExpandAll: boolean;
179
+ showLine: boolean;
180
+ ignoreCase: number;
181
+ }, true, {}, import('vue').SlotsType<{
182
+ title: {
183
+ node: ITreeNode;
184
+ };
185
+ }>, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
186
+ P: {};
187
+ B: {};
188
+ D: {};
189
+ C: {};
190
+ M: {};
191
+ Defaults: {};
192
+ }, Readonly<import('vue').ExtractPropTypes<{
193
+ draggable: {
194
+ type: BooleanConstructor;
195
+ default: boolean;
196
+ };
197
+ data: {
198
+ type: import('vue').PropType<ITreeNode[]>;
199
+ required: true;
200
+ };
201
+ filter: {
202
+ type: StringConstructor;
203
+ default: undefined;
204
+ };
205
+ selectedKeys: {
206
+ type: {
207
+ (arrayLength: number): string[];
208
+ (...items: string[]): string[];
209
+ new (arrayLength: number): string[];
210
+ new (...items: string[]): string[];
211
+ isArray(arg: any): arg is any[];
212
+ readonly prototype: any[];
213
+ from<T>(arrayLike: ArrayLike<T>): T[];
214
+ from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
215
+ from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
216
+ from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
217
+ of<T>(...items: T[]): T[];
218
+ readonly [Symbol.species]: ArrayConstructor;
219
+ fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
220
+ fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
221
+ };
222
+ default: undefined;
223
+ };
224
+ checkedKeys: {
225
+ type: {
226
+ (arrayLength: number): string[];
227
+ (...items: string[]): string[];
228
+ new (arrayLength: number): string[];
229
+ new (...items: string[]): string[];
230
+ isArray(arg: any): arg is any[];
231
+ readonly prototype: any[];
232
+ from<T>(arrayLike: ArrayLike<T>): T[];
233
+ from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
234
+ from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
235
+ from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
236
+ of<T>(...items: T[]): T[];
237
+ readonly [Symbol.species]: ArrayConstructor;
238
+ fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
239
+ fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
240
+ };
241
+ default: undefined;
242
+ };
243
+ expandedKeys: {
244
+ type: {
245
+ (arrayLength: number): string[];
246
+ (...items: string[]): string[];
247
+ new (arrayLength: number): string[];
248
+ new (...items: string[]): string[];
249
+ isArray(arg: any): arg is any[];
250
+ readonly prototype: any[];
251
+ from<T>(arrayLike: ArrayLike<T>): T[];
252
+ from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
253
+ from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
254
+ from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
255
+ of<T>(...items: T[]): T[];
256
+ readonly [Symbol.species]: ArrayConstructor;
257
+ fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
258
+ fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
259
+ };
260
+ default: undefined;
261
+ };
262
+ multiple: {
263
+ type: BooleanConstructor;
264
+ default: boolean;
265
+ };
266
+ lastSelectionLocked: {
267
+ type: BooleanConstructor;
268
+ default: boolean;
269
+ };
270
+ checkable: {
271
+ type: BooleanConstructor;
272
+ default: boolean;
273
+ };
274
+ checkStrictly: {
275
+ type: BooleanConstructor;
276
+ default: boolean;
277
+ };
278
+ autoExpandParent: {
279
+ type: BooleanConstructor;
280
+ default: boolean;
281
+ };
282
+ defaultExpandAll: {
283
+ type: BooleanConstructor;
284
+ default: boolean;
285
+ };
286
+ showLine: {
287
+ type: BooleanConstructor;
288
+ default: boolean;
289
+ };
290
+ ignoreCase: {
291
+ type: NumberConstructor;
292
+ default: number;
293
+ };
294
+ }>> & Readonly<{
295
+ onDrop?: ((event: TreeExDropEvent) => any) | undefined;
296
+ "onUpdate:checkedKeys"?: ((_val: string[]) => any) | undefined;
297
+ "onUpdate:expandedKeys"?: ((_val: string[]) => any) | undefined;
298
+ "onUpdate:selectedKeys"?: ((_val: string[]) => any) | undefined;
299
+ }>, {
300
+ ns: import('@gct-paas/core').Namespace;
301
+ selectedKeysValue: import('vue').WritableComputedRef<string[], string[]>;
302
+ checkedKeysValue: import('vue').WritableComputedRef<string[], string[]>;
303
+ expandedKeysValue: import('vue').WritableComputedRef<string[] | undefined, string[] | undefined>;
304
+ actualDraggable: import('vue').ComputedRef<boolean>;
305
+ filteredTreeData: import('vue').ComputedRef<ITreeNode[]>;
306
+ handleSelect: (sKeys: (string | number)[], { node }: {
307
+ node: import('ant-design-vue/es/tree').EventDataNode;
308
+ }) => void;
309
+ handleCheck: (checked: string[] | {
310
+ checked: string[];
311
+ halfChecked: string[];
312
+ }, info: import('ant-design-vue/es/vc-tree/props').CheckInfo) => void;
313
+ handleDrop: (info: import('ant-design-vue/es/tree').AntTreeNodeDropEvent) => Promise<void>;
314
+ collapseAll: () => void;
315
+ expandAll: () => void;
316
+ onExpand: (eKeys: (string | number)[], { expanded: _expanded, node: _node, }: {
317
+ expanded: boolean;
318
+ node: import('ant-design-vue/es/tree').EventDataNode;
319
+ }) => void;
320
+ expandNode: (key: string, isExpand?: boolean) => void;
321
+ }, {}, {}, {}, {
322
+ draggable: boolean;
323
+ filter: string;
324
+ selectedKeys: string[];
325
+ checkedKeys: string[];
326
+ expandedKeys: string[];
327
+ multiple: boolean;
328
+ lastSelectionLocked: boolean;
329
+ checkable: boolean;
330
+ checkStrictly: boolean;
331
+ autoExpandParent: boolean;
332
+ defaultExpandAll: boolean;
333
+ showLine: boolean;
334
+ ignoreCase: number;
335
+ }> | null;
336
+ }, HTMLDivElement>;
337
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export-helper.mjs";
2
+ import category_sider_vue_vue_type_script_setup_true_name_category_sider_lang_default from "./category-sider.vue_vue_type_script_setup_true_name_category-sider_lang.mjs";
3
+ import './category-sider.vue_vue_type_style_index_0_scoped_5af8c1ba_lang.css';/* empty css */
4
+ //#region src/modules/category/category-sider.vue
5
+ var category_sider_default = /* @__PURE__ */ _plugin_vue_export_helper_default(category_sider_vue_vue_type_script_setup_true_name_category_sider_lang_default, [["__scopeId", "data-v-5af8c1ba"]]);
6
+ //#endregion
7
+ export { category_sider_default as default };
@@ -0,0 +1,239 @@
1
+ import { recursiveTransfer } from "../../utils/recursive.mjs";
2
+ import "../../utils/index.mjs";
3
+ import { TreeEx } from "../../components/TreeEx/tree-ex.mjs";
4
+ import "../../components/index.mjs";
5
+ import { useCategory } from "./hooks/useCategory.mjs";
6
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, onMounted, openBlock, ref, resolveComponent, toDisplayString, unref, watch, withCtx } from "vue";
7
+ import { BasicAction, t, useNamespace } from "@gct-paas/core";
8
+ //#region src/modules/category/category-sider.vue?vue&type=script&setup=true&name=category-sider&lang.ts
9
+ var _hoisted_1 = ["title"];
10
+ var category_sider_vue_vue_type_script_setup_true_name_category_sider_lang_default = /* @__PURE__ */ defineComponent({
11
+ __name: "category-sider",
12
+ props: {
13
+ module: {},
14
+ value: {},
15
+ siderTitle: {},
16
+ readonly: { type: Boolean },
17
+ isTree: { type: Boolean },
18
+ needFolderIcon: { type: Boolean },
19
+ customDelFunc: {},
20
+ customDelTips: {},
21
+ hasTitle: {
22
+ type: Boolean,
23
+ default: true
24
+ },
25
+ draggable: {
26
+ type: Boolean,
27
+ default: true
28
+ },
29
+ ignoreCase: {},
30
+ hasPerBtns: { default: () => [
31
+ BasicAction.Insert,
32
+ BasicAction.Update,
33
+ BasicAction.Delete
34
+ ] }
35
+ },
36
+ emits: [
37
+ "update:value",
38
+ "changeCategory",
39
+ "changeValue"
40
+ ],
41
+ setup(__props, { expose: __expose, emit: __emit }) {
42
+ const MenuClickEvent = {
43
+ EDIT: "edit",
44
+ DELETE: "delete"
45
+ };
46
+ const $t = t;
47
+ const ns = useNamespace("category-sider");
48
+ const props = __props;
49
+ const emit = __emit;
50
+ const selectedKeys = computed({
51
+ get() {
52
+ return props.value ? [props.value] : void 0;
53
+ },
54
+ set(v) {
55
+ emit("update:value", v?.[0]);
56
+ }
57
+ });
58
+ const selfExpandedKeys = ref([]);
59
+ const searchKey = ref();
60
+ const treeExRef = ref();
61
+ const { load, createCategory, editCategory, deleteCategoryAPI, dragCategory, categoryTreeData, isFormDesign } = useCategory({ module: props.module });
62
+ const highlightId = ref("");
63
+ const onVisibleChange = (visible, treeId) => {
64
+ highlightId.value = visible ? treeId : "";
65
+ };
66
+ /**
67
+ * 节点选中事件
68
+ */
69
+ const onMenuVisibleChange = (visible, treeId) => {
70
+ onVisibleChange(visible, treeId);
71
+ };
72
+ const onTreeMenuClick = (node, event) => {
73
+ handleMenuClick(node, String(event.key));
74
+ };
75
+ const handleSelect = (sKeys, { node }) => {
76
+ if (sKeys.length === 0) return;
77
+ if (node.dataRef?.children?.length && !isFormDesign) return;
78
+ if (node.categoryId && !selfExpandedKeys.value.includes(node.categoryId)) selfExpandedKeys.value.push(node.categoryId);
79
+ emit("changeValue", node.dataRef);
80
+ };
81
+ const treeData = computed(() => {
82
+ return recursiveTransfer(categoryTreeData.value || [], (item, resolveChild) => {
83
+ const treeItem = item;
84
+ const node = {
85
+ key: treeItem.id,
86
+ title: treeItem.name,
87
+ sortNum: treeItem.sortNum,
88
+ showFolder: treeItem.children && props.isTree || props.needFolderIcon,
89
+ sysBuiltin: treeItem.sysBuiltin
90
+ };
91
+ if ((treeItem.children || treeItem.child) && props.isTree) node.children = resolveChild(treeItem.children || treeItem.child);
92
+ return node;
93
+ });
94
+ });
95
+ onMounted(async () => {
96
+ await load();
97
+ if (!props.value) {
98
+ emit("update:value", treeData.value[0]?.key);
99
+ if (treeData.value[0]) emit("changeValue", treeData.value[0]);
100
+ }
101
+ });
102
+ watch(treeExRef, () => {
103
+ treeExRef.value?.expandAll();
104
+ }, { immediate: true });
105
+ /**
106
+ * 拖拽事件处理
107
+ * @param dragNode
108
+ * @param after
109
+ */
110
+ const onDrop = async ({ dragNode, after }) => {
111
+ let targetSortNum = 1;
112
+ if (after.nextNode) targetSortNum = Number(after.nextNode.sortNum ?? 0) + 1;
113
+ else if (after.prevNode) targetSortNum = Number(after.prevNode.sortNum ?? 1);
114
+ await dragCategory({
115
+ id: dragNode.key,
116
+ targetParentId: after.parent?.key,
117
+ targetSortNum
118
+ });
119
+ };
120
+ const handleMenuClick = async (node, key) => {
121
+ switch (key) {
122
+ case MenuClickEvent.EDIT:
123
+ await editCategory(node);
124
+ onVisibleChange(false, node.key);
125
+ break;
126
+ case MenuClickEvent.DELETE: {
127
+ const currentSelectedKey = selectedKeys.value[0];
128
+ const res = await deleteCategoryAPI(node, props.customDelFunc, props.customDelTips);
129
+ onVisibleChange(false, node.key);
130
+ if (res && currentSelectedKey === node.key) {
131
+ selectedKeys.value = treeData.value.length ? [treeData.value[0].key] : [];
132
+ emit("changeValue", treeData.value[0]);
133
+ }
134
+ break;
135
+ }
136
+ }
137
+ };
138
+ const newCategory = async () => {
139
+ const data = await createCategory();
140
+ onVisibleChange(false, "");
141
+ if (data.parentId) selfExpandedKeys.value.push(data.parentId);
142
+ selectedKeys.value = treeData.value.length ? [treeData.value[0].key] : [];
143
+ emit("changeValue", treeData.value[0]);
144
+ };
145
+ const getCategoryData = () => {
146
+ return treeData.value;
147
+ };
148
+ __expose({ getCategoryData });
149
+ return (_ctx, _cache) => {
150
+ const _component_a_button = resolveComponent("a-button");
151
+ const _component_a_input = resolveComponent("a-input");
152
+ const _component_ellipsis_outlined = resolveComponent("ellipsis-outlined");
153
+ const _component_a_menu_item = resolveComponent("a-menu-item");
154
+ const _component_a_menu = resolveComponent("a-menu");
155
+ const _component_a_dropdown = resolveComponent("a-dropdown");
156
+ return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).b()]) }, [
157
+ __props.hasTitle || !__props.readonly ? (openBlock(), createElementBlock("div", {
158
+ key: 0,
159
+ class: normalizeClass([unref(ns).e("title-container")])
160
+ }, [createElementVNode("span", { class: normalizeClass([unref(ns).e("title")]) }, toDisplayString(__props.siderTitle), 3), !__props.readonly && __props.hasPerBtns.includes(unref(BasicAction).Insert) ? (openBlock(), createBlock(_component_a_button, {
161
+ key: 0,
162
+ type: "link",
163
+ class: normalizeClass([unref(ns).e("add")]),
164
+ onClick: newCategory
165
+ }, {
166
+ default: withCtx(() => [_cache[3] || (_cache[3] = createElementVNode("i", { class: "iconfont icon-chuangjian" }, null, -1)), createTextVNode(" " + toDisplayString(unref($t)("sys.newCategory")), 1)]),
167
+ _: 1
168
+ }, 8, ["class"])) : createCommentVNode("", true)], 2)) : createCommentVNode("", true),
169
+ createElementVNode("div", { class: normalizeClass([unref(ns).e("search-container")]) }, [createVNode(_component_a_input, {
170
+ value: searchKey.value,
171
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => searchKey.value = $event),
172
+ class: normalizeClass([unref(ns).e("search-input")]),
173
+ placeholder: unref(t)("sys.onlineForm.searchCategory"),
174
+ "allow-clear": ""
175
+ }, {
176
+ prefix: withCtx(() => [..._cache[4] || (_cache[4] = [createElementVNode("i", { class: "iconfont icon-sousuo1" }, null, -1)])]),
177
+ _: 1
178
+ }, 8, [
179
+ "value",
180
+ "class",
181
+ "placeholder"
182
+ ])], 2),
183
+ createElementVNode("div", { class: normalizeClass([unref(ns).e("tree-container")]) }, [treeData.value.length ? (openBlock(), createBlock(unref(TreeEx), {
184
+ key: 0,
185
+ ref_key: "treeExRef",
186
+ ref: treeExRef,
187
+ "selected-keys": selectedKeys.value,
188
+ "onUpdate:selectedKeys": _cache[1] || (_cache[1] = ($event) => selectedKeys.value = $event),
189
+ "expanded-keys": selfExpandedKeys.value,
190
+ "onUpdate:expandedKeys": _cache[2] || (_cache[2] = ($event) => selfExpandedKeys.value = $event),
191
+ class: normalizeClass([unref(ns).e("tree"), __props.draggable && "draggable-tree"]),
192
+ draggable: __props.draggable,
193
+ data: treeData.value,
194
+ "last-selection-locked": "",
195
+ filter: searchKey.value ? searchKey.value.trim() : "",
196
+ "ignore-case": __props.ignoreCase,
197
+ onDrop,
198
+ onSelect: handleSelect
199
+ }, {
200
+ title: withCtx(({ node }) => [createElementVNode("div", { class: normalizeClass([unref(ns).b("tree-node"), unref(ns).is("highlight", highlightId.value === node.key)]) }, [createElementVNode("span", {
201
+ class: normalizeClass([unref(ns).be("tree-node", "title")]),
202
+ title: node.title
203
+ }, toDisplayString(node.title), 11, _hoisted_1), !__props.readonly && (__props.hasPerBtns.includes(unref(BasicAction).Update) || __props.hasPerBtns.includes(unref(BasicAction).Delete)) ? (openBlock(), createBlock(_component_a_dropdown, {
204
+ key: 0,
205
+ class: normalizeClass([unref(ns).be("tree-node", "more")]),
206
+ onVisibleChange: ($event) => onMenuVisibleChange($event, node.key)
207
+ }, {
208
+ overlay: withCtx(() => [createVNode(_component_a_menu, {
209
+ style: { "width": "102px" },
210
+ onClick: ($event) => onTreeMenuClick(node, $event)
211
+ }, {
212
+ default: withCtx(() => [__props.hasPerBtns.includes(unref(BasicAction).Update) ? (openBlock(), createBlock(_component_a_menu_item, { key: MenuClickEvent.EDIT }, {
213
+ default: withCtx(() => [createTextVNode(toDisplayString(unref($t)("sys.component.dataConnection.rename")), 1)]),
214
+ _: 1
215
+ })) : createCommentVNode("", true), __props.hasPerBtns.includes(unref(BasicAction).Delete) ? (openBlock(), createBlock(_component_a_menu_item, { key: MenuClickEvent.DELETE }, {
216
+ default: withCtx(() => [createTextVNode(toDisplayString(unref($t)("sys.delText")), 1)]),
217
+ _: 1
218
+ })) : createCommentVNode("", true)]),
219
+ _: 1
220
+ }, 8, ["onClick"])]),
221
+ default: withCtx(() => [createVNode(_component_ellipsis_outlined)]),
222
+ _: 2
223
+ }, 1032, ["class", "onVisibleChange"])) : createCommentVNode("", true)], 2)]),
224
+ _: 1
225
+ }, 8, [
226
+ "selected-keys",
227
+ "expanded-keys",
228
+ "class",
229
+ "draggable",
230
+ "data",
231
+ "filter",
232
+ "ignore-case"
233
+ ])) : createCommentVNode("", true)], 2)
234
+ ], 2);
235
+ };
236
+ }
237
+ });
238
+ //#endregion
239
+ export { category_sider_vue_vue_type_script_setup_true_name_category_sider_lang_default as default };