@fmdeui/fmui 1.0.160 → 1.0.162

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.
Files changed (51) hide show
  1. package/es/components/fm-autocomplete/component/dirverSelectDialog.vue.d.ts +72 -0
  2. package/es/components/fm-autocomplete/component/guideSelectDialog.vue.d.ts +72 -0
  3. package/es/components/fm-autocomplete/index.d.ts +176 -0
  4. package/es/components/fm-autocomplete/index.vue.d.ts +352 -0
  5. package/es/components/select-table/index.d.ts +50 -5
  6. package/es/components/select-table/src/index.vue.d.ts +21 -3
  7. package/es/components/select-table/src/type.d.ts +4 -0
  8. package/es/packages/api/index.mjs +1 -1
  9. package/es/packages/components/fm-autocomplete/component/accountSelectDialog2.vue.mjs +2 -2
  10. package/es/packages/components/fm-autocomplete/component/dirverSelectDialog.vue.mjs +5 -0
  11. package/es/packages/components/fm-autocomplete/component/dirverSelectDialog2.vue.mjs +334 -0
  12. package/es/packages/components/fm-autocomplete/component/guideSelectDialog.vue.mjs +5 -0
  13. package/es/packages/components/fm-autocomplete/component/guideSelectDialog2.vue.mjs +322 -0
  14. package/es/packages/components/fm-autocomplete/component/linSelectDialog2.vue.mjs +2 -2
  15. package/es/packages/components/fm-autocomplete/component/supplierSelectDialog2.vue.mjs +2 -2
  16. package/es/packages/components/fm-autocomplete/component/supplierUserSelectDialog2.vue.mjs +2 -2
  17. package/es/packages/components/fm-autocomplete/index2.vue.mjs +38 -2
  18. package/es/packages/components/select-table/src/index2.vue.mjs +114 -25
  19. package/index.js +1026 -261
  20. package/index.min.js +7 -7
  21. package/index.min.mjs +7 -7
  22. package/index.mjs +1027 -262
  23. package/lib/components/fm-autocomplete/component/dirverSelectDialog.vue.d.ts +72 -0
  24. package/lib/components/fm-autocomplete/component/guideSelectDialog.vue.d.ts +72 -0
  25. package/lib/components/fm-autocomplete/index.d.ts +176 -0
  26. package/lib/components/fm-autocomplete/index.vue.d.ts +352 -0
  27. package/lib/components/select-table/index.d.ts +50 -5
  28. package/lib/components/select-table/src/index.vue.d.ts +21 -3
  29. package/lib/components/select-table/src/type.d.ts +4 -0
  30. package/lib/packages/api/index.js +1 -1
  31. package/lib/packages/components/fm-autocomplete/component/accountSelectDialog2.vue.js +2 -2
  32. package/lib/packages/components/fm-autocomplete/component/dirverSelectDialog.vue.js +9 -0
  33. package/lib/packages/components/fm-autocomplete/component/dirverSelectDialog2.vue.js +338 -0
  34. package/lib/packages/components/fm-autocomplete/component/guideSelectDialog.vue.js +9 -0
  35. package/lib/packages/components/fm-autocomplete/component/guideSelectDialog2.vue.js +326 -0
  36. package/lib/packages/components/fm-autocomplete/component/linSelectDialog2.vue.js +2 -2
  37. package/lib/packages/components/fm-autocomplete/component/supplierSelectDialog2.vue.js +2 -2
  38. package/lib/packages/components/fm-autocomplete/component/supplierUserSelectDialog2.vue.js +2 -2
  39. package/lib/packages/components/fm-autocomplete/index2.vue.js +38 -2
  40. package/lib/packages/components/select-table/src/index2.vue.js +113 -24
  41. package/locale/en.js +1 -1
  42. package/locale/en.min.js +1 -1
  43. package/locale/en.min.mjs +1 -1
  44. package/locale/en.mjs +1 -1
  45. package/locale/zh-cn.js +1 -1
  46. package/locale/zh-cn.min.js +1 -1
  47. package/locale/zh-cn.min.mjs +1 -1
  48. package/locale/zh-cn.mjs +1 -1
  49. package/package.json +1 -1
  50. /package/es/{make-installer.css → component.css} +0 -0
  51. /package/lib/{version.css → make-installer.css} +0 -0
