@fmdeui/fmui 1.0.166 → 1.0.167

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.
@@ -446,7 +446,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
446
446
  setTimeout(() => {
447
447
  const row = state.tableData.find((item) => item[props.keywords.value] === defaultSelectVal[0]);
448
448
  if (row) {
449
- radioVal.value = state.tableData.indexOf(row) + 1;
449
+ radioVal.value = row[props.keywords.value];
450
450
  state.defaultValue = row;
451
451
  selectDefaultLabel.value = row[props.keywords.label];
452
452
  modeValueId.value = row[props.keywords.value];
@@ -484,35 +484,29 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
484
484
  const filterMethodHandle = (val) => {
485
485
  var _a;
486
486
  if (!props.filterable) return;
487
+ if (props.apiService) return;
487
488
  if (props.filterable && props.remote && typeof props.remoteMethod === "function") {
488
489
  props.remoteMethod(val);
489
490
  return;
490
491
  }
491
492
  const tableData = JSON.parse(JSON.stringify((_a = props.table) == null ? void 0 : _a.data));
492
493
  if (!tableData || tableData.length === 0) return;
493
- if (!props.multiple) {
494
- if (val) {
495
- radioVal.value = "";
496
- } else {
497
- const defaultIndex = tableData.findIndex(
498
- (item) => item[props.keywords.label] === selectDefaultLabel.value
499
- );
500
- if (defaultIndex !== -1) {
501
- radioVal.value = defaultIndex + 1;
502
- }
503
- }
504
- }
494
+ const currentSelectedId = modeValueId.value;
505
495
  state.tableData = tableData.filter((item) => {
506
496
  var _a2;
507
- return (_a2 = item[props.keywords.label]) == null ? void 0 : _a2.includes(val);
497
+ return (_a2 = item[props.keywords.label]) == null ? void 0 : _a2.toLowerCase().includes(val.toLowerCase());
508
498
  });
509
- if (selectDefaultLabel.value) {
510
- const defaultIndex = state.tableData.findIndex(
511
- (item) => item[props.keywords.label] === selectDefaultLabel.value
499
+ if (currentSelectedId) {
500
+ const isStillInTable = state.tableData.some(
501
+ (item) => item[props.keywords.value] === currentSelectedId
512
502
  );
513
- if (defaultIndex !== -1) {
514
- radioVal.value = defaultIndex + 1;
503
+ if (isStillInTable) {
504
+ radioVal.value = currentSelectedId;
505
+ } else {
506
+ radioVal.value = "";
515
507
  }
508
+ } else {
509
+ radioVal.value = "";
516
510
  }
517
511
  };
518
512
  const initTableData = () => {
@@ -529,7 +523,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
529
523
  });
530
524
  } else {
531
525
  const matchedRow = (_b = state.tableData) == null ? void 0 : _b.find(
532
- (item) => item[props.keywords.value] === selectDefaultLabel.value
526
+ (item) => item[props.keywords.value] === modeValueId.value
533
527
  );
534
528
  if (matchedRow) {
535
529
  selectTable.value.setCurrentRow(matchedRow);
@@ -563,11 +557,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
563
557
  showMessage("error", error.message || t("plus.copy.copyFail"));
564
558
  }
565
559
  };
566
- const radioChangeHandle = (event, row, index) => {
560
+ const radioChangeHandle = (event, row, rowValue) => {
567
561
  event.preventDefault();
568
562
  if (row.isRadioDisabled) return;
569
563
  isDefaultSelectVal.value = false;
570
- radioClick(row, index);
564
+ radioClick(row, rowValue);
571
565
  };
572
566
  const isForbidden = () => {
573
567
  forbidden.value = false;
@@ -575,13 +569,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
575
569
  forbidden.value = true;
576
570
  }, 0);
577
571
  };
578
- const radioClick = (row, index) => {
572
+ const radioClick = (row, rowValue) => {
579
573
  forbidden.value = !forbidden.value;
580
- if (radioVal.value === index) {
574
+ if (radioVal.value === rowValue) {
581
575
  if (!props.radioSameIsCancel) return;
582
576
  clear();
583
577
  } else {
584
- updateState(row, index);
578
+ updateState(row, rowValue);
585
579
  }
586
580
  if (props.isExpanded && state.defaultValue) {
587
581
  selectDefaultLabel.value = state.defaultValue[props.keywords.label] || "";
@@ -590,29 +584,24 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
590
584
  blur();
591
585
  }
592
586
  };
593
- const updateState = (row, index) => {
587
+ const updateState = (row, rowValue) => {
594
588
  isForbidden();
595
- radioVal.value = index;
589
+ radioVal.value = rowValue;
596
590
  state.defaultValue = row;
597
- emits("radioChange", row, row[props.keywords.value]);
598
- modeValueId.value = row[props.keywords.value];
591
+ emits("radioChange", row, rowValue);
592
+ modeValueId.value = rowValue;
599
593
  modeValueName.value = row[props.keywords.label];
600
594
  };
601
595
  const rowClick = async (row) => {
602
596
  if (row.isRadioDisabled) return;
603
597
  if (!props.rowClickRadio) return;
604
598
  if (!props.multiple) {
605
- const rowIndex = state.tableData.findIndex(
606
- (item) => item[props.keywords.value] === row[props.keywords.value]
607
- );
608
- if (rowIndex !== -1) {
609
- isDefaultSelectVal.value = false;
610
- await radioClick(row, rowIndex + 1);
611
- if (radioVal.value) {
612
- isRadio.value = true;
613
- } else {
614
- isRadio.value = false;
615
- }
599
+ isDefaultSelectVal.value = false;
600
+ await radioClick(row, row[props.keywords.value]);
601
+ if (radioVal.value) {
602
+ isRadio.value = true;
603
+ } else {
604
+ isRadio.value = false;
616
605
  }
617
606
  }
618
607
  };
@@ -835,10 +824,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
835
824
  createVNode(_component_el_radio, {
836
825
  modelValue: radioVal.value,
837
826
  "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => radioVal.value = $event),
838
- label: scope.$index + 1,
827
+ label: scope.row[__props.keywords.label],
828
+ value: scope.row[__props.keywords.value],
839
829
  disabled: scope.row.isRadioDisabled,
840
- onClick: withModifiers(($event) => radioChangeHandle($event, scope.row, scope.$index + 1), ["stop"])
841
- }, null, 8, ["modelValue", "label", "disabled", "onClick"])
830
+ onClick: withModifiers(($event) => radioChangeHandle($event, scope.row, scope.row[__props.keywords.value]), ["stop"])
831
+ }, null, 8, ["modelValue", "label", "value", "disabled", "onClick"])
842
832
  ]),
843
833
  _: 1
844
834
  /* STABLE */
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fmdeui-fmui v1.0.166 */
1
+ /*! fmdeui-fmui v1.0.167 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vxe-table'), require('@vxe-ui/plugin-render-element'), require('@vxe-ui/plugin-export-xlsx'), require('vxe-pc-ui'), require('exceljs'), require('@element-plus/icons-vue'), require('vue'), require('element-plus'), require('lodash-es'), require('js-cookie'), require('pinia'), require('vue-router'), require('@vueuse/core'), require('crypto-js'), require('xlsx-js-style'), require('vue-i18n'), require('sortablejs'), require('screenfull'), require('push.js'), require('mitt'), require('@microsoft/signalr'), require('axios')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'vxe-table', '@vxe-ui/plugin-render-element', '@vxe-ui/plugin-export-xlsx', 'vxe-pc-ui', 'exceljs', '@element-plus/icons-vue', 'vue', 'element-plus', 'lodash-es', 'js-cookie', 'pinia', 'vue-router', '@vueuse/core', 'crypto-js', 'xlsx-js-style', 'vue-i18n', 'sortablejs', 'screenfull', 'push.js', 'mitt', '@microsoft/signalr', 'axios'], factory) :
@@ -23489,7 +23489,7 @@
23489
23489
  setTimeout(() => {
23490
23490
  const row = state.tableData.find((item) => item[props.keywords.value] === defaultSelectVal[0]);
23491
23491
  if (row) {
23492
- radioVal.value = state.tableData.indexOf(row) + 1;
23492
+ radioVal.value = row[props.keywords.value];
23493
23493
  state.defaultValue = row;
23494
23494
  selectDefaultLabel.value = row[props.keywords.label];
23495
23495
  modeValueId.value = row[props.keywords.value];
@@ -23527,35 +23527,29 @@
23527
23527
  const filterMethodHandle = (val) => {
23528
23528
  var _a;
23529
23529
  if (!props.filterable) return;
23530
+ if (props.apiService) return;
23530
23531
  if (props.filterable && props.remote && typeof props.remoteMethod === "function") {
23531
23532
  props.remoteMethod(val);
23532
23533
  return;
23533
23534
  }
23534
23535
  const tableData = JSON.parse(JSON.stringify((_a = props.table) == null ? void 0 : _a.data));
23535
23536
  if (!tableData || tableData.length === 0) return;
23536
- if (!props.multiple) {
23537
- if (val) {
23538
- radioVal.value = "";
23539
- } else {
23540
- const defaultIndex = tableData.findIndex(
23541
- (item) => item[props.keywords.label] === selectDefaultLabel.value
23542
- );
23543
- if (defaultIndex !== -1) {
23544
- radioVal.value = defaultIndex + 1;
23545
- }
23546
- }
23547
- }
23537
+ const currentSelectedId = modeValueId.value;
23548
23538
  state.tableData = tableData.filter((item) => {
23549
23539
  var _a2;
23550
- return (_a2 = item[props.keywords.label]) == null ? void 0 : _a2.includes(val);
23540
+ return (_a2 = item[props.keywords.label]) == null ? void 0 : _a2.toLowerCase().includes(val.toLowerCase());
23551
23541
  });
23552
- if (selectDefaultLabel.value) {
23553
- const defaultIndex = state.tableData.findIndex(
23554
- (item) => item[props.keywords.label] === selectDefaultLabel.value
23542
+ if (currentSelectedId) {
23543
+ const isStillInTable = state.tableData.some(
23544
+ (item) => item[props.keywords.value] === currentSelectedId
23555
23545
  );
23556
- if (defaultIndex !== -1) {
23557
- radioVal.value = defaultIndex + 1;
23546
+ if (isStillInTable) {
23547
+ radioVal.value = currentSelectedId;
23548
+ } else {
23549
+ radioVal.value = "";
23558
23550
  }
23551
+ } else {
23552
+ radioVal.value = "";
23559
23553
  }
23560
23554
  };
23561
23555
  const initTableData = () => {
@@ -23572,7 +23566,7 @@
23572
23566
  });
23573
23567
  } else {
23574
23568
  const matchedRow = (_b = state.tableData) == null ? void 0 : _b.find(
23575
- (item) => item[props.keywords.value] === selectDefaultLabel.value
23569
+ (item) => item[props.keywords.value] === modeValueId.value
23576
23570
  );
23577
23571
  if (matchedRow) {
23578
23572
  selectTable.value.setCurrentRow(matchedRow);
@@ -23606,11 +23600,11 @@
23606
23600
  showMessage("error", error.message || t("plus.copy.copyFail"));
23607
23601
  }
23608
23602
  };
23609
- const radioChangeHandle = (event, row, index) => {
23603
+ const radioChangeHandle = (event, row, rowValue) => {
23610
23604
  event.preventDefault();
23611
23605
  if (row.isRadioDisabled) return;
23612
23606
  isDefaultSelectVal.value = false;
23613
- radioClick(row, index);
23607
+ radioClick(row, rowValue);
23614
23608
  };
23615
23609
  const isForbidden = () => {
23616
23610
  forbidden.value = false;
@@ -23618,13 +23612,13 @@
23618
23612
  forbidden.value = true;
23619
23613
  }, 0);
23620
23614
  };
23621
- const radioClick = (row, index) => {
23615
+ const radioClick = (row, rowValue) => {
23622
23616
  forbidden.value = !forbidden.value;
23623
- if (radioVal.value === index) {
23617
+ if (radioVal.value === rowValue) {
23624
23618
  if (!props.radioSameIsCancel) return;
23625
23619
  clear();
23626
23620
  } else {
23627
- updateState(row, index);
23621
+ updateState(row, rowValue);
23628
23622
  }
23629
23623
  if (props.isExpanded && state.defaultValue) {
23630
23624
  selectDefaultLabel.value = state.defaultValue[props.keywords.label] || "";
@@ -23633,29 +23627,24 @@
23633
23627
  blur();
23634
23628
  }
23635
23629
  };
23636
- const updateState = (row, index) => {
23630
+ const updateState = (row, rowValue) => {
23637
23631
  isForbidden();
23638
- radioVal.value = index;
23632
+ radioVal.value = rowValue;
23639
23633
  state.defaultValue = row;
23640
- emits("radioChange", row, row[props.keywords.value]);
23641
- modeValueId.value = row[props.keywords.value];
23634
+ emits("radioChange", row, rowValue);
23635
+ modeValueId.value = rowValue;
23642
23636
  modeValueName.value = row[props.keywords.label];
23643
23637
  };
23644
23638
  const rowClick = async (row) => {
23645
23639
  if (row.isRadioDisabled) return;
23646
23640
  if (!props.rowClickRadio) return;
23647
23641
  if (!props.multiple) {
23648
- const rowIndex = state.tableData.findIndex(
23649
- (item) => item[props.keywords.value] === row[props.keywords.value]
23650
- );
23651
- if (rowIndex !== -1) {
23652
- isDefaultSelectVal.value = false;
23653
- await radioClick(row, rowIndex + 1);
23654
- if (radioVal.value) {
23655
- isRadio.value = true;
23656
- } else {
23657
- isRadio.value = false;
23658
- }
23642
+ isDefaultSelectVal.value = false;
23643
+ await radioClick(row, row[props.keywords.value]);
23644
+ if (radioVal.value) {
23645
+ isRadio.value = true;
23646
+ } else {
23647
+ isRadio.value = false;
23659
23648
  }
23660
23649
  }
23661
23650
  };
@@ -23878,10 +23867,11 @@
23878
23867
  vue.createVNode(_component_el_radio, {
23879
23868
  modelValue: radioVal.value,
23880
23869
  "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => radioVal.value = $event),
23881
- label: scope.$index + 1,
23870
+ label: scope.row[__props.keywords.label],
23871
+ value: scope.row[__props.keywords.value],
23882
23872
  disabled: scope.row.isRadioDisabled,
23883
- onClick: vue.withModifiers(($event) => radioChangeHandle($event, scope.row, scope.$index + 1), ["stop"])
23884
- }, null, 8, ["modelValue", "label", "disabled", "onClick"])
23873
+ onClick: vue.withModifiers(($event) => radioChangeHandle($event, scope.row, scope.row[__props.keywords.value]), ["stop"])
23874
+ }, null, 8, ["modelValue", "label", "value", "disabled", "onClick"])
23885
23875
  ]),
23886
23876
  _: 1
23887
23877
  /* STABLE */