@silver-formily/element-plus 3.0.0 → 3.0.1

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 (137) hide show
  1. package/README.en-US.md +32 -32
  2. package/README.md +32 -32
  3. package/esm/__builtins__/configs/index.mjs.map +1 -1
  4. package/esm/__builtins__/index.mjs +18 -18
  5. package/esm/__builtins__/shared/loading.mjs.map +1 -1
  6. package/esm/__builtins__/shared/simple-version-compare.mjs.map +1 -1
  7. package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
  8. package/esm/__builtins__/shared/use-enter-submit.mjs.map +1 -1
  9. package/esm/__builtins__/shared/utils.mjs.map +1 -1
  10. package/esm/array-base/index.mjs +63 -59
  11. package/esm/array-base/index.mjs.map +1 -1
  12. package/esm/array-base/symbols.mjs.map +1 -1
  13. package/esm/array-base/utils.mjs +37 -31
  14. package/esm/array-base/utils.mjs.map +1 -1
  15. package/esm/array-cards/index.mjs +36 -33
  16. package/esm/array-cards/index.mjs.map +1 -1
  17. package/esm/array-collapse/index.mjs +39 -37
  18. package/esm/array-collapse/index.mjs.map +1 -1
  19. package/esm/array-collapse/utils.mjs +9 -2
  20. package/esm/array-collapse/utils.mjs.map +1 -1
  21. package/esm/array-items/index.mjs +38 -34
  22. package/esm/array-items/index.mjs.map +1 -1
  23. package/esm/array-list-tabs/index.mjs +38 -36
  24. package/esm/array-list-tabs/index.mjs.map +1 -1
  25. package/esm/array-list-tabs/utils.mjs +12 -5
  26. package/esm/array-list-tabs/utils.mjs.map +1 -1
  27. package/esm/array-table/index.mjs +62 -60
  28. package/esm/array-table/index.mjs.map +1 -1
  29. package/esm/array-table/utils.mjs +18 -11
  30. package/esm/array-table/utils.mjs.map +1 -1
  31. package/esm/array-tabs/index.mjs +28 -25
  32. package/esm/array-tabs/index.mjs.map +1 -1
  33. package/esm/autocomplete/index.mjs +22 -18
  34. package/esm/autocomplete/index.mjs.map +1 -1
  35. package/esm/cascader/index.mjs +22 -18
  36. package/esm/cascader/index.mjs.map +1 -1
  37. package/esm/checkbox/index.mjs +20 -16
  38. package/esm/checkbox/index.mjs.map +1 -1
  39. package/esm/color-picker/index.mjs +9 -6
  40. package/esm/color-picker/index.mjs.map +1 -1
  41. package/esm/color-picker-panel/index.mjs +9 -6
  42. package/esm/color-picker-panel/index.mjs.map +1 -1
  43. package/esm/date-picker/index.mjs +14 -11
  44. package/esm/date-picker/index.mjs.map +1 -1
  45. package/esm/date-picker/utils.mjs.map +1 -1
  46. package/esm/date-picker-panel/index.mjs +14 -11
  47. package/esm/date-picker-panel/index.mjs.map +1 -1
  48. package/esm/editable/index.mjs +33 -30
  49. package/esm/editable/index.mjs.map +1 -1
  50. package/esm/form/form.mjs +6 -6
  51. package/esm/form/form.mjs.map +1 -1
  52. package/esm/form-button-group/index.mjs +18 -14
  53. package/esm/form-button-group/index.mjs.map +1 -1
  54. package/esm/form-button-group/utils.mjs +9 -2
  55. package/esm/form-button-group/utils.mjs.map +1 -1
  56. package/esm/form-collapse/index.mjs +21 -18
  57. package/esm/form-collapse/index.mjs.map +1 -1
  58. package/esm/form-collapse/utils.mjs.map +1 -1
  59. package/esm/form-dialog/index.d.ts +1 -1
  60. package/esm/form-dialog/index.mjs +22 -22
  61. package/esm/form-dialog/index.mjs.map +1 -1
  62. package/esm/form-dialog/types.d.ts +13 -5
  63. package/esm/form-drawer/index.d.ts +1 -1
  64. package/esm/form-drawer/index.mjs +21 -21
  65. package/esm/form-drawer/index.mjs.map +1 -1
  66. package/esm/form-drawer/types.d.ts +13 -5
  67. package/esm/form-grid/hooks.mjs.map +1 -1
  68. package/esm/form-grid/index.mjs +21 -18
  69. package/esm/form-grid/index.mjs.map +1 -1
  70. package/esm/form-item/index.mjs +55 -53
  71. package/esm/form-item/index.mjs.map +1 -1
  72. package/esm/form-item/utils.mjs.map +1 -1
  73. package/esm/form-layout/form-layout.mjs +14 -10
  74. package/esm/form-layout/form-layout.mjs.map +1 -1
  75. package/esm/form-layout/utils.mjs.map +1 -1
  76. package/esm/form-step/index.mjs +30 -27
  77. package/esm/form-step/index.mjs.map +1 -1
  78. package/esm/form-step/utils.mjs.map +1 -1
  79. package/esm/form-tab/hooks.mjs.map +1 -1
  80. package/esm/form-tab/index.mjs +25 -23
  81. package/esm/form-tab/index.mjs.map +1 -1
  82. package/esm/form-tab/utils.mjs.map +1 -1
  83. package/esm/index.mjs +72 -72
  84. package/esm/input/index.mjs +30 -26
  85. package/esm/input/index.mjs.map +1 -1
  86. package/esm/input-number/index.mjs +11 -8
  87. package/esm/input-number/index.mjs.map +1 -1
  88. package/esm/input-tag/index.mjs +20 -16
  89. package/esm/input-tag/index.mjs.map +1 -1
  90. package/esm/mention/index.mjs +24 -20
  91. package/esm/mention/index.mjs.map +1 -1
  92. package/esm/pagination/components/jumper.mjs.map +1 -1
  93. package/esm/pagination/components/next.mjs.map +1 -1
  94. package/esm/pagination/components/pager.mjs.map +1 -1
  95. package/esm/pagination/components/prev.mjs.map +1 -1
  96. package/esm/pagination/components/total.mjs.map +1 -1
  97. package/esm/pagination/pagination.mjs.map +1 -1
  98. package/esm/password/index.mjs.map +1 -1
  99. package/esm/preview-text/index.mjs +31 -27
  100. package/esm/preview-text/index.mjs.map +1 -1
  101. package/esm/preview-text/utils.mjs.map +1 -1
  102. package/esm/query-form/default-components.mjs.map +1 -1
  103. package/esm/query-form/hooks.mjs.map +1 -1
  104. package/esm/query-form/index.mjs +51 -48
  105. package/esm/query-form/index.mjs.map +1 -1
  106. package/esm/query-form-item/index.mjs +37 -34
  107. package/esm/query-form-item/index.mjs.map +1 -1
  108. package/esm/radio/index.mjs +29 -25
  109. package/esm/radio/index.mjs.map +1 -1
  110. package/esm/rate/index.mjs +13 -10
  111. package/esm/rate/index.mjs.map +1 -1
  112. package/esm/reset/index.mjs.map +1 -1
  113. package/esm/segmented/index.mjs +16 -12
  114. package/esm/segmented/index.mjs.map +1 -1
  115. package/esm/select/index.mjs +26 -22
  116. package/esm/select/index.mjs.map +1 -1
  117. package/esm/select-table/index.mjs +16 -12
  118. package/esm/select-table/index.mjs.map +1 -1
  119. package/esm/shared/overlay-elements.mjs.map +1 -1
  120. package/esm/slider/index.mjs +13 -10
  121. package/esm/slider/index.mjs.map +1 -1
  122. package/esm/submit/index.mjs.map +1 -1
  123. package/esm/switch/index.mjs.map +1 -1
  124. package/esm/time-picker/index.mjs +9 -6
  125. package/esm/time-picker/index.mjs.map +1 -1
  126. package/esm/time-select/index.mjs +9 -6
  127. package/esm/time-select/index.mjs.map +1 -1
  128. package/esm/transfer/index.mjs.map +1 -1
  129. package/esm/tree/index.mjs +33 -29
  130. package/esm/tree/index.mjs.map +1 -1
  131. package/esm/tree/utils.mjs.map +1 -1
  132. package/esm/tree-select/index.mjs +18 -14
  133. package/esm/tree-select/index.mjs.map +1 -1
  134. package/esm/upload/index.mjs +10 -7
  135. package/esm/upload/index.mjs.map +1 -1
  136. package/esm/vendor/sizes.mjs.map +1 -1
  137. package/package.json +6 -5
@@ -1,11 +1,15 @@
1
1
  import { useField as S, connect as b, mapProps as P } from "@silver-formily/vue";
2
- import { PreviewText as h } from "../preview-text/index.mjs";
3
- import { defineComponent as C, useSlots as E, openBlock as s, createBlock as f, unref as e, normalizeProps as K, guardReactiveProps as _, createSlots as B, withCtx as t, createElementBlock as u, Fragment as m, renderList as y, mergeProps as d, renderSlot as n, createCommentVNode as c } from "vue";
4
- import { ElSelect as F, ElOptionGroup as R, ElOption as k } from "element-plus";
5
- import { o as w } from "../vendor/lodash.mjs";
2
+ import { ElSelect as h, ElOptionGroup as C, ElOption as y } from "element-plus";
3
+ import "@formily/reactive";
4
+ import "@vueuse/core";
5
+ import { defineComponent as E, useSlots as K, openBlock as s, createBlock as p, unref as e, normalizeProps as _, guardReactiveProps as B, createSlots as F, withCtx as t, createElementBlock as m, Fragment as u, renderList as c, mergeProps as d, renderSlot as n, createCommentVNode as k } from "vue";
6
+ import { mapReadPretty as R } from "../__builtins__/shared/transform-component.mjs";
7
+ import { PreviewText as w } from "../preview-text/index.mjs";
8
+ import "@formily/core";
9
+ import "@silver-formily/reactive-vue";
6
10
  import { useCleanAttrs as A } from "../__builtins__/shared/utils.mjs";