@@ -1,11 +1,13 @@
1
- import { defineComponent, useSlots, ref, computed, reactive, watch, nextTick, onMounted, onBeforeUnmount, onUpdated, useAttrs, resolveComponent, resolveDirective, openBlock, createBlock, mergeProps, isRef, unref, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, withDirectives, createElementVNode, normalizeStyle, createElementBlock, createVNode, createTextVNode, toDisplayString, createCommentVNode, withModifiers, Fragment } from 'vue';
1
+ import { defineComponent, useModel, useSlots, ref, reactive, watch, computed, nextTick, onMounted, onBeforeUnmount, onUpdated, useAttrs, resolveComponent, resolveDirective, openBlock, createBlock, mergeProps, isRef, unref, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, withDirectives, createElementVNode, normalizeStyle, createElementBlock, createVNode, createTextVNode, toDisplayString, createCommentVNode, withModifiers, Fragment, mergeModels } from 'vue';
2
2
  import '../../query-condition/src/index.vue.mjs';
3
3
  import './renderCol.vue.mjs';
4
4
  import { ElMessage } from 'element-plus';
5
5
  import ClickOutside from './ClickOutside.mjs';
6
6
  import { useVirtualized } from './useVirtualized.mjs';
7
+ import '../../../api/index.mjs';
7
8
  import '../../../hooks/index.mjs';
8
9
  import { useLocale } from '../../../hooks/useLocale.mjs';
10
+ import { useBaseApi } from '../../../api/base/index.mjs';
9
11
  import _sfc_main$1 from '../../query-condition/src/index2.vue.mjs';
10
12
  import _sfc_main$2 from './renderCol2.vue.mjs';
11
13
 
@@ -24,7 +26,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
24
26
  name: "FSelectTable"
25
27
  },
26
28
  __name: "index",
