@silver-formily/element-plus 2.3.0 → 2.4.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 (169) hide show
  1. package/LICENSE +21 -21
  2. package/README.en-US.md +32 -32
  3. package/README.md +32 -32
  4. package/esm/__builtins__/configs/index.mjs.map +1 -1
  5. package/esm/__builtins__/index.mjs +12 -11
  6. package/esm/__builtins__/shared/index.mjs +11 -10
  7. package/esm/__builtins__/shared/loading.mjs.map +1 -1
  8. package/esm/__builtins__/shared/simple-version-compare.mjs.map +1 -1
  9. package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
  10. package/esm/__builtins__/shared/use-enter-submit.mjs.map +1 -1
  11. package/esm/__builtins__/shared/utils.d.ts +1 -0
  12. package/esm/__builtins__/shared/utils.mjs +23 -17
  13. package/esm/__builtins__/shared/utils.mjs.map +1 -1
  14. package/esm/array-base/index.mjs +56 -52
  15. package/esm/array-base/index.mjs.map +1 -1
  16. package/esm/array-base/symbols.mjs.map +1 -1
  17. package/esm/array-base/utils.d.ts +0 -1
  18. package/esm/array-base/utils.mjs +45 -46
  19. package/esm/array-base/utils.mjs.map +1 -1
  20. package/esm/array-cards/index.mjs +36 -33
  21. package/esm/array-cards/index.mjs.map +1 -1
  22. package/esm/array-collapse/index.mjs +39 -37
  23. package/esm/array-collapse/index.mjs.map +1 -1
  24. package/esm/array-collapse/utils.mjs +9 -2
  25. package/esm/array-collapse/utils.mjs.map +1 -1
  26. package/esm/array-items/index.mjs +38 -34
  27. package/esm/array-items/index.mjs.map +1 -1
  28. package/esm/array-list-tabs/index.mjs +38 -36
  29. package/esm/array-list-tabs/index.mjs.map +1 -1
  30. package/esm/array-list-tabs/utils.mjs +12 -5
  31. package/esm/array-list-tabs/utils.mjs.map +1 -1
  32. package/esm/array-table/index.mjs +63 -60
  33. package/esm/array-table/index.mjs.map +1 -1
  34. package/esm/array-table/utils.mjs +18 -11
  35. package/esm/array-table/utils.mjs.map +1 -1
  36. package/esm/array-tabs/index.mjs +28 -25
  37. package/esm/array-tabs/index.mjs.map +1 -1
  38. package/esm/autocomplete/index.mjs +24 -18
  39. package/esm/autocomplete/index.mjs.map +1 -1
  40. package/esm/cascader/index.mjs +22 -18
  41. package/esm/cascader/index.mjs.map +1 -1
  42. package/esm/checkbox/index.mjs +20 -16
  43. package/esm/checkbox/index.mjs.map +1 -1
  44. package/esm/color-picker/index.mjs +9 -6
  45. package/esm/color-picker/index.mjs.map +1 -1
  46. package/esm/color-picker-panel/index.mjs +9 -6
  47. package/esm/color-picker-panel/index.mjs.map +1 -1
  48. package/esm/date-picker/index.mjs +14 -11
  49. package/esm/date-picker/index.mjs.map +1 -1
  50. package/esm/date-picker/utils.mjs.map +1 -1
  51. package/esm/date-picker-panel/index.mjs +14 -11
  52. package/esm/date-picker-panel/index.mjs.map +1 -1
  53. package/esm/editable/editable.d.ts +2 -0
  54. package/esm/editable/index.d.ts +1 -0
  55. package/esm/editable/index.mjs +71 -66
  56. package/esm/editable/index.mjs.map +1 -1
  57. package/esm/form/form.mjs +6 -6
  58. package/esm/form/form.mjs.map +1 -1
  59. package/esm/form-button-group/form-button-group.d.ts +9 -0
  60. package/esm/form-button-group/index.d.ts +15 -0
  61. package/esm/form-button-group/index.mjs +47 -28
  62. package/esm/form-button-group/index.mjs.map +1 -1
  63. package/esm/form-button-group/utils.mjs +9 -2
  64. package/esm/form-button-group/utils.mjs.map +1 -1
  65. package/esm/form-collapse/index.mjs +21 -18
  66. package/esm/form-collapse/index.mjs.map +1 -1
  67. package/esm/form-collapse/utils.mjs.map +1 -1
  68. package/esm/form-dialog/index.mjs +22 -22
  69. package/esm/form-dialog/index.mjs.map +1 -1
  70. package/esm/form-drawer/index.mjs +21 -21
  71. package/esm/form-drawer/index.mjs.map +1 -1
  72. package/esm/form-grid/hooks.mjs.map +1 -1
  73. package/esm/form-grid/index.mjs +26 -22
  74. package/esm/form-grid/index.mjs.map +1 -1
  75. package/esm/form-item/index.d.ts +1 -0
  76. package/esm/form-item/index.mjs +102 -99
  77. package/esm/form-item/index.mjs.map +1 -1
  78. package/esm/form-item/types.d.ts +4 -0
  79. package/esm/form-item/utils.mjs.map +1 -1
  80. package/esm/form-layout/form-layout.mjs +14 -10
  81. package/esm/form-layout/form-layout.mjs.map +1 -1
  82. package/esm/form-layout/utils.mjs +23 -23
  83. package/esm/form-layout/utils.mjs.map +1 -1
  84. package/esm/form-step/index.mjs +30 -27
  85. package/esm/form-step/index.mjs.map +1 -1
  86. package/esm/form-step/utils.mjs.map +1 -1
  87. package/esm/form-tab/hooks.mjs.map +1 -1
  88. package/esm/form-tab/index.mjs +24 -22
  89. package/esm/form-tab/index.mjs.map +1 -1
  90. package/esm/form-tab/utils.mjs.map +1 -1
  91. package/esm/index.d.ts +2 -0
  92. package/esm/index.mjs +82 -78
  93. package/esm/index.mjs.map +1 -1
  94. package/esm/input/index.mjs +30 -26
  95. package/esm/input/index.mjs.map +1 -1
  96. package/esm/input-number/index.mjs +11 -8
  97. package/esm/input-number/index.mjs.map +1 -1
  98. package/esm/input-tag/index.mjs +20 -16
  99. package/esm/input-tag/index.mjs.map +1 -1
  100. package/esm/mention/index.mjs +24 -20
  101. package/esm/mention/index.mjs.map +1 -1
  102. package/esm/pagination/components/jumper.mjs.map +1 -1
  103. package/esm/pagination/components/next.mjs.map +1 -1
  104. package/esm/pagination/components/pager.mjs.map +1 -1
  105. package/esm/pagination/components/prev.mjs.map +1 -1
  106. package/esm/pagination/components/total.mjs.map +1 -1
  107. package/esm/pagination/pagination.mjs.map +1 -1
  108. package/esm/password/index.mjs.map +1 -1
  109. package/esm/preview-text/index.mjs +57 -53
  110. package/esm/preview-text/index.mjs.map +1 -1
  111. package/esm/preview-text/utils.mjs.map +1 -1
  112. package/esm/query-form/default-components.d.ts +5 -0
  113. package/esm/query-form/default-components.mjs +47 -0
  114. package/esm/query-form/default-components.mjs.map +1 -0
  115. package/esm/query-form/hooks.d.ts +25 -0
  116. package/esm/query-form/hooks.mjs +29 -0
  117. package/esm/query-form/hooks.mjs.map +1 -0
  118. package/esm/query-form/index.d.ts +117 -0
  119. package/esm/query-form/index.mjs +337 -0
  120. package/esm/query-form/index.mjs.map +1 -0
  121. package/esm/query-form/query-form-light.d.ts +27 -0
  122. package/esm/query-form/query-form.d.ts +52 -0
  123. package/esm/query-form/types.d.ts +44 -0
  124. package/esm/query-form/types.mjs +2 -0
  125. package/esm/query-form/types.mjs.map +1 -0
  126. package/esm/query-form-item/index.d.ts +151 -0
  127. package/esm/query-form-item/index.mjs +188 -0
  128. package/esm/query-form-item/index.mjs.map +1 -0
  129. package/esm/query-form-item/query-form-item.d.ts +96 -0
  130. package/esm/query-form-item/types.d.ts +46 -0
  131. package/esm/query-form-item/types.mjs +2 -0
  132. package/esm/query-form-item/types.mjs.map +1 -0
  133. package/esm/radio/index.mjs +29 -25
  134. package/esm/radio/index.mjs.map +1 -1
  135. package/esm/rate/index.mjs +13 -10
  136. package/esm/rate/index.mjs.map +1 -1
  137. package/esm/reset/index.mjs.map +1 -1
  138. package/esm/segmented/index.mjs +16 -12
  139. package/esm/segmented/index.mjs.map +1 -1
  140. package/esm/select/index.mjs +26 -22
  141. package/esm/select/index.mjs.map +1 -1
  142. package/esm/select-table/index.mjs +36 -33
  143. package/esm/select-table/index.mjs.map +1 -1
  144. package/esm/shared/overlay-elements.mjs +14 -11
  145. package/esm/shared/overlay-elements.mjs.map +1 -1
  146. package/esm/slider/index.mjs +13 -10
  147. package/esm/slider/index.mjs.map +1 -1
  148. package/esm/styles/form-button-group/index.css +1 -1
  149. package/esm/styles/form-item/index.css +1 -1
  150. package/esm/styles/query-form/index.css +1 -0
  151. package/esm/styles/query-form-item/index.css +1 -0
  152. package/esm/submit/index.mjs.map +1 -1
  153. package/esm/switch/index.mjs.map +1 -1
  154. package/esm/time-picker/index.mjs +9 -6
  155. package/esm/time-picker/index.mjs.map +1 -1
  156. package/esm/time-select/index.mjs +9 -6
  157. package/esm/time-select/index.mjs.map +1 -1
  158. package/esm/transfer/index.mjs.map +1 -1
  159. package/esm/tree/index.mjs +33 -29
  160. package/esm/tree/index.mjs.map +1 -1
  161. package/esm/tree/utils.mjs.map +1 -1
  162. package/esm/tree-select/index.mjs +18 -14
  163. package/esm/tree-select/index.mjs.map +1 -1
  164. package/esm/upload/index.mjs +10 -7
  165. package/esm/upload/index.mjs.map +1 -1
  166. package/esm/vendor/lodash.mjs +751 -663
  167. package/esm/vendor/lodash.mjs.map +1 -1
  168. package/esm/vendor/sizes.mjs.map +1 -1
  169. package/package.json +115 -115
