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

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
@@ -68,14 +68,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
68
68
  type: import("vue-demi").PropType<boolean>;
69
69
  default: boolean;
70
70
  };
71
- itemWidth: {
72
- type: import("vue-demi").PropType<number>;
73
- default: number;
74
- };
75
71
  rules: {
76
72
  type: import("vue-demi").PropType<Record<string, any>>;
77
73
  default: undefined;
78
74
  };
75
+ inline: {
76
+ type: import("vue-demi").PropType<boolean>;
77
+ default: boolean;
78
+ };
79
79
  upIcon: {
80
80
  type: import("vue-demi").PropType<string>;
81
81
  default: string;
@@ -154,16 +154,12 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
154
154
  type: import("vue-demi").PropType<"right" | "left" | "top">;
155
155
  default: string;
156
156
  };
157
- inline: {
158
- type: import("vue-demi").PropType<boolean>;
159
- default: boolean;
160
- };
161
157
  btnBoxLabel: {
162
158
  type: import("vue-demi").PropType<string>;
163
159
  default: string;
164
160
  };
165
161
  btnModel: {
166
- type: import("vue-demi").PropType<"block" | "inline">;
162
+ type: import("vue-demi").PropType<"inline" | "block">;
167
163
  default: string;
168
164
  };
169
165
  labelWidth: {
@@ -473,14 +469,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
473
469
  type: import("vue-demi").PropType<boolean>;
474
470
  default: boolean;
475
471
  };
476
- itemWidth: {
477
- type: import("vue-demi").PropType<number>;
478
- default: number;
479
- };
480
472
  rules: {
481
473
  type: import("vue-demi").PropType<Record<string, any>>;
482
474
  default: undefined;
483
475
  };
476
+ inline: {
477
+ type: import("vue-demi").PropType<boolean>;
478
+ default: boolean;
479
+ };
484
480
  upIcon: {
485
481
  type: import("vue-demi").PropType<string>;
486
482
  default: string;
@@ -559,16 +555,12 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
559
555
  type: import("vue-demi").PropType<"right" | "left" | "top">;
560
556
  default: string;
561
557
  };
562
- inline: {
563
- type: import("vue-demi").PropType<boolean>;
564
- default: boolean;
565
- };
566
558
  btnBoxLabel: {
567
559
  type: import("vue-demi").PropType<string>;
568
560
  default: string;
569
561
  };
570
562
  btnModel: {
571
- type: import("vue-demi").PropType<"block" | "inline">;
563
+ type: import("vue-demi").PropType<"inline" | "block">;
572
564
  default: string;
573
565
  };
574
566
  labelWidth: {
@@ -835,8 +827,8 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
835
827
  size: "medium" | "small" | "mini";
836
828
  selectEmptyWarningTips: string;
837
829
  disabled: boolean;
838
- itemWidth: number;
839
830
  rules: Record<string, any>;
831
+ inline: boolean;
840
832
  upIcon: string;
841
833
  downIcon: string;
842
834
  columns: number;
@@ -855,9 +847,8 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
855
847
  statusIcon: boolean;
856
848
  validateOnRuleChange: boolean;
857
849
  labelPosition: "right" | "left" | "top";
858
- inline: boolean;
859
850
  btnBoxLabel: string;
860
- btnModel: "block" | "inline";
851
+ btnModel: "inline" | "block";
861
852
  labelWidth: number;
862
853
  formOptions: import("./types").NfSearchFormItemOption[];
863
854
  closable: boolean;
@@ -982,14 +973,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
982
973
  type: import("vue-demi").PropType<boolean>;
983
974
  default: boolean;
984
975
  };
985
- itemWidth: {
986
- type: import("vue-demi").PropType<number>;
987
- default: number;
988
- };
989
976
  rules: {
990
977
  type: import("vue-demi").PropType<Record<string, any>>;
991
978
  default: undefined;
992
979
  };
980
+ inline: {
981
+ type: import("vue-demi").PropType<boolean>;
982
+ default: boolean;
983
+ };
993
984
  upIcon: {
994
985
  type: import("vue-demi").PropType<string>;
995
986
  default: string;
@@ -1068,16 +1059,12 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1068
1059
  type: import("vue-demi").PropType<"right" | "left" | "top">;
1069
1060
  default: string;
1070
1061
  };
1071
- inline: {
1072
- type: import("vue-demi").PropType<boolean>;
1073
- default: boolean;
1074
- };
1075
1062
  btnBoxLabel: {
1076
1063
  type: import("vue-demi").PropType<string>;
1077
1064
  default: string;
1078
1065
  };