27
- props: {
29
+ props: /* @__PURE__ */ mergeModels({
28
30
  modelValue: { default: void 0 },
29
31
  inputValue: { default: void 0 },
30
32
  defaultSelectVal: { default: () => [] },
@@ -77,9 +79,21 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
77
79
  isExpanded: { type: Boolean, default: false },
78
80
  multipleDisableDelete: { type: Boolean, default: true },
79
81
  tableLoading: { type: Boolean, default: false },
80
- loadingTxt: { default: "" }
81
- },
82
- emits: ["page-change", "selectionChange", "radioChange", "update:inputValue", "input-focus", "input-blur", "input-clear", "input-click"],
82
+ loadingTxt: { default: "" },
83
+ apiService: { default: void 0 },
84
+ apiAction: { default: "" },
85
+ queryParams: { default: () => ({}) },
86
+ responseFormatter: { type: Function, default: (res) => ({
87
+ data: res.result.items || [],
88
+ total: res.result.total || 0
89
+ }) }
90
+ }, {
91
+ "id": { default: 0, required: false },
92
+ "idModifiers": {},
93
+ "name": { default: "", required: false },
94
+ "nameModifiers": {}
95
+ }),
96
+ emits: /* @__PURE__ */ mergeModels(["page-change", "selectionChange", "radioChange", "update:inputValue", "input-focus", "input-blur", "input-clear", "input-click"], ["update:id", "update:name"]),
83
97
  setup(__props, { expose: __expose, emit: __emit }) {
84
98
  const { t } = useLocale();
85
99
  const {
@@ -90,6 +104,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
90
104
  saveDATA,
91
105
  getItemHeightFromCache
92
106
  } = useVirtualized();
107
+ const modeValueId = useModel(__props, "id");
108
+ const modeValueName = useModel(__props, "name");
93
109
  const props = __props;
94
110
  const vClickOutside = ClickOutside;
95
111
  const emits = __emit;
@@ -101,8 +117,24 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
101
117
  const isVisible = ref(false);
102
118
  const radioVal = ref("");
103
119
  const isShowFirstRadio = ref(props.isShowFirstColumn);
104
- const selectDefaultLabel = ref(props.modelValue);
120
+ const selectDefaultLabel = ref(modeValueName.value);
105
121
  const scrollTopNum = ref(0);
122
+ const pagination = reactive({
123
+ currentPage: props.table.currentPage,
124
+ pageSize: props.table.pageSize,
125
+ total: props.table.total
126
+ });
127
+ watch(
128
+ () => props.table,
129
+ (newVal) => {
130
+ if (!props.apiService) {
131
+ pagination.currentPage = newVal.currentPage;
132
+ pagination.pageSize = newVal.pageSize;
133
+ pagination.total = newVal.total;
134
+ }
135
+ },
136
+ { deep: true }
137
+ );
106
138
  let selectInputVal = computed({
107
139
  get() {
108
140
  return props.inputValue;
@@ -193,20 +225,55 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
193
225
  );
194
226
  onMounted(() => {
195
227
  var _a;
196
- if (state.defaultSelectValue && state.defaultSelectValue.length > 0 && isDefaultSelectVal.value) {
197
- defaultSelect(state.defaultSelectValue);
198
- }
199
- if (props.selfExpanded) {
200
- selectRef.value.expanded = true;
201
- }
202
- if (props.useVirtual) {
203
- saveDATA.value = props.table.data;
204
- isShowFirstRadio.value = false;
205
- getDom(props);
206
- (_a = scrollContainerEl.value) == null ? void 0 : _a.addEventListener("scroll", handleScroll);
228
+ if (props.apiService) {
229
+ fetchTableData();
230
+ } else {
231
+ if (state.defaultSelectValue && state.defaultSelectValue.length > 0 && isDefaultSelectVal.value) {
232
+ defaultSelect(state.defaultSelectValue);
233
+ }
234
+ if (props.selfExpanded) {
235
+ selectRef.value.expanded = true;
236
+ }
237
+ if (props.useVirtual) {
238
+ saveDATA.value = props.table.data;
239
+ isShowFirstRadio.value = false;
240
+ getDom(props);
241
+ (_a = scrollContainerEl.value) == null ? void 0 : _a.addEventListener("scroll", handleScroll);
242
+ }
243
+ if (props.radioSelectValLabel) findLabel();
207
244
  }
208
- if (props.radioSelectValLabel) findLabel();
209
245
  });
246
+ const internalLoading = ref(false);
247
+ const internalQueryParams = reactive({ ...props.queryParams });
248
+ const fetchTableData = async (isResetPage = false) => {
249
+ if (!props.apiService) return;
250
+ internalLoading.value = true;
251
+ try {
252
+ if (isResetPage) {
253
+ pagination.currentPage = 1;
254
+ }
255
+ const requestParams = {
256
+ currentPage: pagination.currentPage,
257
+ pageSize: pagination.pageSize,
258
+ ...internalQueryParams
259
+ };
260
+ const res = await useBaseApi(props.apiService).post(requestParams, props.apiAction);
261
+ const formatted = props.responseFormatter(res);
262
+ pagination.total = formatted.total;
263
+ state.tableData = formatted.data;
264
+ if (props.useVirtual) {
265
+ saveDATA.value = formatted.data;
266
+ updateRenderData(scrollTopNum.value);
267
+ }
268
+ if (state.defaultSelectValue && state.defaultSelectValue.length > 0 && isDefaultSelectVal.value) {
269
+ defaultSelect(state.defaultSelectValue);
270
+ }
271
+ } catch (error) {
272
+ console.error("FSelectTable API request failed:", error);
273
+ } finally {
274
+ internalLoading.value = false;
275
+ }
276
+ };
210
277
  const updateRenderData = (scrollTop) => {
211
278
  let startIndex = 0;
212
279
  let offsetHeight = 0;
@@ -254,6 +321,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
254
321
  } else {
255
322
  if (fQueryConditionRef.value && props.isShowQuery && props.isClearQuery && !selectRef.value.expanded && !props.selfExpanded) {
256
323
  (_a = fQueryConditionRef.value) == null ? void 0 : _a.resetData();
324
+ if (props.apiService) {
325
+ Object.keys(internalQueryParams).forEach((key) => delete internalQueryParams[key]);
326
+ Object.assign(internalQueryParams, props.queryParams);
327
+ fetchTableData(true);
328
+ }
257
329
  }
258
330
  findLabel();
259
331
  filterMethodHandle("");
@@ -331,6 +403,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
331
403
  });
332
404
  };
333
405
  const handlesCurrentChange = (val) => {
406
+ if (props.apiService) {
407
+ fetchTableData();
408
+ return;
409
+ }
334
410
  if (props.multiple) {
335
411
  if (!props.reserveSelection) {
336
412
  clear();
@@ -355,12 +431,15 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
355
431
  setTimeout(() => {
356
432
  var _a, _b;
357
433
  state.defaultValue = multipleList.map((item) => item[props.keywords.label]);
434
+ state.ids = multipleList.map((item) => item[props.keywords.value]);
358
435
  multipleList.forEach((row) => {
359
436
  selectTable.value.toggleRowSelection(row, true);
360
437
  });
361
438
  (_b = (_a = selectRef.value) == null ? void 0 : _a.selected) == null ? void 0 : _b.forEach((item) => {
362
439
  item.currentLabel = item.value;
363
440
  });
441
+ modeValueId.value = state.ids;
442
+ modeValueName.value = state.defaultValue;
364
443
  }, 0);
365
444
  } else {
366
445
  setTimeout(() => {
@@ -369,6 +448,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
369
448
  radioVal.value = state.tableData.indexOf(row) + 1;
370
449
  state.defaultValue = row;
371
450
  selectDefaultLabel.value = row[props.keywords.label];
451
+ modeValueId.value = row[props.keywords.value];
452
+ modeValueName.value = row[props.keywords.label];
372
453
  if (!props.defaultValIsOpenRadioChange) {
373
454
  emits("radioChange", row, row[props.keywords.value]);
374
455
  }
@@ -385,6 +466,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
385
466
  state.defaultSelectValue = [];
386
467
  }
387
468
  emits("selectionChange", val, state.ids);
469
+ if (props.multiple) {
470
+ modeValueId.value = state.ids;
471
+ modeValueName.value = state.defaultValue;
472
+ }
388
473
  };
389
474
  const getRowClassName = ({ row }) => {
390
475
  if (!props.multiple && JSON.stringify(row) === JSON.stringify(state.defaultValue)) {
@@ -509,6 +594,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
509
594
  radioVal.value = index;
510
595
  state.defaultValue = row;
511
596
  emits("radioChange", row, row[props.keywords.value]);
597
+ modeValueId.value = row[props.keywords.value];
598
+ modeValueName.value = row[props.keywords.label];
512
599
  };
513
600
  const rowClick = async (row) => {
514
601
  var _a;
@@ -541,6 +628,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
541
628
  isDefaultSelectVal.value = true;
542
629
  state.defaultSelectValue = [];
543
630
  state.defaultValue = props.multiple ? [] : null;
631
+ modeValueId.value = props.multiple ? [] : 0;
632
+ modeValueName.value = props.multiple ? [] : "";
544
633
  };
545
634
  if (!selectTable.value) {
546
635
  console.warn("selectTable.value is not initialized");
@@ -624,7 +713,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
624
713
  ref_key: "selectRef",
625
714
  ref: selectRef,
626
715
  "model-value": __props.multiple ? state.defaultValue : selectDefaultLabel.value,
627
- "popper-class": "t-select-table",
716
+ "popper-class": "f-select-table",
628
717
  style: { width: __props.selectWidth ? `${__props.selectWidth}px` : "100%" },
629
718
  "value-key": __props.keywords.value,
630
719
  "filter-method": __props.filterMethod || filterMethodHandle,
@@ -804,18 +893,18 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
804
893
  }, 16, ["data", "class"]),
805
894
  __props.isShowPagination ? (openBlock(), createElementBlock("div", _hoisted_4, [
806
895
  createVNode(_component_el_pagination, mergeProps({
807
- "current-page": __props.table.currentPage,
808
- "onUpdate:currentPage": _cache[6] || (_cache[6] = ($event) => __props.table.currentPage = $event),
809
- "page-size": __props.table.pageSize,
810
- "onUpdate:pageSize": _cache[7] || (_cache[7] = ($event) => __props.table.pageSize = $event),
896
+ "current-page": pagination.currentPage,
897
+ "onUpdate:currentPage": _cache[6] || (_cache[6] = ($event) => pagination.currentPage = $event),
898
+ "page-size": pagination.pageSize,
899
+ "onUpdate:pageSize": _cache[7] || (_cache[7] = ($event) => pagination.pageSize = $event),
811
900
  onCurrentChange: handlesCurrentChange,
812
901
  layout: "total, prev, pager, next, jumper",
813
902
  "pager-count": __props.table["pager-count"] || 5,
814
- total: __props.table.total
903
+ total: pagination.total
815
904
  }, { background: true, size: __props.paginationSize || "small", ..._ctx.$attrs }), null, 16, ["current-page", "page-size", "pager-count", "total"])
816
905
  ])) : createCommentVNode("v-if", true)
817
906
  ], 8, _hoisted_2)), [
818
- [_directive_loading, __props.tableLoading]
907
+ [_directive_loading, __props.tableLoading || internalLoading.value]
819
908
  ]),
820
909
  renderSlot(_ctx.$slots, "footer")
821
910
  ],