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