1079
1066
  btnModel: {
1080
- type: import("vue-demi").PropType<"block" | "inline">;
1067
+ type: import("vue-demi").PropType<"inline" | "block">;
1081
1068
  default: string;
1082
1069
  };
1083
1070
  labelWidth: {
@@ -1453,14 +1440,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1453
1440
  type: import("vue-demi").PropType<boolean>;
1454
1441
  default: boolean;
1455
1442
  };
1456
- itemWidth: {
1457
- type: import("vue-demi").PropType<number>;
1458
- default: number;
1459
- };
1460
1443
  rules: {
1461
1444
  type: import("vue-demi").PropType<Record<string, any>>;
1462
1445
  default: undefined;
1463
1446
  };
1447
+ inline: {
1448
+ type: import("vue-demi").PropType<boolean>;
1449
+ default: boolean;
1450
+ };
1464
1451
  upIcon: {
1465
1452
  type: import("vue-demi").PropType<string>;
1466
1453
  default: string;
@@ -1539,16 +1526,12 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1539
1526
  type: import("vue-demi").PropType<"right" | "left" | "top">;
1540
1527
  default: string;
1541
1528
  };
1542
- inline: {
1543
- type: import("vue-demi").PropType<boolean>;
1544
- default: boolean;
1545
- };
1546
1529
  btnBoxLabel: {
1547
1530
  type: import("vue-demi").PropType<string>;
1548
1531
  default: string;
1549
1532
  };
1550
1533
  btnModel: {
1551
- type: import("vue-demi").PropType<"block" | "inline">;
1534
+ type: import("vue-demi").PropType<"inline" | "block">;
1552
1535
  default: string;
1553
1536
  };
1554
1537
  labelWidth: {
@@ -1858,14 +1841,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1858
1841
  type: import("vue-demi").PropType<boolean>;
1859
1842
  default: boolean;
1860
1843
  };
1861
- itemWidth: {
1862
- type: import("vue-demi").PropType<number>;
1863
- default: number;
1864
- };
1865
1844
  rules: {
1866
1845
  type: import("vue-demi").PropType<Record<string, any>>;
1867
1846
  default: undefined;
1868
1847
  };
1848
+ inline: {
1849
+ type: import("vue-demi").PropType<boolean>;
1850
+ default: boolean;
1851
+ };
1869
1852
  upIcon: {
1870
1853
  type: import("vue-demi").PropType<string>;
1871
1854
  default: string;
@@ -1944,16 +1927,12 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1944
1927
  type: import("vue-demi").PropType<"right" | "left" | "top">;
1945
1928
  default: string;
1946
1929
  };
1947
- inline: {
1948
- type: import("vue-demi").PropType<boolean>;
1949
- default: boolean;
1950
- };
1951
1930
  btnBoxLabel: {
1952
1931
  type: import("vue-demi").PropType<string>;
1953
1932
  default: string;
1954
1933
  };
1955
1934
  btnModel: {
1956
- type: import("vue-demi").PropType<"block" | "inline">;
1935
+ type: import("vue-demi").PropType<"inline" | "block">;
1957
1936
  default: string;
1958
1937
  };
1959
1938
  labelWidth: {
@@ -2286,8 +2265,8 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2286
2265
  size: "medium" | "small" | "mini";
2287
2266
  selectEmptyWarningTips: string;
2288
2267
  disabled: boolean;
2289
- itemWidth: number;
2290
2268
  rules: Record<string, any>;
2269
+ inline: boolean;
2291
2270
  upIcon: string;
2292
2271
  downIcon: string;
2293
2272
  columns: number;
@@ -2306,9 +2285,8 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2306
2285
  statusIcon: boolean;
2307
2286
  validateOnRuleChange: boolean;
2308
2287
  labelPosition: "right" | "left" | "top";
2309
- inline: boolean;
2310
2288
  btnBoxLabel: string;
2311
- btnModel: "block" | "inline";
2289
+ btnModel: "inline" | "block";
2312
2290
  labelWidth: number;
2313
2291
  formOptions: import("./types").NfSearchFormItemOption[];
2314
2292
  closable: boolean;
@@ -2434,14 +2412,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2434
2412
  type: import("vue-demi").PropType<boolean>;
2435
2413
  default: boolean;
2436
2414
  };
