@silver-formily/element-plus 4.0.3 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/esm/__builtins__/shared/loading.mjs.map +1 -1
  2. package/esm/__builtins__/shared/transform-component.mjs +1 -1
  3. package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
  4. package/esm/__builtins__/shared/utils.mjs +7 -5
  5. package/esm/__builtins__/shared/utils.mjs.map +1 -1
  6. package/esm/array-base/array-base-inner.mjs.map +1 -1
  7. package/esm/array-base/array-base-move-down.mjs +1 -1
  8. package/esm/array-base/array-base-move-down.mjs.map +1 -1
  9. package/esm/array-base/array-base-move-up.mjs +1 -1
  10. package/esm/array-base/array-base-move-up.mjs.map +1 -1
  11. package/esm/array-base/array-base-remove.mjs +1 -1
  12. package/esm/array-base/array-base-remove.mjs.map +1 -1
  13. package/esm/array-base/types.d.ts +2 -2
  14. package/esm/array-base/utils.d.ts +1 -1
  15. package/esm/array-base/utils.mjs +1 -1
  16. package/esm/array-base/utils.mjs.map +1 -1
  17. package/esm/array-cards/array-cards.mjs +1 -1
  18. package/esm/array-cards/array-cards.mjs.map +1 -1
  19. package/esm/array-collapse/array-collapse-item.mjs +1 -1
  20. package/esm/array-collapse/array-collapse-item.mjs.map +1 -1
  21. package/esm/array-collapse/array-collapse.mjs +3 -4
  22. package/esm/array-collapse/array-collapse.mjs.map +1 -1
  23. package/esm/array-items/array-items.mjs +3 -8
  24. package/esm/array-items/array-items.mjs.map +1 -1
  25. package/esm/array-list-tabs/array-list-tabs.mjs +57 -51
  26. package/esm/array-list-tabs/array-list-tabs.mjs.map +1 -1
  27. package/esm/array-list-tabs/utils.mjs.map +1 -1
  28. package/esm/array-table/array-table.mjs +4 -18
  29. package/esm/array-table/array-table.mjs.map +1 -1
  30. package/esm/array-table/utils.mjs.map +1 -1
  31. package/esm/array-tabs/array-tabs.mjs +1 -1
  32. package/esm/array-tabs/array-tabs.mjs.map +1 -1
  33. package/esm/autocomplete/autocomplete.mjs.map +1 -1
  34. package/esm/autocomplete/index.d.ts +3 -4
  35. package/esm/checkbox/checkbox-group.mjs +1 -1
  36. package/esm/checkbox/checkbox-group.mjs.map +1 -1
  37. package/esm/checkbox/index.d.ts +117 -117
  38. package/esm/color-picker/index.d.ts +28 -28
  39. package/esm/color-picker-panel/index.d.ts +18 -18
  40. package/esm/date-picker-panel/index.d.ts +1 -1
  41. package/esm/editable/editable-popover.mjs +1 -1
  42. package/esm/editable/editable-popover.mjs.map +1 -1
  43. package/esm/editable/editable.mjs +1 -1
  44. package/esm/editable/editable.mjs.map +1 -1
  45. package/esm/form/form.mjs.map +1 -1
  46. package/esm/form/form.vue.d.ts +1 -1
  47. package/esm/form-collapse/form-collapse.mjs +1 -1
  48. package/esm/form-collapse/form-collapse.mjs.map +1 -1
  49. package/esm/form-collapse/index.d.ts +3 -3
  50. package/esm/form-collapse/utils.d.ts +2 -2
  51. package/esm/form-collapse/utils.mjs +2 -2
  52. package/esm/form-collapse/utils.mjs.map +1 -1
  53. package/esm/form-dialog/dialog-content.mjs +1 -1
  54. package/esm/form-dialog/dialog-content.mjs.map +1 -1
  55. package/esm/form-dialog/index.mjs +3 -3
  56. package/esm/form-dialog/index.mjs.map +1 -1
  57. package/esm/form-dialog/types.d.ts +2 -2
  58. package/esm/form-drawer/drawer-content.mjs +1 -1
  59. package/esm/form-drawer/drawer-content.mjs.map +1 -1
  60. package/esm/form-drawer/index.mjs +3 -3
  61. package/esm/form-drawer/index.mjs.map +1 -1
  62. package/esm/form-drawer/types.d.ts +2 -2
  63. package/esm/form-item/form-item.mjs +1 -1
  64. package/esm/form-item/form-item.mjs.map +1 -1
  65. package/esm/form-item/index.mjs +1 -1
  66. package/esm/form-item/index.mjs.map +1 -1
  67. package/esm/form-item/utils.mjs +1 -1
  68. package/esm/form-item/utils.mjs.map +1 -1
  69. package/esm/form-layout/form-layout.mjs +1 -1
  70. package/esm/form-layout/form-layout.mjs.map +1 -1
  71. package/esm/form-layout/form-layout.vue.d.ts +1 -1
  72. package/esm/form-layout/utils.mjs +1 -1
  73. package/esm/form-layout/utils.mjs.map +1 -1
  74. package/esm/form-step/form-step.mjs +1 -1
  75. package/esm/form-step/form-step.mjs.map +1 -1
  76. package/esm/form-step/types.d.ts +1 -1
  77. package/esm/form-step/utils.d.ts +1 -1
  78. package/esm/form-step/utils.mjs +1 -1
  79. package/esm/form-step/utils.mjs.map +1 -1
  80. package/esm/form-tab/hooks.mjs.map +1 -1
  81. package/esm/form-tab/utils.mjs +1 -1
  82. package/esm/form-tab/utils.mjs.map +1 -1
  83. package/esm/input-number/index.d.ts +39 -39
  84. package/esm/input-tag/index.d.ts +1 -2
  85. package/esm/input-tag/input-tag.mjs.map +1 -1
  86. package/esm/mention/index.d.ts +3 -4
  87. package/esm/mention/mention.mjs.map +1 -1
  88. package/esm/pagination/components/pager2.mjs.map +1 -1
  89. package/esm/pagination/components/sizes2.mjs +1 -1
  90. package/esm/pagination/components/sizes2.mjs.map +1 -1
  91. package/esm/picker-select/picker-select.mjs +1 -1
  92. package/esm/picker-select/picker-select.mjs.map +1 -1
  93. package/esm/picker-select/types.d.ts +1 -1
  94. package/esm/preview-text/cascader.mjs.map +1 -1
  95. package/esm/preview-text/color-picker.mjs +1 -1
  96. package/esm/preview-text/color-picker.mjs.map +1 -1
  97. package/esm/preview-text/input.mjs +1 -1
  98. package/esm/preview-text/input.mjs.map +1 -1
  99. package/esm/preview-text/rate.mjs +1 -1
  100. package/esm/preview-text/rate.mjs.map +1 -1
  101. package/esm/preview-text/select.mjs +1 -1
  102. package/esm/preview-text/select.mjs.map +1 -1
  103. package/esm/preview-text/time-picker.mjs +1 -1
  104. package/esm/preview-text/time-picker.mjs.map +1 -1
  105. package/esm/preview-text/tree.mjs.map +1 -1
  106. package/esm/query-form/hooks.mjs +1 -1
  107. package/esm/query-form/hooks.mjs.map +1 -1
  108. package/esm/query-form/index.d.ts +5 -5
  109. package/esm/query-form/query-form-light.mjs +1 -1
  110. package/esm/query-form/query-form-light.mjs.map +1 -1
  111. package/esm/query-form/query-form.mjs +1 -1
  112. package/esm/query-form/query-form.mjs.map +1 -1
  113. package/esm/query-form/types.d.ts +2 -2
  114. package/esm/query-form-item/index.d.ts +4 -4
  115. package/esm/query-form-item/query-form-item.mjs +2 -2
  116. package/esm/query-form-item/query-form-item.mjs.map +1 -1
  117. package/esm/query-form-item/types.d.ts +2 -2
  118. package/esm/radio/index.d.ts +72 -72
  119. package/esm/radio/radio-group.mjs +1 -1
  120. package/esm/radio/radio-group.mjs.map +1 -1
  121. package/esm/rate/index.d.ts +10 -10
  122. package/esm/select/index.d.ts +14 -14
  123. package/esm/select-table/index.d.ts +3 -3
  124. package/esm/select-table/select-table.mjs +1 -1
  125. package/esm/select-table/select-table.mjs.map +1 -1
  126. package/esm/select-table/types.d.ts +1 -1
  127. package/esm/submit/submit.mjs.map +1 -1
  128. package/esm/switch/index.d.ts +27 -27
  129. package/esm/time-select/index.d.ts +20 -20
  130. package/esm/transfer/index.d.ts +12 -12
  131. package/esm/tree/tree.mjs +1 -1
  132. package/esm/tree/tree.mjs.map +1 -1
  133. package/esm/tree-select/tree-select.mjs.map +1 -1
  134. package/esm/upload/upload.mjs +1 -1
  135. package/esm/upload/upload.mjs.map +1 -1
  136. package/package.json +18 -14
