@fecp/mobile 1.1.12 → 1.1.14

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.
@@ -8,13 +8,13 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
8
8
  ;/* empty css */
9
9
  ;/* empty css */
10
10
  const vue = require("vue");
11
- ;/* empty css */
12
- const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
13
11
  ;/* empty css */
14
12
  ;/* empty css */
15
13
  ;/* empty css */
16
14
  ;/* empty css */
17
15
  ;/* empty css */
16
+ ;/* empty css */
17
+ const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
18
18
  const index$1 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/swipe-cell/index.js");
19
19
  const functionCall = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/dialog/function-call.js");
20
20
  require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/dialog/index.js");
@@ -9,11 +9,22 @@ require("../../../../../../node_modules/.pnpm/vxe-table@4.13.2_vue@3.5.13_typesc
9
9
  const dataSourceUtil = require("../../../utils/dataSourceUtil.js");
10
10
  ;/* empty css */
11
11
  const formatterUtil = require("../../../utils/formatterUtil.js");
12
+ ;/* empty css */
13
+ ;/* empty css */
14
+ ;/* empty css */
15
+ ;/* empty css */
16
+ ;/* empty css */
17
+ ;/* empty css */
18
+ ;/* empty css */
19
+ ;/* empty css */
12
20
  ;/* empty css */
13
21
  const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
14
- const index$2 = require("../../../../../../node_modules/.pnpm/vxe-table@4.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/vxe-table/es/grid/index.js");
15
- const index = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/cell-group/index.js");
16
- const index$1 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/list/index.js");
22
+ const index$4 = require("../../../../../../node_modules/.pnpm/vxe-table@4.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/vxe-table/es/grid/index.js");
23
+ const index = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/swipe-cell/index.js");
24
+ const index$1 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/button/index.js");
25
+ const functionCall = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/dialog/function-call.js");
26
+ const index$2 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/cell-group/index.js");
27
+ const index$3 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/list/index.js");
17
28
  const _hoisted_1 = {
18
29
  key: 0,
19
30
  class: "van-list__finished-text"
@@ -101,11 +112,22 @@ const _sfc_main = {
101
112
  //卡片阴影
102
113
  type: Boolean,
103
114
  default: true
115
+ },
116
+ swipeDelete: {
117
+ //左滑删除
118
+ type: Boolean,
119
+ default: false
120
+ },
121
+ swipeEdit: {
122
+ //左滑编辑
123
+ type: Boolean,
124
+ default: false
104
125
  }
105
126
  },
106
- emits: ["update:modelValue"],
127
+ emits: ["update:modelValue", "deleteRow", "editRow"],
107
128
  setup(__props, { emit: __emit }) {
108
129
  const props = __props;
130
+ const emit = __emit;
109
131
  const compHeight = vue.computed(() => {
110
132
  if (props.autoHeight) {
111
133
  return "100%";
@@ -183,13 +205,90 @@ const _sfc_main = {
183
205
  if (uid) {
184
206
  isDesigner = true;
185
207
  }
208
+ setTimeout(() => {
209
+ initSwipeCells();
210
+ }, 500);
186
211
  });
212
+ const initSwipeCells = () => {
213
+ if (props.swipeDelete || props.swipeEdit) {
214
+ const tableBody = gridRef.value.getEl().querySelector(".vxe-table--body");
215
+ tableBody.offsetWidth;
216
+ const tableRows = tableBody.querySelectorAll(".vxe-body--row");
217
+ tableRows.forEach((row, index$22) => {
218
+ if (!row.parentElement.classList.contains("van-swipe-cell__wrapper")) {
219
+ const swipeCell = vue.createVNode(
220
+ index.SwipeCell,
221
+ {
222
+ class: `fec-table-row-swipe`,
223
+ // style: `width:${offsetWidth}px`,
224
+ style: `width:100%`
225
+ // beforeClose: ({ position }) => {
226
+ // switch (position) {
227
+ // case "left":
228
+ // case "cell":
229
+ // case "outside":
230
+ // return true;
231
+ // case "right":
232
+ // return new Promise(resolve => {
233
+ // showConfirmDialog({
234
+ // title: "确定删除吗?",
235
+ // })
236
+ // .then(() => {
237
+ // emit("delete");
238
+ // resolve(true);
239
+ // })
240
+ // .catch(() => resolve(false));
241
+ // });
242
+ // }
243
+ // },
244
+ },
245
+ {
246
+ right: () => [
247
+ vue.createVNode(index$1.Button, {
248
+ square: true,
249
+ type: "primary",
250
+ text: "编辑",
251
+ style: `height:100%;display:${props.swipeEdit ? "inline-block" : "none"}`,
252
+ onClick: () => {
253
+ const rowData = gridRef.value.getData(index$22);
254
+ emit("editRow", rowData);
255
+ }
256
+ }),
257
+ vue.createVNode(index$1.Button, {
258
+ square: true,
259
+ type: "danger",
260
+ text: "删除",
261
+ style: `height:100%;display:${props.swipeDelete ? "inline-block" : "none"}`,
262
+ onClick: () => {
263
+ functionCall.showConfirmDialog({
264
+ title: "确定删除吗?"
265
+ }).then(() => {
266
+ const rowData = gridRef.value.getData(index$22);
267
+ emit("deleteRow", rowData);
268
+ }).catch(() => {
269
+ });
270
+ }
271
+ })
272
+ ]
273
+ }
274
+ );
275
+ const container = document.createElement("div");
276
+ vue.render(swipeCell, container);
277
+ const swipeCellElement = container.firstElementChild;
278
+ const colgroupElement = row.parentNode.parentNode.querySelector("colgroup");
279
+ const cloneColgroupElement = colgroupElement.cloneNode(true);
280
+ swipeCellElement.appendChild(cloneColgroupElement);
281
+ row.parentNode.replaceChild(swipeCellElement, row);
282
+ swipeCellElement.querySelector(".van-swipe-cell__wrapper").appendChild(row);
283
+ }
284
+ });
285
+ }
286
+ };
187
287
  const virtualYConfig = {
188
288
  enabled: false,
189
289
  gt: 0,
190
290
  threshold: 0
191
291
  };
192
- const emit = __emit;
193
292
  const tableData = vue.ref(props.modelValue);
194
293
  const dataSource = dataSourceUtil.useDataSource(props.dataSource);
195
294
  let pageNo = 1;
@@ -244,6 +343,9 @@ const _sfc_main = {
244
343
  checkHasScroll();
245
344
  });
246
345
  }, 300);
346
+ setTimeout(() => {
347
+ initSwipeCells();
348
+ }, 500);
247
349
  }).catch((err) => {
248
350
  console.error(err);
249
351
  if (props.isFixedHead) {
@@ -286,8 +388,8 @@ const _sfc_main = {
286
388
  }
287
389
  }
288
390
  return (_ctx, _cache) => {
289
- const _component_van_list = index$1.List;
290
- const _component_van_cell_group = index.CellGroup;
391
+ const _component_van_list = index$3.List;
392
+ const _component_van_cell_group = index$2.CellGroup;
291
393
  return vue.openBlock(), vue.createBlock(_component_van_cell_group, {
292
394
  class: vue.normalizeClass(["mTableContent", {
293
395
  notAutoHeight: !__props.autoHeight,
@@ -314,9 +416,10 @@ const _sfc_main = {
314
416
  onLoad
315
417
  }, {
316
418
  default: vue.withCtx(() => [
317
- vue.createVNode(vue.unref(index$2.VxeGrid), {
419
+ vue.createVNode(vue.unref(index$4.VxeGrid), {
318
420
  ref_key: "gridRef",
319
421
  ref: gridRef,
422
+ class: "fec-table",
320
423
  "auto-resize": "",
321
424
  data: vue.unref(tableData),
322
425
  columns: vue.unref(columnOptions),
@@ -406,5 +509,5 @@ const _sfc_main = {
406
509
  };
407
510
  }
408
511
  };
409
- const _Table = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-4d61c49d"]]);
512
+ const _Table = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-2d269193"]]);
410
513
  exports.default = _Table;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fecp/mobile",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "main": "lib/packages/mobile/index.js",
5
5
  "module": "es/packages/mobile/index.mjs",
6
6
  "files": [