2437
- itemWidth: {
2438
- type: import("vue-demi").PropType<number>;
2439
- default: number;
2440
- };
2441
2415
  rules: {
2442
2416
  type: import("vue-demi").PropType<Record<string, any>>;
2443
2417
  default: undefined;
2444
2418
  };
2419
+ inline: {
2420
+ type: import("vue-demi").PropType<boolean>;
2421
+ default: boolean;
2422
+ };
2445
2423
  upIcon: {
2446
2424
  type: import("vue-demi").PropType<string>;
2447
2425
  default: string;
@@ -2520,16 +2498,12 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2520
2498
  type: import("vue-demi").PropType<"right" | "left" | "top">;
2521
2499
  default: string;
2522
2500
  };
2523
- inline: {
2524
- type: import("vue-demi").PropType<boolean>;
2525
- default: boolean;
2526
- };
2527
2501
  btnBoxLabel: {
2528
2502
  type: import("vue-demi").PropType<string>;
2529
2503
  default: string;
2530
2504
  };
2531
2505
  btnModel: {
2532
- type: import("vue-demi").PropType<"block" | "inline">;
2506
+ type: import("vue-demi").PropType<"inline" | "block">;
2533
2507
  default: string;
2534
2508
  };
2535
2509
  labelWidth: {
@@ -2774,9 +2748,11 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2774
2748
  } & (new () => {
2775
2749
  $slots: Partial<Record<string, (_: {
2776
2750
  slot: string;
2777
- }) => any>> & Partial<Record<string, (_: {
2778
- slot: string;
2779
2751
  }) => any>> & {
2752
+ default?(_: {
2753
+ nam: string;
2754
+ slot: string;
2755
+ }): any;
2780
2756
  btnBox?(_: {}): any;
2781
2757
  dialogTitle?(_: {
2782
2758
  slot: string;
@@ -8,10 +8,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
8
8
  type: import("vue-demi").PropType<NfSearchFormItemOption>;
9
9
  default: () => {};
10
10
  };
11
- itemWidth: {
12
- type: import("vue-demi").PropType<number>;
13
- default: number;
14
- };
15
11
  }, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
16
12
  input: (event: any) => void;
17
13
  "update:value": (event: any) => void;
@@ -24,14 +20,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
24
20
  type: import("vue-demi").PropType<NfSearchFormItemOption>;
25
21
  default: () => {};
26
22
  };
27
- itemWidth: {
28
- type: import("vue-demi").PropType<number>;
29
- default: number;
30
- };
31
23
  }>>, {
32
24
  value: any;
33
25
  itemOptions: NfSearchFormItemOption;
34
- itemWidth: number;
35
26
  }>, Partial<Record<string, (_: {}) => any>> & Partial<Record<string, (_: {}) => any>>>;
36
27
  export default _default;
37
28
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -334,12 +334,6 @@ __sfc_main$3.props = {
334
334
  required: false,
335
335
  type: null,
336
336
  default: () => ({})
337
- },
338
- itemWidth: {
339
- key: "itemWidth",
340
- required: false,
341
- type: Number,
342
- default: 170
343
337
  }
344
338
  };