@@ -4,10 +4,6 @@ import * as _$vue from "vue";
4
4
  //#region src/radio/index.d.ts
5
5
  declare const Radio: {
6
6
  new (...args: any[]): _$vue.CreateComponentPublicInstanceWithMixins<Readonly<_$vue.ExtractPropTypes<{
7
- modelValue: {
8
- type: _$vue.PropType<string | number | boolean>;
9
- default: undefined;
10
- };
11
7
  value: {
12
8
  type: _$vue.PropType<string | number | boolean>;
13
9
  default: undefined;
@@ -16,21 +12,25 @@ declare const Radio: {
16
12
  type: _$vue.PropType<string>;
17
13
  default: undefined;
18
14
  };
19
- disabled: {
20
- type: _$vue.PropType<boolean>;
21
- default: undefined;
22
- };
23
15
  size: {
24
16
  type: _$vue.PropType<"" | "default" | "small" | "large">;
25
17
  };
26
- border: {
18
+ disabled: {
27
19
  type: _$vue.PropType<boolean>;
28
- default: false;
20
+ default: undefined;
21
+ };
22
+ modelValue: {
23
+ type: _$vue.PropType<string | number | boolean>;
24
+ default: undefined;
29
25
  };
30
26
  label: {
31
27
  type: _$vue.PropType<string | number | boolean>;
32
28
  default: undefined;
33
29
  };
30
+ border: {
31
+ type: _$vue.PropType<boolean>;
32
+ default: false;
33
+ };
34
34
  }>> & {
35
35
  "onUpdate:modelValue"?: ((val: string | number | boolean | undefined) => any) | undefined;
36
36
  onChange?: ((val: string | number | boolean | undefined) => any) | undefined;
@@ -52,10 +52,6 @@ declare const Radio: {
52
52
  M: {};
53
53
  Defaults: {};
54
54
  }, Readonly<_$vue.ExtractPropTypes<{
55
- modelValue: {
56
- type: _$vue.PropType<string | number | boolean>;
57
- default: undefined;
58
- };
59
55
  value: {
60
56
  type: _$vue.PropType<string | number | boolean>;
61
57
  default: undefined;
@@ -64,21 +60,25 @@ declare const Radio: {
64
60
  type: _$vue.PropType<string>;
65
61
  default: undefined;
66
62
  };
67
- disabled: {
68
- type: _$vue.PropType<boolean>;
69
- default: undefined;
70
- };
71
63
  size: {
72
64
  type: _$vue.PropType<"" | "default" | "small" | "large">;
73
65
  };
74
- border: {
66
+ disabled: {
75
67
  type: _$vue.PropType<boolean>;
76
- default: false;
68
+ default: undefined;
69
+ };
70
+ modelValue: {
71
+ type: _$vue.PropType<string | number | boolean>;
72
+ default: undefined;
77
73
  };
78
74
  label: {
79
75
  type: _$vue.PropType<string | number | boolean>;
80
76
  default: undefined;
81
77
  };
78
+ border: {
79
+ type: _$vue.PropType<boolean>;
80
+ default: false;
81
+ };
82
82
  }>> & {
83
83
  "onUpdate:modelValue"?: ((val: string | number | boolean | undefined) => any) | undefined;
84
84
  onChange?: ((val: string | number | boolean | undefined) => any) | undefined;
@@ -94,10 +94,6 @@ declare const Radio: {
94
94
  __isTeleport?: never;
95
95
  __isSuspense?: never;
96
96
  } & _$vue.ComponentOptionsBase<Readonly<_$vue.ExtractPropTypes<{
97
- modelValue: {
98
- type: _$vue.PropType<string | number | boolean>;
99
- default: undefined;
100
- };
101
97
  value: {
102
98
  type: _$vue.PropType<string | number | boolean>;
103
99
  default: undefined;
@@ -106,21 +102,25 @@ declare const Radio: {
106
102
  type: _$vue.PropType<string>;
107
103
  default: undefined;
108
104
  };
109
- disabled: {
110
- type: _$vue.PropType<boolean>;
111
- default: undefined;
112
- };
113
105
  size: {
114
106
  type: _$vue.PropType<"" | "default" | "small" | "large">;
115
107
  };
116
- border: {
108
+ disabled: {
117
109
  type: _$vue.PropType<boolean>;
118
- default: false;
110
+ default: undefined;
111
+ };
112
+ modelValue: {
113
+ type: _$vue.PropType<string | number | boolean>;
114
+ default: undefined;
119
115
  };
120
116
  label: {
121
117
  type: _$vue.PropType<string | number | boolean>;
122
118
  default: undefined;
123
119
  };
120
+ border: {
121
+ type: _$vue.PropType<boolean>;
122
+ default: false;
123
+ };
124
124
  }>> & {
125
125
  "onUpdate:modelValue"?: ((val: string | number | boolean | undefined) => any) | undefined;
126
126
  onChange?: ((val: string | number | boolean | undefined) => any) | undefined;
@@ -141,10 +141,6 @@ declare const Radio: {
141
141
  }) & _$vue.ObjectPlugin & {
142
142
  RadioButton: {
143
143
  new (...args: any[]): _$vue.CreateComponentPublicInstanceWithMixins<Readonly<_$vue.ExtractPropTypes<{
144
- modelValue: {
145
- type: _$vue.PropType<string | number | boolean>;
146
- default: undefined;
147
- };
148
144
  value: {
149
145
  type: _$vue.PropType<string | number | boolean>;
150
146
  default: undefined;
@@ -153,12 +149,16 @@ declare const Radio: {
153
149
  type: _$vue.PropType<string>;
154
150
  default: undefined;
155
151
  };
152
+ size: {
153
+ type: _$vue.PropType<"" | "default" | "small" | "large">;
154
+ };
156
155
  disabled: {
157
156
  type: _$vue.PropType<boolean>;
158
157
  default: undefined;
159
158
  };
160
- size: {
161
- type: _$vue.PropType<"" | "default" | "small" | "large">;
159
+ modelValue: {
160
+ type: _$vue.PropType<string | number | boolean>;
161
+ default: undefined;
162
162
  };
163
163
  label: {
164
164
  type: _$vue.PropType<string | number | boolean>;
@@ -178,10 +178,6 @@ declare const Radio: {
178
178
  M: {};
179
179
  Defaults: {};
180
180
  }, Readonly<_$vue.ExtractPropTypes<{
181
- modelValue: {
182
- type: _$vue.PropType<string | number | boolean>;
183
- default: undefined;
184
- };
185
181
  value: {
186
182
  type: _$vue.PropType<string | number | boolean>;
187
183
  default: undefined;
@@ -190,12 +186,16 @@ declare const Radio: {
190
186
  type: _$vue.PropType<string>;
191
187
  default: undefined;
192
188
  };
189
+ size: {
190
+ type: _$vue.PropType<"" | "default" | "small" | "large">;
191
+ };
193
192
  disabled: {
194
193
  type: _$vue.PropType<boolean>;
195
194
  default: undefined;
196
195
  };
197
- size: {
198
- type: _$vue.PropType<"" | "default" | "small" | "large">;
196
+ modelValue: {
197
+ type: _$vue.PropType<string | number | boolean>;
198
+ default: undefined;
199
199
  };
200
200
  label: {
201
201
  type: _$vue.PropType<string | number | boolean>;
@@ -212,10 +212,6 @@ declare const Radio: {
212
212
  __isTeleport?: never;
213
213
  __isSuspense?: never;
214
214
  } & _$vue.ComponentOptionsBase<Readonly<_$vue.ExtractPropTypes<{
215
- modelValue: {
216
- type: _$vue.PropType<string | number | boolean>;
217
- default: undefined;
218
- };
219
215
  value: {
220
216
  type: _$vue.PropType<string | number | boolean>;
221
217
  default: undefined;
@@ -224,12 +220,16 @@ declare const Radio: {
224
220
  type: _$vue.PropType<string>;
225
221
  default: undefined;
226
222
  };
223
+ size: {
224
+ type: _$vue.PropType<"" | "default" | "small" | "large">;
225
+ };
227
226
  disabled: {
228
227
  type: _$vue.PropType<boolean>;
229
228
  default: undefined;
230
229
  };
231
- size: {
232
- type: _$vue.PropType<"" | "default" | "small" | "large">;
230
+ modelValue: {
231
+ type: _$vue.PropType<string | number | boolean>;
232
+ default: undefined;
233
233
  };
234
234
  label: {
235
235
  type: _$vue.PropType<string | number | boolean>;
@@ -248,9 +248,9 @@ declare const Radio: {
248
248
  });
249
249
  RadioGroup: {
250
250
  new (...args: any[]): _$vue.CreateComponentPublicInstanceWithMixins<Readonly<_$vue.ExtractPropTypes<{
251
- modelValue: {
252
- type: _$vue.PropType<string | number | boolean>;
253
- default: undefined;
251
+ fill: {
252
+ type: _$vue.PropType<string>;
253
+ default: "";
254
254
  };
255
255
  props: {
256
256
  type: _$vue.PropType<_$element_plus0.radioOptionProp>;
@@ -264,16 +264,16 @@ declare const Radio: {
264
264
  type: _$vue.PropType<string>;
265
265
  default: undefined;
266
266
  };
267
- fill: {
268
- type: _$vue.PropType<string>;
269
- default: "";
267
+ size: {
268
+ type: _$vue.PropType<"" | "default" | "small" | "large">;
270
269
  };
271
270
  disabled: {
272
271
  type: _$vue.PropType<boolean>;
273
272
  default: undefined;
274
273
  };
275
- size: {
276
- type: _$vue.PropType<"" | "default" | "small" | "large">;
274
+ modelValue: {
275
+ type: _$vue.PropType<string | number | boolean>;
276
+ default: undefined;
277
277
  };
278
278
  options: {
279
279
  type: _$vue.PropType<_$element_plus0.radioOption[]>;
@@ -317,9 +317,9 @@ declare const Radio: {
317
317
  M: {};
318
318
  Defaults: {};
319
319
  }, Readonly<_$vue.ExtractPropTypes<{
320
- modelValue: {
321
- type: _$vue.PropType<string | number | boolean>;
322
- default: undefined;
320
+ fill: {
321
+ type: _$vue.PropType<string>;
322
+ default: "";
323
323
  };
324
324
  props: {
325
325
  type: _$vue.PropType<_$element_plus0.radioOptionProp>;
@@ -333,16 +333,16 @@ declare const Radio: {
333
333
  type: _$vue.PropType<string>;
334
334
  default: undefined;
335
335
  };
336
- fill: {
337
- type: _$vue.PropType<string>;
338
- default: "";
336
+ size: {
337
+ type: _$vue.PropType<"" | "default" | "small" | "large">;
339
338
  };
340
339
  disabled: {
341
340
  type: _$vue.PropType<boolean>;
342
341
  default: undefined;
343
342
  };
344
- size: {
345
- type: _$vue.PropType<"" | "default" | "small" | "large">;
343
+ modelValue: {
344
+ type: _$vue.PropType<string | number | boolean>;
345
+ default: undefined;
346
346
  };
347
347
  options: {
348
348
  type: _$vue.PropType<_$element_plus0.radioOption[]>;
@@ -380,9 +380,9 @@ declare const Radio: {
380
380
  __isTeleport?: never;
381
381
  __isSuspense?: never;
382
382
  } & _$vue.ComponentOptionsBase<Readonly<_$vue.ExtractPropTypes<{
383
- modelValue: {
384
- type: _$vue.PropType<string | number | boolean>;
385
- default: undefined;
383
+ fill: {
384
+ type: _$vue.PropType<string>;
385
+ default: "";
386
386
  };
387
387
  props: {
388
388
  type: _$vue.PropType<_$element_plus0.radioOptionProp>;
@@ -396,16 +396,16 @@ declare const Radio: {
396
396
  type: _$vue.PropType<string>;
397
397
  default: undefined;
398
398
  };
399
- fill: {
400
- type: _$vue.PropType<string>;
401
- default: "";
399
+ size: {
400
+ type: _$vue.PropType<"" | "default" | "small" | "large">;
402
401
  };
403
402
  disabled: {
404
403
  type: _$vue.PropType<boolean>;
405
404
  default: undefined;
406
405
  };
407
- size: {
408
- type: _$vue.PropType<"" | "default" | "small" | "large">;
406
+ modelValue: {
407
+ type: _$vue.PropType<string | number | boolean>;
408
+ default: undefined;
409
409
  };
410
410
  options: {
411
411
  type: _$vue.PropType<_$element_plus0.radioOption[]>;
@@ -2,7 +2,7 @@ import { lt } from "../__builtins__/shared/simple-version-compare.mjs";
2
2
  import { useCleanAttrs } from "../__builtins__/shared/utils.mjs";
3
3
  import { ElRadio, ElRadioButton, ElRadioGroup, version } from "element-plus";
4
4
  import { Fragment, computed, createBlock, createElementBlock, createTextVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderList, renderSlot, resolveDynamicComponent, toDisplayString, unref, useSlots, withCtx } from "vue";
5
- import { isPlainObj } from "@formily/shared";
5
+ import { isPlainObj } from "@silver-formily/shared";
6
6
  //#region src/radio/radio-group.vue
7
7
  const _sfc_main = /* @__PURE__ */ defineComponent({
8
8
  name: "FRadioGroup",
@@ -1 +1 @@
1
- {"version":3,"file":"radio-group.mjs","names":[],"sources":["../../src/radio/radio-group.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { RadioProps } from 'element-plus'\nimport type { PropType } from 'vue'\nimport { isPlainObj } from '@formily/shared'\nimport { ElRadio, ElRadioButton, ElRadioGroup, version } from 'element-plus'\nimport { computed, useSlots } from 'vue'\nimport { lt, useCleanAttrs } from '../__builtins__'\n\ndefineOptions({\n name: 'FRadioGroup',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n options: {\n type: Array as PropType<Array<RadioProps | string | number>>,\n default: () => [],\n },\n optionType: {\n type: String as PropType<'default' | 'button'>,\n default: 'default',\n },\n})\n\nconst { props: radioProps } = useCleanAttrs()\nconst normalizedOptions = computed(() => Array.isArray(props.options) ? props.options : [])\n\nconst OptionType = computed(() => {\n return props.optionType === 'button' ? ElRadioButton : ElRadio\n})\nconst IS_LESS_THAN_2_6_0 = lt(version, '2.6.0')\n\nfunction isRadioPropsObject(option: any): option is RadioProps {\n return isPlainObj(option)\n}\n\nfunction getOptionLabel(option: any, index: number) {\n if (isRadioPropsObject(normalizedOptions.value[index])) {\n return normalizedOptions.value[index].label\n }\n return option.label\n}\n\nconst compatiableProps = computed(() => {\n return normalizedOptions.value.map((option) => {\n if (!isRadioPropsObject(option)) {\n return {\n label: option,\n value: option,\n }\n }\n /* istanbul ignore if -- @preserve */\n if (IS_LESS_THAN_2_6_0) {\n return {\n ...option,\n label: option.value,\n }\n }\n return option\n })\n})\n\nconst slots = useSlots()\n</script>\n\n<template>\n <ElRadioGroup v-bind=\"radioProps\">\n <template v-if=\"!slots.option\">\n <component :is=\"OptionType\" v-for=\"(option, index) of compatiableProps\" :key=\"index\" v-bind=\"option\">\n {{ getOptionLabel(option, index) }}\n </component>\n </template>\n <template v-else>\n <component :is=\"OptionType\" v-for=\"(option, index) of compatiableProps\" :key=\"index\" v-bind=\"option\">\n <slot name=\"option\" :option=\"option\" />\n </component>\n </template>\n </ElRadioGroup>\n</template>\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Y,EAF6D,KAAK,OAAK,EAAA,EAAA,SAAA,MAAA,EAAU,OAAM,EAAA;6BAC1D,CAAvC,WAAuC,KAAA,QAAA,UAAA,EAAV,QAAM,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"radio-group.mjs","names":[],"sources":["../../src/radio/radio-group.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { RadioProps } from 'element-plus'\nimport type { PropType } from 'vue'\nimport { isPlainObj } from '@silver-formily/shared'\nimport { ElRadio, ElRadioButton, ElRadioGroup, version } from 'element-plus'\nimport { computed, useSlots } from 'vue'\nimport { lt, useCleanAttrs } from '../__builtins__'\n\ndefineOptions({\n name: 'FRadioGroup',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n options: {\n type: Array as PropType<Array<RadioProps | string | number>>,\n default: () => [],\n },\n optionType: {\n type: String as PropType<'default' | 'button'>,\n default: 'default',\n },\n})\n\nconst { props: radioProps } = useCleanAttrs()\nconst normalizedOptions = computed(() => Array.isArray(props.options) ? props.options : [])\n\nconst OptionType = computed(() => {\n return props.optionType === 'button' ? ElRadioButton : ElRadio\n})\nconst IS_LESS_THAN_2_6_0 = lt(version, '2.6.0')\n\nfunction isRadioPropsObject(option: any): option is RadioProps {\n return isPlainObj(option)\n}\n\nfunction getOptionLabel(option: any, index: number) {\n if (isRadioPropsObject(normalizedOptions.value[index])) {\n return normalizedOptions.value[index].label\n }\n return option.label\n}\n\nconst compatiableProps = computed(() => {\n return normalizedOptions.value.map((option) => {\n if (!isRadioPropsObject(option)) {\n return {\n label: option,\n value: option,\n }\n }\n /* istanbul ignore if -- @preserve */\n if (IS_LESS_THAN_2_6_0) {\n return {\n ...option,\n label: option.value,\n }\n }\n return option\n })\n})\n\nconst slots = useSlots()\n</script>\n\n<template>\n <ElRadioGroup v-bind=\"radioProps\">\n <template v-if=\"!slots.option\">\n <component :is=\"OptionType\" v-for=\"(option, index) of compatiableProps\" :key=\"index\" v-bind=\"option\">\n {{ getOptionLabel(option, index) }}\n </component>\n </template>\n <template v-else>\n <component :is=\"OptionType\" v-for=\"(option, index) of compatiableProps\" :key=\"index\" v-bind=\"option\">\n <slot name=\"option\" :option=\"option\" />\n </component>\n </template>\n </ElRadioGroup>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAaA,MAAM,QAAQ;EAWd,MAAM,EAAE,OAAO,eAAe,eAAc;EAC5C,MAAM,oBAAoB,eAAe,MAAM,QAAQ,MAAM,QAAQ,GAAG,MAAM,UAAU,EAAE,CAAA;EAE1F,MAAM,aAAa,eAAe;AAChC,UAAO,MAAM,eAAe,WAAW,gBAAgB;IACxD;EACD,MAAM,qBAAqB,GAAG,SAAS,QAAO;EAE9C,SAAS,mBAAmB,QAAmC;AAC7D,UAAO,WAAW,OAAM;;EAG1B,SAAS,eAAe,QAAa,OAAe;AAClD,OAAI,mBAAmB,kBAAkB,MAAM,OAAO,CACpD,QAAO,kBAAkB,MAAM,OAAO;AAExC,UAAO,OAAO;;EAGhB,MAAM,mBAAmB,eAAe;AACtC,UAAO,kBAAkB,MAAM,KAAK,WAAW;AAC7C,QAAI,CAAC,mBAAmB,OAAO,CAC7B,QAAO;KACL,OAAO;KACP,OAAO;KACT;;AAGF,QAAI,mBACF,QAAO;KACL,GAAG;KACH,OAAO,OAAO;KAChB;AAEF,WAAO;KACR;IACF;EAED,MAAM,QAAQ,UAAS;;uBAIrB,YAWe,MAAA,aAAA,EAAA,eAAA,mBAXO,MAAA,WAAU,CAAA,CAAA,EAAA;2BAKnB,CAAA,CAJM,MAAA,MAAK,CAAC,UAAA,UAAA,KAAA,EACrB,mBAEY,UAAA,EAAA,KAAA,GAAA,EAAA,WAF0C,iBAAA,QAAlB,QAAQ,UAAK;yBAAjD,YAEY,wBAFI,WAAA,MAAU,EAA1B,WAEY,EAF6D,KAAK,OAAK,EAAA,EAAA,SAAA,MAAA,EAAU,OAAM,EAAA;6BAC9D,CAAA,gBAAA,gBAAhC,eAAe,QAAQ,MAAK,CAAA,EAAA,EAAA,CAAA,CAAA;;;kCAIjC,mBAEY,UAAA,EAAA,KAAA,GAAA,EAAA,WAF0C,iBAAA,QAAlB,QAAQ,UAAK;yBAAjD,YAEY,wBAFI,WAAA,MAAU,EAA1B,WAEY,EAF6D,KAAK,OAAK,EAAA,EAAA,SAAA,MAAA,EAAU,OAAM,EAAA;6BAC1D,CAAvC,WAAuC,KAAA,QAAA,UAAA,EAAV,QAAM,CAAA,CAAA,CAAA"}
@@ -5,16 +5,16 @@ import * as _$element_plus_es_utils_index_mjs0 from "element-plus/es/utils/index
5
5
  //#region src/rate/index.d.ts
6
6
  type RateProps = typeof ElRate;
7
7
  declare const Rate: _$element_plus_es_utils_index_mjs0.SFCWithInstall<_$vue.DefineComponent<{
8
- modelValue: {
9
- type: _$vue.PropType<number>;
10
- default: number;
8
+ size: {
9
+ type: _$vue.PropType<"" | "default" | "small" | "large">;
11
10
  };
12
11
  disabled: {
13
12
  type: _$vue.PropType<boolean>;
14
13
  default: undefined;
15
14
  };
16
- size: {
17
- type: _$vue.PropType<"" | "default" | "small" | "large">;
15
+ modelValue: {
16
+ type: _$vue.PropType<number>;
17
+ default: number;
18
18
  };
19
19
  clearable: {
20
20
  type: _$vue.PropType<boolean>;
@@ -90,16 +90,16 @@ declare const Rate: _$element_plus_es_utils_index_mjs0.SFCWithInstall<_$vue.Defi
90
90
  "update:modelValue": (value: number) => void;
91
91
  change: (value: number) => void;
92
92
  }, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
93
- modelValue: {
94
- type: _$vue.PropType<number>;
95
- default: number;
93
+ size: {
94
+ type: _$vue.PropType<"" | "default" | "small" | "large">;
96
95
  };
97
96
  disabled: {
98
97
  type: _$vue.PropType<boolean>;
99
98
  default: undefined;
100
99
  };
101
- size: {
102
- type: _$vue.PropType<"" | "default" | "small" | "large">;
100
+ modelValue: {
101
+ type: _$vue.PropType<number>;
102
+ default: number;
103
103
  };
104
104
  clearable: {
105
105
  type: _$vue.PropType<boolean>;
@@ -8,10 +8,10 @@ declare const Select: {
8
8
  disabled: boolean;
9
9
  created: boolean;
10
10
  }> & Omit<{
11
- readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | NumberConstructor | StringConstructor)[], unknown, unknown>;
11
+ readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | ObjectConstructor | BooleanConstructor | NumberConstructor)[], unknown, unknown>;
12
12
  readonly disabled: boolean;
13
13
  readonly created: boolean;
14
- readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(NumberConstructor | StringConstructor)[], unknown, unknown>;
14
+ readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
15
15
  } & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">) | (Partial<{
16
16
  disabled: boolean;
17
17
  }> & Omit<{
@@ -22,10 +22,10 @@ declare const Select: {
22
22
  disabled: boolean;
23
23
  created: boolean;
24
24
  }> & Omit<{
25
- readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | NumberConstructor | StringConstructor)[], unknown, unknown>;
25
+ readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | ObjectConstructor | BooleanConstructor | NumberConstructor)[], unknown, unknown>;
26
26
  readonly disabled: boolean;
27
27
  readonly created: boolean;
28
- readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(NumberConstructor | StringConstructor)[], unknown, unknown>;
28
+ readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
29
29
  } & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">)[];
30
30
  })>;
31
31
  }> & Readonly<{}>, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, _$vue.PublicProps, {}, true, {}, {}, _$vue.GlobalComponents, _$vue.GlobalDirectives, string, {}, any, _$vue.ComponentProvideOptions, {
@@ -40,10 +40,10 @@ declare const Select: {
40
40
  disabled: boolean;
41
41
  created: boolean;
42
42
  }> & Omit<{
43
- readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | NumberConstructor | StringConstructor)[], unknown, unknown>;
43
+ readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | ObjectConstructor | BooleanConstructor | NumberConstructor)[], unknown, unknown>;
44
44
  readonly disabled: boolean;
45
45
  readonly created: boolean;
46
- readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(NumberConstructor | StringConstructor)[], unknown, unknown>;
46
+ readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
47
47
  } & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">) | (Partial<{
48
48
  disabled: boolean;
49
49
  }> & Omit<{
@@ -54,10 +54,10 @@ declare const Select: {
54
54
  disabled: boolean;
55
55
  created: boolean;
56
56
  }> & Omit<{
57
- readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | NumberConstructor | StringConstructor)[], unknown, unknown>;
57
+ readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | ObjectConstructor | BooleanConstructor | NumberConstructor)[], unknown, unknown>;
58
58
  readonly disabled: boolean;
59
59
  readonly created: boolean;
60
- readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(NumberConstructor | StringConstructor)[], unknown, unknown>;
60
+ readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
61
61
  } & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">)[];
62
62
  })>;
63
63
  }> & Readonly<{}>, {}, {}, {}, {}, {}>;
@@ -69,10 +69,10 @@ declare const Select: {
69
69
  disabled: boolean;
70
70
  created: boolean;
71
71
  }> & Omit<{
72
- readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | NumberConstructor | StringConstructor)[], unknown, unknown>;
72
+ readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | ObjectConstructor | BooleanConstructor | NumberConstructor)[], unknown, unknown>;
73
73
  readonly disabled: boolean;
74
74
  readonly created: boolean;
75
- readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(NumberConstructor | StringConstructor)[], unknown, unknown>;
75
+ readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
76
76
  } & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">) | (Partial<{
77
77
  disabled: boolean;
78
78
  }> & Omit<{
@@ -83,10 +83,10 @@ declare const Select: {
83
83
  disabled: boolean;
84
84
  created: boolean;
85
85
  }> & Omit<{
86
- readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | NumberConstructor | StringConstructor)[], unknown, unknown>;
86
+ readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | ObjectConstructor | BooleanConstructor | NumberConstructor)[], unknown, unknown>;
87
87
  readonly disabled: boolean;
88
88
  readonly created: boolean;
89
- readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(NumberConstructor | StringConstructor)[], unknown, unknown>;
89
+ readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
90
90
  } & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">)[];
91
91
  })>;
92
92
  }> & Readonly<{}>, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, {}, {}, string, {}, _$vue.GlobalComponents, _$vue.GlobalDirectives, string, _$vue.ComponentProvideOptions> & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps & (new () => {
@@ -96,10 +96,10 @@ declare const Select: {
96
96
  disabled: boolean;
97
97
  created: boolean;
98
98
  }> & Omit<{
99
- readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(BooleanConstructor | ObjectConstructor | NumberConstructor | StringConstructor)[], unknown, unknown>;
99
+ readonly value: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | ObjectConstructor | BooleanConstructor | NumberConstructor)[], unknown, unknown>;
100
100
  readonly disabled: boolean;
101
101
  readonly created: boolean;
102
- readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(NumberConstructor | StringConstructor)[], unknown, unknown>;
102
+ readonly label?: _$element_plus_es_utils_index_mjs0.EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>;
103
103
  } & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps, "disabled" | "created">;
104
104
  }) => any;
105
105
  header?: () => any;
@@ -9,10 +9,10 @@ declare const SelectTable: {
9
9
  }>, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
10
10
  "update:modelValue": (...args: any[]) => void;
11
11
  }, _$vue.PublicProps, {
12
- loading: boolean;
13
12
  dataSource: any[];
14
13
  valueType: "all" | "parent" | "child" | "path";
15
14
  mode: "multiple" | "single";
15
+ loading: boolean;
16
16
  columns: _$element_plus0.Column<any>[];
17
17
  optionAsValue: boolean;
18
18
  clickRowToSelect: boolean;
@@ -28,10 +28,10 @@ declare const SelectTable: {
28
28
  }, Readonly<ISelectTableProps> & Readonly<{
29
29
  "onUpdate:modelValue"?: (...args: any[]) => any;
30
30
  }>, {}, {}, {}, {}, {
31
- loading: boolean;
32
31
  dataSource: any[];
33
32
  valueType: "all" | "parent" | "child" | "path";
34
33
  mode: "multiple" | "single";
34
+ loading: boolean;
35
35
  columns: _$element_plus0.Column<any>[];
36
36
  optionAsValue: boolean;
37
37
  clickRowToSelect: boolean;
@@ -46,10 +46,10 @@ declare const SelectTable: {
46
46
  }>, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
47
47
  "update:modelValue": (...args: any[]) => void;
48
48
  }, string, {
49
- loading: boolean;
50
49
  dataSource: any[];
51
50
  valueType: "all" | "parent" | "child" | "path";
52
51
  mode: "multiple" | "single";
52
+ loading: boolean;
53
53
  columns: _$element_plus0.Column<any>[];
54
54
  optionAsValue: boolean;
55
55
  clickRowToSelect: boolean;
@@ -3,7 +3,7 @@ import { stylePrefix } from "../__builtins__/configs/index.mjs";
3
3
  import { ElLink, ElRadio, ElRadioGroup, ElTable, ElTableColumn, useAttrs, vLoading, version } from "element-plus";
4
4
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, nextTick, normalizeClass, openBlock, ref, renderList, renderSlot, toDisplayString, unref, watch, withCtx, withDirectives } from "vue";
5
5
  import { useField } from "@silver-formily/vue";
6
- import { isEqual, isFn, isValid } from "@formily/shared";
6
+ import { isEqual, isFn, isValid } from "@silver-formily/shared";
7
7
  import { differenceWith, remove, uniq, uniqWith, xor } from "lodash-es";
8
8
  //#region src/select-table/select-table.vue
9
9
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -1 +1 @@
1
- {"version":3,"file":"select-table.mjs","names":[],"sources":["../../src/select-table/select-table.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { TableInstance } from 'element-plus'\nimport type { ISelectTableProps } from './types'\nimport { isEqual, isFn, isValid } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport {\n ElLink,\n ElRadio,\n ElRadioGroup,\n ElTable,\n ElTableColumn,\n useAttrs,\n version,\n vLoading,\n} from 'element-plus'\nimport { differenceWith, remove, uniq, uniqWith, xor } from 'lodash-es'\nimport { computed, nextTick, ref, watch } from 'vue'\nimport { lt, stylePrefix } from '../__builtins__'\n\ndefineOptions({\n name: 'FSelectTable',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<ISelectTableProps>(), {\n columns: () => [],\n mode: 'multiple',\n dataSource: () => [],\n optionAsValue: false,\n valueType: 'all',\n loading: false,\n clickRowToSelect: true,\n showAlertToolbar: true,\n ignoreSelectable: true,\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst elTableProps = useAttrs()\nconst field = useField()\nconst elTableRef = ref<TableInstance>()\nconst radioSelectedKey = ref()\n\nfunction requireRowKey() {\n if (!props.rowKey) {\n throw new Error('rowKey is required')\n }\n return props.rowKey\n}\n\nfunction getRowValue(item?: Record<string, any> | null) {\n if (!props.rowKey || !item) {\n return undefined\n }\n return item[props.rowKey]\n}\n\nfunction getSingleSelectedKey(value: any) {\n if (!isValid(value)) {\n return null\n }\n return props.optionAsValue ? getRowValue(value) ?? null : value\n}\n\nfunction getMultipleSelectedKeys(value: any) {\n if (!Array.isArray(value)) {\n return []\n }\n return value\n .map(item => props.optionAsValue ? getRowValue(item) : item)\n .filter(isValid)\n}\n\nfunction syncRadioSelection(item?: Record<string, any> | null) {\n radioSelectedKey.value = getRowValue(item) ?? null\n elTableRef.value?.setCurrentRow(item)\n}\n\nfunction compatibleRadioValue(key: string) {\n return lt(version, '2.6.0') ? { label: key } : { value: key }\n}\n\nfunction getInitialSelectedList() {\n if (!isValid(props.modelValue)) {\n return []\n }\n\n if (props.mode === 'multiple') {\n if (!Array.isArray(props.modelValue)) {\n return []\n }\n\n return props.modelValue.map((item) => {\n if (!props.optionAsValue) {\n if (!props.rowKey) {\n return null\n }\n return {\n [props.rowKey]: item,\n }\n }\n return item\n }).filter(isValid)\n }\n else {\n if (props.optionAsValue) {\n return [props.modelValue]\n }\n if (!props.rowKey) {\n return []\n }\n return [{ [props.rowKey]: props.modelValue }]\n }\n}\nconst initialSelectedList = getInitialSelectedList()\nconst selectedFlatDataSource = ref(initialSelectedList)\n// 为了获取移除的项而缓存的当前页面的前一次选择。由于element-plus没有获取移除项的方法,需要通过这种方式移除field中移除的项\nlet prevSelection = []\n\nconst currentSelectLength = computed(() => {\n if (props.mode === 'multiple') {\n return Array.isArray(props.modelValue) ? props.modelValue.length : 0\n }\n else {\n return isValid(radioSelectedKey.value) ? 1 : 0\n }\n})\n\nwatch(\n () => props.dataSource,\n async () => {\n const selectedKeys = uniq(\n selectedFlatDataSource.value.map(item => getRowValue(item)).filter(isValid),\n )\n await nextTick()\n for (const item of props.dataSource) {\n const itemKey = getRowValue(item)\n if (isValid(itemKey) && selectedKeys.includes(itemKey)) {\n if (props.mode === 'multiple') {\n elTableRef.value?.toggleRowSelection(item, true, props.ignoreSelectable)\n }\n else {\n syncRadioSelection(item)\n }\n }\n await nextTick()\n prevSelection = elTableRef.value?.getSelectionRows() ?? []\n }\n },\n { immediate: true },\n)\n\nwatch(\n () => [props.modelValue, props.loading],\n async ([value, loading]) => {\n if (loading) {\n return\n }\n if (props.mode === 'single') {\n const selectedKey = getSingleSelectedKey(value)\n radioSelectedKey.value = selectedKey\n const selectedItem = props.dataSource.find(item => getRowValue(item) === selectedKey)\n elTableRef.value?.setCurrentRow(selectedItem)\n }\n else {\n await nextTick()\n const currentDisplayDataKeys = elTableRef.value\n ?.getSelectionRows()\n .map(item => getRowValue(item))\n .filter(isValid) ?? []\n const valueKeys = getMultipleSelectedKeys(value)\n selectedFlatDataSource.value = selectedFlatDataSource.value.filter(\n item => valueKeys.includes(getRowValue(item)),\n )\n if (isEqual(valueKeys, currentDisplayDataKeys)) {\n return\n }\n const diffItems = xor(valueKeys, currentDisplayDataKeys)\n for (const tableItem of props.dataSource) {\n const itemKey = getRowValue(tableItem)\n if (isValid(itemKey) && diffItems.includes(itemKey)) {\n const shouldSelect = valueKeys.includes(itemKey)\n elTableRef.value?.toggleRowSelection(tableItem, shouldSelect, props.ignoreSelectable)\n }\n }\n }\n },\n {\n immediate: true,\n },\n)\n\nfunction onSelect(newSelection: Record<string, any>[]) {\n const rowKey = requireRowKey()\n\n const removedItemList\n = prevSelection.length > newSelection.length\n ? differenceWith(\n prevSelection,\n newSelection,\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n : []\n prevSelection = [...newSelection]\n selectedFlatDataSource.value = uniqWith(\n [...selectedFlatDataSource.value, ...newSelection],\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n if (removedItemList.length > 0) {\n const removedKeys = uniq(removedItemList.map(item => item[rowKey]))\n remove(selectedFlatDataSource.value, item =>\n removedKeys.includes(item[rowKey]))\n }\n\n if (props.optionAsValue) {\n emit('update:modelValue', selectedFlatDataSource.value)\n }\n else {\n const selectedKeys = selectedFlatDataSource.value.map(\n item => item[rowKey],\n )\n emit('update:modelValue', selectedKeys)\n }\n}\n\nfunction onRadioClick(item) {\n const rowKey = requireRowKey()\n syncRadioSelection(item)\n if (props.optionAsValue) {\n emit('update:modelValue', item)\n }\n else {\n emit('update:modelValue', item[rowKey])\n }\n}\n\nfunction onRowClick(row: Record<string, any>, _, event: Event) {\n if (!props.clickRowToSelect)\n return\n\n if (props.mode === 'multiple') {\n const checkboxDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"checkbox\"]')\n if (checkboxDOM instanceof HTMLElement) {\n checkboxDOM.click()\n }\n }\n else {\n const radioDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"radio\"]')\n if (radioDOM instanceof HTMLElement) {\n radioDOM.click()\n }\n }\n}\n\nfunction onClearSelectionClick() {\n if (props.mode === 'multiple') {\n emit('update:modelValue', [])\n selectedFlatDataSource.value = []\n }\n else {\n syncRadioSelection(null)\n emit('update:modelValue', null)\n }\n}\n\nfunction selectable(row: Record<string, any>, index: number) {\n if (props.selectable && isFn(props.selectable)) {\n return props.selectable(row, index, field.value)\n }\n return true\n}\n</script>\n\n<template>\n <div :class=\"`${stylePrefix}-select-table`\">\n <div\n v-if=\"currentSelectLength > 0 && props.showAlertToolbar\"\n :class=\"`${stylePrefix}-select-table-alert-container`\"\n >\n <span>已选择 {{ currentSelectLength }} 项</span>\n <ElLink\n type=\"primary\"\n :underline=\"lt(version, '2.9.9') ? false : 'never'\"\n style=\"margin-left: 8px;\"\n @click=\"onClearSelectionClick\"\n >\n 取消选择\n </ElLink>\n </div>\n <ElTable\n ref=\"elTableRef\"\n v-loading=\"props.loading\"\n v-bind=\"elTableProps\"\n :row-key=\"rowKey\"\n :row-class-name=\"props.clickRowToSelect ? `--click-row-select` : ''\"\n :data=\"props.dataSource\"\n :highlight-current-row=\"props.mode === 'single'\"\n @select=\"onSelect\"\n @select-all=\"onSelect\"\n @row-click=\"onRowClick\"\n >\n <ElTableColumn\n v-if=\"props.mode === 'multiple'\"\n type=\"selection\"\n :selectable=\"selectable\"\n />\n <ElTableColumn\n v-else\n width=\"46\"\n >\n <template #default=\"{ row }\">\n <ElRadioGroup v-model=\"radioSelectedKey\" style=\"width: 100%;\">\n <ElRadio\n v-bind=\"compatibleRadioValue(row[rowKey])\"\n @change=\"() => onRadioClick(row)\"\n >\n &nbsp;\n </ElRadio>\n </ElRadioGroup>\n </template>\n </ElTableColumn>\n <template v-if=\"props.columns.length === 0\">\n <slot />\n </template>\n <template v-else>\n <ElTableColumn\n v-for=\"colItem of props.columns\"\n v-bind=\"colItem\"\n :key=\"colItem.prop || colItem.type\"\n />\n </template>\n </ElTable>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBA,MAAM,QAAQ;EAYd,MAAM,OAAO;EAEb,MAAM,eAAe,UAAS;EAC9B,MAAM,QAAQ,UAAS;EACvB,MAAM,aAAa,KAAmB;EACtC,MAAM,mBAAmB,KAAI;EAE7B,SAAS,gBAAgB;AACvB,OAAI,CAAC,MAAM,OACT,OAAM,IAAI,MAAM,qBAAoB;AAEtC,UAAO,MAAM;;EA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kBAPQ,iBAAA;mEAAA,iBAAgB,QAAA;MAAE,OAAA,EAAA,SAAA,QAAoB;;6BAMjD,CALV,YAKU,MAAA,QAAA,EALV,WACU,qBAAqB,IAAI,QAAA,QAAM,EAAA,EACtC,gBAAc,aAAa,IAAG,EAAA,CAAA,EAAA;8BAGjC,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAFC,UAED,GAAA,CAAA,EAAA,CAAA;;;;;;SAIU,MAAM,QAAQ,WAAM,IAClC,WAAQ,KAAA,QAAA,WAAA,EAAA,KAAA,GAAA,CAAA,IAAA,UAAA,KAAA,EAGR,mBAIE,UAAA,EAAA,KAAA,GAAA,EAAA,WAHkB,MAAM,UAAjB,YAAO;yBADhB,YAIE,MAAA,cAAA,EAJF,WAIE,EAAA,SAAA,MAAA,EAFQ,SAAO,EACd,KAAK,QAAQ,QAAQ,QAAQ,MAAA,CAAA,EAAA,MAAA,GAAA;;;;;;;;2BArCvB,MAAM,QAAO,CAAA,CAAA,CAAA,EAAA,EAAA"}
1
+ {"version":3,"file":"select-table.mjs","names":[],"sources":["../../src/select-table/select-table.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { TableInstance } from 'element-plus'\nimport type { ISelectTableProps } from './types'\nimport { isEqual, isFn, isValid } from '@silver-formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport {\n ElLink,\n ElRadio,\n ElRadioGroup,\n ElTable,\n ElTableColumn,\n useAttrs,\n version,\n vLoading,\n} from 'element-plus'\nimport { differenceWith, remove, uniq, uniqWith, xor } from 'lodash-es'\nimport { computed, nextTick, ref, watch } from 'vue'\nimport { lt, stylePrefix } from '../__builtins__'\n\ndefineOptions({\n name: 'FSelectTable',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<ISelectTableProps>(), {\n columns: () => [],\n mode: 'multiple',\n dataSource: () => [],\n optionAsValue: false,\n valueType: 'all',\n loading: false,\n clickRowToSelect: true,\n showAlertToolbar: true,\n ignoreSelectable: true,\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst elTableProps = useAttrs()\nconst field = useField()\nconst elTableRef = ref<TableInstance>()\nconst radioSelectedKey = ref()\n\nfunction requireRowKey() {\n if (!props.rowKey) {\n throw new Error('rowKey is required')\n }\n return props.rowKey\n}\n\nfunction getRowValue(item?: Record<string, any> | null) {\n if (!props.rowKey || !item) {\n return undefined\n }\n return item[props.rowKey]\n}\n\nfunction getSingleSelectedKey(value: any) {\n if (!isValid(value)) {\n return null\n }\n return props.optionAsValue ? getRowValue(value) ?? null : value\n}\n\nfunction getMultipleSelectedKeys(value: any) {\n if (!Array.isArray(value)) {\n return []\n }\n return value\n .map(item => props.optionAsValue ? getRowValue(item) : item)\n .filter(isValid)\n}\n\nfunction syncRadioSelection(item?: Record<string, any> | null) {\n radioSelectedKey.value = getRowValue(item) ?? null\n elTableRef.value?.setCurrentRow(item)\n}\n\nfunction compatibleRadioValue(key: string) {\n return lt(version, '2.6.0') ? { label: key } : { value: key }\n}\n\nfunction getInitialSelectedList() {\n if (!isValid(props.modelValue)) {\n return []\n }\n\n if (props.mode === 'multiple') {\n if (!Array.isArray(props.modelValue)) {\n return []\n }\n\n return props.modelValue.map((item) => {\n if (!props.optionAsValue) {\n if (!props.rowKey) {\n return null\n }\n return {\n [props.rowKey]: item,\n }\n }\n return item\n }).filter(isValid)\n }\n else {\n if (props.optionAsValue) {\n return [props.modelValue]\n }\n if (!props.rowKey) {\n return []\n }\n return [{ [props.rowKey]: props.modelValue }]\n }\n}\nconst initialSelectedList = getInitialSelectedList()\nconst selectedFlatDataSource = ref(initialSelectedList)\n// 为了获取移除的项而缓存的当前页面的前一次选择。由于element-plus没有获取移除项的方法,需要通过这种方式移除field中移除的项\nlet prevSelection = []\n\nconst currentSelectLength = computed(() => {\n if (props.mode === 'multiple') {\n return Array.isArray(props.modelValue) ? props.modelValue.length : 0\n }\n else {\n return isValid(radioSelectedKey.value) ? 1 : 0\n }\n})\n\nwatch(\n () => props.dataSource,\n async () => {\n const selectedKeys = uniq(\n selectedFlatDataSource.value.map(item => getRowValue(item)).filter(isValid),\n )\n await nextTick()\n for (const item of props.dataSource) {\n const itemKey = getRowValue(item)\n if (isValid(itemKey) && selectedKeys.includes(itemKey)) {\n if (props.mode === 'multiple') {\n elTableRef.value?.toggleRowSelection(item, true, props.ignoreSelectable)\n }\n else {\n syncRadioSelection(item)\n }\n }\n await nextTick()\n prevSelection = elTableRef.value?.getSelectionRows() ?? []\n }\n },\n { immediate: true },\n)\n\nwatch(\n () => [props.modelValue, props.loading],\n async ([value, loading]) => {\n if (loading) {\n return\n }\n if (props.mode === 'single') {\n const selectedKey = getSingleSelectedKey(value)\n radioSelectedKey.value = selectedKey\n const selectedItem = props.dataSource.find(item => getRowValue(item) === selectedKey)\n elTableRef.value?.setCurrentRow(selectedItem)\n }\n else {\n await nextTick()\n const currentDisplayDataKeys = elTableRef.value\n ?.getSelectionRows()\n .map(item => getRowValue(item))\n .filter(isValid) ?? []\n const valueKeys = getMultipleSelectedKeys(value)\n selectedFlatDataSource.value = selectedFlatDataSource.value.filter(\n item => valueKeys.includes(getRowValue(item)),\n )\n if (isEqual(valueKeys, currentDisplayDataKeys)) {\n return\n }\n const diffItems = xor(valueKeys, currentDisplayDataKeys)\n for (const tableItem of props.dataSource) {\n const itemKey = getRowValue(tableItem)\n if (isValid(itemKey) && diffItems.includes(itemKey)) {\n const shouldSelect = valueKeys.includes(itemKey)\n elTableRef.value?.toggleRowSelection(tableItem, shouldSelect, props.ignoreSelectable)\n }\n }\n }\n },\n {\n immediate: true,\n },\n)\n\nfunction onSelect(newSelection: Record<string, any>[]) {\n const rowKey = requireRowKey()\n\n const removedItemList\n = prevSelection.length > newSelection.length\n ? differenceWith(\n prevSelection,\n newSelection,\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n : []\n prevSelection = [...newSelection]\n selectedFlatDataSource.value = uniqWith(\n [...selectedFlatDataSource.value, ...newSelection],\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n if (removedItemList.length > 0) {\n const removedKeys = uniq(removedItemList.map(item => item[rowKey]))\n remove(selectedFlatDataSource.value, item =>\n removedKeys.includes(item[rowKey]))\n }\n\n if (props.optionAsValue) {\n emit('update:modelValue', selectedFlatDataSource.value)\n }\n else {\n const selectedKeys = selectedFlatDataSource.value.map(\n item => item[rowKey],\n )\n emit('update:modelValue', selectedKeys)\n }\n}\n\nfunction onRadioClick(item) {\n const rowKey = requireRowKey()\n syncRadioSelection(item)\n if (props.optionAsValue) {\n emit('update:modelValue', item)\n }\n else {\n emit('update:modelValue', item[rowKey])\n }\n}\n\nfunction onRowClick(row: Record<string, any>, _, event: Event) {\n if (!props.clickRowToSelect)\n return\n\n if (props.mode === 'multiple') {\n const checkboxDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"checkbox\"]')\n if (checkboxDOM instanceof HTMLElement) {\n checkboxDOM.click()\n }\n }\n else {\n const radioDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"radio\"]')\n if (radioDOM instanceof HTMLElement) {\n radioDOM.click()\n }\n }\n}\n\nfunction onClearSelectionClick() {\n if (props.mode === 'multiple') {\n emit('update:modelValue', [])\n selectedFlatDataSource.value = []\n }\n else {\n syncRadioSelection(null)\n emit('update:modelValue', null)\n }\n}\n\nfunction selectable(row: Record<string, any>, index: number) {\n if (props.selectable && isFn(props.selectable)) {\n return props.selectable(row, index, field.value)\n }\n return true\n}\n</script>\n\n<template>\n <div :class=\"`${stylePrefix}-select-table`\">\n <div\n v-if=\"currentSelectLength > 0 && props.showAlertToolbar\"\n :class=\"`${stylePrefix}-select-table-alert-container`\"\n >\n <span>已选择 {{ currentSelectLength }} 项</span>\n <ElLink\n type=\"primary\"\n :underline=\"lt(version, '2.9.9') ? false : 'never'\"\n style=\"margin-left: 8px;\"\n @click=\"onClearSelectionClick\"\n >\n 取消选择\n </ElLink>\n </div>\n <ElTable\n ref=\"elTableRef\"\n v-loading=\"props.loading\"\n v-bind=\"elTableProps\"\n :row-key=\"rowKey\"\n :row-class-name=\"props.clickRowToSelect ? `--click-row-select` : ''\"\n :data=\"props.dataSource\"\n :highlight-current-row=\"props.mode === 'single'\"\n @select=\"onSelect\"\n @select-all=\"onSelect\"\n @row-click=\"onRowClick\"\n >\n <ElTableColumn\n v-if=\"props.mode === 'multiple'\"\n type=\"selection\"\n :selectable=\"selectable\"\n />\n <ElTableColumn\n v-else\n width=\"46\"\n >\n <template #default=\"{ row }\">\n <ElRadioGroup v-model=\"radioSelectedKey\" style=\"width: 100%;\">\n <ElRadio\n v-bind=\"compatibleRadioValue(row[rowKey])\"\n @change=\"() => onRadioClick(row)\"\n >\n &nbsp;\n </ElRadio>\n </ElRadioGroup>\n </template>\n </ElTableColumn>\n <template v-if=\"props.columns.length === 0\">\n <slot />\n </template>\n <template v-else>\n <ElTableColumn\n v-for=\"colItem of props.columns\"\n v-bind=\"colItem\"\n :key=\"colItem.prop || colItem.type\"\n />\n </template>\n </ElTable>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBA,MAAM,QAAQ;EAYd,MAAM,OAAO;EAEb,MAAM,eAAe,UAAS;EAC9B,MAAM,QAAQ,UAAS;EACvB,MAAM,aAAa,KAAmB;EACtC,MAAM,mBAAmB,KAAI;EAE7B,SAAS,gBAAgB;AACvB,OAAI,CAAC,MAAM,OACT,OAAM,IAAI,MAAM,qBAAoB;AAEtC,UAAO,MAAM;;EAGf,SAAS,YAAY,MAAmC;AACtD,OAAI,CAAC,MAAM,UAAU,CAAC,KACpB;AAEF,UAAO,KAAK,MAAM;;EAGpB,SAAS,qBAAqB,OAAY;AACxC,OAAI,CAAC,QAAQ,MAAM,CACjB,QAAO;AAET,UAAO,MAAM,gBAAgB,YAAY,MAAM,IAAI,OAAO;;EAG5D,SAAS,wBAAwB,OAAY;AAC3C,OAAI,CAAC,MAAM,QAAQ,MAAM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;;SAIU,MAAM,QAAQ,WAAM,IAClC,WAAQ,KAAA,QAAA,WAAA,EAAA,KAAA,GAAA,CAAA,IAAA,UAAA,KAAA,EAGR,mBAIE,UAAA,EAAA,KAAA,GAAA,EAAA,WAHkB,MAAM,UAAjB,YAAO;yBADhB,YAIE,MAAA,cAAA,EAJF,WAIE,EAAA,SAAA,MAAA,EAFQ,SAAO,EACd,KAAK,QAAQ,QAAQ,QAAQ,MAAA,CAAA,EAAA,MAAA,GAAA;;;;;;;;2BArCvB,MAAM,QAAO,CAAA,CAAA,CAAA,EAAA,EAAA"}
@@ -1,5 +1,5 @@
1
1
  import { Column } from "element-plus";
2
- import { GeneralField } from "@formily/core";
2
+ import { GeneralField } from "@silver-formily/core";
3
3
 
4
4
  //#region src/select-table/types.d.ts
5
5
  interface ISelectTableProps {
@@ -1 +1 @@
1
- {"version":3,"file":"submit.mjs","names":["$attrs"],"sources":["../../src/submit/submit.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { IFormFeedback } from '@formily/core'\nimport type { PropType } from 'vue'\nimport { useParentForm } from '@silver-formily/vue'\nimport { ElButton } from 'element-plus'\n\ndefineOptions({\n name: 'FSubmit',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n onClick: Function as PropType<(e: MouseEvent) => any>,\n onSubmit: Function as PropType<(values: any) => Promise<any>>,\n onSubmitSuccess: Function as PropType<(payload: any) => void>,\n onSubmitFailed: Function as PropType<(feedbacks: IFormFeedback[]) => void>,\n submit: Boolean,\n loading: Boolean,\n})\n\nconst formRef = useParentForm()\n\nfunction handleClick(e: MouseEvent) {\n if (props.onClick?.(e) === false)\n return\n if (props.onSubmit) {\n const form = formRef?.value\n form?.submit(props.onSubmit)\n .then(props.onSubmitSuccess)\n .catch(props.onSubmitFailed ?? console.error)\n }\n}\n</script>\n\n<template>\n <ElButton\n :native-type=\"props.submit ? 'button' : 'submit'\"\n type=\"primary\"\n v-bind=\"$attrs\"\n :loading=\"formRef?.submitting ?? props.loading\"\n @click=\"handleClick\"\n >\n <template #default>\n <slot />\n </template>\n </ElButton>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAWA,MAAM,QAAQ;EASd,MAAM,UAAU,eAAc;EAE9B,SAAS,YAAY,GAAe;AAClC,OAAI,MAAM,UAAU,EAAE,KAAK,MACzB;AACF,OAAI,MAAM,SAER,EADa,SAAS,QAChB,OAAO,MAAM,SAAQ,CACxB,KAAK,MAAM,gBAAe,CAC1B,MAAM,MAAM,kBAAkB,QAAQ,MAAK;;;uBAMhD,YAUW,MAAA,SAAA,EAVX,WAUW;IATR,eAAa,MAAM,SAAM,WAAA;IAC1B,MAAK;MACGA,KAAAA,QAAM;IACb,SAAS,MAAA,QAAO,EAAE,cAAc,MAAM;IACtC,SAAO;;IAEG,SAAO,cACR,CAAR,WAAQ,KAAA,QAAA,UAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"submit.mjs","names":["$attrs"],"sources":["../../src/submit/submit.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { IFormFeedback } from '@silver-formily/core'\nimport type { PropType } from 'vue'\nimport { useParentForm } from '@silver-formily/vue'\nimport { ElButton } from 'element-plus'\n\ndefineOptions({\n name: 'FSubmit',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n onClick: Function as PropType<(e: MouseEvent) => any>,\n onSubmit: Function as PropType<(values: any) => Promise<any>>,\n onSubmitSuccess: Function as PropType<(payload: any) => void>,\n onSubmitFailed: Function as PropType<(feedbacks: IFormFeedback[]) => void>,\n submit: Boolean,\n loading: Boolean,\n})\n\nconst formRef = useParentForm()\n\nfunction handleClick(e: MouseEvent) {\n if (props.onClick?.(e) === false)\n return\n if (props.onSubmit) {\n const form = formRef?.value\n form?.submit(props.onSubmit)\n .then(props.onSubmitSuccess)\n .catch(props.onSubmitFailed ?? console.error)\n }\n}\n</script>\n\n<template>\n <ElButton\n :native-type=\"props.submit ? 'button' : 'submit'\"\n type=\"primary\"\n v-bind=\"$attrs\"\n :loading=\"formRef?.submitting ?? props.loading\"\n @click=\"handleClick\"\n >\n <template #default>\n <slot />\n </template>\n </ElButton>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAWA,MAAM,QAAQ;EASd,MAAM,UAAU,eAAc;EAE9B,SAAS,YAAY,GAAe;AAClC,OAAI,MAAM,UAAU,EAAE,KAAK,MACzB;AACF,OAAI,MAAM,SAER,EADa,SAAS,QAChB,OAAO,MAAM,SAAQ,CACxB,KAAK,MAAM,gBAAe,CAC1B,MAAM,MAAM,kBAAkB,QAAQ,MAAK;;;uBAMhD,YAUW,MAAA,SAAA,EAVX,WAUW;IATR,eAAa,MAAM,SAAM,WAAA;IAC1B,MAAK;MACGA,KAAAA,QAAM;IACb,SAAS,MAAA,QAAO,EAAE,cAAc,MAAM;IACtC,SAAO;;IAEG,SAAO,cACR,CAAR,WAAQ,KAAA,QAAA,UAAA,CAAA,CAAA"}