7
- import { mapReadPretty as G } from "../__builtins__/shared/transform-component.mjs";
8
- const O = /* @__PURE__ */ C({
11
+ import { o as G } from "../vendor/lodash.mjs";
12
+ const O = /* @__PURE__ */ E({
9
13
  name: "FSelect",
10
14
  inheritAttrs: !1,
11
15
  __name: "select",
@@ -13,34 +17,34 @@ const O = /* @__PURE__ */ C({
13
17
  options: {}
14
18
  },
15
19
  setup(v) {
16
- const g = v, l = E(), { props: i } = A(), p = S();
20
+ const g = v, l = K(), { props: i } = A(), f = S();
17
21
  function $(o) {
18
22
  return o.options !== void 0;
19
23
  }
20
- return (o, z) => (s(), f(e(F), K(_(e(i))), B({
24
+ return (o, z) => (s(), p(e(h), _(B(e(i))), F({
21
25
  default: t(() => [
22
- (s(!0), u(m, null, y(g.options, (r) => (s(), u(m, null, [
23
- $(r) ? (s(), f(e(R), d({
26
+ (s(!0), m(u, null, c(g.options, (r) => (s(), m(u, null, [
27
+ $(r) ? (s(), p(e(C), d({
24
28
  key: 0,
25
29
  ref_for: !0
26
- }, e(w)(r, "options"), {
30
+ }, e(G)(r, "options"), {
27
31
  key: r.label
28
32
  }), {
29
33
  default: t(() => [
30
- (s(!0), u(m, null, y(r.options, (a) => (s(), f(e(k), d({
34
+ (s(!0), m(u, null, c(r.options, (a) => (s(), p(e(y), d({
31
35
  key: e(i).valueKey ? a[e(i).valueKey] : a.label
32
36
  }, { ref_for: !0 }, a), {
33
37
  default: t(() => [
34
38
  l.option ? n(o.$slots, "option", {
35
39
  key: 0,
36
40
  option: a
37
- }) : c("", !0)
41
+ }) : k("", !0)
38
42
  ]),
39
43
  _: 2
40
44
  }, 1040))), 128))
41
45
  ]),
42
46
  _: 2
43
- }, 1040)) : (s(), f(e(k), d({
47
+ }, 1040)) : (s(), p(e(y), d({
44
48
  key: 1,
45
49
  ref_for: !0
46
50
  }, r, {
@@ -50,7 +54,7 @@ const O = /* @__PURE__ */ C({
50
54
  l.option ? n(o.$slots, "option", {
51
55
  key: 0,
52
56
  option: r
53
- }) : c("", !0)
57
+ }) : k("", !0)
54
58
  ]),
55
59
  _: 2
56
60
  }, 1040))
@@ -61,14 +65,14 @@ const O = /* @__PURE__ */ C({
61
65
  l.header ? {
62
66
  name: "header",
63
67
  fn: t(() => [
64
- n(o.$slots, "header", { field: e(p) })
68
+ n(o.$slots, "header", { field: e(f) })
65
69
  ]),
66
70
  key: "0"
67
71
  } : void 0,
68
72
  l.footer ? {
69
73
  name: "footer",
70
74
  fn: t(() => [
71
- n(o.$slots, "footer", { field: e(p) })
75
+ n(o.$slots, "footer", { field: e(f) })
72
76
  ]),
73
77
  key: "1"
74
78
  } : void 0,
@@ -89,7 +93,7 @@ const O = /* @__PURE__ */ C({
89
93
  l.tag ? {
90
94
  name: "tag",
91
95
  fn: t(() => [
92
- n(o.$slots, "tag", { field: e(p) })
96
+ n(o.$slots, "tag", { field: e(f) })
93
97
  ]),
94
98
  key: "4"
95
99
  } : void 0,
@@ -112,13 +116,13 @@ const O = /* @__PURE__ */ C({
112
116
  } : void 0
113
117
  ]), 1040));
114
118
  }
115
- }), H = b(
119
+ }), Q = b(
116
120
  O,
117
121
  P({ dataSource: "options", loading: !0, disabled: !0 }),
118
- G(h.Select)
122
+ R(w.Select)
119
123
  );
120
124
  export {
121
- H as Select,
122
- H as default
125
+ Q as Select,
126
+ Q as default
123
127
  };
124
128
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/select/select.vue","../../src/select/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport { useField } from '@silver-formily/vue'\r\nimport { ElOption, ElOptionGroup, ElSelect } from 'element-plus'\r\nimport { omit } from 'lodash-es'\r\nimport { useCleanAttrs } from '../__builtins__'\r\n\r\ndefineOptions({\r\n name: 'FSelect',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = defineProps<{\r\n options?: Array<OptionType | OptionGroupType>\r\n}>()\r\n\r\nconst slots = defineSlots<{\r\n option?: (props: { option: OptionType }) => any\r\n header?: () => any\r\n footer?: () => any\r\n prefix?: () => any\r\n empty?: () => any\r\n tag?: () => any\r\n loading?: () => any\r\n label?: () => any\r\n}>()\r\n\r\ntype OptionType = InstanceType<typeof ElOption>['$props']\r\ntype OptionGroupType = InstanceType<typeof ElOptionGroup>['$props'] & {\r\n options: OptionType[]\r\n}\r\n\r\nconst { props: selectProps } = useCleanAttrs()\r\n\r\nconst fieldRef = useField()\r\n\r\nfunction isGroup(option: OptionType | OptionGroupType): option is OptionGroupType {\r\n return (option as OptionGroupType).options !== undefined\r\n}\r\n</script>\r\n\r\n<template>\r\n <ElSelect v-bind=\"selectProps\">\r\n <template v-for=\"option of props.options\">\r\n <template v-if=\"isGroup(option)\">\r\n <ElOptionGroup v-bind=\"omit(option, 'options')\" :key=\"option.label\">\r\n <ElOption v-for=\"i of option.options\" :key=\"selectProps.valueKey ? i[selectProps.valueKey] : i.label\" v-bind=\"i\">\r\n <slot v-if=\"slots.option\" name=\"option\" :option=\"i\" />\r\n </ElOption>\r\n </ElOptionGroup>\r\n </template>\r\n <ElOption v-else v-bind=\"option\" :key=\"selectProps.valueKey ? option[selectProps.valueKey] : option.label\">\r\n <slot v-if=\"slots.option\" name=\"option\" :option=\"option\" />\r\n </ElOption>\r\n </template>\r\n <template v-if=\"slots.header\" #header>\r\n <slot name=\"header\" :field=\"fieldRef\" />\r\n </template>\r\n <template v-if=\"slots.footer\" #footer>\r\n <slot name=\"footer\" :field=\"fieldRef\" />\r\n </template>\r\n <template v-if=\"slots.prefix\" #prefix>\r\n <slot name=\"prefix\" />\r\n </template>\r\n <template v-if=\"slots.empty\" #empty>\r\n <slot name=\"empty\" />\r\n </template>\r\n <template v-if=\"slots.tag\" #tag>\r\n <slot name=\"tag\" :field=\"fieldRef\" />\r\n </template>\r\n <template v-if=\"slots.loading\" #loading>\r\n <slot name=\"loading\" />\r\n </template>\r\n <template v-if=\"slots.label\" #label=\"{ label, value: labelValue }\">\r\n <slot name=\"label\" :label=\"label\" :value=\"labelValue\" />\r\n </template>\r\n </ElSelect>\r\n</template>\r\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\nimport FSelect from './select.vue'\r\n\r\nexport const Select = connect<typeof FSelect>(\r\n FSelect,\r\n mapProps({ dataSource: 'options', loading: true, disabled: true }),\r\n mapReadPretty(PreviewText.Select),\r\n)\r\n\r\nexport default Select\r\n"],"names":["props","__props","slots","_useSlots","selectProps","useCleanAttrs","fieldRef","useField","isGroup","option","_openBlock","_createBlock","_unref","_createSlots","_createElementBlock","_Fragment","_renderList","_mergeProps","omit","i","_renderSlot","_ctx","label","labelValue","Select","connect","FSelect","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;;;;;;;;;AAWA,UAAMA,IAAQC,GAIRC,IAAQC,EAAA,GAgBR,EAAE,OAAOC,EAAA,IAAgBC,EAAA,GAEzBC,IAAWC,EAAA;AAEjB,aAASC,EAAQC,GAAiE;AAChF,aAAQA,EAA2B,YAAY;AAAA,IACjD;sBAIEC,EAAA,GAAAC,EAkCWC,UAlCOA,EAAAR,CAAA,CAAW,CAAA,GAAAS,EAAA;AAAA,iBACjB,MAA+B;AAAA,SAAzCH,EAAA,EAAA,GAAAI,EAWWC,GAAA,MAAAC,EAXgBhB,EAAM,UAAhBS;UACCD,EAAQC,CAAM,KAC5BC,EAAA,GAAAC,EAIgBC,MAJhBK,EAIgB;AAAA;;aAJOL,EAAAM,CAAA,EAAKT,GAAM,SAAA,GAAA;AAAA,YAAe,KAAKA,EAAO;AAAA,UAAA;uBACjD,MAA2B;AAAA,eAArCC,EAAA,EAAA,GAAAI,EAEWC,GAAA,MAAAC,EAFWP,EAAO,UAAZU,OAAjBT,KAAAC,EAEWC,MAFXK,EAEW;AAAA,gBAF4B,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EAAM;cAAQ;AAAA,cAC5B,CAAwD,EADnB,OAAAoB,GAAK,OAASC,QAAU;AAAA,UAC7DH,EAAwDC,EAAA,QAAA,SAAA;AAAA,YAApC,OAAAC;AAAA,YAAe,OAAOC;AAAA,UAAA;;;;;;ICpEnCC,IAASC;AAAA,EACpBC;AAAAA,EACAC,EAAS,EAAE,YAAY,WAAW,SAAS,IAAM,UAAU,IAAM;AAAA,EACjEC,EAAcC,EAAY,MAAM;AAClC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/select/select.vue","../../src/select/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useField } from '@silver-formily/vue'\nimport { ElOption, ElOptionGroup, ElSelect } from 'element-plus'\nimport { omit } from 'lodash-es'\nimport { useCleanAttrs } from '../__builtins__'\n\ndefineOptions({\n name: 'FSelect',\n inheritAttrs: false,\n})\n\nconst props = defineProps<{\n options?: Array<OptionType | OptionGroupType>\n}>()\n\nconst slots = defineSlots<{\n option?: (props: { option: OptionType }) => any\n header?: () => any\n footer?: () => any\n prefix?: () => any\n empty?: () => any\n tag?: () => any\n loading?: () => any\n label?: () => any\n}>()\n\ntype OptionType = InstanceType<typeof ElOption>['$props']\ntype OptionGroupType = InstanceType<typeof ElOptionGroup>['$props'] & {\n options: OptionType[]\n}\n\nconst { props: selectProps } = useCleanAttrs()\n\nconst fieldRef = useField()\n\nfunction isGroup(option: OptionType | OptionGroupType): option is OptionGroupType {\n return (option as OptionGroupType).options !== undefined\n}\n</script>\n\n<template>\n <ElSelect v-bind=\"selectProps\">\n <template v-for=\"option of props.options\">\n <template v-if=\"isGroup(option)\">\n <ElOptionGroup v-bind=\"omit(option, 'options')\" :key=\"option.label\">\n <ElOption v-for=\"i of option.options\" :key=\"selectProps.valueKey ? i[selectProps.valueKey] : i.label\" v-bind=\"i\">\n <slot v-if=\"slots.option\" name=\"option\" :option=\"i\" />\n </ElOption>\n </ElOptionGroup>\n </template>\n <ElOption v-else v-bind=\"option\" :key=\"selectProps.valueKey ? option[selectProps.valueKey] : option.label\">\n <slot v-if=\"slots.option\" name=\"option\" :option=\"option\" />\n </ElOption>\n </template>\n <template v-if=\"slots.header\" #header>\n <slot name=\"header\" :field=\"fieldRef\" />\n </template>\n <template v-if=\"slots.footer\" #footer>\n <slot name=\"footer\" :field=\"fieldRef\" />\n </template>\n <template v-if=\"slots.prefix\" #prefix>\n <slot name=\"prefix\" />\n </template>\n <template v-if=\"slots.empty\" #empty>\n <slot name=\"empty\" />\n </template>\n <template v-if=\"slots.tag\" #tag>\n <slot name=\"tag\" :field=\"fieldRef\" />\n </template>\n <template v-if=\"slots.loading\" #loading>\n <slot name=\"loading\" />\n </template>\n <template v-if=\"slots.label\" #label=\"{ label, value: labelValue }\">\n <slot name=\"label\" :label=\"label\" :value=\"labelValue\" />\n </template>\n </ElSelect>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport FSelect from './select.vue'\n\nexport const Select = connect<typeof FSelect>(\n FSelect,\n mapProps({ dataSource: 'options', loading: true, disabled: true }),\n mapReadPretty(PreviewText.Select),\n)\n\nexport default Select\n"],"names":["props","__props","slots","_useSlots","selectProps","useCleanAttrs","fieldRef","useField","isGroup","option","_openBlock","_createBlock","_unref","_createSlots","_createElementBlock","_Fragment","_renderList","_mergeProps","omit","i","_renderSlot","_ctx","label","labelValue","Select","connect","FSelect","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA,UAAMA,IAAQC,GAIRC,IAAQC,EAAA,GAgBR,EAAE,OAAOC,EAAA,IAAgBC,EAAA,GAEzBC,IAAWC,EAAA;AAEjB,aAASC,EAAQC,GAAiE;AAChF,aAAQA,EAA2B,YAAY;AAAA,IACjD;sBAIEC,EAAA,GAAAC,EAkCWC,UAlCOA,EAAAR,CAAA,CAAW,CAAA,GAAAS,EAAA;AAAA,iBACjB,MAA+B;AAAA,SAAzCH,EAAA,EAAA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AAA;;;MAERnB,EAAM;cAAQ;AAAA,cAC5B,MAAqB;AAAA,UAArBkB,EAAqBC,EAAA,QAAA,OAAA;AAAA,QAAA;;;MAEPnB,EAAM;cAAM;AAAA,cAC1B,MAAqC;AAAA,UAArCkB,EAAqCC,EAAA,QAAA,OAAA,EAAnB,OAAOT,EAAAN,CAAA,EAAA,CAAQ;AAAA,QAAA;;;MAEnBJ,EAAM;cAAU;AAAA,cAC9B,MAAuB;AAAA,UAAvBkB,EAAuBC,EAAA,QAAA,SAAA;AAAA,QAAA;;;MAETnB,EAAM;cAAQ;AAAA,cAC5B,CAAwD,EADnB,OAAAoB,GAAK,OAASC,QAAU;AAAA,UAC7DH,EAAwDC,EAAA,QAAA,SAAA;AAAA,YAApC,OAAAC;AAAA,YAAe,OAAOC;AAAA,UAAA;;;;;;ICpEnCC,IAASC;AAAA,EACpBC;AAAAA,EACAC,EAAS,EAAE,YAAY,WAAW,SAAS,IAAM,UAAU,IAAM;AAAA,EACjEC,EAAcC,EAAY,MAAM;AAClC;"}
@@ -2,9 +2,13 @@ import { useField as W, connect as z, mapProps as G } from "@silver-formily/vue"
2
2
  import { defineComponent as U, ref as g, computed as j, watch as R, nextTick as v, openBlock as s, createElementBlock as S, normalizeClass as A, unref as n, createElementVNode as J, toDisplayString as Q, createVNode as V, withCtx as f, createTextVNode as C, createCommentVNode as X, withDirectives as Y, createBlock as y, mergeProps as w, renderSlot as Z, Fragment as ee, renderList as le } from "vue";
3
3
  import { isValid as te, isEqual as oe, isFn as ae } from "@formily/shared";
4
4
  import { useAttrs as re, ElLink as ne, version as E, ElTable as ue, ElTableColumn as b, ElRadioGroup as ie, ElRadio as se, vLoading as ce } from "element-plus";
5
- import { u as x, x as de, d as me, a as fe, r as pe } from "../vendor/lodash.mjs";
6
- import { stylePrefix as K } from "../__builtins__/configs/index.mjs";
7
- import { lt as L } from "../__builtins__/shared/simple-version-compare.mjs";
5
+ import { stylePrefix as x } from "../__builtins__/configs/index.mjs";
6
+ import "@formily/reactive";
7
+ import "@vueuse/core";
8
+ import { lt as K } from "../__builtins__/shared/simple-version-compare.mjs";
9
+ import "@formily/core";
10
+ import "@silver-formily/reactive-vue";
11
+ import { u as L, x as de, d as me, a as fe, r as pe } from "../vendor/lodash.mjs";
8
12
  import '../styles/select-table/index.css';const ye = /* @__PURE__ */ U({
9
13
  name: "FSelectTable",
10
14
  inheritAttrs: !1,
@@ -28,7 +32,7 @@ import '../styles/select-table/index.css';const ye = /* @__PURE__ */ U({
28
32
  setup(B, { emit: D }) {
29
33
  const e = B, c = D, _ = re(), q = W();
30
34
  function F(l) {
31
- return L(E, "2.6.0") ? { label: l } : { value: l };
35
+ return K(E, "2.6.0") ? { label: l } : { value: l };
32
36
  }
33
37
  const d = g(), t = e.rowKey;
34
38
  function M() {
@@ -42,7 +46,7 @@ import '../styles/select-table/index.css';const ye = /* @__PURE__ */ U({
42
46
  R(
43
47
  () => e.dataSource,
44
48
  async () => {
45
- const l = x(
49
+ const l = L(
46
50
  u.value.map((a) => a[t])
47
51
  );
48
52
  await v();
@@ -87,7 +91,7 @@ import '../styles/select-table/index.css';const ye = /* @__PURE__ */ U({
87
91
  [...u.value, ...l],
88
92
  (r, o) => r[t] === o[t]
89
93
  ), a.length > 0) {
90
- const r = x(a.map((o) => o[t]));
94
+ const r = L(a.map((o) => o[t]));
91
95
  pe(u.value, (o) => r.includes(o[t]));
92
96
  }
93
97
  if (e.optionAsValue)
@@ -119,16 +123,16 @@ import '../styles/select-table/index.css';const ye = /* @__PURE__ */ U({
119
123
  return e.selectable && ae(e.selectable) ? e.selectable(l, a, q.value) : !0;
120
124
  }
121
125
  return (l, a) => (s(), S("div", {
122
- class: A(`${n(K)}-select-table`)
126
+ class: A(`${n(x)}-select-table`)
123
127
  }, [
124
128
  k.value > 0 && e.showAlertToolbar ? (s(), S("div", {
125
129
  key: 0,
126
- class: A(`${n(K)}-select-table-alert-container`)
130
+ class: A(`${n(x)}-select-table-alert-container`)
127
131
  }, [
128
132
  J("span", null, "已选择 " + Q(k.value) + " 项", 1),
129
133
  V(n(ne), {
130
134
  type: "primary",
131
- underline: n(L)(n(E), "2.9.9") ? !1 : "never",
135
+ underline: n(K)(n(E), "2.9.9") ? !1 : "never",
132
136
  style: { "margin-left": "8px" },
133
137
  onClick: $
134
138
  }, {
@@ -190,12 +194,12 @@ import '../styles/select-table/index.css';const ye = /* @__PURE__ */ U({
190
194
  ])
191
195
  ], 2));
192
196
  }
193
- }), he = z(
197
+ }), Ce = z(
194
198
  ye,
195
199
  G({ dataSource: "dataSource", loading: "loading" })
196
200
  );
197
201
  export {
198
- he as SelectTable,
199
- he as default
202
+ Ce as SelectTable,
203
+ Ce as default
200
204
  };
201
205
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/select-table/select-table.vue","../../src/select-table/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { TableInstance } from 'element-plus'\r\nimport type { ISelectTableProps } from './types'\r\nimport { isEqual, isFn, isValid } from '@formily/shared'\r\nimport { useField } from '@silver-formily/vue'\r\nimport {\r\n ElLink,\r\n ElRadio,\r\n ElRadioGroup,\r\n ElTable,\r\n ElTableColumn,\r\n useAttrs,\r\n version,\r\n vLoading,\r\n} from 'element-plus'\r\nimport { differenceWith, remove, uniq, uniqWith, xor } from 'lodash-es'\r\nimport { computed, nextTick, ref, watch } from 'vue'\r\nimport { lt, stylePrefix } from '../__builtins__'\r\n\r\ndefineOptions({\r\n name: 'FSelectTable',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = withDefaults(defineProps<ISelectTableProps>(), {\r\n columns: () => [],\r\n mode: 'multiple',\r\n dataSource: () => [],\r\n optionAsValue: false,\r\n valueType: 'all',\r\n loading: false,\r\n clickRowToSelect: true,\r\n showAlertToolbar: true,\r\n ignoreSelectable: true,\r\n})\r\n\r\nconst emit = defineEmits(['update:modelValue'])\r\n\r\nconst elTableProps = useAttrs()\r\nconst field = useField()\r\n\r\nfunction compatibleRadioValue(key: string) {\r\n return lt(version, '2.6.0') ? { label: key } : { value: key }\r\n}\r\n\r\nconst elTableRef = ref<TableInstance>()\r\nconst rowKey = props.rowKey\r\nfunction getInitialSelectedList() {\r\n if (props.mode === 'multiple') {\r\n return props.modelValue?.map((item) => {\r\n if (!props.optionAsValue) {\r\n return {\r\n [rowKey]: item,\r\n }\r\n }\r\n return item\r\n }) ?? []\r\n }\r\n else {\r\n return props.optionAsValue ? [props.modelValue] : [{ [rowKey]: props.modelValue }]\r\n }\r\n}\r\nconst initialSelectedList = getInitialSelectedList()\r\nconst selectedFlatDataSource = ref(initialSelectedList)\r\n// 为了获取移除的项而缓存的当前页面的前一次选择。由于element-plus没有获取移除项的方法,需要通过这种方式移除field中移除的项\r\nlet prevSelection = []\r\n\r\nconst radioSelectedKey = ref()\r\n\r\nconst currentSelectLength = computed(() => {\r\n if (props.mode === 'multiple') {\r\n return Array.isArray(props.modelValue) ? props.modelValue.length : 0\r\n }\r\n else {\r\n return isValid(radioSelectedKey.value) ? 1 : 0\r\n }\r\n})\r\n\r\nwatch(\r\n () => props.dataSource,\r\n async () => {\r\n const selectedKeys = uniq(\r\n selectedFlatDataSource.value.map(item => item[rowKey]),\r\n )\r\n await nextTick()\r\n for (const item of props.dataSource) {\r\n if (selectedKeys.includes(item[rowKey])) {\r\n if (props.mode === 'multiple') {\r\n elTableRef.value?.toggleRowSelection(item, true, props.ignoreSelectable)\r\n }\r\n else {\r\n elTableRef.value?.setCurrentRow(item)\r\n onRadioClick(item)\r\n }\r\n }\r\n await nextTick()\r\n prevSelection = elTableRef.value?.getSelectionRows()\r\n }\r\n },\r\n { immediate: true },\r\n)\r\n\r\nwatch(\r\n () => [props.modelValue, props.loading],\r\n async ([value, loading]) => {\r\n if (loading) {\r\n return\r\n }\r\n if (props.mode === 'single') {\r\n radioSelectedKey.value = props.optionAsValue ? value[rowKey] : value\r\n }\r\n else {\r\n await nextTick()\r\n const currentDisplayDataKeys = elTableRef.value\r\n ?.getSelectionRows()\r\n .map(item => item[rowKey])\r\n const valueKeys = props.optionAsValue\r\n ? value?.map(item => item[rowKey])\r\n : value ?? []\r\n selectedFlatDataSource.value = selectedFlatDataSource.value.filter(\r\n item => valueKeys.includes(item[rowKey]),\r\n )\r\n if (isEqual(valueKeys, currentDisplayDataKeys)) {\r\n return\r\n }\r\n const diffItems = xor(valueKeys, currentDisplayDataKeys)\r\n for (const tableItem of props.dataSource) {\r\n if (diffItems.includes(tableItem[rowKey])) {\r\n const shouldSelect = valueKeys.includes(tableItem[rowKey])\r\n elTableRef.value.toggleRowSelection(tableItem, shouldSelect, props.ignoreSelectable)\r\n }\r\n }\r\n }\r\n },\r\n {\r\n immediate: true,\r\n },\r\n)\r\n\r\nfunction onSelect(newSelection: Record<string, any>[]) {\r\n /* istanbul ignore if -- @preserve */\r\n if (!rowKey) {\r\n throw new Error('rowKey is required')\r\n }\r\n\r\n const removedItemList\r\n = prevSelection.length > newSelection.length\r\n ? differenceWith(\r\n prevSelection,\r\n newSelection,\r\n (itemPrev, itemNext) => {\r\n return itemPrev[rowKey] === itemNext[rowKey]\r\n },\r\n )\r\n : []\r\n prevSelection = [...newSelection]\r\n selectedFlatDataSource.value = uniqWith(\r\n [...selectedFlatDataSource.value, ...newSelection],\r\n (itemPrev, itemNext) => {\r\n return itemPrev[rowKey] === itemNext[rowKey]\r\n },\r\n )\r\n if (removedItemList.length > 0) {\r\n const removedKeys = uniq(removedItemList.map(item => item[rowKey]))\r\n remove(selectedFlatDataSource.value, item =>\r\n removedKeys.includes(item[rowKey]))\r\n }\r\n\r\n if (props.optionAsValue) {\r\n emit('update:modelValue', selectedFlatDataSource.value)\r\n }\r\n else {\r\n const selectedKeys = selectedFlatDataSource.value.map(\r\n item => item[rowKey],\r\n )\r\n emit('update:modelValue', selectedKeys)\r\n }\r\n}\r\n\r\nfunction onRadioClick(item) {\r\n radioSelectedKey.value = item[rowKey]\r\n if (props.optionAsValue) {\r\n emit('update:modelValue', item)\r\n }\r\n else {\r\n emit('update:modelValue', item[rowKey])\r\n }\r\n}\r\n\r\nfunction onRowClick(row: Record<string, any>, _, event: Event) {\r\n if (!props.clickRowToSelect)\r\n return\r\n\r\n if (props.mode === 'multiple') {\r\n const checkboxDOM = (event.target as Element)\r\n .closest('tr')\r\n .querySelector('input[type=\"checkbox\"]')\r\n if (checkboxDOM instanceof HTMLElement) {\r\n checkboxDOM.click()\r\n }\r\n }\r\n else {\r\n const radioDOM = (event.target as Element)\r\n .closest('tr')\r\n .querySelector('input[type=\"radio\"]')\r\n if (radioDOM instanceof HTMLElement) {\r\n radioDOM.click()\r\n }\r\n }\r\n}\r\n\r\nfunction onClearSelectionClick() {\r\n if (props.mode === 'multiple') {\r\n emit('update:modelValue', [])\r\n selectedFlatDataSource.value = []\r\n }\r\n else {\r\n radioSelectedKey.value = null\r\n emit('update:modelValue', null)\r\n }\r\n}\r\n\r\nfunction selectable(row: Record<string, any>, index: number) {\r\n if (props.selectable && isFn(props.selectable)) {\r\n return props.selectable(row, index, field.value)\r\n }\r\n return true\r\n}\r\n</script>\r\n\r\n<template>\r\n <div :class=\"`${stylePrefix}-select-table`\">\r\n <div\r\n v-if=\"currentSelectLength > 0 && props.showAlertToolbar\"\r\n :class=\"`${stylePrefix}-select-table-alert-container`\"\r\n >\r\n <span>已选择 {{ currentSelectLength }} 项</span>\r\n <ElLink\r\n type=\"primary\"\r\n :underline=\"lt(version, '2.9.9') ? false : 'never'\"\r\n style=\"margin-left: 8px;\"\r\n @click=\"onClearSelectionClick\"\r\n >\r\n 取消选择\r\n </ElLink>\r\n </div>\r\n <ElTable\r\n ref=\"elTableRef\"\r\n v-loading=\"props.loading\"\r\n v-bind=\"elTableProps\"\r\n :row-key=\"rowKey\"\r\n :row-class-name=\"props.clickRowToSelect ? `--click-row-select` : ''\"\r\n :data=\"props.dataSource\"\r\n :highlight-current-row=\"props.mode === 'single'\"\r\n @select=\"onSelect\"\r\n @select-all=\"onSelect\"\r\n @row-click=\"onRowClick\"\r\n >\r\n <ElTableColumn\r\n v-if=\"props.mode === 'multiple'\"\r\n type=\"selection\"\r\n :selectable=\"selectable\"\r\n />\r\n <ElTableColumn\r\n v-else\r\n width=\"46\"\r\n >\r\n <template #default=\"{ row }\">\r\n <ElRadioGroup v-model=\"radioSelectedKey\" style=\"width: 100%;\">\r\n <ElRadio\r\n v-bind=\"compatibleRadioValue(row[rowKey])\"\r\n @change=\"() => onRadioClick(row)\"\r\n >\r\n &nbsp;\r\n </ElRadio>\r\n </ElRadioGroup>\r\n </template>\r\n </ElTableColumn>\r\n <template v-if=\"props.columns.length === 0\">\r\n <slot />\r\n </template>\r\n <template v-else>\r\n <ElTableColumn\r\n v-for=\"colItem of props.columns\"\r\n v-bind=\"colItem\"\r\n :key=\"colItem.prop || colItem.type\"\r\n />\r\n </template>\r\n </ElTable>\r\n </div>\r\n</template>\r\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport InnerSelectTable from './select-table.vue'\r\nimport './style.scss'\r\n\r\nconst SelectTable = connect<typeof InnerSelectTable>(\n InnerSelectTable,\n mapProps({ dataSource: 'dataSource', loading: 'loading' }),\r\n)\r\n\r\nexport { SelectTable }\r\n\r\nexport default SelectTable\r\n"],"names":["props","__props","emit","__emit","elTableProps","useAttrs","field","useField","compatibleRadioValue","key","lt","version","elTableRef","ref","rowKey","getInitialSelectedList","item","initialSelectedList","selectedFlatDataSource","prevSelection","radioSelectedKey","currentSelectLength","computed","isValid","watch","selectedKeys","uniq","nextTick","onRadioClick","value","loading","currentDisplayDataKeys","valueKeys","isEqual","diffItems","xor","tableItem","shouldSelect","onSelect","newSelection","removedItemList","differenceWith","itemPrev","itemNext","uniqWith","removedKeys","remove","onRowClick","row","_","event","checkboxDOM","radioDOM","onClearSelectionClick","selectable","index","isFn","_createElementBlock","_unref","stylePrefix","_createElementVNode","_toDisplayString","_createVNode","ElLink","_cache","_withDirectives","_openBlock","_createBlock","_mergeProps","ElTableColumn","_withCtx","ElRadioGroup","$event","_renderSl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AIE;AAAA,UAHM/C,EAAM,SAAI,mBADlBmE,EAIET,EAAAW,CAAA,GAAA;AAAA;YAFA,MAAK;AAAA,YACJ,YAAAf;AAAA,UAAA,YAEHa,EAcgBT,EAAAW,CAAA,GAAA;AAAA;YAZd,OAAM;AAAA,UAAA;YAEK,SAAOC,EAChB,CAOe,EARK,KAAAtB,QAAG;AAAA,cACvBc,EAOeJ,EAAAa,EAAA,GAAA;AAAA,4BAPQnD,EAAA;AAAA,8DAAAA,EAAgB,QAAAoD;AAAA,gBAAE,OAAA,EAAA,OAAA,OAAA;AAAA,cAAA;2BACvC,MAKU;AAAA,kBALVV,EAKUJ,OALVU,EAKU5D,EAJqBwC,EAAIU,EAAA5C,CAAA,CAAM,CAAA,GAAA;AAAA,oBACtC,UAAM,MAAQc,EAAaoB,CAAG;AAAA,kBAAA;+BAChC,MAED,CAAA,GAAAgB,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,wBAFC,OAED,EAAA;AAAA,oBAAA;;;;;;;;;UAIUhE,EAAM,QAAQ,WAAM,IAClCyE,EAAQC,EAAA,QAAA,WAAA,EAAA,KAAA,EAAA,CAAA,KAGRR,EAAA,EAAA,GAAAT,EAIEkB,IAAA,EAAA,KAAA,EAAA,GAAAC,GAHkB5E,EAAM,UAAjB6E,YADTV,EAIET,EAAAW,CAAA,GAJFD,EAIE,EAAA,SAAA,GAAA,GAFQS,GAAO;AAAA,YACd,KAAKA,EAAQ,QAAQA,EAAQ;AAAA,UAAA;;;;QArCvB,CAAAnB,EAAAoB,EAAA,GAAA9E,EAAM,OAAO;AAAA,MAAA;;;ICpPxB+E,KAAcC;AAAA,EAClBC;AAAAA,EACAC,EAAS,EAAE,YAAY,cAAc,SAAS,WAAW;AAC3D;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/select-table/select-table.vue","../../src/select-table/index.ts"],"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()\n\nfunction compatibleRadioValue(key: string) {\n return lt(version, '2.6.0') ? { label: key } : { value: key }\n}\n\nconst elTableRef = ref<TableInstance>()\nconst rowKey = props.rowKey\nfunction getInitialSelectedList() {\n if (props.mode === 'multiple') {\n return props.modelValue?.map((item) => {\n if (!props.optionAsValue) {\n return {\n [rowKey]: item,\n }\n }\n return item\n }) ?? []\n }\n else {\n return props.optionAsValue ? [props.modelValue] : [{ [rowKey]: props.modelValue }]\n }\n}\nconst initialSelectedList = getInitialSelectedList()\nconst selectedFlatDataSource = ref(initialSelectedList)\n// 为了获取移除的项而缓存的当前页面的前一次选择。由于element-plus没有获取移除项的方法,需要通过这种方式移除field中移除的项\nlet prevSelection = []\n\nconst radioSelectedKey = ref()\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 => item[rowKey]),\n )\n await nextTick()\n for (const item of props.dataSource) {\n if (selectedKeys.includes(item[rowKey])) {\n if (props.mode === 'multiple') {\n elTableRef.value?.toggleRowSelection(item, true, props.ignoreSelectable)\n }\n else {\n elTableRef.value?.setCurrentRow(item)\n onRadioClick(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 radioSelectedKey.value = props.optionAsValue ? value[rowKey] : value\n }\n else {\n await nextTick()\n const currentDisplayDataKeys = elTableRef.value\n ?.getSelectionRows()\n .map(item => item[rowKey])\n const valueKeys = props.optionAsValue\n ? value?.map(item => item[rowKey])\n : value ?? []\n selectedFlatDataSource.value = selectedFlatDataSource.value.filter(\n item => valueKeys.includes(item[rowKey]),\n )\n if (isEqual(valueKeys, currentDisplayDataKeys)) {\n return\n }\n const diffItems = xor(valueKeys, currentDisplayDataKeys)\n for (const tableItem of props.dataSource) {\n if (diffItems.includes(tableItem[rowKey])) {\n const shouldSelect = valueKeys.includes(tableItem[rowKey])\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 /* istanbul ignore if -- @preserve */\n if (!rowKey) {\n throw new Error('rowKey is required')\n }\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 radioSelectedKey.value = item[rowKey]\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 radioSelectedKey.value = 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","import { connect, mapProps } from '@silver-formily/vue'\r\nimport InnerSelectTable from './select-table.vue'\r\nimport './style.scss'\r\n\r\nconst SelectTable = connect<typeof InnerSelectTable>(\n InnerSelectTable,\n mapProps({ dataSource: 'dataSource', loading: 'loading' }),\r\n)\r\n\r\nexport { SelectTable }\r\n\r\nexport default SelectTable\r\n"],"names":["props","__props","emit","__emit","elTableProps","useAttrs","field","useField","compatibleRadioValue","key","lt","version","elTableRef","ref","rowKey","getInitialSelectedList","item","initialSelectedList","selectedFlatDataSource","prevSelection","radioSelectedKey","currentSelectLength","computed","isValid","watch","selectedKeys","uniq","nextTick","onRadioClick","value","loading","currentDisplayDataKeys","valueKeys","isEqual","diffItems","xor","tableItem","shouldSelect","onSelect","newSelection","removedItemList","differenceWith","itemPrev","itemNext","uniqWith","removedKeys","remove","onRowClick","row","_","event","checkboxDOM","radioDOM","onClearSelectionClick","selectable","index","isFn","_createElementBlock","_unref","stylePrefix","_createElementVNode","_toDisplayString","_createVNode","ElLink","_cache","_withDirectives","_openBlock","_createBlock","_mergeProps","ElTableColumn","_withCtx","ElRadioGroup","$event","_renderSlot","_ctx","_Fragment","_renderList","colItem","vLoading","SelectTable","connect","InnerSelectTable","mapProps"],"mappings":";;;;;;;;;;;;;;;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AK;AAAA,YACJ,YAAAf;AAAA,UAAA,YAEHa,EAcgBT,EAAAW,CAAA,GAAA;AAAA;YAZd,OAAM;AAAA,UAAA;YAEK,SAAOC,EAChB,CAOe,EARK,KAAAtB,QAAG;AAAA,cACvBc,EAOeJ,EAAAa,EAAA,GAAA;AAAA,4BAPQnD,EAAA;AAAA,8DAAAA,EAAgB,QAAAoD;AAAA,gBAAE,OAAA,EAAA,OAAA,OAAA;AAAA,cAAA;2BACvC,MAKU;AAAA,kBALVV,EAKUJ,OALVU,EAKU5D,EAJqBwC,EAAIU,EAAA5C,CAAA,CAAM,CAAA,GAAA;AAAA,oBACtC,UAAM,MAAQc,EAAaoB,CAAG;AAAA,kBAAA;+BAChC,MAED,CAAA,GAAAgB,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,wBAFC,OAED,EAAA;AAAA,oBAAA;;;;;;;;;UAIUhE,EAAM,QAAQ,WAAM,IAClCyE,EAAQC,EAAA,QAAA,WAAA,EAAA,KAAA,EAAA,CAAA,KAGRR,EAAA,EAAA,GAAAT,EAIEkB,IAAA,EAAA,KAAA,EAAA,GAAAC,GAHkB5E,EAAM,UAAjB6E,YADTV,EAIET,EAAAW,CAAA,GAJFD,EAIE,EAAA,SAAA,GAAA,GAFQS,GAAO;AAAA,YACd,KAAKA,EAAQ,QAAQA,EAAQ;AAAA,UAAA;;;;QArCvB,CAAAnB,EAAAoB,EAAA,GAAA9E,EAAM,OAAO;AAAA,MAAA;;;ICpPxB+E,KAAcC;AAAA,EAClBC;AAAAA,EACAC,EAAS,EAAE,YAAY,cAAc,SAAS,WAAW;AAC3D;"}
@@ -1 +1 @@
1
- {"version":3,"file":"overlay-elements.mjs","sources":["../../src/shared/overlay-elements.ts"],"sourcesContent":["import type { ComponentPublicInstance } from 'vue'\r\n\r\nexport type DialogLikeInstance = ComponentPublicInstance<{ dialogContentRef?: ComponentPublicInstance | null }> | null\r\n\r\ntype OverlayLikeInstance = ComponentPublicInstance & {\r\n exposed?: Record<string, any>\r\n $refs?: Record<string, any>\r\n dialogContentRef?: ComponentPublicInstance | null\r\n}\r\n\r\nfunction toHTMLElement(target: unknown): HTMLElement | null {\r\n if (target instanceof HTMLElement)\r\n return target\r\n\r\n const element = (target as { $el?: unknown } | null | undefined)?.$el\r\n return element instanceof HTMLElement ? element : null\r\n}\r\n\r\nexport function resolveDialogElement(instance: DialogLikeInstance): HTMLElement | null {\r\n const vm = instance as OverlayLikeInstance | null\r\n return toHTMLElement(vm?.dialogContentRef)\r\n ?? toHTMLElement(vm?.exposed?.dialogContentRef)\r\n ?? toHTMLElement(vm)\r\n}\r\n\r\nexport function resolveDrawerElement(instance: ComponentPublicInstance | null): HTMLElement | null {\r\n const vm = instance as OverlayLikeInstance | null\r\n return toHTMLElement(vm?.exposed?.drawerRef)\r\n ?? toHTMLElement(vm?.$refs?.drawerRef)\r\n ?? toHTMLElement(vm)\r\n}\r\n"],"names":["toHTMLElement","target","element","resolveDialogElement","instance","vm","resolveDrawerElement"],"mappings":"AAUA,SAASA,EAAcC,GAAqC;AAC1D,MAAIA,aAAkB;AACpB,WAAOA;AAET,QAAMC,IAAWD,GAAiD;AAClE,SAAOC,aAAmB,cAAcA,IAAU;AACpD;AAEO,SAASC,EAAqBC,GAAkD;AACrF,QAAMC,IAAKD;AACX,SAAOJ,EAAcK,GAAI,gBAAgB,KACpCL,EAAcK,GAAI,SAAS,gBAAgB,KAC3CL,EAAcK,CAAE;AACvB;AAEO,SAASC,EAAqBF,GAA8D;AACjG,QAAMC,IAAKD;AACX,SAAOJ,EAAcK,GAAI,SAAS,SAAS,KACtCL,EAAcK,GAAI,OAAO,SAAS,KAClCL,EAAcK,CAAE;AACvB;"}
1
+ {"version":3,"file":"overlay-elements.mjs","sources":["../../src/shared/overlay-elements.ts"],"sourcesContent":["import type { ComponentPublicInstance } from 'vue'\n\nexport type DialogLikeInstance = ComponentPublicInstance<{ dialogContentRef?: ComponentPublicInstance | null }> | null\n\ntype OverlayLikeInstance = ComponentPublicInstance & {\n exposed?: Record<string, any>\n $refs?: Record<string, any>\n dialogContentRef?: ComponentPublicInstance | null\n}\n\nfunction toHTMLElement(target: unknown): HTMLElement | null {\n if (target instanceof HTMLElement)\n return target\n\n const element = (target as { $el?: unknown } | null | undefined)?.$el\n return element instanceof HTMLElement ? element : null\n}\n\nexport function resolveDialogElement(instance: DialogLikeInstance): HTMLElement | null {\n const vm = instance as OverlayLikeInstance | null\n return toHTMLElement(vm?.dialogContentRef)\n ?? toHTMLElement(vm?.exposed?.dialogContentRef)\n ?? toHTMLElement(vm)\n}\n\nexport function resolveDrawerElement(instance: ComponentPublicInstance | null): HTMLElement | null {\n const vm = instance as OverlayLikeInstance | null\n return toHTMLElement(vm?.exposed?.drawerRef)\n ?? toHTMLElement(vm?.$refs?.drawerRef)\n ?? toHTMLElement(vm)\n}\n"],"names":["toHTMLElement","target","element","resolveDialogElement","instance","vm","resolveDrawerElement"],"mappings":"AAUA,SAASA,EAAcC,GAAqC;AAC1D,MAAIA,aAAkB;AACpB,WAAOA;AAET,QAAMC,IAAWD,GAAiD;AAClE,SAAOC,aAAmB,cAAcA,IAAU;AACpD;AAEO,SAASC,EAAqBC,GAAkD;AACrF,QAAMC,IAAKD;AACX,SAAOJ,EAAcK,GAAI,gBAAgB,KACpCL,EAAcK,GAAI,SAAS,gBAAgB,KAC3CL,EAAcK,CAAE;AACvB;AAEO,SAASC,EAAqBF,GAA8D;AACjG,QAAMC,IAAKD;AACX,SAAOJ,EAAcK,GAAI,SAAS,SAAS,KACtCL,EAAcK,GAAI,OAAO,SAAS,KAClCL,EAAcK,CAAE;AACvB;"}
@@ -1,14 +1,17 @@
1
- import { connect as r, mapProps as e } from "@silver-formily/vue";
2
- import { ElSlider as o } from "element-plus";
3
- import { PreviewText as t } from "../preview-text/index.mjs";
4
- import { mapReadPretty as m } from "../__builtins__/shared/transform-component.mjs";
5
- const l = r(
6
- o,
7
- e({ readOnly: "readonly", disabled: !0 }),
8
- m(t.Input)
1
+ import { connect as r, mapProps as o } from "@silver-formily/vue";
2
+ import { ElSlider as t } from "element-plus";
3
+ import "@formily/reactive";
4
+ import "@vueuse/core";
5
+ import "vue";
6
+ import { mapReadPretty as e } from "../__builtins__/shared/transform-component.mjs";
7
+ import { PreviewText as m } from "../preview-text/index.mjs";
8
+ const s = r(
9
+ t,
10
+ o({ readOnly: "readonly", disabled: !0 }),
11
+ e(m.Input)
9
12
  );
10
13
  export {
11
- l as Slider,
12
- l as default
14
+ s as Slider,
15
+ s as default
13
16
  };
14
17
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/slider/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElSlider } from 'element-plus'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\n\r\nexport type SliderProps = typeof ElSlider\r\n\r\nexport const Slider = connect<typeof ElSlider>(\r\n ElSlider,\r\n mapProps({ readOnly: 'readonly', disabled: true }),\r\n mapReadPretty(PreviewText.Input),\r\n)\r\n\r\nexport default Slider\r\n"],"names":["Slider","connect","ElSlider","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;AAOO,MAAMA,IAASC;AAAA,EACpBC;AAAA,EACAC,EAAS,EAAE,UAAU,YAAY,UAAU,IAAM;AAAA,EACjDC,EAAcC,EAAY,KAAK;AACjC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/slider/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElSlider } from 'element-plus'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\n\nexport type SliderProps = typeof ElSlider\n\nexport const Slider = connect<typeof ElSlider>(\n ElSlider,\n mapProps({ readOnly: 'readonly', disabled: true }),\n mapReadPretty(PreviewText.Input),\n)\n\nexport default Slider\n"],"names":["Slider","connect","ElSlider","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;AAOO,MAAMA,IAASC;AAAA,EACpBC;AAAA,EACAC,EAAS,EAAE,UAAU,YAAY,UAAU,IAAM;AAAA,EACjDC,EAAcC,EAAY,KAAK;AACjC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/submit/submit.vue","../../src/submit/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\r\nimport type { IFormFeedback } from '@formily/core'\r\nimport type { PropType } from 'vue'\r\nimport { useParentForm } from '@silver-formily/vue'\r\nimport { ElButton } from 'element-plus'\r\n\r\ndefineOptions({\r\n name: 'FSubmit',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = defineProps({\r\n onClick: Function as PropType<(e: MouseEvent) => any>,\r\n onSubmit: Function as PropType<(values: any) => Promise<any>>,\r\n onSubmitSuccess: Function as PropType<(payload: any) => void>,\r\n onSubmitFailed: Function as PropType<(feedbacks: IFormFeedback[]) => void>,\r\n submit: Boolean,\r\n loading: Boolean,\r\n})\r\n\r\nconst formRef = useParentForm()\r\n\r\nfunction handleClick(e: MouseEvent) {\r\n if (props.onClick?.(e) === false)\r\n return\r\n if (props.onSubmit) {\r\n const form = formRef?.value\r\n form?.submit(props.onSubmit)\r\n .then(props.onSubmitSuccess)\r\n .catch(props.onSubmitFailed ?? console.error)\r\n }\r\n}\r\n</script>\r\n\r\n<template>\r\n <ElButton\r\n :native-type=\"props.submit ? 'button' : 'submit'\"\r\n type=\"primary\"\r\n v-bind=\"$attrs\"\r\n :loading=\"formRef?.submitting ?? props.loading\"\r\n @click=\"handleClick\"\r\n >\r\n <template #default>\r\n <slot />\r\n </template>\r\n </ElButton>\r\n</template>\r\n","import { observer } from '@silver-formily/reactive-vue'\r\nimport FSubmit from './submit.vue'\r\n\r\nexport const Submit = observer(FSubmit)\r\n\r\nexport default Submit\r\n"],"names":["props","__props","formRef","useParentForm","handleClick","e","_openBlock","_createBlock","_unref","_mergeProps","$attrs","_renderSlot","_ctx","Submit","observer","FSubmit"],"mappings":";;;;;;;;;;;;;;;;;AAWA,UAAMA,IAAQC,GASRC,IAAUC,EAAA;AAEhB,aAASC,EAAYC,GAAe;AAClC,MAAIL,EAAM,UAAUK,CAAC,MAAM,MAEvBL,EAAM,YACKE,GAAS,OAChB,OAAOF,EAAM,QAAQ,EACxB,KAAKA,EAAM,eAAe,EAC1B,MAAMA,EAAM,kBAAkB,QAAQ,KAAK;AAAA,IAElD;sBAIEM,KAAAC,EAUWC,MAVXC,EAUW;AAAA,MATR,eAAaT,EAAM,SAAM,WAAA;AAAA,MAC1B,MAAK;AAAA,IAAA,GACGU,EAAAA,QAAM;AAAA,MACb,SAASF,EAAAN,CAAA,GAAS,cAAcF,EAAM;AAAA,MACtC,SAAOI;AAAA,IAAA;MAEG,WACT,MAAQ;AAAA,QAARO,EAAQC,EAAA,QAAA,SAAA;AAAA,MAAA;;;;ICxCDC,IAASC,EAASC,CAAO;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/submit/submit.vue","../../src/submit/index.ts"],"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","import { observer } from '@silver-formily/reactive-vue'\nimport FSubmit from './submit.vue'\n\nexport const Submit = observer(FSubmit)\n\nexport default Submit\n"],"names":["props","__props","formRef","useParentForm","handleClick","e","_openBlock","_createBlock","_unref","_mergeProps","$attrs","_renderSlot","_ctx","Submit","observer","FSubmit"],"mappings":";;;;;;;;;;;;;;;;;AAWA,UAAMA,IAAQC,GASRC,IAAUC,EAAA;AAEhB,aAASC,EAAYC,GAAe;AAClC,MAAIL,EAAM,UAAUK,CAAC,MAAM,MAEvBL,EAAM,YACKE,GAAS,OAChB,OAAOF,EAAM,QAAQ,EACxB,KAAKA,EAAM,eAAe,EAC1B,MAAMA,EAAM,kBAAkB,QAAQ,KAAK;AAAA,IAElD;sBAIEM,KAAAC,EAUWC,MAVXC,EAUW;AAAA,MATR,eAAaT,EAAM,SAAM,WAAA;AAAA,MAC1B,MAAK;AAAA,IAAA,GACGU,EAAAA,QAAM;AAAA,MACb,SAASF,EAAAN,CAAA,GAAS,cAAcF,EAAM;AAAA,MACtC,SAAOI;AAAA,IAAA;MAEG,WACT,MAAQ;AAAA,QAARO,EAAQC,EAAA,QAAA,SAAA;AAAA,MAAA;;;;ICxCDC,IAASC,EAASC,CAAO;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/switch/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElSwitch } from 'element-plus'\r\n\r\nexport type SwitchProps = typeof ElSwitch\r\n\r\nexport const Switch = connect<typeof ElSwitch>(\r\n ElSwitch,\r\n mapProps({\r\n readOnly: 'readonly',\r\n }),\r\n)\r\n\r\nexport default Switch\r\n"],"names":["Switch","connect","ElSwitch","mapProps"],"mappings":";;AAKO,MAAMA,IAASC;AAAA,EACpBC;AAAA,EACAC,EAAS;AAAA,IACP,UAAU;AAAA,EAAA,CACX;AACH;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/switch/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElSwitch } from 'element-plus'\n\nexport type SwitchProps = typeof ElSwitch\n\nexport const Switch = connect<typeof ElSwitch>(\n ElSwitch,\n mapProps({\n readOnly: 'readonly',\n }),\n)\n\nexport default Switch\n"],"names":["Switch","connect","ElSwitch","mapProps"],"mappings":";;AAKO,MAAMA,IAASC;AAAA,EACpBC;AAAA,EACAC,EAAS;AAAA,IACP,UAAU;AAAA,EAAA,CACX;AACH;"}
@@ -1,14 +1,17 @@
1
1
  import { connect as r, mapProps as e } from "@silver-formily/vue";
2
2
  import { ElTimePicker as m } from "element-plus";
3
- import { PreviewText as o } from "../preview-text/index.mjs";
4
- import { mapReadPretty as i } from "../__builtins__/shared/transform-component.mjs";
5
- const P = r(
3
+ import "@formily/reactive";
4
+ import "@vueuse/core";
5
+ import "vue";
6
+ import { mapReadPretty as o } from "../__builtins__/shared/transform-component.mjs";
7
+ import { PreviewText as i } from "../preview-text/index.mjs";
8
+ const d = r(
6
9
  m,
7
10
  e({ readOnly: "readonly" }),
8
- i(o.TimePicker)
11
+ o(i.TimePicker)
9
12
  );
10
13
  export {
11
- P as TimePicker,
12
- P as default
14
+ d as TimePicker,
15
+ d as default
13
16
  };
14
17
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/time-picker/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElTimePicker } from 'element-plus'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\n\r\nexport type TimePickerProps = typeof ElTimePicker\r\n\r\nexport const TimePicker = connect<typeof ElTimePicker>(\r\n ElTimePicker,\r\n mapProps({ readOnly: 'readonly' }),\r\n mapReadPretty(PreviewText.TimePicker),\r\n)\r\n\r\nexport default TimePicker\r\n"],"names":["TimePicker","connect","ElTimePicker","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;AAOO,MAAMA,IAAaC;AAAA,EACxBC;AAAA,EACAC,EAAS,EAAE,UAAU,YAAY;AAAA,EACjCC,EAAcC,EAAY,UAAU;AACtC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/time-picker/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElTimePicker } from 'element-plus'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\n\nexport type TimePickerProps = typeof ElTimePicker\n\nexport const TimePicker = connect<typeof ElTimePicker>(\n ElTimePicker,\n mapProps({ readOnly: 'readonly' }),\n mapReadPretty(PreviewText.TimePicker),\n)\n\nexport default TimePicker\n"],"names":["TimePicker","connect","ElTimePicker","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;AAOO,MAAMA,IAAaC;AAAA,EACxBC;AAAA,EACAC,EAAS,EAAE,UAAU,YAAY;AAAA,EACjCC,EAAcC,EAAY,UAAU;AACtC;"}
@@ -1,14 +1,17 @@
1
1
  import { connect as e, mapProps as t } from "@silver-formily/vue";
2
2
  import { ElTimeSelect as m } from "element-plus";
3
- import { PreviewText as o } from "../preview-text/index.mjs";
4
- import { mapReadPretty as r } from "../__builtins__/shared/transform-component.mjs";
5
- const l = e(
3
+ import "@formily/reactive";
4
+ import "@vueuse/core";
5
+ import "vue";
6
+ import { mapReadPretty as o } from "../__builtins__/shared/transform-component.mjs";
7
+ import { PreviewText as r } from "../preview-text/index.mjs";
8
+ const s = e(
6
9
  m,
7
10
  t({ disabled: "disabled", editable: "editable" }),
8
- r(o.Input)
11
+ o(r.Input)
9
12
  );
10
13
  export {
11
- l as TimeSelect,
12
- l as default
14
+ s as TimeSelect,
15
+ s as default
13
16
  };
14
17
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/time-select/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElTimeSelect } from 'element-plus'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\n\r\nexport const TimeSelect = connect<typeof ElTimeSelect>(\n ElTimeSelect,\n mapProps({ disabled: 'disabled', editable: 'editable' }),\r\n mapReadPretty(PreviewText.Input),\r\n)\r\n\r\nexport default TimeSelect\r\n"],"names":["TimeSelect","connect","ElTimeSelect","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;AAKO,MAAMA,IAAaC;AAAA,EACxBC;AAAA,EACAC,EAAS,EAAE,UAAU,YAAY,UAAU,YAAY;AAAA,EACvDC,EAAcC,EAAY,KAAK;AACjC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/time-select/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElTimeSelect } from 'element-plus'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\n\r\nexport const TimeSelect = connect<typeof ElTimeSelect>(\n ElTimeSelect,\n mapProps({ disabled: 'disabled', editable: 'editable' }),\r\n mapReadPretty(PreviewText.Input),\r\n)\r\n\r\nexport default TimeSelect\r\n"],"names":["TimeSelect","connect","ElTimeSelect","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;AAKO,MAAMA,IAAaC;AAAA,EACxBC;AAAA,EACAC,EAAS,EAAE,UAAU,YAAY,UAAU,YAAY;AAAA,EACvDC,EAAcC,EAAY,KAAK;AACjC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/transfer/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElTransfer } from 'element-plus'\r\n\r\nexport type TransferProps = typeof ElTransfer\r\n\r\nexport const Transfer = connect<typeof ElTransfer>(\r\n ElTransfer,\r\n mapProps({ dataSource: 'data' }),\r\n)\r\n\r\nexport default Transfer\r\n"],"names":["Transfer","connect","ElTransfer","mapProps"],"mappings":";;AAKO,MAAMA,IAAWC;AAAA,EACtBC;AAAA,EACAC,EAAS,EAAE,YAAY,OAAA,CAAQ;AACjC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/transfer/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElTransfer } from 'element-plus'\n\nexport type TransferProps = typeof ElTransfer\n\nexport const Transfer = connect<typeof ElTransfer>(\n ElTransfer,\n mapProps({ dataSource: 'data' }),\n)\n\nexport default Transfer\n"],"names":["Transfer","connect","ElTransfer","mapProps"],"mappings":";;AAKO,MAAMA,IAAWC;AAAA,EACtBC;AAAA,EACAC,EAAS,EAAE,YAAY,OAAA,CAAQ;AACjC;"}
@@ -1,12 +1,16 @@
1
1
  import { useField as _, connect as A, mapProps as D } from "@silver-formily/vue";
2
- import { PreviewText as H } from "../preview-text/index.mjs";
3
- import { defineComponent as P, useSlots as R, ref as h, computed as y, watch as v, nextTick as k, openBlock as g, createBlock as C, unref as a, withCtx as T, withDirectives as w, mergeProps as F, createSlots as B, renderList as E, renderSlot as L, normalizeProps as j, guardReactiveProps as z } from "vue";
4
- import { isFn as I } from "@formily/shared";
5
- import { ElScrollbar as N, ElTree as O, vLoading as $ } from "element-plus";
6
- import { addDisabledToNodes as q, flattenTree as G, getInputKeys as J, getOutputData as M } from "./utils.mjs";
7
- import { useCleanAttrs as Q } from "../__builtins__/shared/utils.mjs";
8
- import { mapReadPretty as U } from "../__builtins__/shared/transform-component.mjs";
9
- const W = /* @__PURE__ */ P({
2
+ import { ElScrollbar as H, ElTree as P, vLoading as R } from "element-plus";
3
+ import "@formily/reactive";
4
+ import "@vueuse/core";
5
+ import { defineComponent as w, useSlots as F, ref as h, computed as y, watch as v, nextTick as k, openBlock as g, createBlock as C, unref as a, withCtx as T, withDirectives as B, mergeProps as E, createSlots as L, renderList as j, renderSlot as z, normalizeProps as I, guardReactiveProps as N } from "vue";
6
+ import { mapReadPretty as O } from "../__builtins__/shared/transform-component.mjs";
7
+ import { PreviewText as $ } from "../preview-text/index.mjs";
8
+ import { isFn as q } from "@formily/shared";
9
+ import "@formily/core";
10
+ import "@silver-formily/reactive-vue";
11
+ import { useCleanAttrs as G } from "../__builtins__/shared/utils.mjs";
12
+ import { addDisabledToNodes as J, flattenTree as M, getInputKeys as Q, getOutputData as U } from "./utils.mjs";
13
+ const W = /* @__PURE__ */ w({
10
14
  name: "Tree",
11
15
  inheritAttrs: !1,
12
16
  __name: "tree",
@@ -28,13 +32,13 @@ const W = /* @__PURE__ */ P({
28
32
  },
29
33
  emits: ["update:modelValue"],
30
34
  setup(K, { emit: V }) {
31
- const e = K, s = V, b = R(), { props: l } = Q(), o = h(), d = h([]), n = y(() => q(e.data ?? [], l.value.disabled, e.props)), c = y(() => G(n.value ?? [], [], e.props.children));
32
- async function u() {
35
+ const e = K, i = V, b = F(), { props: l } = G(), o = h(), d = h([]), n = y(() => J(e.data ?? [], l.value.disabled, e.props)), p = y(() => M(n.value ?? [], [], e.props.children));
36
+ async function c() {
33
37
  await k();
34
38
  const t = o.value.getCheckedKeys(), f = o.value.getHalfCheckedKeys() || [];
35
39
  d.value = t;
36
- const { value: m, nodes: r } = M(t, f, {
37
- flatData: c.value,
40
+ const { value: m, nodes: r } = U(t, f, {
41
+ flatData: p.value,
38
42
  nodeKey: e.nodeKey,
39
43
  propsConfig: e.props,
40
44
  data: e.data ?? [],
@@ -42,13 +46,13 @@ const W = /* @__PURE__ */ P({
42
46
  includeHalfChecked: e.includeHalfChecked,
43
47
  checkStrictly: l.value.checkStrictly
44
48
  });
45
- e.optionAsValue ? I(e.optionFormatter) ? s("update:modelValue", r.map((i, x, S) => e.optionFormatter(i, x, S))) : s("update:modelValue", r) : s("update:modelValue", m);
49
+ e.optionAsValue ? q(e.optionFormatter) ? i("update:modelValue", r.map((s, x, S) => e.optionFormatter(s, x, S))) : i("update:modelValue", r) : i("update:modelValue", m);
46
50
  }
47
51
  v(() => e.modelValue, (t) => {
48
- t !== void 0 && (d.value = J(t, {
52
+ t !== void 0 && (d.value = Q(t, {
49
53
  optionAsValue: e.optionAsValue,
50
54
  nodeKey: e.nodeKey,
51
- flatData: c.value,
55
+ flatData: p.value,
52
56
  propsConfig: e.props,
53
57
  data: e.data ?? [],
54
58
  valueType: e.valueType,
@@ -57,17 +61,17 @@ const W = /* @__PURE__ */ P({
57
61
  o.value && o.value.setCheckedKeys(d.value);
58
62
  }));
59
63
  }, { immediate: !0 }), v(() => [e.valueType, e.optionAsValue, e.includeHalfChecked], () => {
60
- u();
64
+ c();
61
65
  }, { immediate: !1 });
62
- const p = _();
63
- return p.value?.inject({
66
+ const u = _();
67
+ return u.value?.inject({
64
68
  getTreeRef: () => o
65
- }), (t, f) => (g(), C(a(N), {
69
+ }), (t, f) => (g(), C(a(H), {
66
70
  height: e.height,
67
71
  "max-height": e.maxHeight
68
72
  }, {
69
73
  default: T(() => [
70
- w((g(), C(a(O), F({
74
+ B((g(), C(a(P), E({
71
75
  ref_key: "treeRef",
72
76
  ref: o,
73
77
  data: n.value,
@@ -75,27 +79,27 @@ const W = /* @__PURE__ */ P({
75
79
  "node-key": e.nodeKey,
76
80
  "default-checked-keys": d.value,
77
81
  "show-checkbox": !0
78
- }, a(l), { onCheck: u }), B({ _: 2 }, [
79
- E(a(b), (m, r) => ({
82
+ }, a(l), { onCheck: c }), L({ _: 2 }, [
83
+ j(a(b), (m, r) => ({
80
84
  name: r,
81
- fn: T((i) => [
82
- L(t.$slots, r, j(z({ field: a(p), ...i })))
85
+ fn: T((s) => [
86
+ z(t.$slots, r, I(N({ field: a(u), ...s })))
83
87
  ])
84
88
  }))
85
89
  ]), 1040, ["data", "props", "node-key", "default-checked-keys"])), [
86
- [a($), a(l).loading]
90
+ [a(R), a(l).loading]
87
91
  ])
88
92
  ]),
89
93
  _: 3
90
94
  }, 8, ["height", "max-height"]));
91
95
  }
92
- }), re = A(
96
+ }), ne = A(
93
97
  W,
94
98
  D({ dataSource: "data", loading: "loading", disabled: !0 }),
95
- U(H.Tree)
99
+ O($.Tree)
96
100
  );
97
101
  export {
98
- re as Tree,
99
- re as default
102
+ ne as Tree,
103
+ ne as default
100
104
  };
101
105
  //# sourceMappingURL=index.mjs.map