@94ai/nf-search-form 9.0.0 → 10.0.0

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.
@@ -3,7 +3,6 @@ import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
3
3
  import { useLocale, createUniqueString, CachedManager, deepClone, validate, resolveValue, mapDispose } from "@94ai/common-utils";
4
4
  import ResizeObserver from "resize-observer-polyfill";
5
5
  import { getCurrentInstance as getCurrentInstance$1, effectScope, shallowReactive, set } from "vue";
6
- import { throttle as throttle$1 } from "lodash-es";
7
6
  import { ELEMENT_LABEL_TYPE_DEFAULT_VALUE, EXCHANGE_KEY_TYPE } from "@94ai/common-constants";
8
7
  import NfMessage from "@94ai/nf-message";
9
8
  const __sfc_main$5 = defineComponent({
@@ -38,7 +37,7 @@ __sfc_main$5.setup = (__props, __ctx) => {
38
37
  const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
39
38
  const emit = __ctx.emit;
40
39
  const inputlistens = computed(() => {
41
- const list = Object.assign({}, (instance == null ? void 0 : instance.$listeners) || {}, {
40
+ const list = Object.assign({}, instance == null ? void 0 : instance.$listeners, {
42
41
  change: function() {
43
42
  emit("change", [minNumber.value, maxNumber.value]);
44
43
  }
@@ -242,7 +241,7 @@ __sfc_main$4.setup = (__props, __ctx) => {
242
241
  attrs == null ? true : delete attrs.type;
243
242
  const pickerOptions = (attrs == null ? void 0 : attrs["picker-options"]) || {};
244
243
  return {
245
- ...attrs || {},
244
+ ...attrs,
246
245
  "picker-options": {
247
246
  ...pickerOptions
248
247
  }
@@ -467,7 +466,7 @@ __sfc_main$3.setup = (__props, __ctx) => {
467
466
  if (events == null ? void 0 : events.change) {
468
467
  delete events.change;
469
468
  }
470
- return events || {};
469
+ return events;
471
470
  });
472
471
  const tooltip = computed(() => {
473
472
  return props.itemOptions.tooltip;
@@ -6447,15 +6446,11 @@ __sfc_main$1.setup = (__props, __ctx) => {
6447
6446
  fixedColumn.value.splice(fixedIndex, 1);
6448
6447
  }
6449
6448
  };
6450
- const insertColumn = (column, append = false) => {
6449
+ const insertColumn = (column) => {
6451
6450
  const unFixedIndex = unFixedColumn.value.findIndex((item) => item.prop === column.prop);
6452
6451
  const fixedIndex = fixedColumn.value.findIndex((item) => item.prop === column.prop);
6453
6452
  if (unFixedIndex === -1 && fixedIndex === -1) {
6454
- if (append) {
6455
- (column.attr.fixed ? fixedColumn.value : unFixedColumn.value).push(column);
6456
- } else {
6457
- (column.attr.fixed ? fixedColumn.value : unFixedColumn.value).unshift(column);
6458
- }
6453
+ (column.attr.fixed ? fixedColumn.value : unFixedColumn.value).push(column);
6459
6454
  }
6460
6455
  };
6461
6456
  const updateCheckStatus = () => {
@@ -6505,13 +6500,14 @@ __sfc_main$1.setup = (__props, __ctx) => {
6505
6500
  if (item) {
6506
6501
  item.initHidden = false;
6507
6502
  const cloneItem = deepClone(item);
6508
- if (!cloneItem.attr) {
6509
- cloneItem.attr = {};
6510
- }
6511
6503
  newColumns.push(cloneItem);
6512
6504
  }
6513
6505
  });
6514
6506
  currentTable.value = newColumns;
6507
+ if (columnName.value) {
6508
+ searchValue = currentTable.value.filter((item) => (item.addLabel || item.label).includes(columnName.value));
6509
+ setFields(searchValue);
6510
+ }
6515
6511
  currentTable.value.map((item) => {
6516
6512
  if (item.attr.fixed) {
6517
6513
  fixedColumn.value.push(item);
@@ -6528,7 +6524,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
6528
6524
  searchValue.map((item) => {
6529
6525
  if (!unChangedColumn.value.includes(item.prop)) {
6530
6526
  if (v) {
6531
- insertColumn(item, true);
6527
+ insertColumn(item);
6532
6528
  } else {
6533
6529
  pullAwayColumn(item);
6534
6530
  }
@@ -6540,7 +6536,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
6540
6536
  currentTable.value.map((item) => {
6541
6537
  if (!unChangedColumn.value.includes(item.prop)) {
6542
6538
  if (v) {
6543
- insertColumn(item, true);
6539
+ insertColumn(item);
6544
6540
  } else {
6545
6541
  pullAwayColumn(item);
6546
6542
  }
@@ -6557,7 +6553,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
6557
6553
  if (item.prop === prop) {
6558
6554
  item.initHidden = !v;
6559
6555
  v ? "" : item.attr.fixed = false;
6560
- v ? insertColumn(item, true) : pullAwayColumn(item);
6556
+ v ? insertColumn(item) : pullAwayColumn(item);
6561
6557
  }
6562
6558
  });
6563
6559
  updateCheckStatus();
@@ -7544,9 +7540,6 @@ __sfc_main.setup = (__props, __ctx) => {
7544
7540
  }
7545
7541
  return key;
7546
7542
  });
7547
- computed(() => {
7548
- return "nf-search-form-view-identity";
7549
- });
7550
7543
  const processedColumns = computed(() => {
7551
7544
  var _a2;
7552
7545
  const viewField = window.viewField;
@@ -7610,9 +7603,9 @@ __sfc_main.setup = (__props, __ctx) => {
7610
7603
  return;
7611
7604
  let list = deepClone(props.btnItems);
7612
7605
  if (validate.isString(props.btnItems)) {
7613
- list = [...props.btnItems ? [{
7606
+ list = [{
7614
7607
  btnType: props.btnItems
7615
- }] : []];
7608
+ }];
7616
7609
  }
7617
7610
  list = list.map((item) => {
7618
7611
  if (validate.isString(item)) {
@@ -7864,15 +7857,15 @@ __sfc_main.setup = (__props, __ctx) => {
7864
7857
  btnItemsInit();
7865
7858
  formsInit();
7866
7859
  });
7867
- const refreshNfSearchFormModel = () => {
7860
+ function refreshNfSearchFormModel() {
7868
7861
  processedColumns.value.filter((item) => !resolveValue(item.destory, nfSearchFormModel.value)).forEach((v) => {
7869
7862
  if (!localShowItems.value.includes(v.prop)) {
7870
- mapDispose.setValue(nfSearchFormModel.value, v.key, void 0);
7863
+ mapDispose.setValue(nfSearchFormModel.value, v.prop, void 0);
7871
7864
  } else if (nfSearchFormModel.value[v.prop] === void 0) {
7872
7865
  setDefaultVal(v);
7873
7866
  }
7874
7867
  });
7875
- };
7868
+ }
7876
7869
  const formsInit = () => {
7877
7870
  getChangePropKeys();
7878
7871
  processedColumns.value.forEach((item) => {
@@ -7887,7 +7880,6 @@ __sfc_main.setup = (__props, __ctx) => {
7887
7880
  await nextTick();
7888
7881
  refreshLabel();
7889
7882
  };
7890
- const domWidth = ref();
7891
7883
  const topDom = ref();
7892
7884
  const refreshLabel = () => {
7893
7885
  if (props.btnModel === "inline" && !props.btnBoxLabel && props.labelPosition === "top") {
@@ -7919,24 +7911,14 @@ __sfc_main.setup = (__props, __ctx) => {
7919
7911
  }, 0);
7920
7912
  newColumns.value = count;
7921
7913
  };
7922
- throttle$1(calcColumns, 100);
7923
- const onResize = async (params = {}) => {
7924
- var _a2;
7925
- const {
7926
- width
7927
- } = ((_a2 = params == null ? void 0 : params[0]) == null ? void 0 : _a2.contentRect) || {};
7928
- if (width && domWidth.value && width === domWidth.value) {
7929
- return;
7930
- }
7931
- if (domWidth.value) {
7932
- await nextTick();
7933
- domWidth.value = topDom.value.offsetWidth;
7934
- }
7914
+ const onResize = async (_params) => {
7935
7915
  refreshLabel();
7936
7916
  };
7937
7917
  const observer = ref();
7938
7918
  onMounted(async () => {
7939
7919
  await nextTick();
7920
+ if (!topDom.value)
7921
+ return;
7940
7922
  observer.value = new ResizeObserver(onResize);
7941
7923
  observer.value.observe(topDom.value, {
7942
7924
  box: "border-box"
@@ -7981,7 +7963,7 @@ __sfc_main.setup = (__props, __ctx) => {
7981
7963
  }
7982
7964
  };
7983
7965
  const hiddenNfSearchFormItemOptionField = async (prop) => {
7984
- prop.formOptions._skip = true;
7966
+ props.formOptions._skip = true;
7985
7967
  processedColumns.value.every((item) => {
7986
7968
  if (item.prop === prop) {
7987
7969
  item.initHidden = true;
@@ -7999,22 +7981,10 @@ __sfc_main.setup = (__props, __ctx) => {
7999
7981
  await nextTick();
8000
7982
  refreshLabel();
8001
7983
  };
8002
- const columnCheckConfirmFeedback = (value) => {
8003
- if (!props.columnEdit) {
8004
- const itemsList = [];
8005
- for (const key in value) {
8006
- if (value[key]) {
8007
- itemsList.push(key);
8008
- }
8009
- }
8010
- setLocalShowItems(itemsList, true);
8011
- }
8012
- };
8013
7984
  const columnCheckConfirm = async (cb, error) => {
8014
7985
  var _a2;
8015
7986
  try {
8016
- const value = columnCheckDrawer.value.syncTableColumnsToCookies();
8017
- columnCheckConfirmFeedback(value);
7987
+ columnCheckDrawer.value.syncTableColumnsToCookies();
8018
7988
  await syncCookiesToLocalShowColumn(true);
8019
7989
  await syncCookiesToSearchFormItemOptions();
8020
7990
  await nextTick();
@@ -8032,8 +8002,7 @@ __sfc_main.setup = (__props, __ctx) => {
8032
8002
  async function clearColumnEditCached() {
8033
8003
  await CachedManager.asyncCachedSet(cStorageKey.value, null);
8034
8004
  }
8035
- const nfSearchFormItemOptionFieldsSave = async (value) => {
8036
- columnCheckConfirmFeedback(value);
8005
+ const nfSearchFormItemOptionFieldsSave = async () => {
8037
8006
  await syncCookiesToLocalShowColumn(true);
8038
8007
  await syncCookiesToSearchFormItemOptions();
8039
8008
  await nextTick();