@fecp/mobile 1.1.34 → 1.1.36

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.
@@ -0,0 +1,282 @@
1
+ /* empty css */
2
+ /* empty css */
3
+ /* empty css */
4
+ /* empty css */
5
+ /* empty css */
6
+ import { ref, watch, computed, createElementBlock, openBlock, createElementVNode, createBlock, createCommentVNode, unref, withCtx, Fragment, renderList, normalizeClass, toDisplayString, nextTick } from "vue";
7
+ /* empty css */
8
+ import _export_sfc from "../../../../../../_virtual/_plugin-vue_export-helper.mjs";
9
+ import { Steps } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/steps/index.mjs";
10
+ import { Step } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/step/index.mjs";
11
+ import { Icon } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/icon/index.mjs";
12
+ const _hoisted_1 = { class: "time-line-filter" };
13
+ const _hoisted_2 = { class: "line-selected-content" };
14
+ const _hoisted_3 = { class: "custom-item" };
15
+ const _hoisted_4 = { class: "line-list-content" };
16
+ const _hoisted_5 = ["onClick"];
17
+ const _sfc_main = {
18
+ __name: "TimeLineFilter",
19
+ props: {
20
+ data: {
21
+ type: Array,
22
+ default: []
23
+ },
24
+ option: {
25
+ type: Object,
26
+ default: {
27
+ id: "id",
28
+ name: "name",
29
+ pid: "pid",
30
+ isLeaf: "isLeaf"
31
+ }
32
+ },
33
+ modelValue: {
34
+ type: String,
35
+ default: ""
36
+ }
37
+ },
38
+ emits: ["update:modelValue"],
39
+ setup(__props, { emit: __emit }) {
40
+ const props = __props;
41
+ const emit = __emit;
42
+ const selectedList = ref([]);
43
+ const targetId = ref("0");
44
+ const listDataActId = ref("");
45
+ const stepsActive = ref(0);
46
+ let isDown = true;
47
+ watch(
48
+ [() => props.modelValue, () => props.data],
49
+ ([value, data]) => {
50
+ if (value && data.length > 0 && isDown) {
51
+ const ids = value.split(",");
52
+ selectedList.value = data.filter((item) => ids.includes(item.id + ""));
53
+ selectedList.value = selectedList.value.map((s) => {
54
+ s.isAct = false;
55
+ return s;
56
+ });
57
+ const lastNode = selectedList.value[selectedList.value.length - 1];
58
+ const maxLevel = getMaxLevel(data);
59
+ if (ids.length < maxLevel && (lastNode == null ? void 0 : lastNode.isLeaf) != true) {
60
+ targetId.value = ids[ids.length - 1];
61
+ selectedList.value.push({
62
+ id: "pleaseSelect",
63
+ name: "请选择",
64
+ hollow: true,
65
+ isAct: true,
66
+ pid: targetId.value
67
+ });
68
+ } else {
69
+ selectedList.value[selectedList.value.length - 1].isAct = true;
70
+ targetId.value = ids[ids.length - 2];
71
+ }
72
+ listDataActId.value = selectedList.value[selectedList.value.length - 1].id;
73
+ stepsActive.value = selectedList.value.length - 1;
74
+ }
75
+ },
76
+ {
77
+ immediate: true
78
+ }
79
+ );
80
+ function getMaxLevel(list) {
81
+ const map = {};
82
+ let maxLevel = 0;
83
+ list.forEach((item) => {
84
+ map[item.id] = { pid: item.pid, lvl: 0 };
85
+ });
86
+ list.forEach((item) => {
87
+ let currentId = item.id;
88
+ let level = 1;
89
+ while (map[currentId] && map[currentId].pid != "0") {
90
+ currentId = map[currentId].pid;
91
+ level++;
92
+ }
93
+ map[item.id].lvl = level;
94
+ if (level > maxLevel) {
95
+ maxLevel = level;
96
+ }
97
+ });
98
+ return maxLevel;
99
+ }
100
+ function getChildrenById(tree, targetId2) {
101
+ if (!targetId2 || targetId2 == 0) {
102
+ return tree;
103
+ }
104
+ function findNode(node) {
105
+ if (node.id == targetId2) {
106
+ return node.children;
107
+ }
108
+ for (const child of node.children) {
109
+ const result = findNode(child);
110
+ if (result) {
111
+ return result;
112
+ }
113
+ }
114
+ return null;
115
+ }
116
+ for (const root of tree) {
117
+ const children = findNode(root);
118
+ if (children) {
119
+ return children;
120
+ }
121
+ }
122
+ return null;
123
+ }
124
+ function getNodeById(tree, id) {
125
+ if (Array.isArray(tree)) {
126
+ for (let i = 0; i < tree.length; i++) {
127
+ const node = tree[i];
128
+ if (node.id === id) {
129
+ return node;
130
+ }
131
+ if (node.children && node.children.length > 0) {
132
+ const found = getNodeById(node.children, id);
133
+ if (found) {
134
+ return found;
135
+ }
136
+ }
137
+ }
138
+ }
139
+ return null;
140
+ }
141
+ const treeData = computed(() => {
142
+ return listToTree(props.data);
143
+ });
144
+ const listData = computed(() => {
145
+ return getChildrenById(treeData.value, targetId.value);
146
+ });
147
+ function clickListItem(item) {
148
+ isDown = true;
149
+ if (selectedList.value.length >= item.lvl) {
150
+ selectedList.value = selectedList.value.slice(0, item.lvl - 1);
151
+ }
152
+ selectedList.value.push(item);
153
+ const selectedIdList = selectedList.value.map((s) => s.id);
154
+ emit("update:modelValue", "");
155
+ nextTick(() => {
156
+ emit("update:modelValue", selectedIdList.join(","));
157
+ });
158
+ }
159
+ function clickSelectedItem(item) {
160
+ if (item.id == "pleaseSelect") {
161
+ const t = getNodeById(treeData.value, item.pid);
162
+ clickListItem(t);
163
+ return;
164
+ }
165
+ isDown = false;
166
+ targetId.value = item.pid;
167
+ const index = selectedList.value.findIndex((t) => t.id === item.id);
168
+ if (index !== -1) {
169
+ selectedList.value.splice(index + 1);
170
+ }
171
+ listDataActId.value = item.id;
172
+ selectedList.value.forEach((s) => {
173
+ s.isAct = false;
174
+ if (item.id == s.id) {
175
+ s.isAct = true;
176
+ }
177
+ });
178
+ const selectedIdList = selectedList.value.map((s) => s.id);
179
+ const maxLevel = getMaxLevel(props.data);
180
+ if (selectedIdList.length < maxLevel) {
181
+ selectedList.value.push({
182
+ id: "pleaseSelect",
183
+ name: "请选择",
184
+ hollow: true,
185
+ isAct: false,
186
+ pid: item.id
187
+ });
188
+ }
189
+ emit("update:modelValue", "");
190
+ nextTick(() => {
191
+ emit("update:modelValue", selectedIdList.join(","));
192
+ });
193
+ }
194
+ function listToTree(list) {
195
+ const map = {};
196
+ const tree = [];
197
+ list = list.map((item) => {
198
+ const temp = {
199
+ id: item[props.option.id],
200
+ name: item[props.option.name],
201
+ pid: item[props.option.pid],
202
+ ...item
203
+ };
204
+ return temp;
205
+ });
206
+ list.forEach((item) => {
207
+ map[item.id] = { ...item, children: [], lvl: 0 };
208
+ });
209
+ list.forEach((item) => {
210
+ const node = map[item.id];
211
+ const parentId = item.pid;
212
+ if (parentId == "0") {
213
+ node.lvl = 1;
214
+ tree.push(node);
215
+ } else {
216
+ const parent = map[parentId];
217
+ if (parent) {
218
+ node.lvl = parent.lvl + 1;
219
+ parent.children.push(node);
220
+ }
221
+ }
222
+ });
223
+ return tree;
224
+ }
225
+ return (_ctx, _cache) => {
226
+ const _component_van_icon = Icon;
227
+ const _component_van_step = Step;
228
+ const _component_van_steps = Steps;
229
+ return openBlock(), createElementBlock("div", _hoisted_1, [
230
+ createElementVNode("div", _hoisted_2, [
231
+ unref(selectedList).length > 0 ? (openBlock(), createBlock(_component_van_steps, {
232
+ key: 0,
233
+ direction: "vertical",
234
+ active: unref(stepsActive),
235
+ class: "selected-time-line"
236
+ }, {
237
+ default: withCtx(() => [
238
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(selectedList), (item, index) => {
239
+ return openBlock(), createBlock(_component_van_step, {
240
+ onClick: ($event) => clickSelectedItem(item)
241
+ }, {
242
+ default: withCtx(() => [
243
+ createElementVNode("div", _hoisted_3, [
244
+ createElementVNode("span", {
245
+ class: normalizeClass(["label", { act: item.isAct || item.id == unref(listDataActId) }])
246
+ }, toDisplayString(item.name), 3),
247
+ item.isAct || item.id == unref(listDataActId) ? (openBlock(), createBlock(_component_van_icon, {
248
+ key: 0,
249
+ name: "arrow",
250
+ color: "#ccc"
251
+ })) : createCommentVNode("", true)
252
+ ])
253
+ ]),
254
+ _: 2
255
+ }, 1032, ["onClick"]);
256
+ }), 256))
257
+ ]),
258
+ _: 1
259
+ }, 8, ["active"])) : createCommentVNode("", true)
260
+ ]),
261
+ createElementVNode("div", _hoisted_4, [
262
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(listData), (item) => {
263
+ return openBlock(), createElementBlock("div", {
264
+ class: normalizeClass(["line-list-item", { act: item.id == unref(listDataActId) }]),
265
+ onClick: ($event) => clickListItem(item)
266
+ }, [
267
+ createElementVNode("span", null, toDisplayString(item.name), 1),
268
+ item.id == unref(listDataActId) ? (openBlock(), createBlock(_component_van_icon, {
269
+ key: 0,
270
+ name: "success"
271
+ })) : createCommentVNode("", true)
272
+ ], 10, _hoisted_5);
273
+ }), 256))
274
+ ])
275
+ ]);
276
+ };
277
+ }
278
+ };
279
+ const _TimeLineFilter = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c5b57ddb"]]);
280
+ export {
281
+ _TimeLineFilter as default
282
+ };
@@ -0,0 +1,10 @@
1
+ import _TimeLineFilter from "./TimeLineFilter.vue.mjs";
2
+ import install from "../../../utils/install.mjs";
3
+ const MobileTimeLineFilter = install.withInstall(
4
+ "MobileTimeLineFilter",
5
+ _TimeLineFilter
6
+ );
7
+ export {
8
+ MobileTimeLineFilter,
9
+ MobileTimeLineFilter as default
10
+ };
@@ -122,10 +122,18 @@ const _sfc_main = {
122
122
  default: false
123
123
  }
