@94ai/nf-search-form 3.2.25 → 3.2.29

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/lib/index.d.ts CHANGED
@@ -86,7 +86,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
86
86
  };
87
87
  columns: {
88
88
  type: import("vue-demi").PropType<number>;
89
- default: number;
89
+ default: undefined;
90
90
  };
91
91
  showBtn: {
92
92
  type: import("vue-demi").PropType<boolean>;
@@ -167,7 +167,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
167
167
  default: number;
168
168
  };
169
169
  formOptions: {
170
- type: import("vue-demi").PropType<import("./types").NfSearchFormItemOption[]>;
170
+ type: import("vue-demi").PropType<any>;
171
171
  default: () => never[];
172
172
  };
173
173
  closable: {
@@ -487,7 +487,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
487
487
  };
488
488
  columns: {
489
489
  type: import("vue-demi").PropType<number>;
490
- default: number;
490
+ default: undefined;
491
491
  };
492
492
  showBtn: {
493
493
  type: import("vue-demi").PropType<boolean>;
@@ -568,7 +568,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
568
568
  default: number;
569
569
  };
570
570
  formOptions: {
571
- type: import("vue-demi").PropType<import("./types").NfSearchFormItemOption[]>;
571
+ type: import("vue-demi").PropType<any>;
572
572
  default: () => never[];
573
573
  };
574
574
  closable: {
@@ -850,7 +850,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
850
850
  btnBoxLabel: string;
851
851
  btnModel: "inline" | "block";
852
852
  labelWidth: number;
853
- formOptions: import("./types").NfSearchFormItemOption[];
853
+ formOptions: any;
854
854
  closable: boolean;
855
855
  columnEdit: boolean;
856
856
  showItems: string[];
@@ -991,7 +991,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
991
991
  };
992
992
  columns: {
993
993
  type: import("vue-demi").PropType<number>;
994
- default: number;
994
+ default: undefined;
995
995
  };
996
996
  showBtn: {
997
997
  type: import("vue-demi").PropType<boolean>;
@@ -1072,7 +1072,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1072
1072
  default: number;
1073
1073
  };
1074
1074
  formOptions: {
1075
- type: import("vue-demi").PropType<import("./types").NfSearchFormItemOption[]>;
1075
+ type: import("vue-demi").PropType<any>;
1076
1076
  default: () => never[];
1077
1077
  };
1078
1078
  closable: {
@@ -1371,6 +1371,8 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1371
1371
  columnCheckDrawer: import("vue-demi").Ref<any>;
1372
1372
  configNfSearchItemVisibleDialog: import("vue-demi").Ref<boolean>;
1373
1373
  syncCookiesToSearchFormItemOptions: (readCached?: boolean) => void;
1374
+ onResize: () => void;
1375
+ visibleChange: () => void;
1374
1376
  }> & import("vue/types/v3-component-options").ExtractComputedReturns<{}> & import("vue-demi").ComponentCustomProperties & Readonly<import("vue-demi").ExtractPropTypes<{
1375
1377
  storageKey: {
1376
1378
  type: import("vue-demi").PropType<string>;
@@ -1458,7 +1460,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1458
1460
  };
1459
1461
  columns: {
1460
1462
  type: import("vue-demi").PropType<number>;
1461
- default: number;
1463
+ default: undefined;
1462
1464
  };
1463
1465
  showBtn: {
1464
1466
  type: import("vue-demi").PropType<boolean>;
@@ -1539,7 +1541,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1539
1541
  default: number;
1540
1542
  };
1541
1543
  formOptions: {
1542
- type: import("vue-demi").PropType<import("./types").NfSearchFormItemOption[]>;
1544
+ type: import("vue-demi").PropType<any>;
1543
1545
  default: () => never[];
1544
1546
  };
1545
1547
  closable: {
@@ -1859,7 +1861,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1859
1861
  };
1860
1862
  columns: {
1861
1863
  type: import("vue-demi").PropType<number>;
1862
- default: number;
1864
+ default: undefined;
1863
1865
  };
1864
1866
  showBtn: {
1865
1867
  type: import("vue-demi").PropType<boolean>;
@@ -1940,7 +1942,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1940
1942
  default: number;
1941
1943
  };
1942
1944
  formOptions: {
1943
- type: import("vue-demi").PropType<import("./types").NfSearchFormItemOption[]>;
1945
+ type: import("vue-demi").PropType<any>;
1944
1946
  default: () => never[];
1945
1947
  };
1946
1948
  closable: {
@@ -2239,6 +2241,8 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2239
2241
  columnCheckDrawer: import("vue-demi").Ref<any>;
2240
2242
  configNfSearchItemVisibleDialog: import("vue-demi").Ref<boolean>;
2241
2243
  syncCookiesToSearchFormItemOptions: (readCached?: boolean) => void;
2244
+ onResize: () => void;
2245
+ visibleChange: () => void;
2242
2246
  }, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
2243
2247
  onChange: (event: Record<string, any>) => void;
2244
2248
  itemsChange: (event: string[]) => void;
@@ -2288,7 +2292,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2288
2292
  btnBoxLabel: string;
2289
2293
  btnModel: "inline" | "block";
2290
2294
  labelWidth: number;
2291
- formOptions: import("./types").NfSearchFormItemOption[];
2295
+ formOptions: any;
2292
2296
  closable: boolean;
2293
2297
  columnEdit: boolean;
2294
2298
  showItems: string[];
@@ -2430,7 +2434,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2430
2434
  };