@@ -1,9 +1,12 @@
1
1
  import { connect as r, mapProps as a } from "@silver-formily/vue";
2
2
  import { ElDatePicker as m } from "element-plus";
3
- import { PreviewText as o } from "../preview-text/index.mjs";
4
- import { getDefaultFormat as t } from "./utils.mjs";
5
- import { mapReadPretty as i } from "../__builtins__/shared/transform-component.mjs";
6
- const n = 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
+ import { getDefaultFormat as e } from "./utils.mjs";
9
+ const y = r(
7
10
  m,
8
11
  a(
9
12
  {
@@ -11,16 +14,16 @@ const n = r(
11
14
  disabled: !0,
12
15
  editable: !0
13
16
  },
14
- (e) => ({
15
- ...e,
16
- format: e.format || t(e.type),
17
- valueFormat: e.valueFormat || t(e.type, "valueFormat")
17
+ (t) => ({
18
+ ...t,
19
+ format: t.format || e(t.type),
20
+ valueFormat: t.valueFormat || e(t.type, "valueFormat")
18
21
  })
19
22
  ),
20
- i(o.DatePicker)
23
+ o(i.DatePicker)
21
24
  );
22
25
  export {
23
- n as DatePicker,
24
- n as default
26
+ y as DatePicker,
27
+ y as default
25
28
  };
26
29
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/date-picker/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElDatePicker } from 'element-plus'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\nimport { getDefaultFormat } from './utils'\r\n\r\nexport const DatePicker = connect<typeof ElDatePicker>(\r\n ElDatePicker,\r\n mapProps(\r\n {\r\n readOnly: 'readonly',\r\n disabled: true,\r\n editable: true,\r\n },\r\n (props: any) => {\r\n return {\r\n ...props,\r\n format: props.format || getDefaultFormat(props.type),\r\n valueFormat:\r\n props.valueFormat || getDefaultFormat(props.type, 'valueFormat'),\r\n }\r\n },\r\n ),\r\n mapReadPretty(PreviewText.DatePicker),\r\n)\r\n\r\nexport default DatePicker\r\n"],"names":["DatePicker","connect","ElDatePicker","mapProps","props","getDefaultFormat","mapReadPretty","PreviewText"],"mappings":";;;;;AAMO,MAAMA,IAAaC;AAAA,EACxBC;AAAA,EACAC;AAAA,IACE;AAAA,MACE,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,IAAA;AAAA,IAEZ,CAACC,OACQ;AAAA,MACL,GAAGA;AAAA,MACH,QAAQA,EAAM,UAAUC,EAAiBD,EAAM,IAAI;AAAA,MACnD,aACEA,EAAM,eAAeC,EAAiBD,EAAM,MAAM,aAAa;AAAA,IAAA;AAAA,EAErE;AAAA,EAEFE,EAAcC,EAAY,UAAU;AACtC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/date-picker/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElDatePicker } from 'element-plus'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport { getDefaultFormat } from './utils'\n\nexport const DatePicker = connect<typeof ElDatePicker>(\n ElDatePicker,\n mapProps(\n {\n readOnly: 'readonly',\n disabled: true,\n editable: true,\n },\n (props: any) => {\n return {\n ...props,\n format: props.format || getDefaultFormat(props.type),\n valueFormat:\n props.valueFormat || getDefaultFormat(props.type, 'valueFormat'),\n }\n },\n ),\n mapReadPretty(PreviewText.DatePicker),\n)\n\nexport default DatePicker\n"],"names":["DatePicker","connect","ElDatePicker","mapProps","props","getDefaultFormat","mapReadPretty","PreviewText"],"mappings":";;;;;;;;AAMO,MAAMA,IAAaC;AAAA,EACxBC;AAAA,EACAC;AAAA,IACE;AAAA,MACE,UAAU;AAAA,MACV,UAAU;AAAA,MACV,UAAU;AAAA,IAAA;AAAA,IAEZ,CAACC,OACQ;AAAA,MACL,GAAGA;AAAA,MACH,QAAQA,EAAM,UAAUC,EAAiBD,EAAM,IAAI;AAAA,MACnD,aACEA,EAAM,eAAeC,EAAiBD,EAAM,MAAM,aAAa;AAAA,IAAA;AAAA,EAErE;AAAA,EAEFE,EAAcC,EAAY,UAAU;AACtC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../src/date-picker/utils.ts"],"sourcesContent":["import type { DatePickerProps } from 'element-plus'\r\n\r\ntype FormatType = 'format' | 'valueFormat'\r\n\r\nexport function getDefaultFormat(type: DatePickerProps['type'] = 'date', formatType: FormatType = 'format') {\r\n if (type === 'week' && formatType === 'format') {\r\n return '[Week] ww'\r\n }\r\n else {\r\n switch (type) {\r\n case 'year':\r\n case 'years':\r\n case 'yearrange': {\r\n return 'YYYY'\r\n }\r\n case 'month':\r\n case 'months':\r\n case 'monthrange': {\r\n return 'YYYY-MM'\r\n }\r\n case 'week': {\r\n return 'ww'\r\n }\r\n case 'date':\r\n case 'dates':\r\n case 'daterange': {\r\n return 'YYYY-MM-DD'\r\n }\r\n case 'datetime':\r\n case 'datetimerange': {\r\n return 'YYYY-MM-DD HH:mm:ss'\r\n }\r\n }\r\n }\r\n}\r\n"],"names":["getDefaultFormat","type","formatType"],"mappings":"AAIO,SAASA,EAAiBC,IAAgC,QAAQC,IAAyB,UAAU;AAC1G,MAAID,MAAS,UAAUC,MAAe;AACpC,WAAO;AAGP,UAAQD,GAAA;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,EACT;AAGN;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../../src/date-picker/utils.ts"],"sourcesContent":["import type { DatePickerProps } from 'element-plus'\n\ntype FormatType = 'format' | 'valueFormat'\n\nexport function getDefaultFormat(type: DatePickerProps['type'] = 'date', formatType: FormatType = 'format') {\n if (type === 'week' && formatType === 'format') {\n return '[Week] ww'\n }\n else {\n switch (type) {\n case 'year':\n case 'years':\n case 'yearrange': {\n return 'YYYY'\n }\n case 'month':\n case 'months':\n case 'monthrange': {\n return 'YYYY-MM'\n }\n case 'week': {\n return 'ww'\n }\n case 'date':\n case 'dates':\n case 'daterange': {\n return 'YYYY-MM-DD'\n }\n case 'datetime':\n case 'datetimerange': {\n return 'YYYY-MM-DD HH:mm:ss'\n }\n }\n }\n}\n"],"names":["getDefaultFormat","type","formatType"],"mappings":"AAIO,SAASA,EAAiBC,IAAgC,QAAQC,IAAyB,UAAU;AAC1G,MAAID,MAAS,UAAUC,MAAe;AACpC,WAAO;AAGP,UAAQD,GAAA;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IAET,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,EACT;AAGN;"}
@@ -1,27 +1,30 @@
1
1
  import { connect as r, mapProps as m } from "@silver-formily/vue";
2
2
  import { ElDatePickerPanel as o } from "element-plus";
3
+ import "@formily/reactive";
4
+ import "@vueuse/core";
5
+ import "vue";
6
+ import { mapReadPretty as i } from "../__builtins__/shared/transform-component.mjs";
3
7
  import { getDefaultFormat as a } from "../date-picker/utils.mjs";
4
- import { PreviewText as i } from "../preview-text/index.mjs";
5
- import { mapReadPretty as l } from "../__builtins__/shared/transform-component.mjs";
6
- const c = r(
8
+ import { PreviewText as l } from "../preview-text/index.mjs";
9
+ const v = r(
7
10
  o,
8
11
  m(
9
12
  {
10
13
  disabled: !0,
11
14
  editable: !0
12
15
  },
13
- (e) => {
14
- const t = {};
15
- return e.readOnly && (t.editable = !1), e.valueFormat || (t.valueFormat = a(e.type, "valueFormat")), e.dateFormat || (t.dateFormat = a(e.type)), {
16
- ...e,
17
- ...t
16
+ (t) => {
17
+ const e = {};
18
+ return t.readOnly && (e.editable = !1), t.valueFormat || (e.valueFormat = a(t.type, "valueFormat")), t.dateFormat || (e.dateFormat = a(t.type)), {
19
+ ...t,
20
+ ...e
18
21
  };
19
22
  }
20
23
  ),
21
- l(i.DatePicker)
24
+ i(l.DatePicker)
22
25
  );
23
26
  export {
24
- c as DatePickerPanel,
25
- c as default
27
+ v as DatePickerPanel,
28
+ v as default
26
29
  };
27
30
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/date-picker-panel/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElDatePickerPanel } from 'element-plus'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { getDefaultFormat } from '../date-picker/utils'\r\nimport { PreviewText } from '../preview-text'\r\n\r\nexport const DatePickerPanel = connect<typeof ElDatePickerPanel>(\r\n ElDatePickerPanel,\r\n mapProps(\r\n {\r\n disabled: true,\r\n editable: true,\r\n },\r\n (props: any) => {\r\n const next: Record<string, any> = {}\r\n\r\n if (props.readOnly) {\r\n next.editable = false\r\n }\r\n\r\n if (!props.valueFormat) {\r\n next.valueFormat = getDefaultFormat(props.type, 'valueFormat')\r\n }\r\n\r\n if (!props.dateFormat) {\r\n next.dateFormat = getDefaultFormat(props.type)\r\n }\r\n\r\n return {\r\n ...props,\r\n ...next,\r\n }\r\n },\r\n ),\r\n mapReadPretty(PreviewText.DatePicker),\r\n)\r\n\r\nexport default DatePickerPanel\r\n"],"names":["DatePickerPanel","connect","ElDatePickerPanel","mapProps","props","next","getDefaultFormat","mapReadPretty","PreviewText"],"mappings":";;;;;AAMO,MAAMA,IAAkBC;AAAA,EAC7BC;AAAA,EACAC;AAAA,IACE;AAAA,MACE,UAAU;AAAA,MACV,UAAU;AAAA,IAAA;AAAA,IAEZ,CAACC,MAAe;AACd,YAAMC,IAA4B,CAAA;AAElC,aAAID,EAAM,aACRC,EAAK,WAAW,KAGbD,EAAM,gBACTC,EAAK,cAAcC,EAAiBF,EAAM,MAAM,aAAa,IAG1DA,EAAM,eACTC,EAAK,aAAaC,EAAiBF,EAAM,IAAI,IAGxC;AAAA,QACL,GAAGA;AAAA,QACH,GAAGC;AAAA,MAAA;AAAA,IAEP;AAAA,EAAA;AAAA,EAEFE,EAAcC,EAAY,UAAU;AACtC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/date-picker-panel/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElDatePickerPanel } from 'element-plus'\nimport { mapReadPretty } from '../__builtins__'\nimport { getDefaultFormat } from '../date-picker/utils'\nimport { PreviewText } from '../preview-text'\n\nexport const DatePickerPanel = connect<typeof ElDatePickerPanel>(\n ElDatePickerPanel,\n mapProps(\n {\n disabled: true,\n editable: true,\n },\n (props: any) => {\n const next: Record<string, any> = {}\n\n if (props.readOnly) {\n next.editable = false\n }\n\n if (!props.valueFormat) {\n next.valueFormat = getDefaultFormat(props.type, 'valueFormat')\n }\n\n if (!props.dateFormat) {\n next.dateFormat = getDefaultFormat(props.type)\n }\n\n return {\n ...props,\n ...next,\n }\n },\n ),\n mapReadPretty(PreviewText.DatePicker),\n)\n\nexport default DatePickerPanel\n"],"names":["DatePickerPanel","connect","ElDatePickerPanel","mapProps","props","next","getDefaultFormat","mapReadPretty","PreviewText"],"mappings":";;;;;;;;AAMO,MAAMA,IAAkBC;AAAA,EAC7BC;AAAA,EACAC;AAAA,IACE;AAAA,MACE,UAAU;AAAA,MACV,UAAU;AAAA,IAAA;AAAA,IAEZ,CAACC,MAAe;AACd,YAAMC,IAA4B,CAAA;AAElC,aAAID,EAAM,aACRC,EAAK,WAAW,KAGbD,EAAM,gBACTC,EAAK,cAAcC,EAAiBF,EAAM,MAAM,aAAa,IAG1DA,EAAM,eACTC,EAAK,aAAaC,EAAiBF,EAAM,IAAI,IAGxC;AAAA,QACL,GAAGA;AAAA,QACH,GAAGC;AAAA,MAAA;AAAA,IAEP;AAAA,EAAA;AAAA,EAEFE,EAAcC,EAAY,UAAU;AACtC;"}
@@ -19,6 +19,7 @@ declare function __VLS_template(): {
19
19
  labelWrap: boolean;
20
20
  fullness: boolean;
21
21
  }> & Omit<{
22
+ readonly internalFormItemClass?: string;
22
23
  readonly label?: string;
23
24
  readonly for?: string;
24
25
  readonly tooltip?: string;
@@ -109,6 +110,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
109
110
  labelWrap: boolean;
110
111
  fullness: boolean;
111
112
  }> & Omit<{
113
+ readonly internalFormItemClass?: string;
112
114
  readonly label?: string;
113
115
  readonly for?: string;
114
116
  readonly tooltip?: string;
@@ -19,6 +19,7 @@ export declare const Editable: {
19
19
  labelWrap: boolean;
20
20
  fullness: boolean;
21
21
  }> & Omit<{
22
+ readonly internalFormItemClass?: string;
22
23
  readonly label?: string;
23
24
  readonly for?: string;
24
25
  readonly tooltip?: string;
@@ -1,18 +1,22 @@
1
1
  import { useField as E, connect as h, mapProps as w } from "@silver-formily/vue";
2
- import { FormBaseItem as c, fieldFeedbackMapper as R } from "../form-item/index.mjs";
3
- import { defineComponent as z, ref as m, createElementBlock as p, openBlock as d, normalizeClass as i, createVNode as u, unref as t, mergeProps as P, withCtx as n, withDirectives as T, createBlock as _, createElementVNode as C, createTextVNode as S, toDisplayString as V, renderSlot as A, computed as g, createCommentVNode as q, Fragment as I, nextTick as x } from "vue";
4
- import { Edit as F, Close as N } from "@element-plus/icons-vue";
5
- import { reaction as D } from "@formily/reactive";
6
- import { isValid as $, isPlainObj as M } from "@formily/shared";
7
- import { ElPopover as j, ElText as G, ClickOutside as L } from "element-plus";
8
- import { stylePrefix as W } from "../__builtins__/configs/index.mjs";
2
+ import { ElPopover as O, ElText as S, ClickOutside as R } from "element-plus";
3
+ import { reaction as V } from "@formily/reactive";
4
+ import "@vueuse/core";
5
+ import { defineComponent as z, ref as m, createElementBlock as f, openBlock as n, normalizeClass as i, createVNode as u, unref as t, mergeProps as P, withCtx as d, withDirectives as F, createBlock as C, createElementVNode as _, createTextVNode as q, toDisplayString as N, renderSlot as T, computed as g, createCommentVNode as D, Fragment as M, nextTick as x } from "vue";
6
+ import "@formily/core";
7
+ import "@silver-formily/reactive-vue";
8
+ import { composeExport as j } from "../__builtins__/shared/utils.mjs";
9
+ import { FormBaseItem as c, fieldFeedbackMapper as A } from "../form-item/index.mjs";
10
+ import { Edit as I, Close as G } from "@element-plus/icons-vue";
11
+ import { isValid as $, isPlainObj as H } from "@formily/shared";
12
+ import { stylePrefix as L } from "../__builtins__/configs/index.mjs";
9
13
  import { o as k } from "../vendor/lodash.mjs";
10
- import { composeExport as H } from "../__builtins__/shared/utils.mjs";
11
14
  import '../styles/editable/index.css';const J = /* @__PURE__ */ z({
12
15
  name: "FEditablePopover",
13
16
  inheritAttrs: !1,
14
17
  __name: "editable-popover",
15
18
  props: {
19
+ internalFormItemClass: {},
16
20
  label: {},
17
21
  for: {},
18
22
  tooltip: {},
@@ -37,69 +41,69 @@ import '../styles/editable/index.css';const J = /* @__PURE__ */ z({
37
41
  tooltipLayout: {}
38
42
  },
39
43
  setup(b) {
40
- const a = b, e = E(), l = `${W}-editable`, s = m(), r = m(!1);
44
+ const a = b, e = E(), o = `${L}-editable`, s = m(), l = m(!1);
41
45
  if ($(e.value.data)) {
42
46
  /* istanbul ignore else -- @preserve */
43
47
  $(e.value.data.readPretty) || (e.value.data.readPretty = !0);
44
48
  } else
45
49
  e.value.data = {}, e.value.data.readPretty = !0;
46
- function v(o) {
47
- const f = s.value.parentElement;
50
+ function v(r) {
51
+ const p = s.value.parentElement;
48
52
  /* istanbul ignore else -- @preserve */
49
- f.contains(o.target) || (r.value = !1);
53
+ p.contains(r.target) || (l.value = !1);
50
54
  }
51
55
  function y() {
52
- r.value = !0;
56
+ l.value = !0;
53
57
  }
54
- return D(
58
+ return V(
55
59
  () => e.value.form.queryFeedbacks({
56
60
  type: "error",
57
61
  address: `${e.value.address.entire}.*`
58
62
  }),
59
- (o) => {
60
- o.length > 0 && (r.value = !0);
63
+ (r) => {
64
+ r.length > 0 && (l.value = !0);
61
65
  }
62
- ), (o, f) => (d(), p("div", {
63
- class: i(l)
66
+ ), (r, p) => (n(), f("div", {
67
+ class: i(o)
64
68
  }, [
65
- u(t(j), P(o.$attrs, {
66
- visible: r.value,
67
- title: o.$attrs.title || t(e).title,
69
+ u(t(O), P(r.$attrs, {
70
+ visible: l.value,
71
+ title: r.$attrs.title || t(e).title,
68
72
  trigger: "click",
69
73
  width: "auto"
70
74
  }), {
71
- default: n(() => [
72
- C("div", {
75
+ default: d(() => [
76
+ _("div", {
73
77
  ref_key: "contentRef",
74
78
  ref: s,
75
- class: i(`${l}-popover-wrapper`)
79
+ class: i(`${o}-popover-wrapper`)
76
80
  }, [
77
- A(o.$slots, "default")
81
+ T(r.$slots, "default")
78
82
  ], 2)
79
83
  ]),
80
- reference: n(() => [
81
- T((d(), _(t(c), P(a, {
82
- class: `${l}-trigger`
84
+ reference: d(() => [
85
+ F((n(), C(t(c), P(a, {
86
+ class: `${o}-trigger`
83
87
  }), {
84
- default: n(() => [
85
- C("div", {
86
- class: i(`${l}-content`),
88
+ default: d(() => [
89
+ _("div", {
90
+ class: i(`${o}-content`),
87
91
  onClick: y
88
92
  }, [
89
- u(t(G), null, {
90
- default: n(() => [
91
- S(V(t(e).title), 1)
93
+ u(t(S), null, {
94
+ default: d(() => [
95
+ q(N(t(e).title), 1)
92
96
  ]),
93
97
  _: 1
94
98
  }),
95
- u(t(F), {
96
- class: i(`${l}-edit-btn`)
99
+ u(t(I), {
100
+ class: i(`${o}-edit-btn`)
97
101
  }, null, 8, ["class"])
98
102
  ], 2)
99
103
  ]),
100
104
  _: 1
101
105
  }, 16, ["class"])), [
102
- [t(L), v]
106
+ [t(R), v]
103
107
  ])
104
108
  ]),
105
109
  _: 3
@@ -110,6 +114,7 @@ import '../styles/editable/index.css';const J = /* @__PURE__ */ z({
110
114
  name: "FEditable",
111
115
  __name: "editable",
112
116
  props: {
117
+ internalFormItemClass: {},
113
118
  label: {},
114
119
  for: {},
115
120
  tooltip: {},
@@ -135,58 +140,58 @@ import '../styles/editable/index.css';const J = /* @__PURE__ */ z({
135
140
  editProps: {}
136
141
  },
137
142
  setup(b) {
138
- const a = b, e = E(), l = m(null), s = `${W}-editable`, r = m(null), v = g(() => k(a, "editProps")), y = g(() => M(a.editProps) ? { ...k(a, "editProps"), ...a.editProps } : k(a, "editProps"));
139
- function o() {
143
+ const a = b, e = E(), o = m(null), s = `${L}-editable`, l = m(null), v = g(() => k(a, "editProps")), y = g(() => H(a.editProps) ? { ...k(a, "editProps"), ...a.editProps } : k(a, "editProps"));
144
+ function r() {
140
145
  $(e.value.data) || (e.value.data = {});
141
146
  }
142
- o(), e.value.data.readPretty = !0;
143
- async function f() {
144
- e.value.disabled || (o(), e.value.data.readPretty = !1, await x(), r.value.feedbackTooltipRef.updatePopper(), l.value?.querySelector("input")?.focus());
147
+ r(), e.value.data.readPretty = !0;
148
+ async function p() {
149
+ e.value.disabled || (r(), e.value.data.readPretty = !1, await x(), l.value.feedbackTooltipRef.updatePopper(), o.value?.querySelector("input")?.focus());
145
150
  }
146
151
  function B() {
147
- e.value.data?.readPretty !== !0 && (o(), setTimeout(async () => {
148
- e.value.data.readPretty = !0, await x(), r.value?.feedbackTooltipRef.updatePopper();
152
+ e.value.data?.readPretty !== !0 && (r(), setTimeout(async () => {
153
+ e.value.data.readPretty = !0, await x(), l.value?.feedbackTooltipRef.updatePopper();
149
154
  }, 0));
150
155
  }
151
- return (O, X) => (d(), p("div", {
156
+ return (W, X) => (n(), f("div", {
152
157
  ref_key: "innerRef",
153
- ref: l,
158
+ ref: o,
154
159
  class: i([s, t(e).disabled && "is-disabled"])
155
160
  }, [
156
- T((d(), p("div", {
161
+ F((n(), f("div", {
157
162
  class: i(`${s}-content`)
158
163
  }, [
159
164
  u(t(c), P({
160
165
  ref_key: "formItemRef",
161
- ref: r
162
- }, t(e).data?.readPretty === !1 ? y.value : v.value, { onClick: f }), {
163
- default: n(() => [
164
- C("div", null, [
165
- A(O.$slots, "default")
166
+ ref: l
167
+ }, t(e).data?.readPretty === !1 ? y.value : v.value, { onClick: p }), {
168
+ default: d(() => [
169
+ _("div", null, [
170
+ T(W.$slots, "default")
166
171
  ])
167
172
  ]),
168
173
  _: 3
169
174
  }, 16),
170
- t(e).disabled ? q("", !0) : (d(), p(I, { key: 0 }, [
171
- t(e).data?.readPretty === !0 ? (d(), _(t(c), {
175
+ t(e).disabled ? D("", !0) : (n(), f(M, { key: 0 }, [
176
+ t(e).data?.readPretty === !0 ? (n(), C(t(c), {
172
177
  key: 0,
173
178
  size: a.size,
174
179
  "feedback-layout": a.feedbackLayout
175
180
  }, {
176
- default: n(() => [
177
- u(t(F), {
181
+ default: d(() => [
182
+ u(t(I), {
178
183
  class: i(`${s}-edit-btn`),
179
- onClick: f
184
+ onClick: p
180
185
  }, null, 8, ["class"])
181
186
  ]),
182
187
  _: 1
183
- }, 8, ["size", "feedback-layout"])) : (d(), _(t(c), {
188
+ }, 8, ["size", "feedback-layout"])) : (n(), C(t(c), {
184
189
  key: 1,
185
190
  size: a.size,
186
191
  "feedback-layout": a.feedbackLayout
187
192
  }, {
188
- default: n(() => [
189
- u(t(N), {
193
+ default: d(() => [
194
+ u(t(G), {
190
195
  class: i(`${s}-close-btn`),
191
196
  onClick: B
192
197
  }, null, 8, ["class"])
@@ -195,7 +200,7 @@ import '../styles/editable/index.css';const J = /* @__PURE__ */ z({
195
200
  }, 8, ["size", "feedback-layout"]))
196
201
  ], 64))
197
202
  ], 2)), [
198
- [t(L), B]
203
+ [t(R), B]
199
204
  ])
200
205
  ], 2));
201
206
  }
@@ -204,18 +209,18 @@ import '../styles/editable/index.css';const J = /* @__PURE__ */ z({
204
209
  required: !0,
205
210
  description: "extra"
206
211
  },
207
- R
212
+ A
208
213
  )), U = h(J, w(
209
214
  {
210
215
  required: !0,
211
216
  description: "extra"
212
217
  },
213
- R
214
- )), de = H(Q, {
218
+ A
219
+ )), pe = j(Q, {
215
220
  Popover: U
216
221
  });
217
222
  export {
218
- de as Editable,
219
- de as default
223
+ pe as Editable,
224
+ pe as default
220
225
  };
221
226
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/editable/editable-popover.vue","../../src/editable/editable.vue","../../src/editable/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\r\nimport type { Field } from '@formily/core'\r\nimport type { IFormItemProps } from '../form-item/types'\r\nimport { Edit } from '@element-plus/icons-vue'\r\nimport { reaction } from '@formily/reactive'\r\nimport { isValid } from '@formily/shared'\r\nimport { useField } from '@silver-formily/vue'\r\nimport { ElPopover, ElText, ClickOutside as vClickOutside } from 'element-plus'\r\nimport { ref } from 'vue'\r\nimport { stylePrefix } from '../__builtins__/configs'\r\nimport { FormBaseItem } from '../form-item'\r\n\r\ndefineOptions({\r\n name: 'FEditablePopover',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = withDefaults(defineProps<IFormItemProps>(), {\r\n feedbackLayout: 'popover',\r\n size: 'default',\r\n})\r\n\r\nconst fieldRef = useField<Field>()\r\nconst prefixCls = `${stylePrefix}-editable`\r\nconst contentRef = ref<HTMLElement>()\r\nconst visible = ref(false)\r\n\r\nif (isValid(fieldRef.value.data)) {\r\n /* istanbul ignore else -- @preserve */\r\n if (!isValid(fieldRef.value.data.readPretty)) {\r\n fieldRef.value.data.readPretty = true\r\n }\r\n}\r\nelse {\r\n fieldRef.value.data = {}\r\n fieldRef.value.data.readPretty = true\r\n}\r\n\r\nfunction onClickOutside(e) {\r\n const popoverDOM = contentRef.value.parentElement\r\n /* istanbul ignore else -- @preserve */\r\n if (!popoverDOM.contains(e.target)) {\r\n visible.value = false\r\n }\r\n}\r\nfunction onClick() {\r\n visible.value = true\r\n}\r\n\r\nreaction(\r\n () => fieldRef.value.form.queryFeedbacks({\r\n type: 'error',\r\n address: `${fieldRef.value.address.entire}.*`,\r\n }),\r\n (errorList) => {\r\n if (errorList.length > 0) {\r\n visible.value = true\r\n }\r\n },\r\n)\r\n</script>\r\n\r\n<template>\r\n <div :class=\"prefixCls\">\r\n <ElPopover\r\n v-bind=\"$attrs\"\r\n :visible=\"visible\"\r\n :title=\"$attrs.title || fieldRef.title\" trigger=\"click\" width=\"auto\"\r\n >\r\n <template #default>\r\n <div ref=\"contentRef\" :class=\"`${prefixCls}-popover-wrapper`\">\r\n <slot />\r\n </div>\r\n </template>\r\n <template #reference>\r\n <FormBaseItem v-click-outside=\"onClickOutside\" v-bind=\"props\" :class=\"`${prefixCls}-trigger`\">\r\n <div :class=\"`${prefixCls}-content`\" @click=\"onClick\">\r\n <ElText>\r\n {{ fieldRef.title }}\r\n </ElText>\r\n <Edit :class=\"`${prefixCls}-edit-btn`\" />\r\n </div>\r\n </FormBaseItem>\r\n </template>\r\n </ElPopover>\r\n </div>\r\n</template>\r\n","<script lang=\"ts\" setup>\r\nimport type { Field } from '@formily/core'\r\nimport type { IFormItemProps } from '../form-item/types'\r\nimport { Close, Edit } from '@element-plus/icons-vue'\r\nimport { isPlainObj, isValid } from '@formily/shared'\r\nimport { useField } from '@silver-formily/vue'\r\nimport { ClickOutside as vClickOutside } from 'element-plus'\r\nimport { omit } from 'lodash-es'\r\nimport { computed, nextTick, ref } from 'vue'\r\nimport { stylePrefix } from '../__builtins__/configs'\r\nimport { FormBaseItem } from '../form-item'\r\n\r\ndefineOptions({\r\n name: 'FEditable',\r\n})\r\n\r\nconst props = withDefaults(defineProps<IFormItemProps & { editProps?: IFormItemProps }>(), {\r\n feedbackLayout: 'popover',\r\n size: 'default',\r\n})\r\n\r\nconst fieldRef = useField<Field>()\r\nconst innerRef = ref<HTMLElement>(null)\r\nconst prefixCls = `${stylePrefix}-editable`\r\nconst formItemRef = ref<InstanceType<typeof FormBaseItem>>(null)\r\n\r\nconst commonProps = computed(() => omit(props, 'editProps'))\r\nconst editProps = computed(() => {\r\n if (isPlainObj(props.editProps)) {\r\n return { ...omit(props, 'editProps'), ...props.editProps }\r\n }\r\n return omit(props, 'editProps')\r\n})\r\n\r\nfunction handleEnsureReadPretty() {\r\n if (!isValid(fieldRef.value.data)) {\r\n fieldRef.value.data = {}\r\n }\r\n}\r\n\r\nhandleEnsureReadPretty()\r\nfieldRef.value.data.readPretty = true\r\n\r\nasync function onClick() {\r\n if (fieldRef.value.disabled)\r\n return\r\n handleEnsureReadPretty()\r\n fieldRef.value.data.readPretty = false\r\n await nextTick()\r\n formItemRef.value.feedbackTooltipRef.updatePopper()\r\n innerRef.value?.querySelector('input')?.focus()\r\n}\r\n\r\nfunction onClickOutside() {\r\n if (fieldRef.value.data?.readPretty === true)\r\n return\r\n handleEnsureReadPretty()\r\n // 使用下拉菜单等触发的事件完成应有的操作\r\n setTimeout(async () => {\r\n fieldRef.value.data.readPretty = true\r\n await nextTick()\r\n formItemRef.value?.feedbackTooltipRef.updatePopper()\r\n }, 0)\r\n}\r\n</script>\r\n\r\n<template>\r\n <div ref=\"innerRef\" :class=\"[prefixCls, fieldRef.disabled && 'is-disabled']\">\r\n <div v-click-outside=\"onClickOutside\" :class=\"`${prefixCls}-content`\">\r\n <FormBaseItem ref=\"formItemRef\" v-bind=\"fieldRef.data?.readPretty === false ? editProps : commonProps\" @click=\"onClick\">\r\n <div>\r\n <slot />\r\n </div>\r\n </FormBaseItem>\r\n <template v-if=\"!fieldRef.disabled\">\r\n <template v-if=\"fieldRef.data?.readPretty === true\">\r\n <FormBaseItem :size=\"props.size\" :feedback-layout=\"props.feedbackLayout\">\r\n <Edit :class=\"`${prefixCls}-edit-btn`\" @click=\"onClick\" />\r\n </FormBaseItem>\r\n </template>\r\n <template v-else>\r\n <FormBaseItem :size=\"props.size\" :feedback-layout=\"props.feedbackLayout\">\r\n <Close :class=\"`${prefixCls}-close-btn`\" @click=\"onClickOutside\" />\r\n </FormBaseItem>\r\n </template>\r\n </template>\r\n </div>\r\n </div>\r\n</template>\r\n","import type { ElPopover } from 'element-plus'\r\nimport type { IFormItemProps } from '../form-item/types'\r\nimport { connect, mapProps } from '@silver-formily/vue'\r\nimport { composeExport } from '../__builtins__/shared'\r\nimport { fieldFeedbackMapper } from '../form-item'\r\nimport FEditablePopover from './editable-popover.vue'\r\nimport FEditable from './editable.vue'\r\nimport './style.scss'\r\n\r\nexport type EditableProps = IFormItemProps\r\nexport type EditablePopoverProps = typeof ElPopover\r\n\r\nconst EditableInner = connect<typeof FEditable>(FEditable, mapProps(\r\n {\r\n required: true,\r\n description: 'extra',\r\n },\r\n fieldFeedbackMapper,\r\n))\r\n\r\nconst EditablePopover = connect<typeof FEditablePopover>(FEditablePopover, mapProps(\r\n {\r\n required: true,\r\n description: 'extra',\r\n },\r\n fieldFeedbackMapper,\r\n))\r\n\r\nexport const Editable = composeExport(EditableInner, {\r\n Popover: EditablePopover,\r\n})\r\n\r\nexport default Editable\r\n"],"names":["props","__props","fieldRef","useField","prefixCls","stylePrefix","contentRef","ref","visible","isValid","onClickOutside","e","popoverDOM","onClick","reaction","errorList","_createElementBlock","_createVNode","_unref","ElPopover","_mergeProps","_ctx","$attrs","_createElementVNode","_renderSlot","_createBlock","FormBaseItem","ElText","_createTextVNode","_toDisplayString","Edit","innerRef","formItemRef","commonProps","computed","omit","editProps","isPlainObj","handleEnsureReadPretty","nextTick","_normalizeClass","_Fragment","Close","EditableInner","connect","FEditable","mapProps","fieldFeedbackMapper","EditablePopover","FEditablePopover","Editable","composeExport"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,UAAMA,IAAQC,GAKRC,IAAWC,EAAA,GACXC,IAAY,GAAGC,CAAW,aAC1BC,IAAaC,EAAA,GACbC,IAAUD,EAAI,EAAK;AAEzB,QAAIE,EAAQP,EAAS,MAAM,IAAI,GAAG;AAAA,MAAA;AAEhC,MAAKO,EAAQP,EAAS,MAAM,KAAK,UAAU,MACzCA,EAAS,MAAM,KAAK,aAAa;AAAA,IAErC;AAEE,MAAAA,EAAS,MAAM,OAAO,CAAA,GACtBA,EAAS,MAAM,KAAK,aAAa;AAGnC,aAASQ,EAAeC,GAAG;AACzB,YAAMC,IAAaN,EAAW,MAAM;AAAA,MAAA;AAEpC,MAAKM,EAAW,SAASD,EAAE,MAAM,MAC/BH,EAAQ,QAAQ;AAAA,IAEpB;AACA,aAASK,IAAU;AACjB,MAAAL,EAAQ,QAAQ;AAAA,IAClB;AAEA,WAAAM;AAAA,MACE,MAAMZ,EAAS,MAAM,KAAK,eAAe;AAAA,QACvC,MAAM;AAAA,QACN,SAAS,GAAGA,EAAS,MAAM,QAAQ,MAAM;AAAA,MAAA,CAC1C;AAAA,MACD,CAACa,MAAc;AACb,QAAIA,EAAU,SAAS,MACrBP,EAAQ,QAAQ;AAAA,MAEpB;AAAA,IAAA,mBAKAQ,EAsBM,OAAA;AAAA,MAtBA,SAAOZ,CAAS;AAAA,IAAA;MACpBa,EAoBYC,EAAAC,CAAA,GApBZC,EAoBYC,EAAA,QAnBI;AAAA,QACb,SAASb,EAAA;AAAA,QACT,OAAOc,EAAAA,OAAO,SAASJ,EAAAhB,CAAA,EAAS;AAAA,QAAO,SAAQ;AAAA,QAAQ,OAAM;AAAA,MAAA;QAEnD,WACT,MAEM;AAAA,UAFNqB,EAEM,OAAA;AAAA,qBAFG;AAAA,YAAJ,KAAIjB;AAAA,Y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,MAAmE;AAAA,cAAnEiB,EAAmEC,EAAAwB,CAAA,GAAA;AAAA,gBAA3D,YAAUtC,CAAS,YAAA;AAAA,gBAAe,SAAOM;AAAA,cAAA;;;;;;eAdnCA,CAAc;AAAA,MAAA;;;ICxDlCiC,IAAgBC,EAA0BC,GAAWC;AAAA,EACzD;AAAA,IACE,UAAU;AAAA,IACV,aAAa;AAAA,EAAA;AAAA,EAEfC;AACF,CAAC,GAEKC,IAAkBJ,EAAiCK,GAAkBH;AAAA,EACzE;AAAA,IACE,UAAU;AAAA,IACV,aAAa;AAAA,EAAA;AAAA,EAEfC;AACF,CAAC,GAEYG,KAAWC,EAAcR,GAAe;AAAA,EACnD,SAASK;AACX,CAAC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/editable/editable-popover.vue","../../src/editable/editable.vue","../../src/editable/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { Field } from '@formily/core'\nimport type { IFormItemProps } from '../form-item/types'\nimport { Edit } from '@element-plus/icons-vue'\nimport { reaction } from '@formily/reactive'\nimport { isValid } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport { ElPopover, ElText, ClickOutside as vClickOutside } from 'element-plus'\nimport { ref } from 'vue'\nimport { stylePrefix } from '../__builtins__/configs'\nimport { FormBaseItem } from '../form-item'\n\ndefineOptions({\n name: 'FEditablePopover',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IFormItemProps>(), {\n feedbackLayout: 'popover',\n size: 'default',\n})\n\nconst fieldRef = useField<Field>()\nconst prefixCls = `${stylePrefix}-editable`\nconst contentRef = ref<HTMLElement>()\nconst visible = ref(false)\n\nif (isValid(fieldRef.value.data)) {\n /* istanbul ignore else -- @preserve */\n if (!isValid(fieldRef.value.data.readPretty)) {\n fieldRef.value.data.readPretty = true\n }\n}\nelse {\n fieldRef.value.data = {}\n fieldRef.value.data.readPretty = true\n}\n\nfunction onClickOutside(e) {\n const popoverDOM = contentRef.value.parentElement\n /* istanbul ignore else -- @preserve */\n if (!popoverDOM.contains(e.target)) {\n visible.value = false\n }\n}\nfunction onClick() {\n visible.value = true\n}\n\nreaction(\n () => fieldRef.value.form.queryFeedbacks({\n type: 'error',\n address: `${fieldRef.value.address.entire}.*`,\n }),\n (errorList) => {\n if (errorList.length > 0) {\n visible.value = true\n }\n },\n)\n</script>\n\n<template>\n <div :class=\"prefixCls\">\n <ElPopover\n v-bind=\"$attrs\"\n :visible=\"visible\"\n :title=\"$attrs.title || fieldRef.title\" trigger=\"click\" width=\"auto\"\n >\n <template #default>\n <div ref=\"contentRef\" :class=\"`${prefixCls}-popover-wrapper`\">\n <slot />\n </div>\n </template>\n <template #reference>\n <FormBaseItem v-click-outside=\"onClickOutside\" v-bind=\"props\" :class=\"`${prefixCls}-trigger`\">\n <div :class=\"`${prefixCls}-content`\" @click=\"onClick\">\n <ElText>\n {{ fieldRef.title }}\n </ElText>\n <Edit :class=\"`${prefixCls}-edit-btn`\" />\n </div>\n </FormBaseItem>\n </template>\n </ElPopover>\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport type { Field } from '@formily/core'\nimport type { IFormItemProps } from '../form-item/types'\nimport { Close, Edit } from '@element-plus/icons-vue'\nimport { isPlainObj, isValid } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport { ClickOutside as vClickOutside } from 'element-plus'\nimport { omit } from 'lodash-es'\nimport { computed, nextTick, ref } from 'vue'\nimport { stylePrefix } from '../__builtins__/configs'\nimport { FormBaseItem } from '../form-item'\n\ndefineOptions({\n name: 'FEditable',\n})\n\nconst props = withDefaults(defineProps<IFormItemProps & { editProps?: IFormItemProps }>(), {\n feedbackLayout: 'popover',\n size: 'default',\n})\n\nconst fieldRef = useField<Field>()\nconst innerRef = ref<HTMLElement>(null)\nconst prefixCls = `${stylePrefix}-editable`\nconst formItemRef = ref<InstanceType<typeof FormBaseItem>>(null)\n\nconst commonProps = computed(() => omit(props, 'editProps'))\nconst editProps = computed(() => {\n if (isPlainObj(props.editProps)) {\n return { ...omit(props, 'editProps'), ...props.editProps }\n }\n return omit(props, 'editProps')\n})\n\nfunction handleEnsureReadPretty() {\n if (!isValid(fieldRef.value.data)) {\n fieldRef.value.data = {}\n }\n}\n\nhandleEnsureReadPretty()\nfieldRef.value.data.readPretty = true\n\nasync function onClick() {\n if (fieldRef.value.disabled)\n return\n handleEnsureReadPretty()\n fieldRef.value.data.readPretty = false\n await nextTick()\n formItemRef.value.feedbackTooltipRef.updatePopper()\n innerRef.value?.querySelector('input')?.focus()\n}\n\nfunction onClickOutside() {\n if (fieldRef.value.data?.readPretty === true)\n return\n handleEnsureReadPretty()\n // 使用下拉菜单等触发的事件完成应有的操作\n setTimeout(async () => {\n fieldRef.value.data.readPretty = true\n await nextTick()\n formItemRef.value?.feedbackTooltipRef.updatePopper()\n }, 0)\n}\n</script>\n\n<template>\n <div ref=\"innerRef\" :class=\"[prefixCls, fieldRef.disabled && 'is-disabled']\">\n <div v-click-outside=\"onClickOutside\" :class=\"`${prefixCls}-content`\">\n <FormBaseItem ref=\"formItemRef\" v-bind=\"fieldRef.data?.readPretty === false ? editProps : commonProps\" @click=\"onClick\">\n <div>\n <slot />\n </div>\n </FormBaseItem>\n <template v-if=\"!fieldRef.disabled\">\n <template v-if=\"fieldRef.data?.readPretty === true\">\n <FormBaseItem :size=\"props.size\" :feedback-layout=\"props.feedbackLayout\">\n <Edit :class=\"`${prefixCls}-edit-btn`\" @click=\"onClick\" />\n </FormBaseItem>\n </template>\n <template v-else>\n <FormBaseItem :size=\"props.size\" :feedback-layout=\"props.feedbackLayout\">\n <Close :class=\"`${prefixCls}-close-btn`\" @click=\"onClickOutside\" />\n </FormBaseItem>\n </template>\n </template>\n </div>\n </div>\n</template>\n","import type { ElPopover } from 'element-plus'\nimport type { IFormItemProps } from '../form-item/types'\nimport { connect, mapProps } from '@silver-formily/vue'\nimport { composeExport } from '../__builtins__/shared'\nimport { fieldFeedbackMapper } from '../form-item'\nimport FEditablePopover from './editable-popover.vue'\nimport FEditable from './editable.vue'\nimport './style.scss'\n\nexport type EditableProps = IFormItemProps\nexport type EditablePopoverProps = typeof ElPopover\n\nconst EditableInner = connect<typeof FEditable>(FEditable, mapProps(\n {\n required: true,\n description: 'extra',\n },\n fieldFeedbackMapper,\n))\n\nconst EditablePopover = connect<typeof FEditablePopover>(FEditablePopover, mapProps(\n {\n required: true,\n description: 'extra',\n },\n fieldFeedbackMapper,\n))\n\nexport const Editable = composeExport(EditableInner, {\n Popover: EditablePopover,\n})\n\nexport default Editable\n"],"names":["props","__props","fieldRef","useField","prefixCls","stylePrefix","contentRef","ref","visible","isValid","onClickOutside","e","popoverDOM","onClick","reaction","errorList","_createElementBlock","_createVNode","_unref","ElPopover","_mergeProps","_ctx","$attrs","_createElementVNode","_renderSlot","_createBlock","FormBaseItem","ElText","_createTextVNode","_toDisplayString","Edit","innerRef","formItemRef","commonProps","computed","omit","editProps","isPlainObj","handleEnsureReadPretty","nextTick","_normalizeClass","_Fragment","Close","EditableInner","connect","FEditable","mapProps","fieldFeedbackMapper","EditablePopover","FEditablePopover","Editable","composeExport"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,UAAMA,IAAQC,GAKRC,IAAWC,EAAA,GACXC,IAAY,GAAGC,CAAW,aAC1BC,IAAaC,EAAA,GACbC,IAAUD,EAAI,EAAK;AAEzB,QAAIE,EAAQP,EAAS,MAAM,IAAI,GAAG;AAAA,MAAA;AAEhC,MAAKO,EAAQP,EAAS,MAAM,KAAK,UAAU,MACzCA,EAAS,MAAM,KAAK,aAAa;AAAA,IAErC;AAEE,MAAAA,EAAS,MAAM,OAAO,CAAA,GACtBA,EAAS,MAAM,KAAK,aAAa;AAGnC,aAASQ,EAAeC,GAAG;AACzB,YAAMC,IAAaN,EAAW,MAAM;AAAA,MAAA;AAEpC,MAAKM,EAAW,SAASD,EAAE,MAAM,MAC/BH,EAAQ,QAAQ;AAAA,IAEpB;AACA,aAASK,IAAU;AACjB,M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AAYH,EAAA,OAAW,EAAG,SAAApB,EAAA,CAAc,GAAA;AAAA,qBACpH,MAEM;AAAA,YAFNU,EAEM,OAAA,MAAA;AAAA,cADJC,EAAQH,EAAA,QAAA,SAAA;AAAA,YAAA;;;;QAGKH,EAAAhB,CAAA,EAAS,6BAA1Bc,EAWWyB,GAAA,EAAA,KAAA,KAAA;AAAA,UAVOvB,EAAAhB,CAAA,EAAS,MAAM,eAAU,WACvCuB,EAEeP,EAAAQ,CAAA,GAAA;AAAA;YAFA,MAAM1B,EAAM;AAAA,YAAO,mBAAiBA,EAAM;AAAA,UAAA;uBACvD,MAA0D;AAAA,cAA1DiB,EAA0DC,EAAAY,CAAA,GAAA;AAAA,gBAAnD,YAAU1B,CAAS,WAAA;AAAA,gBAAc,SAAAS;AAAA,cAAA;;;sDAI1CY,EAEeP,EAAAQ,CAAA,GAAA;AAAA;YAFA,MAAM1B,EAAM;AAAA,YAAO,mBAAiBA,EAAM;AAAA,UAAA;uBACvD,MAAmE;AAAA,cAAnEiB,EAAmEC,EAAAwB,CAAA,GAAA;AAAA,gBAA3D,YAAUtC,CAAS,YAAA;AAAA,gBAAe,SAAOM;AAAA,cAAA;;;;;;eAdnCA,CAAc;AAAA,MAAA;;;ICxDlCiC,IAAgBC,EAA0BC,GAAWC;AAAA,EACzD;AAAA,IACE,UAAU;AAAA,IACV,aAAa;AAAA,EAAA;AAAA,EAEfC;AACF,CAAC,GAEKC,IAAkBJ,EAAiCK,GAAkBH;AAAA,EACzE;AAAA,IACE,UAAU;AAAA,IACV,aAAa;AAAA,EAAA;AAAA,EAEfC;AACF,CAAC,GAEYG,KAAWC,EAAcR,GAAe;AAAA,EACnD,SAASK;AACX,CAAC;"}
package/esm/form/form.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as h, createBlock as f, createCommentVNode as S, openBlock as p, unref as t, withCtx as i, createVNode as n, mergeProps as d, renderSlot as s, withModifiers as F } from "vue";
2
2
  import { useForm as v, FormProvider as w } from "@silver-formily/vue";
3
- import { PreviewText as c } from "../preview-text/index.mjs";
4
- import { _ as b } from "../form-layout/form-layout.mjs";
3
+ import { _ as c } from "../form-layout/form-layout.mjs";
4
+ import { PreviewText as b } from "../preview-text/index.mjs";
5
5
  const $ = /* @__PURE__ */ h({
6
6
  name: "FForm",
7
7
  inheritAttrs: !1,
@@ -30,11 +30,11 @@ const $ = /* @__PURE__ */ h({
30
30
  form: o.form
31
31
  }, {
32
32
  default: i(() => [
33
- n(t(c), {
33
+ n(t(b), {
34
34
  placeholder: o.previewTextPlaceholder
35
35
  }, {
36
36
  default: i(() => [
37
- n(t(b), d(m.$attrs, {
37
+ n(t(c), d(m.$attrs, {
38
38
  onSubmit: r[0] || (r[0] = (e) => a(e, l.form))
39
39
  }), {
40
40
  default: i(() => [
@@ -47,12 +47,12 @@ const $ = /* @__PURE__ */ h({
47
47
  }, 8, ["placeholder"])
48
48
  ]),
49
49
  _: 3
50
- }, 8, ["form"])) : t(u) ? (p(), f(t(c), {
50
+ }, 8, ["form"])) : t(u) ? (p(), f(t(b), {
51
51
  key: 1,
52
52
  placeholder: o.previewTextPlaceholder
53
53
  }, {
54
54
  default: i(() => [
55
- n(t(b), d(m.$attrs, {
55
+ n(t(c), d(m.$attrs, {
56
56
  onSubmit: r[1] || (r[1] = F((e) => a(e, t(u)), ["prevent", "stop"]))
57
57
  }), {
58
58
  default: i(() => [
@@ -1 +1 @@
1
- {"version":3,"file":"form.mjs","sources":["../../src/form/form.vue"],"sourcesContent":["<script lang=\"ts\" setup>\r\nimport type { Form as FormType, IFormFeedback } from '@formily/core'\r\nimport type { PropType } from 'vue'\r\nimport { FormProvider, useForm } from '@silver-formily/vue'\r\nimport { FormLayout } from '../form-layout'\r\nimport { PreviewText } from '../preview-text'\r\n\r\ndefineOptions({\r\n name: 'FForm',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = defineProps({\r\n form: {\r\n type: Object as PropType<FormType>,\r\n },\r\n previewTextPlaceholder: {\r\n type: String,\r\n },\r\n onAutoSubmit: {\r\n type: Function as PropType<(values: FormType['values']) => Promise<any>>,\r\n },\r\n onAutoSubmitFailed: {\r\n type: Function as PropType<(error: IFormFeedback[]) => void>,\r\n },\r\n})\r\n\r\nconst top = useForm()\r\n\r\nfunction handleSubmit(e: Event, form: FormType) {\r\n form\r\n .submit(values => props.onAutoSubmit?.(values))\r\n .catch(error => props.onAutoSubmitFailed?.(error))\r\n}\r\n</script>\r\n\r\n<template>\r\n <FormProvider v-if=\"props.form\" :form=\"props.form\">\r\n <PreviewText :placeholder=\"props.previewTextPlaceholder\">\r\n <FormLayout v-bind=\"$attrs\" @submit=\"(e) => handleSubmit(e, form)\">\r\n <slot />\r\n </FormLayout>\r\n </PreviewText>\r\n </FormProvider>\r\n <template v-else-if=\"top\">\r\n <PreviewText :placeholder=\"props.previewTextPlaceholder\">\r\n <FormLayout\r\n v-bind=\"$attrs\"\r\n @submit.prevent.stop=\"(e) => handleSubmit(e, top)\"\r\n >\r\n <slot />\r\n </FormLayout>\r\n </PreviewText>\r\n </template>\r\n</template>\r\n"],"names":["props","__props","top","useForm","handleSubmit","e","form","values","error","_createBlock","_unref","FormProvider","_createVNode","PreviewText","FormLayout","_mergeProps","_ctx","_renderSlot"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAYA,UAAMA,IAAQC,GAeRC,IAAMC,EAAA;AAEZ,aAASC,EAAaC,GAAUC,GAAgB;AAC9C,MAAAA,EACG,OAAO,CAAAC,MAAUP,EAAM,eAAeO,CAAM,CAAC,EAC7C,MAAM,CAAAC,MAASR,EAAM,qBAAqBQ,CAAK,CAAC;AAAA,IACrD;qBAIsBR,EAAM,aAA1BS,EAMeC,EAAAC,CAAA,GAAA;AAAA;MANkB,MAAMX,EAAM;AAAA,IAAA;iBAC3C,MAIc;AAAA,QAJdY,EAIcF,EAAAG,CAAA,GAAA;AAAA,UAJA,aAAab,EAAM;AAAA,QAAA;qBAC/B,MAEa;AAAA,YAFbY,EAEaF,EAAAI,CAAA,GAFbC,EAEaC,EAAA,QAFa;AAAA,cAAG,2BAAS,MAAMZ,EAAa,GAAGH,EAAA,IAAI;AAAA,YAAA;yBAC9D,MAAQ;AAAA,gBAARgB,EAAQD,EAAA,QAAA,SAAA;AAAA,cAAA;;;;;;;;uBAION,EAAAR,CAAA,UACnBO,EAOcC,EAAAG,CAAA,GAAA;AAAA;MAPA,aAAab,EAAM;AAAA,IAAA;iBAC/B,MAKa;AAAA,QALbY,EAKaF,EAAAI,CAAA,GALbC,EAKaC,EAAA,QAJG;AAAA,UACb,6BAAsB,MAAMZ,EAAa,GAAGM,EAAAR,CAAA,CAAG,GAAA,CAAA,WAAA,MAAA,CAAA;AAAA,QAAA;qBAEhD,MAAQ;AAAA,YAARe,EAAQD,EAAA,QAAA,SAAA;AAAA,UAAA;;;;;;;;"}
1
+ {"version":3,"file":"form.mjs","sources":["../../src/form/form.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { Form as FormType, IFormFeedback } from '@formily/core'\nimport type { PropType } from 'vue'\nimport { FormProvider, useForm } from '@silver-formily/vue'\nimport { FormLayout } from '../form-layout'\nimport { PreviewText } from '../preview-text'\n\ndefineOptions({\n name: 'FForm',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n form: {\n type: Object as PropType<FormType>,\n },\n previewTextPlaceholder: {\n type: String,\n },\n onAutoSubmit: {\n type: Function as PropType<(values: FormType['values']) => Promise<any>>,\n },\n onAutoSubmitFailed: {\n type: Function as PropType<(error: IFormFeedback[]) => void>,\n },\n})\n\nconst top = useForm()\n\nfunction handleSubmit(e: Event, form: FormType) {\n form\n .submit(values => props.onAutoSubmit?.(values))\n .catch(error => props.onAutoSubmitFailed?.(error))\n}\n</script>\n\n<template>\n <FormProvider v-if=\"props.form\" :form=\"props.form\">\n <PreviewText :placeholder=\"props.previewTextPlaceholder\">\n <FormLayout v-bind=\"$attrs\" @submit=\"(e) => handleSubmit(e, form)\">\n <slot />\n </FormLayout>\n </PreviewText>\n </FormProvider>\n <template v-else-if=\"top\">\n <PreviewText :placeholder=\"props.previewTextPlaceholder\">\n <FormLayout\n v-bind=\"$attrs\"\n @submit.prevent.stop=\"(e) => handleSubmit(e, top)\"\n >\n <slot />\n </FormLayout>\n </PreviewText>\n </template>\n</template>\n"],"names":["props","__props","top","useForm","handleSubmit","e","form","values","error","_createBlock","_unref","FormProvider","_createVNode","PreviewText","FormLayout","_mergeProps","_ctx","_renderSlot"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAYA,UAAMA,IAAQC,GAeRC,IAAMC,EAAA;AAEZ,aAASC,EAAaC,GAAUC,GAAgB;AAC9C,MAAAA,EACG,OAAO,CAAAC,MAAUP,EAAM,eAAeO,CAAM,CAAC,EAC7C,MAAM,CAAAC,MAASR,EAAM,qBAAqBQ,CAAK,CAAC;AAAA,IACrD;qBAIsBR,EAAM,aAA1BS,EAMeC,EAAAC,CAAA,GAAA;AAAA;MANkB,MAAMX,EAAM;AAAA,IAAA;iBAC3C,MAIc;AAAA,QAJdY,EAIcF,EAAAG,CAAA,GAAA;AAAA,UAJA,aAAab,EAAM;AAAA,QAAA;qBAC/B,MAEa;AAAA,YAFbY,EAEaF,EAAAI,CAAA,GAFbC,EAEaC,EAAA,QAFa;AAAA,cAAG,2BAAS,MAAMZ,EAAa,GAAGH,EAAA,IAAI;AAAA,YAAA;yBAC9D,MAAQ;AAAA,gBAARgB,EAAQD,EAAA,QAAA,SAAA;AAAA,cAAA;;;;;;;;uBAION,EAAAR,CAAA,UACnBO,EAOcC,EAAAG,CAAA,GAAA;AAAA;MAPA,aAAab,EAAM;AAAA,IAAA;iBAC/B,MAKa;AAAA,QALbY,EAKaF,EAAAI,CAAA,GALbC,EAKaC,EAAA,QAJG;AAAA,UACb,6BAAsB,MAAMZ,EAAa,GAAGM,EAAAR,CAAA,CAAG,GAAA,CAAA,WAAA,MAAA,CAAA;AAAA,QAAA;qBAEhD,MAAQ;AAAA,YAARe,EAAQD,EAAA,QAAA,SAAA;AAAA,UAAA;;;;;;;;"}
@@ -13,6 +13,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
13
13
  type: StringConstructor;
14
14
  default: string;
15
15
  };
16
+ inline: {
17
+ type: BooleanConstructor;
18
+ default: boolean;
19
+ };
16
20
  gutter: {
17
21
  type: NumberConstructor;
18
22
  default: number;
@@ -26,6 +30,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
26
30
  type: StringConstructor;
27
31
  default: string;
28
32
  };
33
+ inline: {
34
+ type: BooleanConstructor;
35
+ default: boolean;
36
+ };
29
37
  gutter: {
30
38
  type: NumberConstructor;
31
39
  default: number;
@@ -37,6 +45,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
37
45
  }>> & Readonly<{}>, {
38
46
  align: string;
39
47
  gutter: number;
48
+ inline: boolean;
40
49
  alignFormItem: boolean;
41
50
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
42
51
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
@@ -4,6 +4,10 @@ export declare const FormButtonGroup: {
4
4
  type: StringConstructor;
5
5
  default: string;
6
6
  };
7
+ inline: {
8
+ type: BooleanConstructor;
9
+ default: boolean;
10
+ };
7
11
  gutter: {
8
12
  type: NumberConstructor;
9
13
  default: number;
@@ -15,6 +19,7 @@ export declare const FormButtonGroup: {
15
19
  }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
16
20
  align: string;
17
21
  gutter: number;
22
+ inline: boolean;
18
23
  alignFormItem: boolean;
19
24
  }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
20
25
  P: {};
@@ -28,6 +33,10 @@ export declare const FormButtonGroup: {
28
33
  type: StringConstructor;
29
34
  default: string;
30
35
  };
36
+ inline: {
37
+ type: BooleanConstructor;
38
+ default: boolean;
39
+ };
31
40
  gutter: {
32
41
  type: NumberConstructor;
33
42
  default: number;
@@ -39,6 +48,7 @@ export declare const FormButtonGroup: {
39
48
  }>> & Readonly<{}>, {}, {}, {}, {}, {
40
49
  align: string;
41
50
  gutter: number;
51
+ inline: boolean;
42
52
  alignFormItem: boolean;
43
53
  }>;
44
54
  __isFragment?: never;
@@ -49,6 +59,10 @@ export declare const FormButtonGroup: {
49
59
  type: StringConstructor;
50
60
  default: string;
51
61
  };
62
+ inline: {
63
+ type: BooleanConstructor;
64
+ default: boolean;
65
+ };
52
66
  gutter: {
53
67
  type: NumberConstructor;
54
68
  default: number;
@@ -60,6 +74,7 @@ export declare const FormButtonGroup: {
60
74
  }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
61
75
  align: string;
62
76
  gutter: number;
77
+ inline: boolean;
63
78
  alignFormItem: boolean;
64
79
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
65
80
  $slots: {