@94ai/nf-search-form 8.0.1 → 8.0.5

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.
@@ -1,112 +1,112 @@
1
- import { NfSearchFormItemOption } from '@94ai/nf-search-form/lib/types';
2
- declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
- value?: any;
4
- itemOptions?: NfSearchFormItemOption | undefined;
5
- itemWidth?: number | undefined;
6
- nfSearchFormModel?: Record<string, any> | undefined;
7
- }>, {
8
- value: undefined;
9
- itemOptions: () => {};
10
- itemWidth: number;
11
- nfSearchFormModel: () => {};
12
- }>, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
13
- input: (event: any) => void;
14
- "update:value": (event: any) => void;
15
- handleChangeProps: (event: string[]) => void;
16
- }, string, Readonly<import("vue-demi").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
17
- value?: any;
18
- itemOptions?: NfSearchFormItemOption | undefined;
19
- itemWidth?: number | undefined;
20
- nfSearchFormModel?: Record<string, any> | undefined;
21
- }>, {
22
- value: undefined;
23
- itemOptions: () => {};
24
- itemWidth: number;
25
- nfSearchFormModel: () => {};
26
- }>>>, {
27
- value: any;
28
- itemOptions: NfSearchFormItemOption;
29
- itemWidth: number;
30
- nfSearchFormModel: Record<string, any>;
31
- }>, Partial<Record<string, (_: {}) => any>> & Partial<Record<string, (_: {
32
- slot: string;
33
- }) => any>> & Partial<Record<string, (_: {
34
- slot: string;
35
- }) => any>> & Partial<Record<string, (_: {
36
- slot: string;
37
- }) => any>> & Partial<Record<string, (_: {
38
- slot: string;
39
- }) => any>> & Partial<Record<string, (_: {
40
- slot: string;
41
- }) => any>> & Partial<Record<string, (_: {
42
- slot: string;
43
- }) => any>> & Partial<Record<string, (_: {
44
- slot: string;
45
- }) => any>> & Partial<Record<string, (_: {
46
- slot: string;
47
- }) => any>> & Partial<Record<string, (_: {
48
- slot: string;
49
- }) => any>> & Partial<Record<string, (_: {
50
- slot: string;
51
- }) => any>> & Partial<Record<string, (_: {
52
- slot: string;
53
- }) => any>> & Partial<Record<string, (_: {
54
- slot: string;
55
- }) => any>> & Partial<Record<string, (_: {
56
- slot: string;
57
- }) => any>> & Partial<Record<string, (_: {
58
- slot: string;
59
- }) => any>> & Partial<Record<string, (_: {
60
- slot: string;
61
- }) => any>> & Partial<Record<string, (_: {
62
- slot: string;
63
- }) => any>> & Partial<Record<string, (_: {
64
- slot: string;
65
- }) => any>> & Partial<Record<string, (_: {
66
- slot: string;
67
- }) => any>> & Partial<Record<string, (_: {
68
- slot: string;
69
- }) => any>> & Partial<Record<string, (_: {
70
- slot: string;
71
- }) => any>> & Partial<Record<string, (_: {
72
- slot: string;
73
- }) => any>> & Partial<Record<string, (_: {
74
- slot: string;
75
- }) => any>> & Partial<Record<string, (_: {
76
- slot: string;
77
- }) => any>> & Partial<Record<string, (_: {
78
- slot: string;
79
- }) => any>> & Partial<Record<string, (_: {
80
- slot: string;
81
- }) => any>> & Partial<Record<string, (_: {
82
- slot: string;
83
- }) => any>> & Partial<Record<string, (_: {
84
- slot: string;
85
- }) => any>> & Partial<Record<string, (_: {
86
- slot: string;
87
- }) => any>> & Partial<Record<string, (_: {
88
- slot: string;
89
- }) => any>> & Partial<Record<string, (_: {}) => any>>>;
90
- export default _default;
91
- declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
92
- declare type __VLS_TypePropsToRuntimeProps<T> = {
93
- [K in keyof T]-?: {} extends Pick<T, K> ? {
94
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
95
- } : {
96
- type: import('vue').PropType<T[K]>;
97
- required: true;
98
- };
99
- };
100
- declare type __VLS_WithDefaults<P, D> = {
101
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
102
- default: D[K];
103
- }> : P[K];
104
- };
105
- declare type __VLS_Prettify<T> = {
106
- [K in keyof T]: T[K];
107
- } & {};
108
- declare type __VLS_WithTemplateSlots<T, S> = T & {
109
- new (): {
110
- $scopedSlots: S;
111
- };
112
- };
1
+ import { NfSearchFormItemOption } from '@94ai/nf-search-form/lib/types';
2
+ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ value?: any;
4
+ itemOptions?: NfSearchFormItemOption | undefined;
5
+ itemWidth?: number | undefined;
6
+ nfSearchFormModel?: Record<string, any> | undefined;
7
+ }>, {
8
+ value: undefined;
9
+ itemOptions: () => {};
10
+ itemWidth: number;
11
+ nfSearchFormModel: () => {};
12
+ }>, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
13
+ input: (event: any) => void;
14
+ "update:value": (event: any) => void;
15
+ handleChangeProps: (event: string[]) => void;
16
+ }, string, Readonly<import("vue-demi").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
17
+ value?: any;
18
+ itemOptions?: NfSearchFormItemOption | undefined;
19
+ itemWidth?: number | undefined;
20
+ nfSearchFormModel?: Record<string, any> | undefined;
21
+ }>, {
22
+ value: undefined;
23
+ itemOptions: () => {};
24
+ itemWidth: number;
25
+ nfSearchFormModel: () => {};
26
+ }>>>, {
27
+ value: any;
28
+ itemOptions: NfSearchFormItemOption;
29
+ itemWidth: number;
30
+ nfSearchFormModel: Record<string, any>;
31
+ }>, Partial<Record<string, (_: {}) => any>> & Partial<Record<string, (_: {
32
+ slot: string;
33
+ }) => any>> & Partial<Record<string, (_: {
34
+ slot: string;
35
+ }) => any>> & Partial<Record<string, (_: {
36
+ slot: string;
37
+ }) => any>> & Partial<Record<string, (_: {
38
+ slot: string;
39
+ }) => any>> & Partial<Record<string, (_: {
40
+ slot: string;
41
+ }) => any>> & Partial<Record<string, (_: {
42
+ slot: string;
43
+ }) => any>> & Partial<Record<string, (_: {
44
+ slot: string;
45
+ }) => any>> & Partial<Record<string, (_: {
46
+ slot: string;
47
+ }) => any>> & Partial<Record<string, (_: {
48
+ slot: string;
49
+ }) => any>> & Partial<Record<string, (_: {
50
+ slot: string;
51
+ }) => any>> & Partial<Record<string, (_: {
52
+ slot: string;
53
+ }) => any>> & Partial<Record<string, (_: {
54
+ slot: string;
55
+ }) => any>> & Partial<Record<string, (_: {
56
+ slot: string;
57
+ }) => any>> & Partial<Record<string, (_: {
58
+ slot: string;
59
+ }) => any>> & Partial<Record<string, (_: {
60
+ slot: string;
61
+ }) => any>> & Partial<Record<string, (_: {
62
+ slot: string;
63
+ }) => any>> & Partial<Record<string, (_: {
64
+ slot: string;
65
+ }) => any>> & Partial<Record<string, (_: {
66
+ slot: string;
67
+ }) => any>> & Partial<Record<string, (_: {
68
+ slot: string;
69
+ }) => any>> & Partial<Record<string, (_: {
70
+ slot: string;
71
+ }) => any>> & Partial<Record<string, (_: {
72
+ slot: string;
73
+ }) => any>> & Partial<Record<string, (_: {
74
+ slot: string;
75
+ }) => any>> & Partial<Record<string, (_: {
76
+ slot: string;
77
+ }) => any>> & Partial<Record<string, (_: {
78
+ slot: string;
79
+ }) => any>> & Partial<Record<string, (_: {
80
+ slot: string;
81
+ }) => any>> & Partial<Record<string, (_: {
82
+ slot: string;
83
+ }) => any>> & Partial<Record<string, (_: {
84
+ slot: string;
85
+ }) => any>> & Partial<Record<string, (_: {
86
+ slot: string;
87
+ }) => any>> & Partial<Record<string, (_: {
88
+ slot: string;
89
+ }) => any>> & Partial<Record<string, (_: {}) => any>>>;
90
+ export default _default;
91
+ declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
92
+ declare type __VLS_TypePropsToRuntimeProps<T> = {
93
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
94
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
95
+ } : {
96
+ type: import('vue').PropType<T[K]>;
97
+ required: true;
98
+ };
99
+ };
100
+ declare type __VLS_WithDefaults<P, D> = {
101
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
102
+ default: D[K];
103
+ }> : P[K];
104
+ };
105
+ declare type __VLS_Prettify<T> = {
106
+ [K in keyof T]: T[K];
107
+ } & {};
108
+ declare type __VLS_WithTemplateSlots<T, S> = T & {
109
+ new (): {
110
+ $scopedSlots: S;
111
+ };
112
+ };
@@ -6375,13 +6375,36 @@ __sfc_main$1.setup = (__props, __ctx) => {
6375
6375
  const updateColumn = () => {
6376
6376
  fixedColumn.value = [];
6377
6377
  unFixedColumn.value = [];
6378
- currentTable.value.map((item) => {
6378
+ currentTable.value.filter((item) => !item.initHidden).map((item) => {
6379
6379
  if (item.attr.fixed) {
6380
6380
  fixedColumn.value.push(item);
6381
6381
  } else {
6382
6382
  unFixedColumn.value.push(item);
6383
6383
  }
6384
6384
  });
6385
+ updateCheckStatus();
6386
+ };
6387
+ const pullAwayColumn = (column) => {
6388
+ const unFixedIndex = unFixedColumn.value.findIndex((item) => item.prop === column.prop);
6389
+ const fixedIndex = fixedColumn.value.findIndex((item) => item.prop === column.prop);
6390
+ if (unFixedIndex > -1) {
6391
+ unFixedColumn.value.splice(unFixedIndex, 1);
6392
+ } else if (fixedIndex > -1) {
6393
+ fixedColumn.value.splice(fixedIndex, 1);
6394
+ }
6395
+ };
6396
+ const insertColumn = (column, append = false) => {
6397
+ const unFixedIndex = unFixedColumn.value.findIndex((item) => item.prop === column.prop);
6398
+ const fixedIndex = fixedColumn.value.findIndex((item) => item.prop === column.prop);
6399
+ if (unFixedIndex === -1 && fixedIndex === -1) {
6400
+ if (append) {
6401
+ unFixedColumn.value.push(column);
6402
+ } else {
6403
+ unFixedColumn.value.unshift(column);
6404
+ }
6405
+ }
6406
+ };
6407
+ const updateCheckStatus = () => {
6385
6408
  showColumn.value = currentTable.value.filter((i) => !i.initHidden).map((item) => item.prop);
6386
6409
  if (columnName.value && fields.value.length) {
6387
6410
  checkedCount.value = searchValue.filter((i) => !i.initHidden).length;
@@ -6403,28 +6426,72 @@ __sfc_main$1.setup = (__props, __ctx) => {
6403
6426
  }
6404
6427
  });
6405
6428
  setFields(searchValue);
6406
- updateColumn();
6429
+ updateCheckStatus();
6407
6430
  };
6408
6431
  const checkAll = vueDemi.ref(false);
6409
6432
  const isIndeterminate = vueDemi.ref(false);
6410
6433
  const handleCheckAllChange = (v) => {
6434
+ if (v) {
6435
+ let flag = false;
6436
+ if (columnName.value && fields.value.length) {
6437
+ if (searchValue.length && currentTable.value.length && searchValue.length === currentTable.value.length) {
6438
+ if (!unFixedColumn.value.length && !fixedColumn.value.length) {
6439
+ flag = true;
6440
+ }
6441
+ }
6442
+ } else if (!unFixedColumn.value.length && !fixedColumn.value.length) {
6443
+ flag = true;
6444
+ }
6445
+ if (flag) {
6446
+ fixedColumn.value = [];
6447
+ unFixedColumn.value = [];
6448
+ const newColumns = [];
6449
+ props.tableColumns.forEach((column) => {
6450
+ const item = currentTable.value.find((item2) => item2.prop === column.prop);
6451
+ if (item) {
6452
+ item.initHidden = false;
6453
+ newColumns.push(item);
6454
+ }
6455
+ });
6456
+ currentTable.value = newColumns;
6457
+ currentTable.value.map((item) => {
6458
+ if (item.attr.fixed) {
6459
+ fixedColumn.value.push(item);
6460
+ } else {
6461
+ unFixedColumn.value.push(item);
6462
+ }
6463
+ });
6464
+ updateCheckStatus();
6465
+ isIndeterminate.value = false;
6466
+ return;
6467
+ }
6468
+ }
6411
6469
  if (columnName.value && fields.value.length) {
6412
6470
  searchValue.map((item) => {
6471
+ if (v) {
6472
+ insertColumn(item, true);
6473
+ } else {
6474
+ pullAwayColumn(item);
6475
+ }
6413
6476
  if (!unChangedColumn.value.includes(item.prop)) {
6414
6477
  item.initHidden = !v;
6415
6478
  v ? "" : item.attr.fixed = false;
6416
6479
  }
6417
6480
  });
6418
- updateColumn();
6419
6481
  } else {
6420
6482
  currentTable.value.map((item) => {
6483
+ if (v) {
6484
+ insertColumn(item, true);
6485
+ } else {
6486
+ pullAwayColumn(item);
6487
+ }
6421
6488
  if (!unChangedColumn.value.includes(item.prop)) {
6422
6489
  item.initHidden = !v;
6423
6490
  v ? "" : item.attr.fixed = false;
6424
6491
  }
6425
6492
  });
6426
- updateColumn();
6427
6493
  }
6494
+ updateCheckStatus();
6428
6495
  isIndeterminate.value = false;
6429
6496
  };
6430
6497
  const handleCheckedChange = (v, prop) => {
@@ -6432,9 +6499,10 @@ __sfc_main$1.setup = (__props, __ctx) => {
6432
6499
  if (item.prop === prop) {
6433
6500
  item.initHidden = !v;
6434
6501
  v ? "" : item.attr.fixed = false;
6502
+ v ? insertColumn(item, true) : pullAwayColumn(item);
6435
6503
  }
6436
6504
  });
6437
- updateColumn();
6505
+ updateCheckStatus();
6438
6506
  };
6439
6507
  const syncTableColumnsToCookies = () => {
6440
6508
  var _a2;
@@ -6373,13 +6373,36 @@ __sfc_main$1.setup = (__props, __ctx) => {
6373
6373
  const updateColumn = () => {
6374
6374
  fixedColumn.value = [];
6375
6375
  unFixedColumn.value = [];
6376
- currentTable.value.map((item) => {
6376
+ currentTable.value.filter((item) => !item.initHidden).map((item) => {
6377
6377
  if (item.attr.fixed) {
6378
6378
  fixedColumn.value.push(item);
6379
6379
  } else {
6380
6380
  unFixedColumn.value.push(item);
6381
6381
  }
6382
6382
  });
6383
+ updateCheckStatus();
6384
+ };
6385
+ const pullAwayColumn = (column) => {
6386
+ const unFixedIndex = unFixedColumn.value.findIndex((item) => item.prop === column.prop);
6387
+ const fixedIndex = fixedColumn.value.findIndex((item) => item.prop === column.prop);
6388
+ if (unFixedIndex > -1) {
6389
+ unFixedColumn.value.splice(unFixedIndex, 1);
6390
+ } else if (fixedIndex > -1) {
6391
+ fixedColumn.value.splice(fixedIndex, 1);
6392
+ }
6393
+ };
6394
+ const insertColumn = (column, append = false) => {
6395
+ const unFixedIndex = unFixedColumn.value.findIndex((item) => item.prop === column.prop);
6396
+ const fixedIndex = fixedColumn.value.findIndex((item) => item.prop === column.prop);
6397
+ if (unFixedIndex === -1 && fixedIndex === -1) {
6398
+ if (append) {
6399
+ unFixedColumn.value.push(column);
6400
+ } else {
6401
+ unFixedColumn.value.unshift(column);
6402
+ }
6403
+ }
6404
+ };
6405
+ const updateCheckStatus = () => {
6383
6406
  showColumn.value = currentTable.value.filter((i) => !i.initHidden).map((item) => item.prop);
6384
6407
  if (columnName.value && fields.value.length) {
6385
6408
  checkedCount.value = searchValue.filter((i) => !i.initHidden).length;
@@ -6401,28 +6424,72 @@ __sfc_main$1.setup = (__props, __ctx) => {
6401
6424
  }
6402
6425
  });
6403
6426
  setFields(searchValue);
6404
- updateColumn();
6427
+ updateCheckStatus();
6405
6428
  };
6406
6429
  const checkAll = ref(false);
6407
6430
  const isIndeterminate = ref(false);
6408
6431
  const handleCheckAllChange = (v) => {
6432
+ if (v) {
6433
+ let flag = false;
6434
+ if (columnName.value && fields.value.length) {
6435
+ if (searchValue.length && currentTable.value.length && searchValue.length === currentTable.value.length) {
6436
+ if (!unFixedColumn.value.length && !fixedColumn.value.length) {
6437
+ flag = true;
6438
+ }
6439
+ }
6440
+ } else if (!unFixedColumn.value.length && !fixedColumn.value.length) {
6441
+ flag = true;
6442
+ }
6443
+ if (flag) {
6444
+ fixedColumn.value = [];
6445
+ unFixedColumn.value = [];
6446
+ const newColumns = [];
6447
+ props.tableColumns.forEach((column) => {
6448
+ const item = currentTable.value.find((item2) => item2.prop === column.prop);
6449
+ if (item) {
6450
+ item.initHidden = false;
6451
+ newColumns.push(item);
6452
+ }
6453
+ });
6454
+ currentTable.value = newColumns;
6455
+ currentTable.value.map((item) => {
6456
+ if (item.attr.fixed) {
6457
+ fixedColumn.value.push(item);
6458
+ } else {
6459
+ unFixedColumn.value.push(item);
6460
+ }
6461
+ });
6462
+ updateCheckStatus();
6463
+ isIndeterminate.value = false;
6464
+ return;
6465
+ }
6466
+ }
6409
6467
  if (columnName.value && fields.value.length) {
6410
6468
  searchValue.map((item) => {
6469
+ if (v) {
6470
+ insertColumn(item, true);
6471
+ } else {
6472
+ pullAwayColumn(item);
6473
+ }
6411
6474
  if (!unChangedColumn.value.includes(item.prop)) {
6412
6475
  item.initHidden = !v;
6413
6476
  v ? "" : item.attr.fixed = false;
6414
6477
  }
6415
6478
  });
6416
- updateColumn();
6417
6479
  } else {
6418
6480
  currentTable.value.map((item) => {
6481
+ if (v) {
6482
+ insertColumn(item, true);
6483
+ } else {
6484
+ pullAwayColumn(item);
6485
+ }
6419
6486
  if (!unChangedColumn.value.includes(item.prop)) {
6420
6487
  item.initHidden = !v;
6421
6488
  v ? "" : item.attr.fixed = false;
6422
6489
  }
6423
6490
  });
6424
- updateColumn();
6425
6491
  }
6492
+ updateCheckStatus();
6426
6493
  isIndeterminate.value = false;
6427
6494
  };
6428
6495
  const handleCheckedChange = (v, prop) => {
@@ -6430,9 +6497,10 @@ __sfc_main$1.setup = (__props, __ctx) => {
6430
6497
  if (item.prop === prop) {
6431
6498
  item.initHidden = !v;
6432
6499
  v ? "" : item.attr.fixed = false;
6500
+ v ? insertColumn(item, true) : pullAwayColumn(item);
6433
6501
  }
6434
6502
  });
6435
- updateColumn();
6503
+ updateCheckStatus();
6436
6504
  };
6437
6505
  const syncTableColumnsToCookies = () => {
6438
6506
  var _a2;
@@ -1 +1 @@
1
-
1
+
@@ -1 +1 @@
1
-
1
+
package/lib/types.d.ts CHANGED
@@ -1,70 +1,70 @@
1
- interface IExchangeKey {
2
- type: number;
3
- value?: any;
4
- }
5
- export declare type NfSearchFormItemOption = {
6
- key?: string;
7
- _index?: number;
8
- __index?: number;
9
- initHidden?: boolean;
10
- destory?: boolean;
11
- label?: string;
12
- addLabel?: string;
13
- prop?: string;
14
- width?: string;
15
- isShowColon?: boolean;
16
- hidden?: boolean;
17
- required?: boolean;
18
- rules?: Record<string, any>;
19
- size?: 'medium' | 'small' | 'mini';
20
- labelWidth?: string;
21
- 'is-range'?: boolean;
22
- showMessage?: boolean;
23
- inlineMessage?: boolean;
24
- getOptions?: (callback: (options: any[]) => void, formData: Record<string, any>) => void;
25
- changeProps?: string[];
26
- show?: (formData: Record<string, any>) => boolean;
27
- exchangeKey?: IExchangeKey;
28
- category?: string;
29
- initValue?: any;
30
- slot?: string;
31
- labelSlot?: string;
32
- inputSlot?: {
33
- prepend?: string;
34
- append?: string;
35
- suffix?: string;
36
- prefix?: string;
37
- doublePrepend?: string;
38
- doubleAppend?: string;
39
- doubleSuffix?: string;
40
- doublePrefix?: string;
41
- doubleSegment?: string;
42
- };
43
- class?: string;
44
- tooltip?: {
45
- slot: string;
46
- };
47
- type?: 'monthrange' | 'datetimerange' | 'daterange' | 'yearrange' | 'halfyearrange' | 'quarterrange' | 'date' | 'month' | 'week' | 'dates';
48
- element?: 'el-input' | 'el-select' | 'custom-select' | 'ai-select' | 'ai-custom-select' | 'nf-lazy-select' | 'el-input-number' | 'el-date-picker' | 'el-cascader' | 'el-time-select' | 'el-time-picker' | 'number-range' | 'nf-date-picker' | 'nf-timezone-picker' | 'nf-quarter-picker' | 'nf-half-year-picker' | 'nf-double-year' | 'nf-double-week' | 'nf-double-half-year' | 'nf-double-quarter' | 'nf-transfer-select';
49
- events?: Record<string, Function>;
50
- placeholder?: string;
51
- virtualList?: boolean;
52
- 'controls-position'?: 'right' | 'left';
53
- clearable?: boolean;
54
- startPlaceholder?: string;
55
- rangeSeparator?: string;
56
- endPlaceholder?: string;
57
- defaultTime?: string[];
58
- options?: {
59
- label: string;
60
- value: string | number;
61
- }[];
62
- 'picker-options'?: {
63
- start: string;
64
- step: string;
65
- end: string;
66
- };
67
- valueFormat?: string;
68
- min?: 0;
69
- };
70
- export {};
1
+ interface IExchangeKey {
2
+ type: number;
3
+ value?: any;
4
+ }
5
+ export declare type NfSearchFormItemOption = {
6
+ key?: string;
7
+ _index?: number;
8
+ __index?: number;
9
+ initHidden?: boolean;
10
+ destory?: boolean;
11
+ label?: string;
12
+ addLabel?: string;
13
+ prop?: string;
14
+ width?: string;
15
+ isShowColon?: boolean;
16
+ hidden?: boolean;
17
+ required?: boolean;
18
+ rules?: Record<string, any>;
19
+ size?: 'medium' | 'small' | 'mini';
20
+ labelWidth?: string;
21
+ 'is-range'?: boolean;
22
+ showMessage?: boolean;
23
+ inlineMessage?: boolean;
24
+ getOptions?: (callback: (options: any[]) => void, formData: Record<string, any>) => void;
25
+ changeProps?: string[];
26
+ show?: (formData: Record<string, any>) => boolean;
27
+ exchangeKey?: IExchangeKey;
28
+ category?: string;
29
+ initValue?: any;
30
+ slot?: string;
31
+ labelSlot?: string;
32
+ inputSlot?: {
33
+ prepend?: string;
34
+ append?: string;
35
+ suffix?: string;
36
+ prefix?: string;
37
+ doublePrepend?: string;
38
+ doubleAppend?: string;
39
+ doubleSuffix?: string;
40
+ doublePrefix?: string;
41
+ doubleSegment?: string;
42
+ };
43
+ class?: string;
44
+ tooltip?: {
45
+ slot: string;
46
+ };
47
+ type?: 'monthrange' | 'datetimerange' | 'daterange' | 'yearrange' | 'halfyearrange' | 'quarterrange' | 'date' | 'month' | 'week' | 'dates';
48
+ element?: 'el-input' | 'el-select' | 'custom-select' | 'ai-select' | 'ai-custom-select' | 'nf-lazy-select' | 'el-input-number' | 'el-date-picker' | 'el-cascader' | 'el-time-select' | 'el-time-picker' | 'number-range' | 'nf-date-picker' | 'nf-timezone-picker' | 'nf-quarter-picker' | 'nf-half-year-picker' | 'nf-double-year' | 'nf-double-week' | 'nf-double-half-year' | 'nf-double-quarter' | 'nf-transfer-select';
49
+ events?: Record<string, Function>;
50
+ placeholder?: string;
51
+ virtualList?: boolean;
52
+ 'controls-position'?: 'right' | 'left';
53
+ clearable?: boolean;
54
+ startPlaceholder?: string;
55
+ rangeSeparator?: string;
56
+ endPlaceholder?: string;
57
+ defaultTime?: string[];
58
+ options?: {
59
+ label: string;
60
+ value: string | number;
61
+ }[];
62
+ 'picker-options'?: {
63
+ start: string;
64
+ step: string;
65
+ end: string;
66
+ };
67
+ valueFormat?: string;
68
+ min?: 0;
69
+ };
70
+ export {};
@@ -248,13 +248,40 @@ const checkedCount = ref(0) // 勾选的数量
248
248
  const updateColumn = () => {
249
249
  fixedColumn.value = []
250
250
  unFixedColumn.value = []
251
- currentTable.value.map(item => {
251
+ currentTable.value.filter(item => !item.initHidden).map(item => {
252
252
  if (item.attr.fixed) {
253
253
  fixedColumn.value.push(item)
254
254
  } else {
255
255
  unFixedColumn.value.push(item)
256
256
  }
257
257
  })
258
+ updateCheckStatus()
259
+ }
260
+
261
+
262
+ const pullAwayColumn = (column) => {
263
+ const unFixedIndex = unFixedColumn.value.findIndex(item => item.prop === column.prop)
264
+ const fixedIndex = fixedColumn.value.findIndex(item => item.prop === column.prop)
265
+ if (unFixedIndex > -1) {
266
+ unFixedColumn.value.splice(unFixedIndex, 1)
267
+ } else if (fixedIndex > -1) {
268
+ fixedColumn.value.splice(fixedIndex, 1)
269
+ }
270
+ }
271
+
272
+ const insertColumn = (column, append = false) => {
273
+ const unFixedIndex = unFixedColumn.value.findIndex(item => item.prop === column.prop)
274
+ const fixedIndex = fixedColumn.value.findIndex(item => item.prop === column.prop)
275
+ if (unFixedIndex === -1 && fixedIndex === -1) {
276
+ if (append) {
277
+ unFixedColumn.value.push(column)
278
+ } else {
279
+ unFixedColumn.value.unshift(column)
280
+ }
281
+ }
282
+ }
283
+
284
+ const updateCheckStatus = () => {
258
285
  // 勾选状态
259
286
  showColumn.value = currentTable.value.filter(i => !i.initHidden).map(item => item.prop)
260
287
  // [全选 checkbox] 展示状态
@@ -283,7 +310,7 @@ const handleSearch = (str) => {
283
310
  }
284
311
  })
285
312
  setFields(searchValue)
286
- updateColumn()
313
+ updateCheckStatus()
287
314
  }
288
315
 
289
316
  /**
@@ -293,26 +320,70 @@ const handleSearch = (str) => {
293
320
  const checkAll = ref(false)
294
321
  const isIndeterminate = ref(false) // 来自官方解释:indeterminate 属性用以表示 checkbox 的不确定状态,一般用于实现全选的效果
295
322
  const handleCheckAllChange = (v) => {
323
+ if (v) { // 全选前为空,全选还原成最原始默认的顺序
324
+ let flag = false
325
+ if (columnName.value && fields.value.length) { // 搜索时,全选
326
+ if (searchValue.length && currentTable.value.length && searchValue.length === currentTable.value.length) {
327
+ if (!unFixedColumn.value.length && !fixedColumn.value.length) {
328
+ flag = true
329
+ }
330
+ }
331
+ } else if (!unFixedColumn.value.length && !fixedColumn.value.length) {
332
+ flag = true
333
+ }
334
+ if (flag) {
335
+ fixedColumn.value = []
336
+ unFixedColumn.value = []
337
+ const newColumns: Record<string, any>[] = []
338
+ props.tableColumns.forEach(column => {
339
+ const item = currentTable.value.find(item => item.prop === column.prop)
340
+ if (item) {
341
+ item.initHidden = false
342
+ newColumns.push(item)
343
+ }
344
+ })
345
+ currentTable.value = newColumns
346
+ currentTable.value.map(item => {
347
+ if (item.attr.fixed) {
348
+ fixedColumn.value.push(item)
349
+ } else {
350
+ unFixedColumn.value.push(item)
351
+ }
352
+ })
353
+ updateCheckStatus()
354
+ isIndeterminate.value = false
355
+ return
356
+ }
357
+ }
296
358
  // 搜索时,全选
297
359
  if (columnName.value && fields.value.length) {
298
360
  searchValue.map(item => {
361
+ if (v) { // 追加
362
+ insertColumn(item, true)
363
+ } else {
364
+ pullAwayColumn(item)
365
+ }
299
366
  if (!unChangedColumn.value.includes(item.prop)) {
300
367
  item.initHidden = !v
301
368
  // 清除列目时,清除固定属性
302
369
  v ? '' : item.attr.fixed = false
303
370
  }
304
371
  })
305
- updateColumn()
306
372
  } else {
307
373
  currentTable.value.map(item => {
374
+ if (v) { // 追加
375
+ insertColumn(item, true)
376
+ } else {
377
+ pullAwayColumn(item)
378
+ }
308
379
  if (!unChangedColumn.value.includes(item.prop)) {
309
380
  item.initHidden = !v
310
381
  // 清除列目时,清除固定属性
311
382
  v ? '' : item.attr.fixed = false
312
383
  }
313
384
  })
314
- updateColumn()
315
385
  }
386
+ updateCheckStatus()
316
387
  isIndeterminate.value = false
317
388
  }
318
389
 
@@ -327,9 +398,10 @@ const handleCheckedChange = (v, prop) => {
327
398
  item.initHidden = !v
328
399
  // 清除列目时,清除固定属性
329
400
  v ? '' : item.attr.fixed = false
401
+ v ? insertColumn(item, true) : pullAwayColumn(item)
330
402
  }
331
403
  })
332
- updateColumn()
404
+ updateCheckStatus()
333
405
  }
334
406
 
335
407
  /**
@@ -341,8 +413,20 @@ const handleFixed = (v, prop) => {
341
413
  const columnInfo = currentTable.value.find(item => item.prop === prop)
342
414
  if (columnInfo) {
343
415
  columnInfo.attr.fixed = v ? 'left' : false
416
+ if (v) { // 固定
417
+ const unFixedColumnIndex = unFixedColumn.value.findIndex(unFixedColumnItem => unFixedColumnItem.prop === columnInfo.prop)
418
+ if (unFixedColumnIndex > -1) {
419
+ unFixedColumn.value.splice(unFixedColumnIndex, 1)
420
+ fixedColumn.value.push(columnInfo)
421
+ }
422
+ } else { // 取消固定
423
+ const fixedColumnIndex = fixedColumn.value.findIndex(fixedColumnItem => fixedColumnItem.prop === columnInfo.prop)
424
+ if (fixedColumnIndex > -1) {
425
+ fixedColumn.value.splice(fixedColumnIndex, 1)
426
+ unFixedColumn.value.push(columnInfo)
427
+ }
428
+ }
344
429
  }
345
- updateColumn()
346
430
  }
347
431
 
348
432
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-search-form",
3
- "version": "8.0.1",
3
+ "version": "8.0.5",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "zoujiahe <zoujiahe@94ai.com>",
@@ -14,23 +14,23 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/common-constants": "^8.0.1",
18
- "@94ai/common-utils": "^8.0.1",
19
- "@94ai/nf-button": "^8.0.1",
20
- "@94ai/nf-double-half-year": "^8.0.1",
21
- "@94ai/nf-double-quarter": "^8.0.1",
22
- "@94ai/nf-double-week": "^8.0.1",
23
- "@94ai/nf-double-year": "^8.0.1",
24
- "@94ai/nf-drawer": "^8.0.1",
25
- "@94ai/nf-form": "^8.0.1",
26
- "@94ai/nf-form-item": "^8.0.1",
27
- "@94ai/nf-half-year-picker": "^8.0.1",
28
- "@94ai/nf-lazy-select": "^8.0.1",
29
- "@94ai/nf-message": "^8.0.1",
30
- "@94ai/nf-quarter-picker": "^8.0.1",
31
- "@94ai/nf-theme-chalk": "^8.0.1",
32
- "@94ai/nf-transfer-select": "^8.0.1",
33
- "@94ai/nf-virtual-select": "^8.0.1",
17
+ "@94ai/common-constants": "^8.0.5",
18
+ "@94ai/common-utils": "^8.0.5",
19
+ "@94ai/nf-button": "^8.0.5",
20
+ "@94ai/nf-double-half-year": "^8.0.5",
21
+ "@94ai/nf-double-quarter": "^8.0.5",
22
+ "@94ai/nf-double-week": "^8.0.5",
23
+ "@94ai/nf-double-year": "^8.0.5",
24
+ "@94ai/nf-drawer": "^8.0.5",
25
+ "@94ai/nf-form": "^8.0.5",
26
+ "@94ai/nf-form-item": "^8.0.5",
27
+ "@94ai/nf-half-year-picker": "^8.0.5",
28
+ "@94ai/nf-lazy-select": "^8.0.5",
29
+ "@94ai/nf-message": "^8.0.5",
30
+ "@94ai/nf-quarter-picker": "^8.0.5",
31
+ "@94ai/nf-theme-chalk": "^8.0.5",
32
+ "@94ai/nf-transfer-select": "^8.0.5",
33
+ "@94ai/nf-virtual-select": "^8.0.5",
34
34
  "idb-keyval": "^6.2.1",
35
35
  "resize-observer-polyfill": "^1.5.1",
36
36
  "vue-demi": "^0.14.5",
@@ -50,5 +50,5 @@
50
50
  "types": "lib/index.d.ts",
51
51
  "main": "lib/nf-search-form.cjs.js",
52
52
  "module": "lib/nf-search-form.esm-bundler.js",
53
- "gitHead": "316144e9cd2a06b10e14476d5fdc7f1d42fa88c6"
53
+ "gitHead": "fab708c9a9c54ca34e3fea3c92a4a378184da4b3"
54
54
  }