@gct-paas/render-mobile 0.1.5-dev.2 → 0.1.5-dev.3

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 (55) hide show
  1. package/dist/index.min.css +2 -0
  2. package/dist/loader.esm.min.js +1 -1
  3. package/es/_virtual/_plugin-vue_export-helper.mjs +8 -0
  4. package/es/components/form-component/FieldCheckbox.d.ts +36 -0
  5. package/es/components/form-component/FieldCheckbox.mjs +74 -0
  6. package/es/components/form-component/FieldRadio.d.ts +37 -0
  7. package/es/components/form-component/FieldRadio.mjs +73 -0
  8. package/es/components/form-component/FieldSelect.d.ts +110 -0
  9. package/es/components/form-component/FieldSelect.mjs +170 -0
  10. package/es/components/form-component/index.css +32 -0
  11. package/es/components/form-component/index.d.ts +5 -0
  12. package/es/components/form-component/index.mjs +4 -0
  13. package/es/components/form-component/tag-label.vue.d.ts +26 -0
  14. package/es/components/form-component/tag-label.vue.mjs +7 -0
  15. package/es/components/form-component/tag-label.vue_vue_type_script_setup_true_lang.mjs +135 -0
  16. package/es/components/form-component/tag-label.vue_vue_type_style_index_0_scoped_42ed8aa7_lang.css +18 -0
  17. package/es/components/form-component/tag-span.vue.d.ts +21 -0
  18. package/es/components/form-component/tag-span.vue.mjs +7 -0
  19. package/es/components/form-component/tag-span.vue_vue_type_script_setup_true_lang.mjs +25 -0
  20. package/es/components/form-component/tag-span.vue_vue_type_style_index_0_scoped_1f0f2305_lang.css +31 -0
  21. package/es/components/index.d.ts +3 -0
  22. package/es/components/index.mjs +8 -0
  23. package/es/components/timePicker/index.d.ts +4 -0
  24. package/es/components/timePicker/index.mjs +34 -0
  25. package/es/components/timePicker/src/timePicker.vue.d.ts +4 -0
  26. package/es/components/timePicker/src/timePicker.vue.mjs +5 -0
  27. package/es/components/timePicker/src/timePicker.vue_vue_type_script_setup_true_name_timePicker_lang.mjs +82 -0
  28. package/es/components/timePicker/src/typing.d.ts +13 -0
  29. package/es/components/timePicker/src/typing.mjs +1 -0
  30. package/es/components/treePopup/index.d.ts +5 -0
  31. package/es/components/treePopup/index.mjs +35 -0
  32. package/es/components/treePopup/src/components/selectList.vue.d.ts +11 -0
  33. package/es/components/treePopup/src/components/selectList.vue.mjs +7 -0
  34. package/es/components/treePopup/src/components/selectList.vue_vue_type_script_setup_true_name_selectList_lang.mjs +62 -0
  35. package/es/components/treePopup/src/components/selectList.vue_vue_type_style_index_0_scoped_04a58132_lang.css +10 -0
  36. package/es/components/treePopup/src/components/treeItem.vue.d.ts +12 -0
  37. package/es/components/treePopup/src/components/treeItem.vue.mjs +7 -0
  38. package/es/components/treePopup/src/components/treeItem.vue_vue_type_script_setup_true_name_treeItem_lang.mjs +70 -0
  39. package/es/components/treePopup/src/components/treeItem.vue_vue_type_style_index_0_scoped_950c3131_lang.css +17 -0
  40. package/es/components/treePopup/src/components/treeList.vue.d.ts +19 -0
  41. package/es/components/treePopup/src/components/treeList.vue.mjs +7 -0
  42. package/es/components/treePopup/src/components/treeList.vue_vue_type_script_setup_true_name_treelist_lang.mjs +61 -0
  43. package/es/components/treePopup/src/components/treeList.vue_vue_type_style_index_0_scoped_469e28be_lang.css +20 -0
  44. package/es/components/treePopup/src/treeCheck.vue.d.ts +71 -0
  45. package/es/components/treePopup/src/treeCheck.vue.mjs +7 -0
  46. package/es/components/treePopup/src/treeCheck.vue_vue_type_script_setup_true_lang.mjs +276 -0
  47. package/es/components/treePopup/src/treeCheck.vue_vue_type_style_index_0_scoped_00b864e8_lang.css +29 -0
  48. package/es/components/treePopup/src/treePopup.vue.d.ts +103 -0
  49. package/es/components/treePopup/src/treePopup.vue.mjs +6 -0
  50. package/es/components/treePopup/src/treePopup.vue_vue_type_script_setup_true_name_treePopup_lang.mjs +129 -0
  51. package/es/components/treePopup/src/treePopup.vue_vue_type_style_index_0_lang.css +7 -0
  52. package/es/components/treePopup/src/typing.d.ts +53 -0
  53. package/es/components/treePopup/src/typing.mjs +13 -0
  54. package/es/index.mjs +8 -1
  55. package/package.json +20 -18