345
339
  __sfc_main$3.setup = (__props, __ctx) => {
@@ -348,9 +342,6 @@ __sfc_main$3.setup = (__props, __ctx) => {
348
342
  const slotName = vueDemi.computed(() => {
349
343
  return props.itemOptions.slot || "";
350
344
  });
351
- const width = vueDemi.computed(() => {
352
- return props.itemWidth + "px";
353
- });
354
345
  const currentVal = vueDemi.computed({
355
346
  get() {
356
347
  return props.value;
@@ -385,12 +376,14 @@ __sfc_main$3.setup = (__props, __ctx) => {
385
376
  return obj;
386
377
  };
387
378
  const bindProps = vueDemi.ref(getProps());
388
- vueDemi.watch(() => {
389
- return props.itemOptions;
390
- }, () => {
391
- bindProps.value = getProps();
392
- }, {
393
- deep: true
379
+ vueDemi.onBeforeMount(() => {
380
+ vueDemi.watch(() => {
381
+ return props.itemOptions;
382
+ }, () => {
383
+ bindProps.value = getProps();
384
+ }, {
385
+ deep: true
386
+ });
394
387
  });
395
388
  const bindEvents = vueDemi.computed(() => {
396
389
  const events = {
@@ -501,7 +494,6 @@ __sfc_main$3.setup = (__props, __ctx) => {
501
494
  };
502
495
  return {
503
496
  slotName,
504
- width,
505
497
  currentVal,
506
498
  bindProps,
507
499
  bindEvents,
@@ -536,10 +528,7 @@ var _sfc_render$3 = function render3() {
536
528
  var _vm = this, _c = _vm._self._c;
537
529
  _vm._self._setupProxy;
538
530
  return _c("div", {
539
- staticClass: "nf-search-form-item",
540
- style: {
541
- width: _vm.width
542
- }
531
+ staticClass: "nf-search-form-item"
543
532
  }, [_vm.slotName ? [_vm._t(_vm.slotName)] : [_vm.isInput ? _c("el-input", _vm._g(_vm._b({
544
533
  attrs: {
545
534
  "placeholder": _vm.itemOptions.placeholder
@@ -568,7 +557,6 @@ var _sfc_render$3 = function render3() {
568
557
  }
569
558
  }, "el-input-number", _vm.bindProps, false), _vm.bindEvents)) : _vm._e(), _vm.isSelect ? _c("nf-virtual-select", _vm._g(_vm._b({
570
559
  attrs: {
571
- "width": _vm.width,
572
560
  "item-options": _vm.itemOptions,
573
561
  "placeholder": _vm.itemOptions.placeholder
574
562
  },
@@ -6432,7 +6420,7 @@ var _sfc_staticRenderFns$1 = [];
6432
6420
  var __component__$1 = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(__sfc_main$1, _sfc_render$1, _sfc_staticRenderFns$1, false, null, null, null, null);
6433
6421
  const ColumnCheckDrawer = __component__$1.exports;
6434
6422
  const __sfc_main = vueDemi.defineComponent({
6435
- name: "nf-search-from"
6423
+ name: "nf-search-form"
6436
6424
  });
6437
6425
  __sfc_main.props = {
6438
6426
  upIcon: {
@@ -6589,12 +6577,6 @@ __sfc_main.props = {
6589
6577
  type: String,
6590
6578
  default: "block"
6591
6579
  },
6592
- itemWidth: {
6593
- key: "itemWidth",
6594
- required: false,
6595
- type: Number,
6596
- default: 190
6597
- },
6598
6580
  labelWidth: {
6599
6581
  key: "labelWidth",
6600
6582
  required: false,
@@ -7141,9 +7123,9 @@ __sfc_main.setup = (__props, __ctx) => {
7141
7123
  const syncCookiesToSearchFormItemOptions = (readCached = true) => {
7142
7124
  var _a2;
7143
7125
  const columns = props.formOptions.map((item, index2) => {
7126
+ item.key = item.key || createUniqueString();
7144
7127
  item._index = index2;
7145
7128
  item.__index = index2;
7146
- item.key = item.key || createUniqueString();
7147
7129
  return item;
7148
7130
  });
7149
7131
  if (readCached && props.columnEdit) {
@@ -7189,6 +7171,13 @@ __sfc_main.setup = (__props, __ctx) => {
7189
7171
  immediate: true
7190
7172
  });
7191
7173
  vueDemi.onBeforeMount(() => {
7174
+ vueDemi.watch(() => {
7175
+ return props.formOptions;
7176
+ }, () => {
7177
+ syncCookiesToSearchFormItemOptions();
7178
+ }, {
7179
+ deep: true
7180
+ });
7192
7181
  const obj = {};
7193
7182
  props.formOptions.forEach((v) => {
7194
7183
  if (v.initValue !== void 0) {
@@ -7479,8 +7468,8 @@ var _sfc_render = function render6() {
7479
7468
  "label-width": item.labelWidth
7480
7469
  }
7481
7470
  }, [_c("search-form-item", {
7471
+ key: item.key,
7482
7472
  attrs: {
7483
- "item-width": _vm.itemWidth,
7484
7473
  "item-options": item
7485
7474
  },
7486
7475
  model: {
@@ -7490,8 +7479,9 @@ var _sfc_render = function render6() {
7490
7479
  },
7491
7480
  expression: "nfSearchFormModel[item.prop]"
7492
7481
  }
7493
- }, [item.tooltip ? _vm._t(item.tooltip.slot, null, {
7494
- "slot": item.tooltip.slot
7482
+ }, [item.tooltip ? _vm._t("default", null, {
7483
+ "slot": item.tooltip.slot,
7484
+ "nam": item.tooltip.slot
7495
7485
  }) : _vm._e(), item.slot ? _vm._t(item.slot, null, {
7496
7486
  "slot": item.slot
7497
7487
  }) : _vm._e()], 2), _vm.closable ? _c("div", {
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, getCurrentInstance, computed, watch, onMounted, onBeforeMount, nextTick, onUnmounted } from "vue-demi";
1
+ import { defineComponent, ref, getCurrentInstance, computed, watch, onBeforeMount, onMounted, nextTick, onUnmounted } from "vue-demi";
2
2
  import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
3
3
  import NfMessage from "@94ai/nf-message";
4
4
  const __sfc_main$5 = defineComponent({
@@ -332,12 +332,6 @@ __sfc_main$3.props = {
332
332
  required: false,
333
333
  type: null,
334
334
  default: () => ({})
335
- },
336
- itemWidth: {
337
- key: "itemWidth",
338
- required: false,
339
- type: Number,
340
- default: 170
341
335
  }
342
336
  };
343
337
  __sfc_main$3.setup = (__props, __ctx) => {
@@ -346,9 +340,6 @@ __sfc_main$3.setup = (__props, __ctx) => {
346
340
  const slotName = computed(() => {
347
341
  return props.itemOptions.slot || "";
348
342
  });
349
- const width = computed(() => {
350
- return props.itemWidth + "px";
351
- });
352
343
  const currentVal = computed({
353
344
  get() {
354
345
  return props.value;
@@ -383,12 +374,14 @@ __sfc_main$3.setup = (__props, __ctx) => {
383
374
  return obj;
384
375
  };
385
376
  const bindProps = ref(getProps());
386
- watch(() => {
387
- return props.itemOptions;
388
- }, () => {
389
- bindProps.value = getProps();
390
- }, {
391
- deep: true
377
+ onBeforeMount(() => {
378
+ watch(() => {
379
+ return props.itemOptions;
380
+ }, () => {
381
+ bindProps.value = getProps();
382
+ }, {
383
+ deep: true
384
+ });
392
385
  });
393
386
  const bindEvents = computed(() => {
394
387
  const events = {
@@ -499,7 +492,6 @@ __sfc_main$3.setup = (__props, __ctx) => {
499
492
  };
500
493
  return {
501
494
  slotName,
502
- width,
503
495
  currentVal,
504
496
  bindProps,
505
497
  bindEvents,
@@ -534,10 +526,7 @@ var _sfc_render$3 = function render3() {
534
526
  var _vm = this, _c = _vm._self._c;
535
527
  _vm._self._setupProxy;
536
528
  return _c("div", {
537
- staticClass: "nf-search-form-item",
538
- style: {
539
- width: _vm.width
540
- }
529
+ staticClass: "nf-search-form-item"
541
530
  }, [_vm.slotName ? [_vm._t(_vm.slotName)] : [_vm.isInput ? _c("el-input", _vm._g(_vm._b({
542
531
  attrs: {
543
532
  "placeholder": _vm.itemOptions.placeholder
@@ -566,7 +555,6 @@ var _sfc_render$3 = function render3() {
566
555
  }
567
556
  }, "el-input-number", _vm.bindProps, false), _vm.bindEvents)) : _vm._e(), _vm.isSelect ? _c("nf-virtual-select", _vm._g(_vm._b({
568
557
  attrs: {
569
- "width": _vm.width,
570
558
  "item-options": _vm.itemOptions,
571
559
  "placeholder": _vm.itemOptions.placeholder
572
560
  },
@@ -6430,7 +6418,7 @@ var _sfc_staticRenderFns$1 = [];
6430
6418
  var __component__$1 = /* @__PURE__ */ normalizeComponent(__sfc_main$1, _sfc_render$1, _sfc_staticRenderFns$1, false, null, null, null, null);
6431
6419
  const ColumnCheckDrawer = __component__$1.exports;
6432
6420
  const __sfc_main = defineComponent({
6433
- name: "nf-search-from"
6421
+ name: "nf-search-form"
6434
6422
  });
6435
6423
  __sfc_main.props = {
6436
6424
  upIcon: {
@@ -6587,12 +6575,6 @@ __sfc_main.props = {
6587
6575
  type: String,
6588
6576
  default: "block"
6589
6577
  },
6590
- itemWidth: {
6591
- key: "itemWidth",
6592
- required: false,
6593
- type: Number,
6594
- default: 190
6595
- },
6596
6578
  labelWidth: {
6597
6579
  key: "labelWidth",
6598
6580
  required: false,
@@ -7139,9 +7121,9 @@ __sfc_main.setup = (__props, __ctx) => {
7139
7121
  const syncCookiesToSearchFormItemOptions = (readCached = true) => {
7140
7122
  var _a2;
7141
7123
  const columns = props.formOptions.map((item, index2) => {
7124
+ item.key = item.key || createUniqueString();
7142
7125
  item._index = index2;
7143
7126
  item.__index = index2;
7144
- item.key = item.key || createUniqueString();
7145
7127
  return item;
7146
7128
  });
7147
7129
  if (readCached && props.columnEdit) {
@@ -7187,6 +7169,13 @@ __sfc_main.setup = (__props, __ctx) => {
7187
7169
  immediate: true
7188
7170
  });
7189
7171
  onBeforeMount(() => {
7172
+ watch(() => {
7173
+ return props.formOptions;
7174
+ }, () => {
7175
+ syncCookiesToSearchFormItemOptions();
7176
+ }, {
7177
+ deep: true
7178
+ });
7190
7179
  const obj = {};
7191
7180
  props.formOptions.forEach((v) => {
7192
7181
  if (v.initValue !== void 0) {
@@ -7477,8 +7466,8 @@ var _sfc_render = function render6() {
7477
7466
  "label-width": item.labelWidth
7478
7467
  }
7479
7468
  }, [_c("search-form-item", {
7469
+ key: item.key,
7480
7470
  attrs: {
7481
- "item-width": _vm.itemWidth,
7482
7471
  "item-options": item
7483
7472
  },
7484
7473
  model: {
@@ -7488,8 +7477,9 @@ var _sfc_render = function render6() {
7488
7477
  },
7489
7478
  expression: "nfSearchFormModel[item.prop]"
7490
7479
  }
7491
- }, [item.tooltip ? _vm._t(item.tooltip.slot, null, {
7492
- "slot": item.tooltip.slot
7480
+ }, [item.tooltip ? _vm._t("default", null, {
7481
+ "slot": item.tooltip.slot,
7482
+ "nam": item.tooltip.slot
7493
7483
  }) : _vm._e(), item.slot ? _vm._t(item.slot, null, {
7494
7484
  "slot": item.slot
7495
7485
  }) : _vm._e()], 2), _vm.closable ? _c("div", {
@@ -69,14 +69,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
69
69
  type: import("vue-demi").PropType<boolean>;
70
70
  default: boolean;
71
71
  };
72
- itemWidth: {
73
- type: import("vue-demi").PropType<number>;
74
- default: number;
75
- };
76
72
  rules: {
77
73
  type: import("vue-demi").PropType<Record<string, any>>;
78
74
  default: undefined;
79
75
  };
76
+ inline: {
77
+ type: import("vue-demi").PropType<boolean>;
78
+ default: boolean;
79
+ };
80
80
  upIcon: {
81
81
  type: import("vue-demi").PropType<string>;
82
82
  default: string;
@@ -155,16 +155,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
155
155
  type: import("vue-demi").PropType<"right" | "left" | "top">;
156
156
  default: string;
157
157
  };
158
- inline: {
159
- type: import("vue-demi").PropType<boolean>;
160
- default: boolean;
161
- };
162
158
  btnBoxLabel: {
163
159
  type: import("vue-demi").PropType<string>;
164
160
  default: string;
165
161
  };
166
162
  btnModel: {
167
- type: import("vue-demi").PropType<"block" | "inline">;
163
+ type: import("vue-demi").PropType<"inline" | "block">;
168
164
  default: string;
169
165
  };
170
166
  labelWidth: {
@@ -548,14 +544,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
548
544
  type: import("vue-demi").PropType<boolean>;
549
545
  default: boolean;
550
546
  };
551
- itemWidth: {
552
- type: import("vue-demi").PropType<number>;
553
- default: number;
554
- };
555
547
  rules: {
556
548
  type: import("vue-demi").PropType<Record<string, any>>;
557
549
  default: undefined;
558
550
  };
551
+ inline: {
552
+ type: import("vue-demi").PropType<boolean>;
553
+ default: boolean;
554
+ };
559
555
  upIcon: {
560
556
  type: import("vue-demi").PropType<string>;
561
557
  default: string;
@@ -634,16 +630,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
634
630
  type: import("vue-demi").PropType<"right" | "left" | "top">;
635
631
  default: string;
636
632
  };
637
- inline: {
638
- type: import("vue-demi").PropType<boolean>;
639
- default: boolean;
640
- };
641
633
  btnBoxLabel: {
642
634
  type: import("vue-demi").PropType<string>;
643
635
  default: string;
644
636
  };
645
637
  btnModel: {
646
- type: import("vue-demi").PropType<"block" | "inline">;
638
+ type: import("vue-demi").PropType<"inline" | "block">;
647
639
  default: string;
648
640
  };
649
641
  labelWidth: {
@@ -902,8 +894,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
902
894
  size: 'medium' | 'small' | 'mini';
903
895
  selectEmptyWarningTips: string;
904
896
  disabled: boolean;
905
- itemWidth: number;
906
897
  rules: Record<string, any>;
898
+ inline: boolean;
907
899
  upIcon: string;
908
900
  downIcon: string;
909
901
  columns: number;
@@ -922,7 +914,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
922
914
  statusIcon: boolean;
923
915
  validateOnRuleChange: boolean;
924
916
  labelPosition: 'top' | 'right' | 'left';
925
- inline: boolean;
926
917
  btnBoxLabel: string;
927
918
  btnModel: 'inline' | 'block';
928
919
  labelWidth: number;
@@ -982,9 +973,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
982
973
  resetBtnClass: string;
983
974
  }>, Partial<Record<string, (_: {
984
975
  slot: string;
985
- }) => any>> & Partial<Record<string, (_: {
986
- slot: string;
987
976
  }) => any>> & {
977
+ default?(_: {
978
+ nam: string;
979
+ slot: string;
980
+ }): any;
988
981
  btnBox?(_: {}): any;
989
982
  dialogTitle?(_: {
990
983
  slot: string;
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="nf-search-form-item" :style="{ width }">
2
+ <div class="nf-search-form-item">
3
3
  <template v-if="slotName">
4
4
  <slot :name="slotName" />
5
5
  </template>
@@ -22,7 +22,6 @@
22
22
  />
23
23
  <nf-virtual-select
24
24
  v-if="isSelect"
25
- :width="width"
26
25
  v-model="currentVal"
27
26
  v-bind="bindProps"
28
27
  v-on="bindEvents"
@@ -183,7 +182,8 @@ import TimeRange from './nf-time-range.vue'
183
182
  import {
184
183
  computed,
185
184
  ref,
186
- watch
185
+ watch,
186
+ onBeforeMount
187
187
  } from 'vue-demi'
188
188
  import { NfSearchFormItemOption } from '@94ai/nf-search-form/lib/types'
189
189
  import { createUniqueString } from './tools'
@@ -202,24 +202,15 @@ const props = withDefaults(defineProps<{
202
202
  * 单个表单项渲染数据
203
203
  */
204
204
  itemOptions?: NfSearchFormItemOption,
205
- /**
206
- * content宽度
207
- */
208
- itemWidth?: number,
209
205
  }>(), {
210
206
  value: undefined,
211
207
  itemOptions: () => ({}),
212
- itemWidth: 170,
213
208
  })
214
209
 
215
210
  const slotName = computed(() => {
216
211
  return props.itemOptions.slot || ''
217
212
  })
218
213
 
219
- const width = computed(() => {
220
- return props.itemWidth + 'px'
221
- })
222
-
223
214
  // 双向绑定数据值
224
215
  const currentVal = computed({
225
216
  get() {
@@ -260,12 +251,14 @@ const getProps = () => {
260
251
  // 绑定属性
261
252
  const bindProps = ref(getProps())
262
253
 
263
- watch(() => {
264
- return props.itemOptions
265
- }, () => {
266
- bindProps.value = getProps()
267
- }, {
268
- deep: true
254
+ onBeforeMount(() => {
255
+ watch(() => {
256
+ return props.itemOptions
257
+ }, () => {
258
+ bindProps.value = getProps()
259
+ }, {
260
+ deep: true
261
+ })
269
262
  })
270
263
 
271
264
  // 绑定方法
@@ -51,11 +51,12 @@
51
51
  :required="item.required"
52
52
  :label-width="item.labelWidth"
53
53
  >
54
- <search-form-item v-model="nfSearchFormModel[item.prop]"
55
- :item-width="itemWidth"
56
- :item-options="item">
54
+ <search-form-item
55
+ :key="item.key"
56
+ v-model="nfSearchFormModel[item.prop]"
57
+ :item-options="item">
57
58
  <!-- 定制化SearchItem?提示-->
58
- <slot :name="item.tooltip.slot" v-if="item.tooltip" :slot="item.tooltip.slot" />
59
+ <slot :nam="item.tooltip.slot" v-if="item.tooltip" :slot="item.tooltip.slot" />
59
60
  <!-- 定制化SearchItem插槽-->
60
61
  <slot :name="item.slot" v-if="item.slot" :slot="item.slot" />
61
62
  </search-form-item>
@@ -262,7 +263,7 @@
262
263
  import { defineComponent } from 'vue-demi'
263
264
 
264
265
  export default defineComponent({
265
- name: 'nf-search-from'
266
+ name: 'nf-search-form'
266
267
  })
267
268
  </script>
268
269
 
@@ -330,10 +331,6 @@ const props = withDefaults(defineProps<{
330
331
  inline?: boolean
331
332
  btnBoxLabel?: string
332
333
  btnModel?: 'inline' | 'block'
333
- /**
334
- * 兼容ai-search-form控制item父dom宽度
335
- */
336
- itemWidth?: number,
337
334
  /**
338
335
  * label宽度
339
336
  */
@@ -481,7 +478,6 @@ const props = withDefaults(defineProps<{
481
478
  formOptions: () => [],
482
479
  showItems: () => [],
483
480
  closable: false,
484
- itemWidth: 190,
485
481
  btnItems: () => '',
486
482
  columnEdit: false,
487
483
  btnBoxLabel: '',
@@ -703,9 +699,9 @@ const isShowBtnBoxSlot = computed(() => {
703
699
  const renderSearchFormItemOptions = ref<NfSearchFormItemOption[]>([])
704
700
  const syncCookiesToSearchFormItemOptions = (readCached = true) => {
705
701
  const columns = props.formOptions!.map((item, index) => {
702
+ item.key = item.key || createUniqueString()
706
703
  item._index = index
707
704
  item.__index = index
708
- item.key = item.key || createUniqueString()
709
705
  return item
710
706
  })
711
707
  if (readCached && props.columnEdit) {
@@ -770,6 +766,21 @@ watch(() => {
770
766
  * 初始化formData表单数据
771
767
  */
772
768
  onBeforeMount(() => {
769
+ /**
770
+ * 有部分人喜欢用computed当作formOptions,
771
+ * 由于computed的数据子孙属性改变会引起整个formOptions引用的改动,而且旧对象引用的子属性并未变更
772
+ * 这里需要watch同步到renderSearchFormItemOptions(子组件借助renderSearchFormItemOptions引用watch去监听,如果是data当作formOptions可以不用这个watch)
773
+ *
774
+ * 用computed去改里面的副作用,这样会整个computed改变引起整个表单重新渲染,为此需要每个item传个key,不然就不会有局部更新的效果
775
+ * 用data就是data引用不动,局部动,就会直接局部更新了(不需要这里的watch,考虑到用户用computed写起来更简单,这里就做了兼容,算是优化)
776
+ */
777
+ watch(() => {
778
+ return props.formOptions
779
+ }, () => {
780
+ syncCookiesToSearchFormItemOptions()
781
+ }, {
782
+ deep: true
783
+ })
773
784
  const obj: Record<string, any> = {}
774
785
  props.formOptions.forEach(v => {
775
786
  if (v.initValue !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-search-form",
3
- "version": "3.2.24",
3
+ "version": "3.2.25",
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.24",
18
- "@94ai/nf-double-half-year": "^3.2.24",
19
- "@94ai/nf-double-quarter": "^3.2.24",
20
- "@94ai/nf-double-week": "^3.2.24",
21
- "@94ai/nf-double-year": "^3.2.24",
22
- "@94ai/nf-drawer": "^3.2.24",
23
- "@94ai/nf-form": "^3.2.24",
24
- "@94ai/nf-form-item": "^3.2.24",
25
- "@94ai/nf-half-year-picker": "^3.2.24",
26
- "@94ai/nf-message": "^3.2.24",
27
- "@94ai/nf-quarter-picker": "^3.2.24",
28
- "@94ai/nf-select-transfer": "^3.2.24",
29
- "@94ai/nf-theme-chalk": "^3.2.24",
30
- "@94ai/nf-virtual-select": "^3.2.24",
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",
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": "6f56dd9554a2ac9db9a7107ef8b8698dfa5f51b7"
48
+ "gitHead": "8cef5ebb5a3f98596f2f279bcfcd337d293767d2"
49
49
  }