2431
2435
  columns: {
2432
2436
  type: import("vue-demi").PropType<number>;
2433
- default: number;
2437
+ default: undefined;
2434
2438
  };
2435
2439
  showBtn: {
2436
2440
  type: import("vue-demi").PropType<boolean>;
@@ -2511,7 +2515,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2511
2515
  default: number;
2512
2516
  };
2513
2517
  formOptions: {
2514
- type: import("vue-demi").PropType<import("./types").NfSearchFormItemOption[]>;
2518
+ type: import("vue-demi").PropType<any>;
2515
2519
  default: () => never[];
2516
2520
  };
2517
2521
  closable: {
@@ -337,8 +337,10 @@ __sfc_main$3.props = {
337
337
  }
338
338
  };
339
339
  __sfc_main$3.setup = (__props, __ctx) => {
340
+ var _a;
340
341
  const emit = __ctx.emit;
341
342
  const props = __props;
343
+ const instance = (_a = vueDemi.getCurrentInstance()) == null ? void 0 : _a.proxy;
342
344
  const slotName = vueDemi.computed(() => {
343
345
  return props.itemOptions.slot || "";
344
346
  });
@@ -398,75 +400,75 @@ __sfc_main$3.setup = (__props, __ctx) => {
398
400
  return props.itemOptions.tooltip;
399
401
  });
400
402
  const isInput = vueDemi.computed(() => {
401
- var _a;
402
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "el-input";
403
+ var _a2;
404
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "el-input";
403
405
  });
404
406
  const isInputNumber = vueDemi.computed(() => {
405
- var _a;
406
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "el-input-number";
407
+ var _a2;
408
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "el-input-number";
407
409
  });
408
410
  const isSelect = vueDemi.computed(() => {
409
- var _a;
410
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
411
+ var _a2;
412
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
411
413
  return element === "el-select" || element === "custom-select" || element === "ai-select" || element === "ai-custom-select";
412
414
  });
413
415
  const isDatePickerDateRange = vueDemi.computed(() => {
414
- var _a, _b;
415
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
416
+ var _a2, _b;
417
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
416
418
  const type = (_b = props.itemOptions) == null ? void 0 : _b.type;
417
419
  const isDatePicker = element === "el-date-picker" || element === "nf-date-picker";
418
420
  const isDateRange = type === "datetimerange" || type === "daterange";
419
421
  return isDatePicker && isDateRange;
420
422
  });
421
423
  const isDatePickerMonthRange = vueDemi.computed(() => {
422
- var _a, _b;
423
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
424
+ var _a2, _b;
425
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
424
426
  const isDatePicker = element === "el-date-picker" || element === "nf-date-picker";
425
427
  const isMonthRange = ((_b = props.itemOptions) == null ? void 0 : _b.type) === "monthrange";
426
428
  return isDatePicker && isMonthRange;
427
429
  });
428
430
  const isDatePickerOthers = vueDemi.computed(() => {
429
- var _a;
430
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
431
+ var _a2;
432
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
431
433
  const isDatePicker = element === "el-date-picker" || element === "nf-date-picker";
432
434
  return isDatePicker && !isDatePickerDateRange.value && !isDatePickerMonthRange.value;
433
435
  });
434
436
  const isYearPickerYearRange = vueDemi.computed(() => {
435
- var _a;
436
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
437
+ var _a2;
438
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
437
439
  return element === "nf-double-year";
438
440
  });
439
441
  const isHalfYearPickerHalfYearRange = vueDemi.computed(() => {
440
- var _a, _b;
441
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
442
+ var _a2, _b;
443
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
442
444
  const isHalfYearRange = element === "nf-half-year-picker" && ((_b = props.itemOptions) == null ? void 0 : _b.type) === "halfyearrange";
443
445
  return isHalfYearRange || element === "nf-double-half-year";
444
446
  });
445
447
  const isHalfYearPicker = vueDemi.computed(() => {
446
- var _a, _b;
447
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "nf-half-year-picker" && ((_b = props.itemOptions) == null ? void 0 : _b.type) !== "halfyearrange";
448
+ var _a2, _b;
449
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "nf-half-year-picker" && ((_b = props.itemOptions) == null ? void 0 : _b.type) !== "halfyearrange";
448
450
  });