@@ -0,0 +1,276 @@
1
+ import { SelectType } from "./typing.mjs";
2
+ import treeList_default from "./components/treeList.vue.mjs";
3
+ import treeItem_default from "./components/treeItem.vue.mjs";
4
+ import selectList_default from "./components/selectList.vue.mjs";
5
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, onMounted, openBlock, reactive, ref, renderList, resolveComponent, toDisplayString, unref, vShow, withCtx, withDirectives } from "vue";
6
+ //#region src/components/treePopup/src/treeCheck.vue?vue&type=script&setup=true&lang.ts
7
+ var _hoisted_1 = { class: "pt50px flex flex-col h-full" };
8
+ var _hoisted_2 = { class: "text-left text-16px font-bold p12px absolute title" };
9
+ var _hoisted_3 = { class: "overflow-y-auto flex-1" };
10
+ var _hoisted_4 = { class: "w-full p-12px shadow-top" };
11
+ var _hoisted_5 = {
12
+ key: 0,
13
+ class: "pb-12px"
14
+ };
15
+ var _hoisted_6 = { class: "pr-8px text-sm mr-8px border-r" };
16
+ var _hoisted_7 = { style: { "color": "var(--van-primary-color)" } };
17
+ var treeCheck_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
18
+ __name: "treeCheck",
19
+ props: {
20
+ options: {},
21
+ activeKey: {},
22
+ activeKeys: {},
23
+ title: {},
24
+ type: {},
25
+ hasNoLabels: { type: Boolean },
26
+ ignoreCase: {},
27
+ maxTagTextLength: {}
28
+ },
29
+ emits: ["checked"],
30
+ setup(__props, { emit: __emit }) {
31
+ const props = __props;
32
+ const searchValue = ref("");
33
+ const multipleKeys = ref([]);
34
+ const treeSingleData = ref([]);
35
+ const checkedSingleData = ref([]);
36
+ const treeListRef = ref();
37
+ const selectData = ref([]);
38
+ const emit = __emit;
39
+ const tree2list = (arr) => {
40
+ let cloneTree = JSON.parse(JSON.stringify(arr));
41
+ function iteration(tree, level) {
42
+ let temp = [];
43
+ for (const i of tree) {
44
+ i.level = level;
45
+ temp.push(i);
46
+ if (i.children?.length) temp = [...temp, ...iteration(i.children, level + 1)];
47
+ }
48
+ return temp;
49
+ }
50
+ return iteration(cloneTree, 1);
51
+ };
52
+ const optionList = reactive(tree2list(props.options));
53
+ const addKey = (arr) => arr.map((item) => {
54
+ if (props.activeKeys.includes(item.value)) multipleKeys.value.push(item);
55
+ return {
56
+ label: item.label,
57
+ value: item.value,
58
+ parentId: item.parentId,
59
+ _item: item._item,
60
+ checked: !!props.activeKeys.includes(item.value),
61
+ expand: true,
62
+ children: item.children?.length ? addKey(item.children) : []
63
+ };
64
+ });
65
+ const addAttr2TreeData = (arr) => {
66
+ let tree = [];
67
+ const arrClone = JSON.parse(JSON.stringify(arr));
68
+ if (props.type === SelectType.MULTIPLE) tree = addKey(arrClone);
69
+ else tree = arrClone;
70
+ return tree;
71
+ };
72
+ const treeData = reactive(addAttr2TreeData(props.options));
73
+ onMounted(() => {
74
+ if (props.type === SelectType.SINGLE) {
75
+ const findItem = optionList.find((i) => i.value === props.activeKey);
76
+ if (props.activeKey && findItem && findItem?.parentId !== "ROOT") {
77
+ getfatherData(treeData, findItem, findItem?.parentId);
78
+ checkedSingleData.value = getFatherChecked(findItem.parentId, []) || [];
79
+ } else {
80
+ treeSingleData.value = treeData;
81
+ checkedSingleData.value = [];
82
+ }
83
+ }
84
+ });
85
+ const isDisabled = computed(() => {
86
+ if (props.type === SelectType.SINGLE) if (!treeListRef.value?.active) return optionList.some((i) => i?.noSelectable);
87
+ else return !!optionList.find((i) => i.value === treeListRef.value?.active)?.noSelectable;
88
+ return false;
89
+ });
90
+ /**
91
+ * 单选操作开始-------------------------------------------------------------------
92
+ */
93
+ function getFatherChecked(pid, fathers) {
94
+ const fatherItem = optionList.find((i) => i.value === pid) || {};
95
+ fathers.unshift(fatherItem);
96
+ if (fatherItem.parentId === "ROOT") return fathers;
97
+ return getFatherChecked(fatherItem.parentId, fathers);
98
+ }
99
+ const checkTreeData = (value, pid) => {
100
+ treeSingleData.value = value;
101
+ if (pid && pid !== "ROOT") checkedSingleData.value = getFatherChecked(pid, []) || [];
102
+ };
103
+ const getfatherData = (arr, value, pid) => {
104
+ for (const val of arr) if (pid && val.value === pid) {
105
+ treeSingleData.value = val.children;
106
+ return;
107
+ } else getfatherData(val.children, value, pid);
108
+ };
109
+ const getBackData = (value, pid) => {
110
+ if (pid && pid === "ROOT") {
111
+ checkedSingleData.value = [];
112
+ treeSingleData.value = treeData;
113
+ } else {
114
+ getfatherData(treeData, value, pid);
115
+ checkedSingleData.value = getFatherChecked(value.parentId, []) || [];
116
+ }
117
+ };
118
+ function setSelVal(val) {
119
+ searchValue.value = "";
120
+ if (props.type === SelectType.SINGLE) {
121
+ getBackData(val, val.parentId);
122
+ const findItem = treeSingleData.value.find((item) => item.value === val.value);
123
+ treeListRef.value?.setVal(findItem);
124
+ } else for (const i of val) setMulTreeCheck(treeData, i, i.checked);
125
+ }
126
+ /**
127
+ * 单选操作结束----------------------------------------------------------------------------
128
+ * 多选操作开始----------------------------------------------------------------------------
129
+ */
130
+ function setMulTreeCheck(arr, value, checked) {
131
+ for (const val of arr) if (val.value === value.value) {
132
+ val.checked = checked;
133
+ if (val.checked) multipleKeys.value.push(val);
134
+ else multipleKeys.value = multipleKeys.value.filter((val) => val.value !== value.value);
135
+ return;
136
+ } else if (val.children?.length) setMulTreeCheck(val.children, value, checked);
137
+ }
138
+ function setMulTreeData(val, checked) {
139
+ setMulTreeCheck(treeData, val, checked);
140
+ }
141
+ function setMulToggle(arr, value) {
142
+ for (const val of arr) if (val.value === value.value) {
143
+ val.expand = !val.expand;
144
+ return;
145
+ } else if (val.children?.length) setMulToggle(val.children, value);
146
+ }
147
+ function mulToggle(val) {
148
+ setMulToggle(treeData, val);
149
+ }
150
+ function close(value) {
151
+ setMulTreeCheck(treeData, value, false);
152
+ }
153
+ /**
154
+ * 多选操作结束---------------------------------------------------------------------------
155
+ */
156
+ function setVal() {
157
+ if (props.type === SelectType.SINGLE) emit("checked", treeListRef.value?.active);
158
+ else if (props.type === SelectType.MULTIPLE) emit("checked", multipleKeys.value.map((item) => item.value));
159
+ }
160
+ function getParentLabels(arr, pid, labels) {
161
+ for (const item of arr) if (pid === item.value) {
162
+ labels.push(item.label);
163
+ return labels;
164
+ } else {
165
+ const options = item.children.length && getParentLabels(item.children, pid, labels);
166
+ if (options) return options;
167
+ }
168
+ }
169
+ function treeFilter(tree, func, list) {
170
+ for (const item of tree) {
171
+ if (func(item)) list.push(item);
172
+ if (item.children?.length) treeFilter(item.children, func, list);
173
+ }
174
+ return list;
175
+ }
176
+ const onSearch = (val) => {
177
+ let options = [];
178
+ if (props.type == SelectType.SINGLE) if (props.ignoreCase) options = optionList.filter((i) => i.label?.toLowerCase().indexOf(val.toLowerCase()) !== -1) || [];
179
+ else options = optionList.filter((i) => i.label.indexOf(val) !== -1) || [];
180
+ else options = treeFilter(treeData, (data) => {
181
+ if (props.ignoreCase) return data.label?.toLowerCase().indexOf(val.toLowerCase()) !== -1;
182
+ return data.label?.indexOf(val) !== -1;
183
+ }, []) || [];
184
+ for (const item of options) {
185
+ if (item.parentId && item.parentId === "ROOT") {
186
+ item.labels = "";
187
+ continue;
188
+ }
189
+ if (props.hasNoLabels) item.labels = "";
190
+ else item.labels = getParentLabels(treeData, item.parentId, [])?.join("/");
191
+ }
192
+ selectData.value = JSON.parse(JSON.stringify(options));
193
+ selectData.value.forEach((i) => {
194
+ i.label = ((i.label?.split(new RegExp(`(${val})`, "gi")))?.map((part, index) => part.toLowerCase() === val.toLowerCase() ? `<span key=${index} style='color: var(--van-primary-color);'>${part}</span>` : part))?.join("");
195
+ });
196
+ };
197
+ const handleLabel = (label) => {
198
+ if (props.maxTagTextLength && label.length > props.maxTagTextLength) return label.slice(0, props.maxTagTextLength) + "...";
199
+ return label;
200
+ };
201
+ return (_ctx, _cache) => {
202
+ const _component_van_search = resolveComponent("van-search");
203
+ const _component_van_icon = resolveComponent("van-icon");
204
+ const _component_van_tag = resolveComponent("van-tag");
205
+ const _component_van_button = resolveComponent("van-button");
206
+ return openBlock(), createElementBlock("div", _hoisted_1, [
207
+ createElementVNode("div", _hoisted_2, toDisplayString(props.title), 1),
208
+ createVNode(_component_van_search, {
209
+ modelValue: searchValue.value,
210
+ "onUpdate:modelValue": [_cache[0] || (_cache[0] = ($event) => searchValue.value = $event), onSearch],
211
+ class: normalizeClass({ "border-all": searchValue.value }),
212
+ shape: "round",
213
+ "left-icon": searchValue.value ? "" : "search",
214
+ placeholder: "请输入"
215
+ }, null, 8, [
216
+ "modelValue",
217
+ "class",
218
+ "left-icon"
219
+ ]),
220
+ createElementVNode("div", _hoisted_3, [
221
+ withDirectives(createVNode(treeList_default, {
222
+ ref_key: "treeListRef",
223
+ ref: treeListRef,
224
+ "checked-single-data": checkedSingleData.value,
225
+ "tree-single-data": treeSingleData.value,
226
+ "active-key": __props.activeKey,
227
+ type: __props.type,
228
+ onCheckTreeData: checkTreeData,
229
+ onGetBackData: getBackData
230
+ }, null, 8, [
231
+ "checked-single-data",
232
+ "tree-single-data",
233
+ "active-key",
234
+ "type"
235
+ ]), [[vShow, __props.type === unref(SelectType).SINGLE && !searchValue.value.length]]),
236
+ withDirectives(createElementVNode("div", null, [createVNode(treeItem_default, {
237
+ "tree-data": treeData,
238
+ onSetMulTreeData: setMulTreeData,
239
+ onMulToggle: mulToggle
240
+ }, null, 8, ["tree-data"])], 512), [[vShow, __props.type === unref(SelectType).MULTIPLE && !searchValue.value.length]]),
241
+ withDirectives(createVNode(selectList_default, {
242
+ ref: "selectListRef",
243
+ "select-data": selectData.value,
244
+ type: __props.type,
245
+ onSetSelectData: setSelVal
246
+ }, null, 8, ["select-data", "type"]), [[vShow, searchValue.value.length]])
247
+ ]),
248
+ withDirectives(createElementVNode("div", _hoisted_4, [__props.type === unref(SelectType).MULTIPLE && multipleKeys.value.length ? (openBlock(), createElementBlock("div", _hoisted_5, [createElementVNode("span", _hoisted_6, [_cache[1] || (_cache[1] = createTextVNode(" 已选 ", -1)), createElementVNode("span", _hoisted_7, [createTextVNode(toDisplayString(multipleKeys.value.length) + " ", 1), createVNode(_component_van_icon, { name: "arrow-up" })])]), (openBlock(true), createElementBlock(Fragment, null, renderList(multipleKeys.value, (item, index) => {
249
+ return openBlock(), createBlock(_component_van_tag, {
250
+ key: item.label + "_" + index,
251
+ class: "mx-2px px-2px",
252
+ size: "medium",
253
+ round: "",
254
+ color: "color-mix(in oklch, var(--van-primary-color), transparent 92%)",
255
+ "text-color": "var(--van-primary-color)",
256
+ closeable: "",
257
+ onClose: ($event) => close(item)
258
+ }, {
259
+ default: withCtx(() => [createTextVNode(toDisplayString(handleLabel(item.label)), 1)]),
260
+ _: 2
261
+ }, 1032, ["onClose"]);
262
+ }), 128))])) : createCommentVNode("", true), createVNode(_component_van_button, {
263
+ class: "w-full px-4px",
264
+ type: "primary",
265
+ disabled: isDisabled.value,
266
+ onClick: setVal
267
+ }, {
268
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("完成", -1)])]),
269
+ _: 1
270
+ }, 8, ["disabled"])], 512), [[vShow, !searchValue.value.length]])
271
+ ]);
272
+ };
273
+ }
274
+ });
275
+ //#endregion
276
+ export { treeCheck_vue_vue_type_script_setup_true_lang_default as default };
@@ -0,0 +1,29 @@
1
+ .title[data-v-00b864e8] {
2
+ z-index: 1;
3
+ top: 0;
4
+ width: 100%;
5
+ }
6
+ .title[data-v-00b864e8]:after {
7
+ position: absolute;
8
+ box-sizing: border-box;
9
+ content: ' ';
10
+ pointer-events: none;
11
+ right: 0;
12
+ bottom: 0;
13
+ left: 0;
14
+ border-bottom: 1px solid var(--van-cell-border-color);
15
+ }
16
+ .shadow-top[data-v-00b864e8] {
17
+ box-shadow: 0px -1px 4px 0px rgba(0, 0, 0, 0.12);
18
+ }
19
+ .border-r[data-v-00b864e8] {
20
+ border-right: 1px solid #eaeaea;
21
+ }
22
+ [data-v-00b864e8] .van-search.border-all .van-search__content {
23
+ border: 1px solid var(--van-primary-color);
24
+ background: transparent;
25
+ }
26
+ [data-v-00b864e8] .van-search .van-search__content:focus {
27
+ border: 1px solid var(--van-primary-color);
28
+ background: transparent;
29
+ }
@@ -0,0 +1,103 @@
1
+ import { optionType } from './typing';
2
+ type __VLS_Props = {
3
+ api: Fn;
4
+ title: string;
5
+ options: optionType[];
6
+ fieldKey: string;
7
+ modelKey: string;
8
+ isTreeData?: boolean;
9
+ hasNoLabels?: boolean;
10
+ ignoreCase?: number;
11
+ };
12
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {
13
+ singleTreeOpen: ({ ids, type, callback }: IObject) => void;
14
+ multipleTreeOpen: ({ ids, type, callback }: IObject) => Promise<void>;
15
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
16
+ treeCheckRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
17
+ options: optionType[];
18
+ activeKey: string;
19
+ activeKeys: string[];
20
+ title: string;
21
+ type: string;
22
+ hasNoLabels?: boolean;
23
+ ignoreCase?: number;
24
+ maxTagTextLength?: number;
25
+ }> & Readonly<{
26
+ onChecked?: ((...args: any[]) => any) | undefined;
27
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
28
+ checked: (...args: any[]) => void;
29
+ }, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
30
+ treeListRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
31
+ checkedSingleData: optionType[];
32
+ treeSingleData: optionType[];
33
+ activeKey: string;
34
+ type: string;
35
+ }> & Readonly<{
36
+ onCheckTreeData?: ((...args: any[]) => any) | undefined;
37
+ onGetBackData?: ((...args: any[]) => any) | undefined;
38
+ }>, {
39
+ active: import('vue').Ref<string, string>;
40
+ setVal: (value: IObject) => void;
41
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
42
+ checkTreeData: (...args: any[]) => void;
43
+ getBackData: (...args: any[]) => void;
44
+ }, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
45
+ P: {};
46
+ B: {};
47
+ D: {};
48
+ C: {};
49
+ M: {};
50
+ Defaults: {};
51
+ }, Readonly<{
52
+ checkedSingleData: optionType[];
53
+ treeSingleData: optionType[];
54
+ activeKey: string;
55
+ type: string;
56
+ }> & Readonly<{
57
+ onCheckTreeData?: ((...args: any[]) => any) | undefined;
58
+ onGetBackData?: ((...args: any[]) => any) | undefined;
59
+ }>, {
60
+ active: import('vue').Ref<string, string>;
61
+ setVal: (value: IObject) => void;
62
+ }, {}, {}, {}, {}> | null;
63
+ selectListRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
64
+ selectData: optionType[];
65
+ type: string;
66
+ }> & Readonly<{
67
+ onSetSelectData?: ((...args: any[]) => any) | undefined;
68
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
69
+ setSelectData: (...args: any[]) => void;
70
+ }, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
71
+ P: {};
72
+ B: {};
73
+ D: {};
74
+ C: {};
75
+ M: {};
76
+ Defaults: {};
77
+ }, Readonly<{
78
+ selectData: optionType[];
79
+ type: string;
80
+ }> & Readonly<{
81
+ onSetSelectData?: ((...args: any[]) => any) | undefined;
82
+ }>, {}, {}, {}, {}, {}> | null;
83
+ }, HTMLDivElement, import('vue').ComponentProvideOptions, {
84
+ P: {};
85
+ B: {};
86
+ D: {};
87
+ C: {};
88
+ M: {};
89
+ Defaults: {};
90
+ }, Readonly<{
91
+ options: optionType[];
92
+ activeKey: string;
93
+ activeKeys: string[];
94
+ title: string;
95
+ type: string;
96
+ hasNoLabels?: boolean;
97
+ ignoreCase?: number;
98
+ maxTagTextLength?: number;
99
+ }> & Readonly<{
100
+ onChecked?: ((...args: any[]) => any) | undefined;
101
+ }>, {}, {}, {}, {}, {}> | null;
102
+ }, HTMLDivElement>;
103
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import treePopup_vue_vue_type_script_setup_true_name_treePopup_lang_default from "./treePopup.vue_vue_type_script_setup_true_name_treePopup_lang.mjs";
2
+ import './treePopup.vue_vue_type_style_index_0_lang.css';/* empty css */
3
+ //#region src/components/treePopup/src/treePopup.vue
4
+ var treePopup_default = treePopup_vue_vue_type_script_setup_true_name_treePopup_lang_default;
5
+ //#endregion
6
+ export { treePopup_default as default };
@@ -0,0 +1,129 @@
1
+ import { SelectType } from "./typing.mjs";
2
+ import treeCheck_default from "./treeCheck.vue.mjs";
3
+ import { useAsyncFileAttrs } from "@gct-paas/render";
4
+ import { createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, openBlock, ref, resolveComponent, unref, watch, withCtx } from "vue";
5
+ import { cloneDeep } from "lodash-es";
6
+ //#region src/components/treePopup/src/treePopup.vue?vue&type=script&setup=true&name=treePopup&lang.ts
7
+ var _hoisted_1 = { class: "tree-popup" };
8
+ var treePopup_vue_vue_type_script_setup_true_name_treePopup_lang_default = /* @__PURE__ */ defineComponent({
9
+ __name: "treePopup",
10
+ props: {
11
+ api: {},
12
+ title: {},
13
+ options: {},
14
+ fieldKey: {},
15
+ modelKey: {},
16
+ isTreeData: { type: Boolean },
17
+ hasNoLabels: { type: Boolean },
18
+ ignoreCase: {}
19
+ },
20
+ setup(__props, { expose: __expose }) {
21
+ const props = __props;
22
+ const showPopup = ref(false);
23
+ const activeKey = ref("");
24
+ const activeKeys = ref([]);
25
+ const orgOptions = ref([]);
26
+ const optionlist = ref(props.options);
27
+ let handleSingleOk;
28
+ let handleMutipleOk;
29
+ let checkedType = ref("");
30
+ const { getmaxTagLength, attrObj } = useAsyncFileAttrs();
31
+ watch(() => props.options, () => {
32
+ orgOptions.value = [...setOrgOptions()];
33
+ }, {
34
+ immediate: true,
35
+ deep: true
36
+ });
37
+ function setOrgOptions() {
38
+ let treeOptions = [];
39
+ const arrClone = cloneDeep(optionlist.value);
40
+ arrClone.forEach((i) => {
41
+ !arrClone.find((o) => o.value === i._item.parentId) && (i._item.parentId = "ROOT");
42
+ });
43
+ if (props.isTreeData) treeOptions = arrClone;
44
+ else {
45
+ const mapInfo = arrClone.reduce((obj, item) => {
46
+ item.parentId = item._item.parentId;
47
+ item.children = [];
48
+ obj[item.value] = item;
49
+ return obj;
50
+ }, {});
51
+ arrClone.forEach((i) => {
52
+ const parent = mapInfo[i.parentId];
53
+ parent ? parent.children.push(i) : treeOptions.push(i);
54
+ });
55
+ }
56
+ return treeOptions;
57
+ }
58
+ const checked = (value) => {
59
+ if (checkedType.value === SelectType.SINGLE) {
60
+ activeKey.value = value;
61
+ handleSingleOk && handleSingleOk(value);
62
+ } else if (checkedType.value === SelectType.MULTIPLE) {
63
+ activeKeys.value = value;
64
+ handleMutipleOk && handleMutipleOk(value);
65
+ }
66
+ showPopup.value = false;
67
+ };
68
+ const singleTreeOpen = ({ ids, type, callback }) => {
69
+ activeKey.value = ids || "";
70
+ checkedType.value = type;
71
+ showPopup.value = true;
72
+ handleSingleOk = callback;
73
+ };
74
+ const multipleTreeOpen = async ({ ids, type, callback }) => {
75
+ activeKeys.value = ids || [];
76
+ checkedType.value = type;
77
+ showPopup.value = true;
78
+ await getmaxTagLength({
79
+ fieldKey: props.fieldKey,
80
+ modelKey: props.modelKey
81
+ });
82
+ handleMutipleOk = callback;
83
+ };
84
+ __expose({
85
+ singleTreeOpen,
86
+ multipleTreeOpen
87
+ });
88
+ return (_ctx, _cache) => {
89
+ const _component_van_popup = resolveComponent("van-popup");
90
+ return openBlock(), createElementBlock("div", _hoisted_1, [createVNode(_component_van_popup, {
91
+ show: showPopup.value,
92
+ "onUpdate:show": _cache[0] || (_cache[0] = ($event) => showPopup.value = $event),
93
+ position: "bottom",
94
+ closeable: "",
95
+ style: {
96
+ height: "80%",
97
+ overflow: "hidden"
98
+ },
99
+ round: ""
100
+ }, {
101
+ default: withCtx(() => [showPopup.value ? (openBlock(), createBlock(treeCheck_default, {
102
+ key: 0,
103
+ ref: "treeCheckRef",
104
+ type: unref(checkedType),
105
+ options: orgOptions.value,
106
+ "active-key": activeKey.value,
107
+ "active-keys": activeKeys.value,
108
+ title: __props.title,
109
+ "has-no-labels": __props.hasNoLabels,
110
+ "ignore-case": __props.ignoreCase,
111
+ "max-tag-text-length": unref(attrObj)?.maxTagTextLength,
112
+ onChecked: checked
113
+ }, null, 8, [
114
+ "type",
115
+ "options",
116
+ "active-key",
117
+ "active-keys",
118
+ "title",
119
+ "has-no-labels",
120
+ "ignore-case",
121
+ "max-tag-text-length"
122
+ ])) : createCommentVNode("", true)]),
123
+ _: 1
124
+ }, 8, ["show"])]);
125
+ };
126
+ }
127
+ });
128
+ //#endregion
129
+ export { treePopup_vue_vue_type_script_setup_true_name_treePopup_lang_default as default };
@@ -0,0 +1,7 @@
1
+
2
+ .tree-popup > .van-popup > .van-popup__close-icon {
3
+ position: absolute;
4
+ right: 12px;
5
+ color: #c3c3c3;
6
+ font-size: 16px;
7
+ }
@@ -0,0 +1,53 @@
1
+ export interface Options extends Props {
2
+ callback?: (value: IObject) => void;
3
+ }
4
+ export interface Props {
5
+ api?: Fn;
6
+ title: string;
7
+ options?: optionType[];
8
+ fieldKey?: string;
9
+ modelKey?: string;
10
+ isTreeData?: boolean;
11
+ hasNoLabels?: boolean;
12
+ }
13
+ export interface optionType {
14
+ label: string;
15
+ value: string;
16
+ parentId?: string;
17
+ labels?: string[];
18
+ checked?: boolean;
19
+ selectable?: boolean;
20
+ _item: DeptItem;
21
+ }
22
+ export declare enum SelectType {
23
+ SINGLE = "single",
24
+ MULTIPLE = "multiple"
25
+ }
26
+ export declare enum DEPT_TYPE {
27
+ GROUP = "GROUP",
28
+ DEPARTMENT = "DEPARTMENT"
29
+ }
30
+ export interface openPickerByType {
31
+ ids?: string[] | string;
32
+ type: SelectType;
33
+ callback: openPickerByCallback;
34
+ }
35
+ export type openPickerByCallback = (value: string[] | string) => void;
36
+ export interface DeptItem {
37
+ id: string;
38
+ name: string;
39
+ parentId: string;
40
+ type: DEPT_TYPE;
41
+ sortNum?: number;
42
+ }
43
+ export interface TreeOptions {
44
+ label: string;
45
+ value: string;
46
+ labels?: string[];
47
+ _item: DeptItem;
48
+ parentId?: string;
49
+ checked?: boolean;
50
+ expand?: boolean;
51
+ selectable?: boolean;
52
+ children: TreeOptions[];
53
+ }
@@ -0,0 +1,13 @@
1
+ //#region src/components/treePopup/src/typing.ts
2
+ var SelectType = /* @__PURE__ */ function(SelectType) {
3
+ SelectType["SINGLE"] = "single";
4
+ SelectType["MULTIPLE"] = "multiple";
5
+ return SelectType;
6
+ }({});
7
+ var DEPT_TYPE = /* @__PURE__ */ function(DEPT_TYPE) {
8
+ DEPT_TYPE["GROUP"] = "GROUP";
9
+ DEPT_TYPE["DEPARTMENT"] = "DEPARTMENT";
10
+ return DEPT_TYPE;
11
+ }({});
12
+ //#endregion
13
+ export { DEPT_TYPE, SelectType };
package/es/index.mjs CHANGED
@@ -1,9 +1,16 @@
1
1
  import { setupPageEvent, usePageEvent } from "./Event/Events.mjs";