124
124
  },
125
- emits: ["update:modelValue", "deleteRow", "editRow"],
125
+ emits: [
126
+ "update:modelValue",
127
+ "deleteRow",
128
+ "editRow",
129
+ "clickCell"
130
+ ],
126
131
  setup(__props, { emit: __emit }) {
127
132
  const props = __props;
128
133
  const emit = __emit;
134
+ function cellClickEvent({ row, column }) {
135
+ emit("clickCell", { row, column });
136
+ }
129
137
  const compHeight = computed(() => {
130
138
  if (props.autoHeight) {
131
139
  return "100%";
@@ -448,6 +456,7 @@ const _sfc_main = {
448
456
  ref_key: "gridRef",
449
457
  ref: gridRef,
450
458
  class: "fec-table",
459
+ width: "100%",
451
460
  "auto-resize": "",
452
461
  data: unref(tableData),
453
462
  columns: unref(columnOptions),
@@ -463,7 +472,8 @@ const _sfc_main = {
463
472
  loading: unref(initLoading),
464
473
  showHeader: __props.showHeader,
465
474
  onScrollBoundary: onScrollLoads,
466
- virtualYConfig
475
+ virtualYConfig,
476
+ onCellClick: cellClickEvent
467
477
  }, createSlots({
468
478
  loading: withCtx(() => [
469
479
  _cache[2] || (_cache[2] = createElementVNode("div", {
@@ -539,7 +549,7 @@ const _sfc_main = {
539
549
  };
540
550
  }
541
551
  };
542
- const _Table = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a3ac8e87"]]);
552
+ const _Table = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2f2534dc"]]);
543
553
  export {
544
554
  _Table as default
545
555
  };