449
451
  const isQuarterPickerQuarterRange = vueDemi.computed(() => {
450
- var _a, _b;
451
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
452
+ var _a2, _b;
453
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
452
454
  const isHalfYearRange = element === "nf-quarter-picker" && ((_b = props.itemOptions) == null ? void 0 : _b.type) === "quarterrange";
453
455
  return isHalfYearRange || element === "nf-double-quarter";
454
456
  });
455
457
  const isQuarterPicker = vueDemi.computed(() => {
456
- var _a, _b;
457
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "nf-quarter-picker" && ((_b = props.itemOptions) == null ? void 0 : _b.type) !== "quarterrange";
458
+ var _a2, _b;
459
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "nf-quarter-picker" && ((_b = props.itemOptions) == null ? void 0 : _b.type) !== "quarterrange";
458
460
  });
459
461
  const isDoubleWeek = vueDemi.computed(() => {
460
- var _a;
461
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "nf-double-week";
462
+ var _a2;
463
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "nf-double-week";
462
464
  });
463
465
  const isCascader = vueDemi.computed(() => {
464
- var _a;
465
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "el-cascader";
466
+ var _a2;
467
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "el-cascader";
466
468
  });
467
469
  const isTimeSelect = vueDemi.computed(() => {
468
- var _a;
469
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "el-time-select" && props.itemOptions.type !== "datetimerange";
470
+ var _a2;
471
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "el-time-select" && props.itemOptions.type !== "datetimerange";
470
472
  });