2
2
  import { createNumKeyboardPopup } from "./components/numKeyboard/index.mjs";
3
+ import tag_label_default from "./components/form-component/tag-label.vue.mjs";
4
+ import FieldSelect_default from "./components/form-component/FieldSelect.mjs";
5
+ import FieldRadio_default from "./components/form-component/FieldRadio.mjs";
6
+ import FieldCheckbox_default from "./components/form-component/FieldCheckbox.mjs";
7
+ import { DEPT_TYPE, SelectType } from "./components/treePopup/src/typing.mjs";
8
+ import { createTreePopup } from "./components/treePopup/index.mjs";
9
+ import { createTimePicker } from "./components/timePicker/index.mjs";
3
10
  import "./components/index.mjs";
4
11
  //#region src/index.ts
5
12
  function run() {
6
13
  console.log("Hello World!");
7
14
  }
8
15
  //#endregion
9
- export { createNumKeyboardPopup, run, setupPageEvent, usePageEvent };
16
+ export { DEPT_TYPE, FieldCheckbox_default as FieldCheckbox, FieldRadio_default as FieldRadio, FieldSelect_default as FieldSelect, SelectType, tag_label_default as Taglabel, createNumKeyboardPopup, createTimePicker, createTreePopup, run, setupPageEvent, usePageEvent };