@fmdeui/fmui 1.0.161 → 1.0.163

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.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fmdeui-fmui v1.0.161 */
1
+ /*! fmdeui-fmui v1.0.163 */
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) :
@@ -23069,7 +23069,7 @@
23069
23069
  name: "FSelectTable"
23070
23070
  },
23071
23071
  __name: "index",
23072
- props: {
23072
+ props: /* @__PURE__ */ vue.mergeModels({
23073
23073
  modelValue: { default: void 0 },
23074
23074
  inputValue: { default: void 0 },
23075
23075
  defaultSelectVal: { default: () => [] },
@@ -23122,9 +23122,21 @@
23122
23122
  isExpanded: { type: Boolean, default: false },
23123
23123
  multipleDisableDelete: { type: Boolean, default: true },
23124
23124
  tableLoading: { type: Boolean, default: false },
23125
- loadingTxt: { default: "" }
23126
- },
23127
- emits: ["page-change", "selectionChange", "radioChange", "update:inputValue", "input-focus", "input-blur", "input-clear", "input-click"],
23125
+ loadingTxt: { default: "" },
23126
+ apiService: { default: void 0 },
23127
+ apiAction: { default: "" },
23128
+ queryParams: { default: () => ({}) },
23129
+ responseFormatter: { type: Function, default: (res) => ({
23130
+ data: res.data.result.items || [],
23131
+ total: res.data.result.total || 0
23132
+ }) }
23133
+ }, {
23134
+ "id": { default: void 0, required: false },
23135
+ "idModifiers": {},
23136
+ "name": { default: "", required: false },
23137
+ "nameModifiers": {}
23138
+ }),
23139
+ emits: /* @__PURE__ */ vue.mergeModels(["page-change", "selectionChange", "radioChange", "update:inputValue", "input-focus", "input-blur", "input-clear", "input-click"], ["update:id", "update:name"]),
23128
23140
  setup(__props, { expose: __expose, emit: __emit }) {
23129
23141
  const { t } = useLocale();
23130
23142
  const {
@@ -23135,6 +23147,8 @@
23135
23147
  saveDATA,
23136
23148
  getItemHeightFromCache
23137
23149
  } = useVirtualized();
23150
+ const modeValueId = vue.useModel(__props, "id");
23151
+ const modeValueName = vue.useModel(__props, "name");
23138
23152
  const props = __props;
23139
23153
  const vClickOutside = ClickOutside;
23140
23154
  const emits = __emit;
@@ -23146,8 +23160,24 @@
23146
23160
  const isVisible = vue.ref(false);
23147
23161
  const radioVal = vue.ref("");
23148
23162
  const isShowFirstRadio = vue.ref(props.isShowFirstColumn);
23149
- const selectDefaultLabel = vue.ref(props.modelValue);
23163
+ const selectDefaultLabel = vue.ref(modeValueName.value);
23150
23164
  const scrollTopNum = vue.ref(0);
23165
+ const pagination = vue.reactive({
23166
+ currentPage: props.table.currentPage,
23167
+ pageSize: props.table.pageSize,
23168
+ total: props.table.total
23169
+ });
23170
+ vue.watch(
23171
+ () => props.table,
23172
+ (newVal) => {
23173
+ if (!props.apiService) {
23174
+ pagination.currentPage = newVal.currentPage;
23175
+ pagination.pageSize = newVal.pageSize;
23176
+ pagination.total = newVal.total;
23177
+ }
23178
+ },
23179
+ { deep: true }
23180
+ );
23151
23181
  let selectInputVal = vue.computed({
23152
23182
  get() {
23153
23183
  return props.inputValue;
@@ -23187,6 +23217,7 @@
23187
23217
  () => props.table.data,
23188
23218
  (val) => {
23189
23219
  var _a, _b;
23220
+ if (props.apiService) return;
23190
23221
  if (props.useVirtual) {
23191
23222
  saveDATA.value = val;
23192
23223
  updateRenderData(scrollTopNum.value);
@@ -23238,20 +23269,55 @@
23238
23269
  );
23239
23270
  vue.onMounted(() => {
23240
23271
  var _a;
23241
- if (state.defaultSelectValue && state.defaultSelectValue.length > 0 && isDefaultSelectVal.value) {
23242
- defaultSelect(state.defaultSelectValue);
23243
- }
23244
- if (props.selfExpanded) {
23245
- selectRef.value.expanded = true;
23246
- }
23247
- if (props.useVirtual) {
23248
- saveDATA.value = props.table.data;
23249
- isShowFirstRadio.value = false;
23250
- getDom(props);
23251
- (_a = scrollContainerEl.value) == null ? void 0 : _a.addEventListener("scroll", handleScroll);
23272
+ if (props.apiService) {
23273
+ fetchTableData();
23274
+ } else {
23275
+ if (state.defaultSelectValue && state.defaultSelectValue.length > 0 && isDefaultSelectVal.value) {
23276
+ defaultSelect(state.defaultSelectValue);
23277
+ }
23278
+ if (props.selfExpanded) {
23279
+ selectRef.value.expanded = true;
23280
+ }
23281
+ if (props.useVirtual) {
23282
+ saveDATA.value = props.table.data;
23283
+ isShowFirstRadio.value = false;
23284
+ getDom(props);
23285
+ (_a = scrollContainerEl.value) == null ? void 0 : _a.addEventListener("scroll", handleScroll);
23286
+ }
23287
+ if (props.radioSelectValLabel) findLabel();
23252
23288
  }
23253
- if (props.radioSelectValLabel) findLabel();
23254
23289
  });
23290
+ const internalLoading = vue.ref(false);
23291
+ const internalQueryParams = vue.reactive({ ...props.queryParams });
23292
+ const fetchTableData = async (isResetPage = false) => {
23293
+ if (!props.apiService) return;
23294
+ internalLoading.value = true;
23295
+ try {
23296
+ if (isResetPage) {
23297
+ pagination.currentPage = 1;
23298
+ }
23299
+ const requestParams = {
23300
+ currentPage: pagination.currentPage,
23301
+ pageSize: pagination.pageSize,
23302
+ ...internalQueryParams
23303
+ };
23304
+ const res = await useBaseApi(props.apiService).post(requestParams, props.apiAction);
23305
+ const formatted = props.responseFormatter(res);
23306
+ pagination.total = formatted.total;
23307
+ state.tableData = formatted.data;
23308
+ if (props.useVirtual) {
23309
+ saveDATA.value = formatted.data;
23310
+ updateRenderData(scrollTopNum.value);
23311
+ }
23312
+ if (state.defaultSelectValue && state.defaultSelectValue.length > 0 && isDefaultSelectVal.value) {
23313
+ defaultSelect(state.defaultSelectValue);
23314
+ }
23315
+ } catch (error) {
23316
+ console.error("FSelectTable API request failed:", error);
23317
+ } finally {
23318
+ internalLoading.value = false;
23319
+ }
23320
+ };
23255
23321
  const updateRenderData = (scrollTop) => {
23256
23322
  let startIndex = 0;
23257
23323
  let offsetHeight = 0;
@@ -23299,6 +23365,11 @@
23299
23365
  } else {
23300
23366
  if (fQueryConditionRef.value && props.isShowQuery && props.isClearQuery && !selectRef.value.expanded && !props.selfExpanded) {
23301
23367
  (_a = fQueryConditionRef.value) == null ? void 0 : _a.resetData();
23368
+ if (props.apiService) {
23369
+ Object.keys(internalQueryParams).forEach((key) => delete internalQueryParams[key]);
23370
+ Object.assign(internalQueryParams, props.queryParams);
23371
+ fetchTableData(true);
23372
+ }
23302
23373
  }
23303
23374
  findLabel();
23304
23375
  filterMethodHandle("");
@@ -23376,6 +23447,10 @@
23376
23447
  });
23377
23448
  };
23378
23449
  const handlesCurrentChange = (val) => {
23450
+ if (props.apiService) {
23451
+ fetchTableData();
23452
+ return;
23453
+ }
23379
23454
  if (props.multiple) {
23380
23455
  if (!props.reserveSelection) {
23381
23456
  clear();
@@ -23400,12 +23475,15 @@
23400
23475
  setTimeout(() => {
23401
23476
  var _a, _b;
23402
23477
  state.defaultValue = multipleList.map((item) => item[props.keywords.label]);
23478
+ state.ids = multipleList.map((item) => item[props.keywords.value]);
23403
23479
  multipleList.forEach((row) => {
23404
23480
  selectTable.value.toggleRowSelection(row, true);
23405
23481
  });
23406
23482
  (_b = (_a = selectRef.value) == null ? void 0 : _a.selected) == null ? void 0 : _b.forEach((item) => {
23407
23483
  item.currentLabel = item.value;
23408
23484
  });
23485
+ modeValueId.value = state.ids;
23486
+ modeValueName.value = state.defaultValue;
23409
23487
  }, 0);
23410
23488
  } else {
23411
23489
  setTimeout(() => {
@@ -23414,6 +23492,8 @@
23414
23492
  radioVal.value = state.tableData.indexOf(row) + 1;
23415
23493
  state.defaultValue = row;
23416
23494
  selectDefaultLabel.value = row[props.keywords.label];
23495
+ modeValueId.value = row[props.keywords.value];
23496
+ modeValueName.value = row[props.keywords.label];
23417
23497
  if (!props.defaultValIsOpenRadioChange) {
23418
23498
  emits("radioChange", row, row[props.keywords.value]);
23419
23499
  }
@@ -23430,6 +23510,10 @@
23430
23510
  state.defaultSelectValue = [];
23431
23511
  }
23432
23512
  emits("selectionChange", val, state.ids);
23513
+ if (props.multiple) {
23514
+ modeValueId.value = state.ids;
23515
+ modeValueName.value = state.defaultValue;
23516
+ }
23433
23517
  };
23434
23518
  const getRowClassName = ({ row }) => {
23435
23519
  if (!props.multiple && JSON.stringify(row) === JSON.stringify(state.defaultValue)) {
@@ -23554,6 +23638,8 @@
23554
23638
  radioVal.value = index;
23555
23639
  state.defaultValue = row;
23556
23640
  emits("radioChange", row, row[props.keywords.value]);
23641
+ modeValueId.value = row[props.keywords.value];
23642
+ modeValueName.value = row[props.keywords.label];
23557
23643
  };
23558
23644
  const rowClick = async (row) => {
23559
23645
  var _a;
@@ -23586,6 +23672,8 @@
23586
23672
  isDefaultSelectVal.value = true;
23587
23673
  state.defaultSelectValue = [];
23588
23674
  state.defaultValue = props.multiple ? [] : null;
23675
+ modeValueId.value = props.multiple ? [] : void 0;
23676
+ modeValueName.value = props.multiple ? [] : "";
23589
23677
  };
23590
23678
  if (!selectTable.value) {
23591
23679
  console.warn("selectTable.value is not initialized");
@@ -23669,7 +23757,7 @@
23669
23757
  ref_key: "selectRef",
23670
23758
  ref: selectRef,
23671
23759
  "model-value": __props.multiple ? state.defaultValue : selectDefaultLabel.value,
23672
- "popper-class": "t-select-table",
23760
+ "popper-class": "f-select-table",
23673
23761
  style: { width: __props.selectWidth ? `${__props.selectWidth}px` : "100%" },
23674
23762
  "value-key": __props.keywords.value,
23675
23763
  "filter-method": __props.filterMethod || filterMethodHandle,
@@ -23849,18 +23937,18 @@
23849
23937
  }, 16, ["data", "class"]),
23850
23938
  __props.isShowPagination ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$8, [
23851
23939
  vue.createVNode(_component_el_pagination, vue.mergeProps({
23852
- "current-page": __props.table.currentPage,
23853
- "onUpdate:currentPage": _cache[6] || (_cache[6] = ($event) => __props.table.currentPage = $event),
23854
- "page-size": __props.table.pageSize,
23855
- "onUpdate:pageSize": _cache[7] || (_cache[7] = ($event) => __props.table.pageSize = $event),
23940
+ "current-page": pagination.currentPage,
23941
+ "onUpdate:currentPage": _cache[6] || (_cache[6] = ($event) => pagination.currentPage = $event),
23942
+ "page-size": pagination.pageSize,
23943
+ "onUpdate:pageSize": _cache[7] || (_cache[7] = ($event) => pagination.pageSize = $event),
23856
23944
  onCurrentChange: handlesCurrentChange,
23857
23945
  layout: "total, prev, pager, next, jumper",
23858
23946
  "pager-count": __props.table["pager-count"] || 5,
23859
- total: __props.table.total
23947
+ total: pagination.total
23860
23948
  }, { background: true, size: __props.paginationSize || "small", ..._ctx.$attrs }), null, 16, ["current-page", "page-size", "pager-count", "total"])
23861
23949
  ])) : vue.createCommentVNode("v-if", true)
23862
23950
  ], 8, _hoisted_2$p)), [
23863
- [_directive_loading, __props.tableLoading]
23951
+ [_directive_loading, __props.tableLoading || internalLoading.value]
23864
23952
  ]),
23865
23953
  vue.renderSlot(_ctx.$slots, "footer")
23866
23954
  ],