471
473
  const isTimeSelectRange = vueDemi.computed(() => {
472
474
  return props.itemOptions.element === "el-time-select" && props.itemOptions.type === "datetimerange";
@@ -481,15 +483,15 @@ __sfc_main$3.setup = (__props, __ctx) => {
481
483
  return props.itemOptions.element === "nf-select-transfer";
482
484
  });
483
485
  const handleChange = (event) => {
484
- var _a, _b;
485
- if ((_b = (_a = props.itemOptions) == null ? void 0 : _a.events) == null ? void 0 : _b.change) {
486
- props.itemOptions.events.change(event, void 0);
486
+ var _a2, _b;
487
+ if ((_b = (_a2 = props.itemOptions) == null ? void 0 : _a2.events) == null ? void 0 : _b.change) {
488
+ props.itemOptions.events.change(event, instance);
487
489
  }
488
490
  };
489
491
  const handleInput = (event) => {
490
- var _a, _b;
491
- if ((_b = (_a = props.itemOptions) == null ? void 0 : _a.events) == null ? void 0 : _b.keyup) {
492
- props.itemOptions.events.keyup(event, void 0);
492
+ var _a2, _b;
493
+ if ((_b = (_a2 = props.itemOptions) == null ? void 0 : _a2.events) == null ? void 0 : _b.keyup) {
494
+ props.itemOptions.events.keyup(event, instance);
493
495
  }
494
496
  };
495
497
  return {
@@ -6439,7 +6441,7 @@ __sfc_main.props = {
6439
6441
  key: "columns",
6440
6442
  required: false,
6441
6443
  type: Number,
6442
- default: 3
6444
+ default: void 0
6443
6445
  },
6444
6446
  showBtn: {
6445
6447
  key: "showBtn",
@@ -6586,7 +6588,7 @@ __sfc_main.props = {
6586
6588
  formOptions: {
6587
6589
  key: "formOptions",
6588
6590
  required: false,
6589
- type: Array,
6591
+ type: [Array, null],
6590
6592
  default: () => []
6591
6593
  },
6592
6594
  closable: {
@@ -7040,13 +7042,15 @@ __sfc_main.setup = (__props, __ctx) => {
7040
7042
  const columnCheckDialog = vueDemi.ref();
7041
7043
  const nfSearchFormModel = vueDemi.ref({});
7042
7044
  const initLocalShow = () => {
7045
+ props.formOptions._skip = true;
7043
7046
  const result = props.formOptions.filter((item) => {
7044
7047
  var _a2;
7045
7048
  if ((_a2 = props.showItems) == null ? void 0 : _a2.includes(item.prop)) {
7046
- item.initHidden = true;
7049
+ item.initHidden = false;
7047
7050
  }
7048
- return item.initHidden;
7051
+ return !item.initHidden;
7049
7052
  }).map((item) => item.prop);
7053
+ props.formOptions._skip = false;
7050
7054
  if (result.length) {
7051
7055
  return result;
7052
7056
  }
@@ -7096,6 +7100,7 @@ __sfc_main.setup = (__props, __ctx) => {
7096
7100
  }
7097
7101
  };
7098
7102
  const syncShowItemToInitHidden = () => {
7103
+ props.formOptions._skip = true;
7099
7104
  props.formOptions.forEach((item) => {
7100
7105
  var _a2;
7101
7106
  if ((_a2 = localShowItems.value) == null ? void 0 : _a2.includes(item.prop)) {
@@ -7104,6 +7109,7 @@ __sfc_main.setup = (__props, __ctx) => {
7104
7109
  item.initHidden = true;
7105
7110
  }
7106
7111
  });
7112
+ props.formOptions._skip = false;
7107
7113
  };
7108
7114
  if (props.columnEdit) {
7109
7115
  const cached = (_b = instance == null ? void 0 : instance.$cookies) == null ? void 0 : _b.get(props.storageKey);
@@ -7122,6 +7128,7 @@ __sfc_main.setup = (__props, __ctx) => {
7122
7128
  const renderSearchFormItemOptions = vueDemi.ref([]);
7123
7129
  const syncCookiesToSearchFormItemOptions = (readCached = true) => {
7124
7130
  var _a2;
7131
+ props.formOptions._skip = true;
7125
7132
  const columns = props.formOptions.map((item, index2) => {
7126
7133
  item.key = item.key || createUniqueString();
7127
7134
  item._index = index2;
@@ -7148,6 +7155,7 @@ __sfc_main.setup = (__props, __ctx) => {
7148
7155
  }
7149
7156
  }
7150
7157
  renderSearchFormItemOptions.value = columns.sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
7158
+ props.formOptions._skip = false;
7151
7159
  };
7152
7160
  syncCookiesToSearchFormItemOptions();
7153
7161
  const itemIsShow = (item) => {
@@ -7174,6 +7182,9 @@ __sfc_main.setup = (__props, __ctx) => {
7174
7182
  vueDemi.watch(() => {
7175
7183
  return props.formOptions;
7176
7184
  }, () => {
7185
+ if (props.formOptions._skip) {
7186
+ return;
7187
+ }
7177
7188
  syncCookiesToSearchFormItemOptions();
7178
7189
  }, {
7179
7190
  deep: true
@@ -7208,6 +7219,10 @@ __sfc_main.setup = (__props, __ctx) => {
7208
7219
  }
7209
7220
  };
7210
7221
  const calcColumns = () => {
7222
+ if (props.columns) {
7223
+ newColumns.value = props.columns;
7224
+ return;
7225
+ }
7211
7226
  if (!nfSearchFormRef.value)
7212
7227
  return;
7213
7228
  let count = 0;
@@ -7406,7 +7421,9 @@ __sfc_main.setup = (__props, __ctx) => {
7406
7421
  /**
7407
7422
  * 列编辑同步cookies到组件渲染数据
7408
7423
  */
7409
- syncCookiesToSearchFormItemOptions
7424
+ syncCookiesToSearchFormItemOptions,
7425
+ onResize,
7426
+ visibleChange: onResize
7410
7427
  });
7411
7428
  };
7412
7429
  __sfc_main.components = Object.assign({
@@ -335,8 +335,10 @@ __sfc_main$3.props = {
335
335
  }
336
336
  };
337
337
  __sfc_main$3.setup = (__props, __ctx) => {
338
+ var _a;
338
339
  const emit = __ctx.emit;
339
340
  const props = __props;
341
+ const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
340
342
  const slotName = computed(() => {
341
343
  return props.itemOptions.slot || "";
342
344
  });
@@ -396,75 +398,75 @@ __sfc_main$3.setup = (__props, __ctx) => {
396
398
  return props.itemOptions.tooltip;
397
399
  });
398
400
  const isInput = computed(() => {
399
- var _a;
400
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "el-input";
401
+ var _a2;
402
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "el-input";
401
403
  });
402
404
  const isInputNumber = computed(() => {
403
- var _a;
404
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "el-input-number";
405
+ var _a2;
406
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "el-input-number";
405
407
  });
406
408
  const isSelect = computed(() => {
407
- var _a;
408
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
409
+ var _a2;
410
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
409
411
  return element === "el-select" || element === "custom-select" || element === "ai-select" || element === "ai-custom-select";
410
412
  });
411
413
  const isDatePickerDateRange = computed(() => {
412
- var _a, _b;
413
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
414
+ var _a2, _b;
415
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
414
416
  const type = (_b = props.itemOptions) == null ? void 0 : _b.type;
415
417
  const isDatePicker = element === "el-date-picker" || element === "nf-date-picker";
416
418
  const isDateRange = type === "datetimerange" || type === "daterange";
417
419
  return isDatePicker && isDateRange;
418
420
  });
419
421
  const isDatePickerMonthRange = computed(() => {
420
- var _a, _b;
421
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
422
+ var _a2, _b;
423
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
422
424
  const isDatePicker = element === "el-date-picker" || element === "nf-date-picker";
423
425
  const isMonthRange = ((_b = props.itemOptions) == null ? void 0 : _b.type) === "monthrange";
424
426
  return isDatePicker && isMonthRange;
425
427
  });
426
428
  const isDatePickerOthers = computed(() => {
427
- var _a;
428
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
429
+ var _a2;
430
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
429
431
  const isDatePicker = element === "el-date-picker" || element === "nf-date-picker";
430
432
  return isDatePicker && !isDatePickerDateRange.value && !isDatePickerMonthRange.value;
431
433
  });
432
434
  const isYearPickerYearRange = computed(() => {
433
- var _a;
434
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
435
+ var _a2;
436
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
435
437
  return element === "nf-double-year";
436
438
  });
437
439
  const isHalfYearPickerHalfYearRange = computed(() => {
438
- var _a, _b;
439
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
440
+ var _a2, _b;
441
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
440
442
  const isHalfYearRange = element === "nf-half-year-picker" && ((_b = props.itemOptions) == null ? void 0 : _b.type) === "halfyearrange";
441
443
  return isHalfYearRange || element === "nf-double-half-year";
442
444
  });
443
445
  const isHalfYearPicker = computed(() => {
444
- var _a, _b;
445
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "nf-half-year-picker" && ((_b = props.itemOptions) == null ? void 0 : _b.type) !== "halfyearrange";
446
+ var _a2, _b;
447
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "nf-half-year-picker" && ((_b = props.itemOptions) == null ? void 0 : _b.type) !== "halfyearrange";
446
448
  });
447
449
  const isQuarterPickerQuarterRange = computed(() => {
448
- var _a, _b;
449
- const element = (_a = props.itemOptions) == null ? void 0 : _a.element;
450
+ var _a2, _b;
451
+ const element = (_a2 = props.itemOptions) == null ? void 0 : _a2.element;
450
452
  const isHalfYearRange = element === "nf-quarter-picker" && ((_b = props.itemOptions) == null ? void 0 : _b.type) === "quarterrange";
451
453
  return isHalfYearRange || element === "nf-double-quarter";
452
454
  });
453
455
  const isQuarterPicker = computed(() => {
454
- var _a, _b;
455
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "nf-quarter-picker" && ((_b = props.itemOptions) == null ? void 0 : _b.type) !== "quarterrange";
456
+ var _a2, _b;
457
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "nf-quarter-picker" && ((_b = props.itemOptions) == null ? void 0 : _b.type) !== "quarterrange";
456
458
  });
457
459
  const isDoubleWeek = computed(() => {
458
- var _a;
459
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "nf-double-week";
460
+ var _a2;
461
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "nf-double-week";
460
462
  });
461
463
  const isCascader = computed(() => {
462
- var _a;
463
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "el-cascader";
464
+ var _a2;
465
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "el-cascader";
464
466
  });
465
467
  const isTimeSelect = computed(() => {
466
- var _a;
467
- return ((_a = props.itemOptions) == null ? void 0 : _a.element) === "el-time-select" && props.itemOptions.type !== "datetimerange";
468
+ var _a2;
469
+ return ((_a2 = props.itemOptions) == null ? void 0 : _a2.element) === "el-time-select" && props.itemOptions.type !== "datetimerange";
468
470
  });
469
471
  const isTimeSelectRange = computed(() => {
470
472
  return props.itemOptions.element === "el-time-select" && props.itemOptions.type === "datetimerange";
@@ -479,15 +481,15 @@ __sfc_main$3.setup = (__props, __ctx) => {
479
481
  return props.itemOptions.element === "nf-select-transfer";
480
482
  });
481
483
  const handleChange = (event) => {
482
- var _a, _b;
483
- if ((_b = (_a = props.itemOptions) == null ? void 0 : _a.events) == null ? void 0 : _b.change) {
484
- props.itemOptions.events.change(event, void 0);
484
+ var _a2, _b;
485
+ if ((_b = (_a2 = props.itemOptions) == null ? void 0 : _a2.events) == null ? void 0 : _b.change) {
486
+ props.itemOptions.events.change(event, instance);
485
487
  }
486
488
  };
487
489
  const handleInput = (event) => {
488
- var _a, _b;
489
- if ((_b = (_a = props.itemOptions) == null ? void 0 : _a.events) == null ? void 0 : _b.keyup) {
490
- props.itemOptions.events.keyup(event, void 0);
490
+ var _a2, _b;
491
+ if ((_b = (_a2 = props.itemOptions) == null ? void 0 : _a2.events) == null ? void 0 : _b.keyup) {
492
+ props.itemOptions.events.keyup(event, instance);
491
493
  }
492
494
  };
493
495
  return {
@@ -6437,7 +6439,7 @@ __sfc_main.props = {
6437
6439
  key: "columns",
6438
6440
  required: false,
6439
6441
  type: Number,
6440
- default: 3
6442
+ default: void 0
6441
6443
  },
6442
6444
  showBtn: {
6443
6445
  key: "showBtn",
@@ -6584,7 +6586,7 @@ __sfc_main.props = {
6584
6586
  formOptions: {
6585
6587
  key: "formOptions",
6586
6588
  required: false,
6587
- type: Array,
6589
+ type: [Array, null],
6588
6590
  default: () => []
6589
6591
  },
6590
6592
  closable: {
@@ -7038,13 +7040,15 @@ __sfc_main.setup = (__props, __ctx) => {
7038
7040
  const columnCheckDialog = ref();
7039
7041
  const nfSearchFormModel = ref({});
7040
7042
  const initLocalShow = () => {
7043
+ props.formOptions._skip = true;
7041
7044
  const result = props.formOptions.filter((item) => {
7042
7045
  var _a2;
7043
7046
  if ((_a2 = props.showItems) == null ? void 0 : _a2.includes(item.prop)) {
7044
- item.initHidden = true;
7047
+ item.initHidden = false;
7045
7048
  }
7046
- return item.initHidden;
7049
+ return !item.initHidden;
7047
7050
  }).map((item) => item.prop);
7051
+ props.formOptions._skip = false;
7048
7052
  if (result.length) {
7049
7053
  return result;
7050
7054
  }
@@ -7094,6 +7098,7 @@ __sfc_main.setup = (__props, __ctx) => {
7094
7098
  }
7095
7099
  };
7096
7100
  const syncShowItemToInitHidden = () => {
7101
+ props.formOptions._skip = true;
7097
7102
  props.formOptions.forEach((item) => {
7098
7103
  var _a2;
7099
7104
  if ((_a2 = localShowItems.value) == null ? void 0 : _a2.includes(item.prop)) {
@@ -7102,6 +7107,7 @@ __sfc_main.setup = (__props, __ctx) => {
7102
7107
  item.initHidden = true;
7103
7108
  }
7104
7109
  });
7110
+ props.formOptions._skip = false;
7105
7111
  };
7106
7112
  if (props.columnEdit) {
7107
7113
  const cached = (_b = instance == null ? void 0 : instance.$cookies) == null ? void 0 : _b.get(props.storageKey);
@@ -7120,6 +7126,7 @@ __sfc_main.setup = (__props, __ctx) => {
7120
7126
  const renderSearchFormItemOptions = ref([]);
7121
7127
  const syncCookiesToSearchFormItemOptions = (readCached = true) => {
7122
7128
  var _a2;
7129
+ props.formOptions._skip = true;
7123
7130
  const columns = props.formOptions.map((item, index2) => {
7124
7131
  item.key = item.key || createUniqueString();
7125
7132
  item._index = index2;
@@ -7146,6 +7153,7 @@ __sfc_main.setup = (__props, __ctx) => {
7146
7153
  }
7147
7154
  }
7148
7155
  renderSearchFormItemOptions.value = columns.sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
7156
+ props.formOptions._skip = false;
7149
7157
  };
7150
7158
  syncCookiesToSearchFormItemOptions();
7151
7159
  const itemIsShow = (item) => {
@@ -7172,6 +7180,9 @@ __sfc_main.setup = (__props, __ctx) => {
7172
7180
  watch(() => {
7173
7181
  return props.formOptions;
7174
7182
  }, () => {
7183
+ if (props.formOptions._skip) {
7184
+ return;
7185
+ }
7175
7186
  syncCookiesToSearchFormItemOptions();
7176
7187
  }, {
7177
7188
  deep: true
@@ -7206,6 +7217,10 @@ __sfc_main.setup = (__props, __ctx) => {
7206
7217
  }
7207
7218
  };
7208
7219
  const calcColumns = () => {
7220
+ if (props.columns) {
7221
+ newColumns.value = props.columns;
7222
+ return;
7223
+ }
7209
7224
  if (!nfSearchFormRef.value)
7210
7225
  return;
7211
7226
  let count = 0;
@@ -7404,7 +7419,9 @@ __sfc_main.setup = (__props, __ctx) => {
7404
7419
  /**
7405
7420
  * 列编辑同步cookies到组件渲染数据
7406
7421
  */
7407
- syncCookiesToSearchFormItemOptions
7422
+ syncCookiesToSearchFormItemOptions,
7423
+ onResize,
7424
+ visibleChange: onResize
7408
7425
  });
7409
7426
  };
7410
7427
  __sfc_main.components = Object.assign({
@@ -87,7 +87,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
87
87
  };
88
88
  columns: {
89
89
  type: import("vue-demi").PropType<number>;
90
- default: number;
90
+ default: undefined;
91
91
  };
92
92
  showBtn: {
93
93
  type: import("vue-demi").PropType<boolean>;
@@ -168,7 +168,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
168
168
  default: number;
169
169
  };
170
170
  formOptions: {
171
- type: import("vue-demi").PropType<NfSearchFormItemOption[]>;
171
+ type: import("vue-demi").PropType<any>;
172
172
  default: () => never[];
173
173
  };
174
174
  closable: {
@@ -467,6 +467,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
467
467
  columnCheckDrawer: import("vue-demi").Ref<any>;
468
468
  configNfSearchItemVisibleDialog: import("vue-demi").Ref<boolean>;
469
469
  syncCookiesToSearchFormItemOptions: (readCached?: boolean) => void;
470
+ onResize: () => void;
471
+ visibleChange: () => void;
470
472
  }, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
471
473
  onChange: (event: Record<string, any>) => void;
472
474
  itemsChange: (event: string[]) => void;
@@ -562,7 +564,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
562
564
  };
563
565
  columns: {
564
566
  type: import("vue-demi").PropType<number>;
565
- default: number;
567
+ default: undefined;
566
568
  };
567
569
  showBtn: {
568
570
  type: import("vue-demi").PropType<boolean>;
@@ -643,7 +645,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
643
645
  default: number;
644
646
  };
645
647
  formOptions: {
646
- type: import("vue-demi").PropType<NfSearchFormItemOption[]>;
648
+ type: import("vue-demi").PropType<any>;
647
649
  default: () => never[];
648
650
  };
649
651
  closable: {
@@ -917,7 +919,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
917
919
  btnBoxLabel: string;
918
920
  btnModel: 'inline' | 'block';
919
921
  labelWidth: number;
920
- formOptions: NfSearchFormItemOption[];
922
+ formOptions: NfSearchFormItemOption[] | any;
921
923
  closable: boolean;
922
924
  columnEdit: boolean;
923
925
  showItems: string[];
@@ -183,7 +183,8 @@ import {
183
183
  computed,
184
184
  ref,
185
185
  watch,
186
- onBeforeMount
186
+ onBeforeMount,
187
+ getCurrentInstance
187
188
  } from 'vue-demi'
188
189
  import { NfSearchFormItemOption } from '@94ai/nf-search-form/lib/types'
189
190
  import { createUniqueString } from './tools'
@@ -207,6 +208,8 @@ const props = withDefaults(defineProps<{
207
208
  itemOptions: () => ({}),
208
209
  })
209
210
 
211
+ const instance = getCurrentInstance()?.proxy
212
+
210
213
  const slotName = computed(() => {
211
214
  return props.itemOptions.slot || ''
212
215
  })
@@ -373,12 +376,12 @@ const isSelectTransfer = computed(() => {
373
376
 
374
377
  const handleChange = (event) => {
375
378
  if (props.itemOptions?.events?.change) {
376
- props.itemOptions.events.change(event, this)
379
+ props.itemOptions.events.change(event, instance)
377
380
  }
378
381
  }
379
382
  const handleInput = (event) => {
380
383
  if (props.itemOptions?.events?.keyup) {
381
- props.itemOptions.events.keyup(event, this)
384
+ props.itemOptions.events.keyup(event, instance)
382
385
  }
383
386
  }
384
387
 
@@ -338,7 +338,7 @@ const props = withDefaults(defineProps<{
338
338
  /**
339
339
  * 所有的表单项
340
340
  */
341
- formOptions?: NfSearchFormItemOption[],
341
+ formOptions?: NfSearchFormItemOption[] | any,
342
342
  /**
343
343
  * 列编辑,是否显示关闭选项功能
344
344
  */
@@ -462,7 +462,7 @@ const props = withDefaults(defineProps<{
462
462
  expandBtnCircle: false,
463
463
  expandBtnLoading: false,
464
464
  expandBtnDisabled: false,
465
- columns: 3,
465
+ columns: undefined,
466
466
  labelPosition: 'top',
467
467
  inline: true,
468
468
  rules: undefined,
@@ -602,12 +602,14 @@ const nfSearchFormModel = ref<Record<string, any>>({})
602
602
  * 同步用户参数
603
603
  */
604
604
  const initLocalShow = () => {
605
+ props.formOptions._skip = true
605
606
  const result = props.formOptions.filter(item => {
606
607
  if (props.showItems?.includes(item.prop!)) {
607
- item.initHidden = true
608
+ item.initHidden = false
608
609
  }
609
- return item.initHidden
610
+ return !item.initHidden
610
611
  }).map(item => item.prop!)
612
+ props.formOptions._skip = false
611
613
  if (result.length) {
612
614
  return result
613
615
  }
@@ -657,6 +659,7 @@ const syncCookiesToLocalShowColumn = () => {
657
659
  }
658
660
 
659
661
  const syncShowItemToInitHidden = () => {
662
+ props.formOptions._skip = true
660
663
  props.formOptions.forEach(item => {
661
664
  if (localShowItems.value?.includes(item.prop!)) {
662
665
  item.initHidden = false
@@ -664,12 +667,12 @@ const syncShowItemToInitHidden = () => {
664
667
  item.initHidden = true
665
668
  }
666
669
  })
670
+ props.formOptions._skip = false
667
671
  }
668
672
  if (props.columnEdit) {
669
673
  // 同步缓存参数
670
674
  const cached = instance?.$cookies?.get(props.storageKey)
671
675
  const cachedPriority = props.priority === 'cached'
672
-
673
676
  if (cachedPriority ? cached : localShowItems.value?.length) {
674
677
  cachedPriority ? syncCookiesToLocalShowColumn() : syncLocalShowColumnToCookies()
675
678
  } else if (cachedPriority ? localShowItems.value?.length : cached) {
@@ -698,6 +701,7 @@ const isShowBtnBoxSlot = computed(() => {
698
701
  */
699
702
  const renderSearchFormItemOptions = ref<NfSearchFormItemOption[]>([])
700
703
  const syncCookiesToSearchFormItemOptions = (readCached = true) => {
704
+ props.formOptions._skip = true
701
705
  const columns = props.formOptions!.map((item, index) => {
702
706
  item.key = item.key || createUniqueString()
703
707
  item._index = index
@@ -725,6 +729,7 @@ const syncCookiesToSearchFormItemOptions = (readCached = true) => {
725
729
  }
726
730
  }
727
731
  renderSearchFormItemOptions.value = columns.sort((a, b) => a._index! - b._index! < 0 ? -1 : a._index! - b._index! > 0 ? 1 : 0)
732
+ props.formOptions._skip = false
728
733
  }
729
734
  syncCookiesToSearchFormItemOptions()
730
735
 
@@ -777,6 +782,9 @@ onBeforeMount(() => {
777
782
  watch(() => {
778
783
  return props.formOptions
779
784
  }, () => {
785
+ if (props.formOptions._skip) {
786
+ return
787
+ }
780
788
  syncCookiesToSearchFormItemOptions()
781
789
  }, {
782
790
  deep: true
@@ -815,6 +823,10 @@ const onResize = () => {
815
823
  }
816
824
 
817
825
  const calcColumns = () => {
826
+ if (props.columns) {
827
+ newColumns.value = props.columns
828
+ return
829
+ }
818
830
  if (!nfSearchFormRef.value) return
819
831
  let count = 0
820
832
  const formWidth = nfSearchFormRef.value.$el.offsetWidth
@@ -1026,7 +1038,9 @@ defineExpose({
1026
1038
  /**
1027
1039
  * 列编辑同步cookies到组件渲染数据
1028
1040
  */
1029
- syncCookiesToSearchFormItemOptions
1041
+ syncCookiesToSearchFormItemOptions,
1042
+ onResize,
1043
+ visibleChange: onResize
1030
1044
  })
1031
1045
 
1032
1046
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-search-form",
3
- "version": "3.2.25",
3
+ "version": "3.2.29",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "zoujiahe <zoujiahe@94ai.com>",
@@ -14,20 +14,20 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/nf-action": "^3.2.25",
18
- "@94ai/nf-double-half-year": "^3.2.25",
19
- "@94ai/nf-double-quarter": "^3.2.25",
20
- "@94ai/nf-double-week": "^3.2.25",
21
- "@94ai/nf-double-year": "^3.2.25",
22
- "@94ai/nf-drawer": "^3.2.25",
23
- "@94ai/nf-form": "^3.2.25",
24
- "@94ai/nf-form-item": "^3.2.25",
25
- "@94ai/nf-half-year-picker": "^3.2.25",
26
- "@94ai/nf-message": "^3.2.25",
27
- "@94ai/nf-quarter-picker": "^3.2.25",
28
- "@94ai/nf-select-transfer": "^3.2.25",
29
- "@94ai/nf-theme-chalk": "^3.2.25",
30
- "@94ai/nf-virtual-select": "^3.2.25",
17
+ "@94ai/nf-action": "^3.2.29",
18
+ "@94ai/nf-double-half-year": "^3.2.29",
19
+ "@94ai/nf-double-quarter": "^3.2.29",
20
+ "@94ai/nf-double-week": "^3.2.29",
21
+ "@94ai/nf-double-year": "^3.2.29",
22
+ "@94ai/nf-drawer": "^3.2.29",
23
+ "@94ai/nf-form": "^3.2.29",
24
+ "@94ai/nf-form-item": "^3.2.29",
25
+ "@94ai/nf-half-year-picker": "^3.2.29",
26
+ "@94ai/nf-message": "^3.2.29",
27
+ "@94ai/nf-quarter-picker": "^3.2.29",
28
+ "@94ai/nf-select-transfer": "^3.2.29",
29
+ "@94ai/nf-theme-chalk": "^3.2.29",
30
+ "@94ai/nf-virtual-select": "^3.2.29",
31
31
  "vue-cookies": "^1.8.3",
32
32
  "vue-demi": "^0.14.5",
33
33
  "vuedraggable": "^2.24.3"
@@ -45,5 +45,5 @@
45
45
  "types": "lib/index.d.ts",
46
46
  "main": "lib/nf-search-form.cjs.js",
47
47
  "module": "lib/nf-search-form.esm-bundler.js",
48
- "gitHead": "8cef5ebb5a3f98596f2f279bcfcd337d293767d2"
48
+ "gitHead": "d50a6e5d90176f48f79efc659a7f66bbc31721e2"
49
49
  }