@farris/ui-vue 1.3.0 → 1.3.3

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 (305) hide show
  1. package/components/accordion/index.esm.js +103 -99
  2. package/components/accordion/index.umd.cjs +1 -1
  3. package/components/avatar/index.esm.js +454 -398
  4. package/components/avatar/index.umd.cjs +1 -1
  5. package/components/binding-selector/index.esm.js +444 -0
  6. package/components/binding-selector/index.umd.cjs +1 -0
  7. package/components/binding-selector/package.json +8 -0
  8. package/components/border-editor/index.esm.js +5 -3
  9. package/components/border-editor/index.umd.cjs +1 -1
  10. package/components/button-edit/index.esm.js +143 -139
  11. package/components/button-edit/index.umd.cjs +1 -1
  12. package/components/calendar/index.esm.js +479 -476
  13. package/components/calendar/index.umd.cjs +1 -1
  14. package/components/capsule/index.esm.js +255 -252
  15. package/components/capsule/index.umd.cjs +1 -1
  16. package/components/checkbox/index.esm.js +652 -567
  17. package/components/checkbox/index.umd.cjs +1 -1
  18. package/components/color-picker/index.esm.js +518 -521
  19. package/components/color-picker/index.umd.cjs +2 -2
  20. package/components/combo-list/index.esm.js +659 -553
  21. package/components/combo-list/index.umd.cjs +1 -1
  22. package/components/combo-tree/index.esm.js +162 -155
  23. package/components/combo-tree/index.umd.cjs +1 -1
  24. package/components/common/index.esm.js +866 -747
  25. package/components/common/index.umd.cjs +1 -1
  26. package/components/component/index.esm.js +371 -998
  27. package/components/component/index.umd.cjs +1 -1
  28. package/components/condition/index.esm.js +1174 -1280
  29. package/components/condition/index.umd.cjs +1 -1
  30. package/components/content-container/index.esm.js +340 -991
  31. package/components/content-container/index.umd.cjs +1 -1
  32. package/components/data-grid/index.esm.js +6066 -5847
  33. package/components/data-grid/index.umd.cjs +1 -1
  34. package/components/data-view/index.esm.js +3400 -3486
  35. package/components/data-view/index.umd.cjs +1 -1
  36. package/components/date-picker/index.esm.js +2328 -2446
  37. package/components/date-picker/index.umd.cjs +1 -1
  38. package/components/designer-canvas/index.css +1 -1
  39. package/components/designer-canvas/index.esm.js +9551 -1200
  40. package/components/designer-canvas/index.umd.cjs +1 -1
  41. package/components/designer-outline/index.esm.js +2 -1
  42. package/components/designer-outline/index.umd.cjs +1 -1
  43. package/components/drawer/index.esm.js +34 -38
  44. package/components/drawer/index.umd.cjs +1 -1
  45. package/components/dropdown/index.esm.js +234 -231
  46. package/components/dropdown/index.umd.cjs +2 -2
  47. package/components/dynamic-form/index.esm.js +1996 -2630
  48. package/components/dynamic-form/index.umd.cjs +1 -1
  49. package/components/dynamic-resolver/index.esm.js +138 -123
  50. package/components/dynamic-resolver/index.umd.cjs +1 -1
  51. package/components/dynamic-view/index.esm.js +218 -218
  52. package/components/dynamic-view/index.umd.cjs +1 -1
  53. package/components/event-parameter/index.esm.js +311 -0
  54. package/components/event-parameter/index.umd.cjs +1 -0
  55. package/components/event-parameter/package.json +8 -0
  56. package/components/events-editor/index.css +1 -1
  57. package/components/events-editor/index.esm.js +548 -586
  58. package/components/events-editor/index.umd.cjs +1 -1
  59. package/components/expression-editor/index.esm.js +95 -91
  60. package/components/expression-editor/index.umd.cjs +1 -1
  61. package/components/external-container/index.esm.js +2871 -3736
  62. package/components/external-container/index.umd.cjs +1 -1
  63. package/components/field-selector/index.esm.js +3380 -3645
  64. package/components/field-selector/index.umd.cjs +1 -1
  65. package/components/filter-bar/index.css +1 -1
  66. package/components/filter-bar/index.esm.js +10543 -3207
  67. package/components/filter-bar/index.umd.cjs +1 -1
  68. package/components/flow-canvas/index.css +1 -1
  69. package/components/flow-canvas/index.esm.js +9775 -1312
  70. package/components/flow-canvas/index.umd.cjs +1 -1
  71. package/components/image-cropper/index.esm.js +442 -438
  72. package/components/image-cropper/index.umd.cjs +1 -1
  73. package/components/input-group/index.esm.js +587 -807
  74. package/components/input-group/index.umd.cjs +1 -1
  75. package/components/layout/index.esm.js +415 -381
  76. package/components/layout/index.umd.cjs +1 -1
  77. package/components/list-nav/index.esm.js +361 -1024
  78. package/components/list-nav/index.umd.cjs +1 -1
  79. package/components/list-view/index.esm.js +2265 -2371
  80. package/components/list-view/index.umd.cjs +1 -1
  81. package/components/lookup/index.esm.js +6425 -6257
  82. package/components/lookup/index.umd.cjs +1 -1
  83. package/components/mapping-editor/index.esm.js +6164 -5946
  84. package/components/mapping-editor/index.umd.cjs +1 -1
  85. package/components/message-box/index.esm.js +252 -252
  86. package/components/message-box/index.umd.cjs +1 -1
  87. package/components/modal/index.esm.js +70 -70
  88. package/components/modal/index.umd.cjs +1 -1
  89. package/components/nav/index.esm.js +524 -1474
  90. package/components/nav/index.umd.cjs +3 -3
  91. package/components/number-range/index.esm.js +547 -502
  92. package/components/number-range/index.umd.cjs +1 -1
  93. package/components/number-spinner/index.esm.js +646 -574
  94. package/components/number-spinner/index.umd.cjs +1 -1
  95. package/components/order/index.esm.js +1181 -2028
  96. package/components/order/index.umd.cjs +1 -1
  97. package/components/page-footer/index.esm.js +134 -131
  98. package/components/page-footer/index.umd.cjs +1 -1
  99. package/components/page-header/index.esm.js +1185 -2027
  100. package/components/page-header/index.umd.cjs +1 -1
  101. package/components/pagination/index.esm.js +442 -1368
  102. package/components/pagination/index.umd.cjs +1 -1
  103. package/components/progress/index.esm.js +238 -235
  104. package/components/progress/index.umd.cjs +3 -3
  105. package/components/property-editor/index.esm.js +1635 -1713
  106. package/components/property-editor/index.umd.cjs +2 -2
  107. package/components/property-panel/index.esm.js +791 -716
  108. package/components/property-panel/index.umd.cjs +1 -1
  109. package/components/query-solution/index.css +1 -1
  110. package/components/query-solution/index.esm.js +12203 -5274
  111. package/components/query-solution/index.umd.cjs +6 -1
  112. package/components/radio-button/index.esm.js +97 -97
  113. package/components/radio-button/index.umd.cjs +1 -1
  114. package/components/radio-group/index.css +1 -1
  115. package/components/radio-group/index.esm.js +1873 -520
  116. package/components/radio-group/index.umd.cjs +1 -1
  117. package/components/rate/index.esm.js +299 -300
  118. package/components/rate/index.umd.cjs +1 -1
  119. package/components/response-layout/index.esm.js +176 -173
  120. package/components/response-layout/index.umd.cjs +1 -1
  121. package/components/response-layout-editor/index.esm.js +715 -659
  122. package/components/response-layout-editor/index.umd.cjs +1 -1
  123. package/components/response-toolbar/index.esm.js +1032 -1883
  124. package/components/response-toolbar/index.umd.cjs +1 -1
  125. package/components/schema-selector/index.esm.js +4767 -5693
  126. package/components/schema-selector/index.umd.cjs +2 -2
  127. package/components/search-box/index.esm.js +169 -161
  128. package/components/search-box/index.umd.cjs +1 -1
  129. package/components/section/index.esm.js +490 -1167
  130. package/components/section/index.umd.cjs +1 -1
  131. package/components/smoke-detector/index.esm.js +154 -151
  132. package/components/smoke-detector/index.umd.cjs +1 -1
  133. package/components/splitter/index.esm.js +575 -1204
  134. package/components/splitter/index.umd.cjs +1 -1
  135. package/components/splitter/style.js +2 -0
  136. package/components/step/index.esm.js +279 -276
  137. package/components/step/index.umd.cjs +1 -1
  138. package/components/switch/index.esm.js +478 -428
  139. package/components/switch/index.umd.cjs +1 -1
  140. package/components/tabs/index.esm.js +2591 -3326
  141. package/components/tabs/index.umd.cjs +1 -1
  142. package/components/tags/index.esm.js +442 -439
  143. package/components/tags/index.umd.cjs +1 -1
  144. package/components/text/index.esm.js +309 -307
  145. package/components/text/index.umd.cjs +1 -1
  146. package/components/textarea/index.esm.js +500 -430
  147. package/components/textarea/index.umd.cjs +1 -1
  148. package/components/time-picker/index.esm.js +1391 -1341
  149. package/components/time-picker/index.umd.cjs +1 -1
  150. package/components/transfer/index.esm.js +574 -575
  151. package/components/transfer/index.umd.cjs +1 -1
  152. package/components/tree-grid/index.esm.js +3422 -3536
  153. package/components/tree-grid/index.umd.cjs +1 -1
  154. package/components/tree-view/index.esm.js +2661 -2764
  155. package/components/tree-view/index.umd.cjs +1 -1
  156. package/components/uploader/index.esm.js +675 -674
  157. package/components/uploader/index.umd.cjs +2 -2
  158. package/components/verify-detail/index.esm.js +300 -297
  159. package/components/verify-detail/index.umd.cjs +1 -1
  160. package/components/video/index.esm.js +454 -1089
  161. package/components/video/index.umd.cjs +1 -1
  162. package/components/weather/index.esm.js +709 -706
  163. package/components/weather/index.umd.cjs +5 -5
  164. package/farris.all.esm.js +54780 -52757
  165. package/farris.all.umd.cjs +14 -9
  166. package/index.css +1 -1
  167. package/package.json +1 -1
  168. package/types/binding-selector/index.d.ts +55 -0
  169. package/types/binding-selector/src/binding-selector.component.d.ts +11 -0
  170. package/types/binding-selector/src/binding-selector.props.d.ts +52 -0
  171. package/types/binding-selector/src/components/binding-selector-container.component.d.ts +13 -0
  172. package/types/binding-selector/src/composition/use-field-selection.d.ts +9 -0
  173. package/types/combo-list/src/components/list-container.component.d.ts +6 -6
  174. package/types/combo-list/src/components/list-container.props.d.ts +1 -1
  175. package/types/combo-tree/src/components/tree-container.component.d.ts +5 -5
  176. package/types/common/directive/area-response.d.ts +10 -0
  177. package/types/common/entity/entity-schema.d.ts +26 -11
  178. package/types/common/index.d.ts +9 -0
  179. package/types/common/radio-checkbox/radio-checkbox.props.d.ts +1 -0
  180. package/types/common/types.d.ts +2 -2
  181. package/types/common/utils/resolve-field.d.ts +2 -0
  182. package/types/common/utils/use-class.d.ts +7 -0
  183. package/types/component/src/designer/use-designer-rules.d.ts +2 -2
  184. package/types/condition/src/condition-fields.design.component.d.ts +18 -0
  185. package/types/condition/src/types.d.ts +5 -4
  186. package/types/content-container/src/designer/use-designer-rules.d.ts +3 -3
  187. package/types/data-grid/index.d.ts +8 -5
  188. package/types/data-grid/src/composition/data-grid-component-creator.service.d.ts +20 -0
  189. package/types/data-grid/src/{designer/data-grid-column.props.d.ts → data-grid-column.props.d.ts} +1 -1
  190. package/types/data-grid/src/data-grid.component.d.ts +3 -2
  191. package/types/data-grid/src/data-grid.props.d.ts +2 -2
  192. package/types/data-grid/src/designer/data-grid.design.component.d.ts +2 -2
  193. package/types/data-grid/src/designer/grid-field-editor.component.d.ts +14 -14
  194. package/types/data-grid/src/designer/use-designer-rules.d.ts +2 -2
  195. package/types/data-grid/src/schema/schema-resolver.d.ts +1 -1
  196. package/types/data-view/components/row/hierarchy-row.component.d.ts +2 -2
  197. package/types/data-view/composition/data/use-tree-data.d.ts +1 -1
  198. package/types/data-view/composition/types.d.ts +9 -11
  199. package/types/date-picker/src/components/calendar/calendar.component.d.ts +3 -3
  200. package/types/date-picker/src/components/month/month.component.d.ts +3 -3
  201. package/types/date-picker/src/components/year/year.component.d.ts +3 -3
  202. package/types/designer-canvas/index.d.ts +3 -1
  203. package/types/designer-canvas/src/composition/dg-control.d.ts +5 -0
  204. package/types/designer-canvas/src/composition/function/drag-resolve.d.ts +5 -0
  205. package/types/designer-canvas/src/composition/rule/use-dragula-common-rule.d.ts +4 -0
  206. package/types/designer-canvas/src/composition/rule/use-template-rule.d.ts +30 -0
  207. package/types/designer-canvas/src/composition/types.d.ts +49 -41
  208. package/types/designer-canvas/src/types.d.ts +10 -21
  209. package/types/dynamic-form/index.d.ts +1 -1
  210. package/types/dynamic-form/src/designer/form-group-use-designer-rules.d.ts +3 -0
  211. package/types/dynamic-form/src/designer/response-form-use-designer-rules.d.ts +3 -0
  212. package/types/dynamic-form/src/designer/response-form.design.component.d.ts +7 -1
  213. package/types/dynamic-form/src/property-config/{form.property-config.d.ts → response-form.property-config.d.ts} +1 -1
  214. package/types/dynamic-form/src/schema/{schema-resolver.d.ts → response-form-schema-resolver.d.ts} +1 -1
  215. package/types/dynamic-form/src/types.d.ts +1 -1
  216. package/types/dynamic-resolver/src/common/toolbar-resolver.d.ts +6 -1
  217. package/types/dynamic-resolver/src/converter/row-number.converter.d.ts +3 -0
  218. package/types/entity-binding-selector/composition/use-entity-tree.d.ts +7 -0
  219. package/types/entity-binding-selector/entity-binding-selector.component.d.ts +11 -0
  220. package/types/entity-binding-selector/entity-binding-selector.props.d.ts +3 -0
  221. package/types/enum-editor/src/components/enum-editor-container.component.d.ts +3 -3
  222. package/types/enum-editor/src/enum-editor.component.d.ts +3 -3
  223. package/types/event-parameter/index.d.ts +31 -0
  224. package/types/event-parameter/src/composition/type.d.ts +77 -0
  225. package/types/event-parameter/src/composition/use-editor-combotree.d.ts +3 -0
  226. package/types/event-parameter/src/composition/use-editor-input.d.ts +3 -0
  227. package/types/event-parameter/src/composition/use-editor-select.d.ts +3 -0
  228. package/types/event-parameter/src/composition/use-editor-switch.d.ts +3 -0
  229. package/types/event-parameter/src/composition/use-editor.d.ts +3 -0
  230. package/types/event-parameter/src/event-parameter.component.d.ts +8 -0
  231. package/types/event-parameter/src/event-parameter.props.d.ts +34 -0
  232. package/types/external-container/src/designer/import-external-schema.component.d.ts +1 -1
  233. package/types/external-container/src/designer/use-designer-rules.d.ts +3 -3
  234. package/types/field-selector/src/field-selector.component.d.ts +1 -2
  235. package/types/field-selector/src/field-selector.props.d.ts +0 -9
  236. package/types/input-group/src/designer/use-input-group-rules.d.ts +1 -2
  237. package/types/layout/src/designer/layout-pane-use-designer-rules.d.ts +3 -3
  238. package/types/list-nav/src/designer/use-designer-rules.d.ts +3 -0
  239. package/types/list-view/src/designer/list-view-table.design.component.d.ts +15 -0
  240. package/types/list-view/src/list-view-table.component.d.ts +15 -0
  241. package/types/lookup/src/composition/use-user-data.d.ts +2 -2
  242. package/types/lookup/src/property-config/lookup.property-config.d.ts +2 -6
  243. package/types/modal/src/composition/modal.service.d.ts +2 -1
  244. package/types/page-header/src/designer/page-header.design.component.d.ts +1 -1
  245. package/types/page-header/src/page-header.component.d.ts +1 -1
  246. package/types/pagination/src/components/buttons/goto-buttons.component.d.ts +2 -2
  247. package/types/pagination/src/components/buttons/next-buttons.component.d.ts +2 -2
  248. package/types/pagination/src/components/buttons/previous-buttons.component.d.ts +2 -2
  249. package/types/pagination/src/components/pages/page-list.component.d.ts +2 -2
  250. package/types/pagination/src/components/pages/page-number.component.d.ts +2 -2
  251. package/types/property-panel/index.d.ts +3 -1
  252. package/types/property-panel/src/composition/entity/input-base-property.d.ts +1 -1
  253. package/types/property-panel/src/composition/entity/property-entity.d.ts +1 -1
  254. package/types/property-panel/src/composition/type.d.ts +0 -13
  255. package/types/query-solution/src/composition/types.d.ts +35 -4
  256. package/types/query-solution/src/composition/use-header.d.ts +21 -0
  257. package/types/query-solution/src/composition/{use-filter.d.ts → use-http.d.ts} +2 -2
  258. package/types/query-solution/src/composition/use-solution.d.ts +20 -0
  259. package/types/query-solution/src/designer/query-solution-config/composition/types.d.ts +43 -35
  260. package/types/query-solution/src/designer/query-solution-config/composition/use-panel.d.ts +2 -16
  261. package/types/query-solution/src/designer/query-solution-config/composition/use-property.d.ts +19 -0
  262. package/types/query-solution/src/designer/query-solution-config/composition/use-querysolution-rules.d.ts +3 -0
  263. package/types/query-solution/src/designer/query-solution-config/composition/use-transfer.d.ts +1 -1
  264. package/types/query-solution/src/designer/query-solution-config/query-solution-config.props.d.ts +14 -14
  265. package/types/query-solution/src/property-config/query-solution.property-config.d.ts +12 -0
  266. package/types/query-solution/src/query-solution.d.ts +10 -2
  267. package/types/query-solution/src/solutions.d.ts +108 -509
  268. package/types/radio-group/src/designer/item-collection-editor-inner.component.d.ts +29 -0
  269. package/types/radio-group/src/designer/item-collection-editor.component.d.ts +29 -0
  270. package/types/radio-group/src/designer/item-collection-editor.props.d.ts +21 -0
  271. package/types/radio-group/src/schema/schema-mapper.d.ts +1 -0
  272. package/types/radio-group/src/schema/schema-resolver.d.ts +1 -0
  273. package/types/response-layout-editor/index.d.ts +3 -1
  274. package/types/response-toolbar/src/designer/use-designer-rules.d.ts +3 -3
  275. package/types/response-toolbar/src/property-config/response-toolbar-item.property-config.d.ts +1 -0
  276. package/types/response-toolbar/src/property-config/response-toolbar.property-config.d.ts +1 -0
  277. package/types/section/src/designer/use-designer-rules.d.ts +3 -3
  278. package/types/section/src/property-config/section.property-config.d.ts +17 -17
  279. package/types/section/src/schema/schema-resolver.d.ts +1 -2
  280. package/types/section/src/schema/toolbar-resolver.d.ts +1 -1
  281. package/types/splitter/src/components/splitter-pane.component.d.ts +1 -1
  282. package/types/splitter/src/designer/splitter-pane-use-designer-rules.d.ts +3 -3
  283. package/types/splitter/src/designer/splitter-use-designer-rules.d.ts +3 -3
  284. package/types/tabs/src/composition/types.d.ts +4 -1
  285. package/types/tabs/src/designer/tab-page-use-designer-rules.d.ts +3 -3
  286. package/types/tabs/src/designer/tab-use-designer-rules.d.ts +3 -3
  287. package/types/tabs/src/property-config/tab-page.property-config.d.ts +9 -59
  288. package/types/tabs/src/property-config/tabs.property-config.d.ts +8 -71
  289. package/types/tabs/src/schema/schema-resolver.d.ts +1 -2
  290. package/types/text/src/composition/types.d.ts +4 -4
  291. package/types/textarea/src/property-config/textarea.property-config.d.ts +23 -0
  292. package/types/tree-grid/index.d.ts +3 -3
  293. package/types/tree-grid/src/tree-grid.component.d.ts +1 -1
  294. package/types/weather/src/composition/use-weather-charts.d.ts +15 -0
  295. package/types/weather/src/composition/use-weather-color.d.ts +15 -0
  296. package/types/weather/src/composition/use-weather-data.d.ts +15 -0
  297. package/types/weather/src/composition/use-weather-format-number.d.ts +15 -0
  298. package/types/designer-canvas/src/composition/rule/use-drag-drop-rules.d.ts +0 -19
  299. package/types/designer-canvas/src/composition/use-dragula-common-rule.d.ts +0 -4
  300. package/types/dynamic-form/src/designer/use-designer-rules.d.ts +0 -3
  301. package/types/list-nav/src/composition/use-designer-rules.d.ts +0 -3
  302. package/types/property-panel/src/composition/entity/use-input-rules.d.ts +0 -3
  303. package/types/query-solution/src/designer/query-solution-config/composition/mock-data.d.ts +0 -6
  304. package/types/tree-grid/src/schema/column-resolver.d.ts +0 -3
  305. package/types/weather/src/composition/types.d.ts +0 -2
@@ -1,101 +1,105 @@
1
- import { inject as Te, ref as v, onMounted as Ce, onUnmounted as lt, watch as K, defineComponent as Se, createVNode as T, withModifiers as F } from "vue";
2
- import { isPlainObject as we, cloneDeep as ut } from "lodash-es";
3
- const Ee = {}, ze = {};
4
- function he(e) {
5
- const { properties: i, title: r, ignore: y } = e, o = y && Array.isArray(y), t = Object.keys(i).reduce((h, g) => ((!o || !y.find((w) => w == g)) && (h[g] = i[g].type === "object" && i[g].properties ? he(i[g]) : ut(i[g].default)), h), {});
6
- return (!o || !y.find((h) => h == "id")) && (t.id = `${r}-${Date.now()}`), t;
1
+ import { inject as Te, ref as v, onMounted as Ae, onUnmounted as nt, watch as K, defineComponent as Se, createVNode as S, withModifiers as O } from "vue";
2
+ import { isPlainObject as Me, cloneDeep as ut } from "lodash-es";
3
+ const ze = {}, Ee = {};
4
+ function ve(e) {
5
+ const { properties: i, title: r, ignore: p } = e, o = p && Array.isArray(p), t = Object.keys(i).reduce((h, g) => ((!o || !p.find((w) => w === g)) && (h[g] = i[g].type === "object" && i[g].properties ? ve(i[g]) : ut(i[g].default)), h), {});
6
+ if (r && (!o || !p.find((h) => h === "id"))) {
7
+ const h = r.toLowerCase().replace(/-/g, "_");
8
+ t.id = `${h}_${Math.random().toString().slice(2, 6)}`;
9
+ }
10
+ return t;
7
11
  }
8
- function ve(e, i = {}, r) {
9
- const y = Ee[e];
10
- if (y) {
11
- let o = he(y);
12
- const t = ze[e];
13
- return o = t ? t({ getSchemaByType: ve }, o, i, r) : o, o;
12
+ function ke(e, i = {}, r) {
13
+ const p = ze[e];
14
+ if (p) {
15
+ let o = ve(p);
16
+ const t = Ee[e];
17
+ return o = t ? t({ getSchemaByType: ke }, o, i, r) : o, o;
14
18
  }
15
19
  return null;
16
20
  }
17
21
  function rt(e, i) {
18
- const r = he(i);
19
- return Object.keys(e).reduce((y, o) => (y[o] && we(y[o]) && we(e[o]) ? Object.assign(y[o], e[o]) : y[o] = e[o], y), r), r;
22
+ const r = ve(i);
23
+ return Object.keys(r).reduce((p, o) => (p[o] && Me(p[o]) && Me(e[o] || !e[o]) ? Object.assign(p[o], e[o] || {}) : p[o] = e[o], p), r), r;
20
24
  }
21
25
  function st(e, i) {
22
- return Object.keys(e).filter((y) => e[y] != null).reduce((y, o) => {
26
+ return Object.keys(e).filter((p) => e[p] != null).reduce((p, o) => {
23
27
  if (i.has(o)) {
24
28
  const t = i.get(o);
25
29
  if (typeof t == "string")
26
- y[t] = e[o];
30
+ p[t] = e[o];
27
31
  else {
28
32
  const h = t(o, e[o], e);
29
- Object.assign(y, h);
33
+ Object.assign(p, h);
30
34
  }
31
35
  } else
32
- y[o] = e[o];
33
- return y;
36
+ p[o] = e[o];
37
+ return p;
34
38
  }, {});
35
39
  }
36
40
  function ot(e, i, r = /* @__PURE__ */ new Map()) {
37
- const y = rt(e, i);
38
- return st(y, r);
41
+ const p = rt(e, i);
42
+ return st(p, r);
39
43
  }
40
44
  function ct(e = {}) {
41
- function i(s, x, m, n) {
45
+ function i(s, y, m, l) {
42
46
  if (typeof m == "number")
43
- return n[s].length === m;
47
+ return l[s].length === m;
44
48
  if (typeof m == "object") {
45
- const u = Object.keys(m)[0], A = m[u];
49
+ const u = Object.keys(m)[0], T = m[u];
46
50
  if (u === "not")
47
- return Number(n[s].length) !== Number(A);
51
+ return Number(l[s].length) !== Number(T);
48
52
  if (u === "moreThan")
49
- return Number(n[s].length) >= Number(A);
53
+ return Number(l[s].length) >= Number(T);
50
54
  if (u === "lessThan")
51
- return Number(n[s].length) <= Number(A);
55
+ return Number(l[s].length) <= Number(T);
52
56
  }
53
57
  return !1;
54
58
  }
55
- function r(s, x, m, n) {
56
- return n[s] && n[s].propertyValue && String(n[s].propertyValue.value) === String(m);
59
+ function r(s, y, m, l) {
60
+ return l[s] && l[s].propertyValue && String(l[s].propertyValue.value) === String(m);
57
61
  }
58
- const y = /* @__PURE__ */ new Map([
62
+ const p = /* @__PURE__ */ new Map([
59
63
  ["length", i],
60
64
  ["getProperty", r]
61
65
  ]);
62
- Object.keys(e).reduce((s, x) => (s.set(x, e[x]), s), y);
63
- function o(s, x) {
66
+ Object.keys(e).reduce((s, y) => (s.set(y, e[y]), s), p);
67
+ function o(s, y) {
64
68
  const m = s;
65
- return typeof x == "number" ? [{ target: m, operator: "length", param: null, value: Number(x) }] : typeof x == "boolean" ? [{ target: m, operator: "getProperty", param: s, value: !!x }] : typeof x == "object" ? Object.keys(x).map((n) => {
66
- if (n === "length")
67
- return { target: m, operator: "length", param: null, value: x[n] };
68
- const u = n, A = x[n];
69
- return { target: m, operator: "getProperty", param: u, value: A };
69
+ return typeof y == "number" ? [{ target: m, operator: "length", param: null, value: Number(y) }] : typeof y == "boolean" ? [{ target: m, operator: "getProperty", param: s, value: !!y }] : typeof y == "object" ? Object.keys(y).map((l) => {
70
+ if (l === "length")
71
+ return { target: m, operator: "length", param: null, value: y[l] };
72
+ const u = l, T = y[l];
73
+ return { target: m, operator: "getProperty", param: u, value: T };
70
74
  }) : [];
71
75
  }
72
76
  function t(s) {
73
- return Object.keys(s).reduce((m, n) => {
74
- const u = o(n, s[n]);
77
+ return Object.keys(s).reduce((m, l) => {
78
+ const u = o(l, s[l]);
75
79
  return m.push(...u), m;
76
80
  }, []);
77
81
  }
78
- function h(s, x) {
79
- if (y.has(s.operator)) {
80
- const m = y.get(s.operator);
81
- return m && m(s.target, s.param, s.value, x) || !1;
82
+ function h(s, y) {
83
+ if (p.has(s.operator)) {
84
+ const m = p.get(s.operator);
85
+ return m && m(s.target, s.param, s.value, y) || !1;
82
86
  }
83
87
  return !1;
84
88
  }
85
- function g(s, x) {
86
- return t(s).reduce((u, A) => u && h(A, x), !0);
89
+ function g(s, y) {
90
+ return t(s).reduce((u, T) => u && h(T, y), !0);
87
91
  }
88
- function w(s, x) {
89
- const m = Object.keys(s), n = m.includes("allOf"), u = m.includes("anyOf"), A = n || u, L = (A ? s[A ? n ? "allOf" : "anyOf" : "allOf"] : [s]).map((D) => g(D, x));
90
- return n ? !L.includes(!1) : L.includes(!0);
92
+ function w(s, y) {
93
+ const m = Object.keys(s), l = m.includes("allOf"), u = m.includes("anyOf"), T = l || u, W = (T ? s[T ? l ? "allOf" : "anyOf" : "allOf"] : [s]).map((B) => g(B, y));
94
+ return l ? !W.includes(!1) : W.includes(!0);
91
95
  }
92
96
  return { parseValueSchema: w };
93
97
  }
94
98
  const ft = {}, vt = {};
95
99
  ct();
96
- function ht(e, i, r = /* @__PURE__ */ new Map(), y = (h, g, w) => g, o = {}, t = (h) => h) {
97
- return Ee[i.title] = i, ze[i.title] = y, ft[i.title] = o, vt[i.title] = t, (h = {}) => {
98
- const g = ot(h, i, r), w = Object.keys(e).reduce((s, x) => (s[x] = e[x].default, s), {});
100
+ function ht(e, i, r = /* @__PURE__ */ new Map(), p = (h, g, w, s) => g, o = {}, t = (h) => h) {
101
+ return ze[i.title] = i, Ee[i.title] = p, ft[i.title] = o, vt[i.title] = t, (h = {}) => {
102
+ const g = ot(h, i, r), w = Object.keys(e).reduce((s, y) => (s[y] = e[y].default, s), {});
99
103
  return Object.assign(w, g);
100
104
  };
101
105
  }
@@ -169,18 +173,18 @@ const mt = /* @__PURE__ */ new Map([
169
173
  type: "boolean",
170
174
  default: !0
171
175
  }
172
- }, At = [
176
+ }, Tt = [
173
177
  "id",
174
178
  "type"
175
- ], Tt = {
179
+ ], At = {
176
180
  $schema: pt,
177
181
  $id: yt,
178
182
  title: xt,
179
183
  description: bt,
180
184
  type: Mt,
181
185
  properties: wt,
182
- required: At
183
- }, Ct = "image-cropper", St = "A Farris Component", Et = "object", zt = {
186
+ required: Tt
187
+ }, St = "image-cropper", zt = "A Farris Component", Et = "object", kt = {
184
188
  basic: {
185
189
  description: "Basic Infomation",
186
190
  title: "基本信息",
@@ -233,12 +237,12 @@ const mt = /* @__PURE__ */ new Map([
233
237
  }
234
238
  }
235
239
  }
236
- }, kt = {
237
- title: Ct,
238
- description: St,
240
+ }, Dt = {
241
+ title: St,
242
+ description: zt,
239
243
  type: Et,
240
- categories: zt
241
- }, ge = {
244
+ categories: kt
245
+ }, he = {
242
246
  /** 输出图片格式 */
243
247
  format: { type: String, default: "png" },
244
248
  /** 保持长宽比例 */
@@ -295,9 +299,9 @@ const mt = /* @__PURE__ */ new Map([
295
299
  y2: 1e4
296
300
  }
297
301
  }
298
- }, Ae = ht(ge, Tt, mt, dt, kt);
302
+ }, we = ht(he, At, mt, dt, Dt);
299
303
  var ae = /* @__PURE__ */ ((e) => (e.Move = "move", e.Resize = "resize", e))(ae || {});
300
- function Dt() {
304
+ function Bt() {
301
305
  function e(o) {
302
306
  switch (typeof o == "string" && (o = i(o)), o) {
303
307
  case 2:
@@ -325,16 +329,17 @@ function Dt() {
325
329
  const h = t.byteLength;
326
330
  let g = 2;
327
331
  for (; g < h; ) {
328
- if (t.getUint16(g + 2, !1) <= 8) return -1;
332
+ if (t.getUint16(g + 2, !1) <= 8)
333
+ return -1;
329
334
  const w = t.getUint16(g, !1);
330
335
  if (g += 2, w === 65505) {
331
336
  if (t.getUint32(g += 2, !1) !== 1165519206)
332
337
  return -1;
333
338
  const s = t.getUint16(g += 6, !1) === 18761;
334
339
  g += t.getUint32(g + 4, s);
335
- const x = t.getUint16(g, s);
340
+ const y = t.getUint16(g, s);
336
341
  g += 2;
337
- for (let m = 0; m < x; m++)
342
+ for (let m = 0; m < y; m++)
338
343
  if (t.getUint16(g + m * 12, s) === 274)
339
344
  return t.getUint16(g + m * 12 + 8, s);
340
345
  } else {
@@ -352,67 +357,67 @@ function Dt() {
352
357
  g[w] = t.charCodeAt(w);
353
358
  return g.buffer;
354
359
  }
355
- function y(o, t, h) {
360
+ function p(o, t, h) {
356
361
  const g = o.width, w = o.height;
357
362
  t = Math.round(t), h = Math.round(h);
358
- const s = g / t, x = w / h, m = Math.ceil(s / 2), n = Math.ceil(x / 2), u = o.getContext("2d");
363
+ const s = g / t, y = w / h, m = Math.ceil(s / 2), l = Math.ceil(y / 2), u = o.getContext("2d");
359
364
  if (u) {
360
- const A = u.getImageData(0, 0, g, w), M = u.createImageData(t, h), { data: $ } = A, L = M.data;
365
+ const T = u.getImageData(0, 0, g, w), M = u.createImageData(t, h), { data: P } = T, W = M.data;
361
366
  for (let R = 0; R < h; R++)
362
- for (let D = 0; D < t; D++) {
363
- const j = (D + R * t) * 4, k = R * x;
364
- let p = 0, f = 0, d = 0, B = 0, O = 0, C = 0, S = 0;
365
- const I = Math.floor(D * s), W = Math.floor(R * x);
366
- let Q = Math.ceil((D + 1) * s), G = Math.ceil((R + 1) * x);
367
- Q = Math.min(Q, g), G = Math.min(G, w);
368
- for (let P = W; P < G; P++) {
369
- const E = Math.abs(k - P) / n, ie = D * s, ee = E * E;
370
- for (let U = I; U < Q; U++) {
371
- const N = Math.abs(ie - U) / m, _ = Math.sqrt(ee + N * N);
372
- if (_ >= 1)
367
+ for (let B = 0; B < t; B++) {
368
+ const j = (B + R * t) * 4, d = R * y;
369
+ let A = 0, c = 0, b = 0, V = 0, Q = 0, D = 0, E = 0;
370
+ const $ = Math.floor(B * s), C = Math.floor(R * y);
371
+ let q = Math.ceil((B + 1) * s), J = Math.ceil((R + 1) * y);
372
+ q = Math.min(q, g), J = Math.min(J, w);
373
+ for (let L = C; L < J; L++) {
374
+ const z = Math.abs(d - L) / l, ie = B * s, ee = z * z;
375
+ for (let U = $; U < q; U++) {
376
+ const N = Math.abs(ie - U) / m, H = Math.sqrt(ee + N * N);
377
+ if (H >= 1)
373
378
  continue;
374
- p = 2 * _ * _ * _ - 3 * _ * _ + 1;
375
- const V = 4 * (U + P * g);
376
- S += p * $[V + 3], d += p, $[V + 3] < 255 && (p = p * $[V + 3] / 250), B += p * $[V], O += p * $[V + 1], C += p * $[V + 2], f += p;
379
+ A = 2 * H * H * H - 3 * H * H + 1;
380
+ const I = 4 * (U + L * g);
381
+ E += A * P[I + 3], b += A, P[I + 3] < 255 && (A = A * P[I + 3] / 250), V += A * P[I], Q += A * P[I + 1], D += A * P[I + 2], c += A;
377
382
  }
378
383
  }
379
- L[j] = B / f, L[j + 1] = O / f, L[j + 2] = C / f, L[j + 3] = S / d;
384
+ W[j] = V / c, W[j + 1] = Q / c, W[j + 2] = D / c, W[j + 3] = E / b;
380
385
  }
381
386
  o.width = t, o.height = h, u.putImageData(M, 0, 0);
382
387
  }
383
388
  }
384
389
  return {
385
- resizeCanvas: y,
390
+ resizeCanvas: p,
386
391
  getTransformationsFromExifData: e
387
392
  };
388
393
  }
389
- function Bt(e, i, r, y) {
390
- function o(n, u) {
391
- e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) * r.value, n = Math.max(e.value.x2 - i.value.width, 0), u = Math.max(0 - e.value.y1, 0), (n > 0 || u > 0) && (e.value.x2 -= u * r.value > n ? u * r.value : n, e.value.y1 += u * r.value > n ? u : n / r.value);
394
+ function Ct(e, i, r, p) {
395
+ function o(l, u) {
396
+ e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) * r.value, l = Math.max(e.value.x2 - i.value.width, 0), u = Math.max(0 - e.value.y1, 0), (l > 0 || u > 0) && (e.value.x2 -= u * r.value > l ? u * r.value : l, e.value.y1 += u * r.value > l ? u : l / r.value);
392
397
  }
393
- function t(n, u) {
394
- e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) * r.value, n = Math.max(e.value.x2 - i.value.width, 0), u = Math.max(e.value.y2 - i.value.height, 0), (n > 0 || u > 0) && (e.value.x2 -= u * r.value > n ? u * r.value : n, e.value.y2 -= u * r.value > n ? u : n / r.value);
398
+ function t(l, u) {
399
+ e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) * r.value, l = Math.max(e.value.x2 - i.value.width, 0), u = Math.max(e.value.y2 - i.value.height, 0), (l > 0 || u > 0) && (e.value.x2 -= u * r.value > l ? u * r.value : l, e.value.y2 -= u * r.value > l ? u : l / r.value);
395
400
  }
396
- function h(n, u) {
397
- e.value.y1 = e.value.y2 - (e.value.x2 - e.value.x1) / r.value, n = Math.max(0 - e.value.x1, 0), u = Math.max(0 - e.value.y1, 0), (n > 0 || u > 0) && (e.value.x1 += u * r.value > n ? u * r.value : n, e.value.y1 += u * r.value > n ? u : n / r.value);
401
+ function h(l, u) {
402
+ e.value.y1 = e.value.y2 - (e.value.x2 - e.value.x1) / r.value, l = Math.max(0 - e.value.x1, 0), u = Math.max(0 - e.value.y1, 0), (l > 0 || u > 0) && (e.value.x1 += u * r.value > l ? u * r.value : l, e.value.y1 += u * r.value > l ? u : l / r.value);
398
403
  }
399
- function g(n, u) {
400
- e.value.y1 = e.value.y2 - (e.value.x2 - e.value.x1) / r.value, n = Math.max(e.value.x2 - i.value.width, 0), u = Math.max(0 - e.value.y1, 0), (n > 0 || u > 0) && (e.value.x2 -= u * r.value > n ? u * r.value : n, e.value.y1 += u * r.value > n ? u : n / r.value);
404
+ function g(l, u) {
405
+ e.value.y1 = e.value.y2 - (e.value.x2 - e.value.x1) / r.value, l = Math.max(e.value.x2 - i.value.width, 0), u = Math.max(0 - e.value.y1, 0), (l > 0 || u > 0) && (e.value.x2 -= u * r.value > l ? u * r.value : l, e.value.y1 += u * r.value > l ? u : l / r.value);
401
406
  }
402
- function w(n, u) {
403
- e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) / r.value, n = Math.max(e.value.x2 - i.value.width, 0), u = Math.max(e.value.y2 - i.value.height, 0), (n > 0 || u > 0) && (e.value.x2 -= u * r.value > n ? u * r.value : n, e.value.y2 -= u * r.value > n ? u : n / r.value);
407
+ function w(l, u) {
408
+ e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) / r.value, l = Math.max(e.value.x2 - i.value.width, 0), u = Math.max(e.value.y2 - i.value.height, 0), (l > 0 || u > 0) && (e.value.x2 -= u * r.value > l ? u * r.value : l, e.value.y2 -= u * r.value > l ? u : l / r.value);
404
409
  }
405
- function s(n, u) {
406
- e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) / r.value, n = Math.max(0 - e.value.x1, 0), u = Math.max(e.value.y2 - i.value.height, 0), (n > 0 || u > 0) && (e.value.x1 += u * r.value > n ? u * r.value : n, e.value.y2 -= u * r.value > n ? u : n / r.value);
410
+ function s(l, u) {
411
+ e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) / r.value, l = Math.max(0 - e.value.x1, 0), u = Math.max(e.value.y2 - i.value.height, 0), (l > 0 || u > 0) && (e.value.x1 += u * r.value > l ? u * r.value : l, e.value.y2 -= u * r.value > l ? u : l / r.value);
407
412
  }
408
- function x() {
413
+ function y() {
409
414
  e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) * r.value, e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) / r.value;
410
- const n = Math.max(0 - e.value.x1, 0), u = Math.max(e.value.x2 - i.value.width, 0), A = Math.max(e.value.y2 - i.value.height, 0), M = Math.max(0 - e.value.y1, 0);
411
- (n > 0 || u > 0 || A > 0 || M > 0) && (e.value.x1 += A * r.value > n ? A * r.value : n, e.value.x2 -= M * r.value > u ? M * r.value : u, e.value.y1 += M * r.value > u ? M : u / r.value, e.value.y2 -= A * r.value > n ? A : n / r.value);
415
+ const l = Math.max(0 - e.value.x1, 0), u = Math.max(e.value.x2 - i.value.width, 0), T = Math.max(e.value.y2 - i.value.height, 0), M = Math.max(0 - e.value.y1, 0);
416
+ (l > 0 || u > 0 || T > 0 || M > 0) && (e.value.x1 += T * r.value > l ? T * r.value : l, e.value.x2 -= M * r.value > u ? M * r.value : u, e.value.y1 += M * r.value > u ? M : u / r.value, e.value.y2 -= T * r.value > l ? T : l / r.value);
412
417
  }
413
418
  function m() {
414
419
  if (i.value.width && i.value.height)
415
- switch (y.position) {
420
+ switch (p.position) {
416
421
  case "top":
417
422
  o(0, 0);
418
423
  break;
@@ -434,23 +439,23 @@ function Bt(e, i, r, y) {
434
439
  s(0, 0);
435
440
  break;
436
441
  case "center":
437
- x();
442
+ y();
438
443
  break;
439
444
  }
440
445
  }
441
446
  return { checkAspectRatio: m };
442
447
  }
443
- function ke(e, i) {
444
- const { resizeCanvas: r, getTransformationsFromExifData: y } = Dt(), o = Te("NotifyService"), t = v(e.cropper), h = v(e.transform), g = v(e.cropperMinWidth), w = v(e.maintainAspectRatio), s = v(e.aspectRatio), x = v(e.autoCrop), m = v(e.backgroundColor), n = v(e.resizeToWidth), u = v(e.onlyScaleDown), A = v(e.containWithinAspectRatio), M = v(e.canvasRotation), $ = v(e.format), L = v(e.imageQuality), R = v(e.resizeToHeight), D = v(e.cropperMinHeight), j = v(""), k = v(!0), p = v(!0);
445
- let f, d, B = 0, O, C, S;
446
- const I = v(null), W = v(""), Q = v(""), G = v("0px"), P = v(), E = v({ width: 100, height: 100 }), ie = ae;
447
- let ee, U = 20, N = 20, _ = !1, V = { rotate: 0, flip: !1 }, b = { active: !1, type: null, position: null, x1: 0, y1: 0, x2: 0, y2: 0, clientX: 0, clientY: 0 };
448
- const de = v(e.imageChangedEvent), ne = v(e.imageURL), De = v(e.imageBase64), Be = v(e.imageFile);
448
+ function De(e, i) {
449
+ const { resizeCanvas: r, getTransformationsFromExifData: p } = Bt(), o = Te("NotifyService"), t = v(e.cropper), h = v(e.transform), g = v(e.cropperMinWidth), w = v(e.maintainAspectRatio), s = v(e.aspectRatio), y = v(e.autoCrop), m = v(e.backgroundColor), l = v(e.resizeToWidth), u = v(e.onlyScaleDown), T = v(e.containWithinAspectRatio), M = v(e.canvasRotation), P = v(e.format), W = v(e.imageQuality), R = v(e.resizeToHeight), B = v(e.cropperMinHeight), j = v(""), d = v(!0), A = v(!0);
450
+ let c, b, V = 0, Q, D, E;
451
+ const $ = v(null), C = v(""), q = v(""), J = v("0px"), L = v(), z = v({ width: 100, height: 100 }), ie = ae;
452
+ let ee, U = 20, N = 20, H = !1, I = { rotate: 0, flip: !1 }, x = { active: !1, type: null, position: null, x1: 0, y1: 0, x2: 0, y2: 0, clientX: 0, clientY: 0 };
453
+ const ge = v(e.imageChangedEvent), le = v(e.imageURL), Be = v(e.imageBase64), Ce = v(e.imageFile);
449
454
  function We() {
450
- Q.value = "scaleX(" + (h.value.scale || 1) * (h.value.flipH ? -1 : 1) + ")scaleY(" + (h.value.scale || 1) * (h.value.flipV ? -1 : 1) + ")rotate(" + (h.value.rotate || 0) + "deg)";
455
+ q.value = "scaleX(" + (h.value.scale || 1) * (h.value.flipH ? -1 : 1) + ")scaleY(" + (h.value.scale || 1) * (h.value.flipV ? -1 : 1) + ")rotate(" + (h.value.rotate || 0) + "deg)";
451
456
  }
452
457
  function Y() {
453
- p.value = !1, P.value = null, j.value = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=", b = {
458
+ A.value = !1, L.value = null, j.value = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=", x = {
454
459
  active: !1,
455
460
  type: null,
456
461
  position: null,
@@ -460,13 +465,13 @@ function ke(e, i) {
460
465
  y2: 0,
461
466
  clientX: 0,
462
467
  clientY: 0
463
- }, E.value = {
468
+ }, z.value = {
464
469
  width: 0,
465
470
  height: 0
466
- }, f = {
471
+ }, c = {
467
472
  width: 0,
468
473
  height: 0
469
- }, d = {
474
+ }, b = {
470
475
  width: 0,
471
476
  height: 0
472
477
  }, t.value.x1 = -100, t.value.y1 = -100, t.value.x2 = 1e4, t.value.y2 = 1e4;
@@ -475,220 +480,220 @@ function ke(e, i) {
475
480
  return /image\/(png|jpg|jpeg|bmp|gif|tiff|webp)/.test(a);
476
481
  }
477
482
  function Pe() {
478
- if (M.value += V.rotate, A.value && f.width && f.height) {
483
+ if (M.value += I.rotate, T.value && c.width && c.height) {
479
484
  if (M.value % 2) {
480
- const c = f.width * s.value, z = f.height / s.value;
485
+ const f = c.width * s.value, k = c.height / s.value;
481
486
  return {
482
- width: Math.max(f.height, c),
483
- height: Math.max(f.width, z)
487
+ width: Math.max(c.height, f),
488
+ height: Math.max(c.width, k)
484
489
  };
485
490
  }
486
- const a = f.height * s.value, l = f.width / s.value;
491
+ const a = c.height * s.value, n = c.width / s.value;
487
492
  return {
488
- width: Math.max(f.width, a),
489
- height: Math.max(f.height, l)
493
+ width: Math.max(c.width, a),
494
+ height: Math.max(c.height, n)
490
495
  };
491
496
  }
492
497
  return M.value % 2 ? {
493
- height: f.width,
494
- width: f.height
498
+ height: c.width,
499
+ width: c.height
495
500
  } : {
496
- width: f.width,
497
- height: f.height
501
+ width: c.width,
502
+ height: c.height
498
503
  };
499
504
  }
500
- function $e() {
501
- M.value += V.rotate;
502
- const a = Pe(), l = document.createElement("canvas");
503
- a.width && a.height && (l.width = a.width, l.height = a.height);
504
- const c = l.getContext("2d");
505
- return f.width && f.height && S && (c == null || c.setTransform(V.flip ? -1 : 1, 0, 0, 1, l.width / 2, l.height / 2), c == null || c.rotate(Math.PI * (M.value / 2)), c == null || c.drawImage(S, -f.width / 2, -f.height / 2)), l.toDataURL();
506
- }
507
- function Re(a) {
508
- return new Promise((l) => {
509
- ee = a, j.value = a, P.value = new Image(), P.value.onload = () => {
510
- var c, z;
511
- d.width = (c = P.value) == null ? void 0 : c.naturalWidth, d.height = (z = P.value) == null ? void 0 : z.naturalHeight, l();
512
- }, P.value.src = ee;
505
+ function Re() {
506
+ M.value += I.rotate;
507
+ const a = Pe(), n = document.createElement("canvas");
508
+ a.width && a.height && (n.width = a.width, n.height = a.height);
509
+ const f = n.getContext("2d");
510
+ return c.width && c.height && E && (f == null || f.setTransform(I.flip ? -1 : 1, 0, 0, 1, n.width / 2, n.height / 2), f == null || f.rotate(Math.PI * (M.value / 2)), f == null || f.drawImage(E, -c.width / 2, -c.height / 2)), n.toDataURL();
511
+ }
512
+ function He(a) {
513
+ return new Promise((n) => {
514
+ ee = a, j.value = a, L.value = new Image(), L.value.onload = () => {
515
+ var f, k;
516
+ b.width = (f = L.value) == null ? void 0 : f.naturalWidth, b.height = (k = L.value) == null ? void 0 : k.naturalHeight, n();
517
+ }, L.value.src = ee;
513
518
  });
514
519
  }
515
- function me() {
516
- if (!S || !S.complete || !V)
520
+ function de() {
521
+ if (!E || !E.complete || !I)
517
522
  return Promise.reject(new Error("No image loaded"));
518
- const a = $e();
519
- return Re(a);
523
+ const a = Re();
524
+ return He(a);
520
525
  }
521
- function le(a) {
522
- const l = (c) => {
526
+ function ne(a) {
527
+ const n = (f) => {
523
528
  o.show({
524
529
  showCloseButton: !1,
525
530
  timeout: 3e3,
526
531
  animate: "fadeIn",
527
532
  toasts: [{ type: "string", title: "提示", msg: "图片上传错误,请重试" }]
528
- }), k.value = !1, _ = !0, i.emit("loadImageFailed"), S = null, W.value = "";
533
+ }), d.value = !1, H = !0, i.emit("loadImageFailed"), E = null, C.value = "";
529
534
  };
530
- S = new Image(), S.onload = () => {
531
- W.value = a, V = y(a), f.width = S == null ? void 0 : S.naturalWidth, f.height = S == null ? void 0 : S.naturalHeight, me().then(() => {
532
- _ = !1;
533
- }).catch(l);
534
- }, S.onerror = l, S.src = a;
535
- }
536
- function _e(a, l) {
537
- Le(l) ? (_ = !1, le(a)) : (o.show({
535
+ E = new Image(), E.onload = () => {
536
+ C.value = a, I = p(a), c.width = E == null ? void 0 : E.naturalWidth, c.height = E == null ? void 0 : E.naturalHeight, de().then(() => {
537
+ H = !1;
538
+ }).catch(n);
539
+ }, E.onerror = n, E.src = a;
540
+ }
541
+ function _e(a, n) {
542
+ Le(n) ? (H = !1, ne(a)) : (o.show({
538
543
  showCloseButton: !1,
539
544
  timeout: 3e3,
540
545
  animate: "fadeIn",
541
546
  toasts: [{ type: "string", title: "提示", msg: "图片类型不正确,请重试" }]
542
- }), k.value = !1, _ = !0, i.emit("loadImageFailed"));
547
+ }), d.value = !1, H = !0, i.emit("loadImageFailed"));
543
548
  }
544
- function pe(a) {
545
- const l = new FileReader();
546
- l.onload = (c) => _e(c.target.result, a.type), l.readAsDataURL(a);
549
+ function me(a) {
550
+ const n = new FileReader();
551
+ n.onload = (f) => _e(f.target.result, a.type), n.readAsDataURL(a);
547
552
  }
548
- function ye(a) {
549
- const l = new Image();
550
- l.onerror = () => {
553
+ function pe(a) {
554
+ const n = new Image();
555
+ n.onerror = () => {
551
556
  o.show({
552
557
  showCloseButton: !1,
553
558
  timeout: 3e3,
554
559
  animate: "fadeIn",
555
560
  toasts: [{ type: "string", title: "提示", msg: "图片加载错误,请重试" }]
556
- }), k.value = !1, _ = !0, i.emit("loadImageFailed");
557
- }, l.onload = () => {
558
- _ = !1;
559
- const c = document.createElement("canvas"), z = c.getContext("2d");
560
- c.width = l.width, c.height = l.height, z == null || z.drawImage(l, 0, 0), le(c.toDataURL());
561
- }, l.crossOrigin = "anonymous", l.src = a;
561
+ }), d.value = !1, H = !0, i.emit("loadImageFailed");
562
+ }, n.onload = () => {
563
+ H = !1;
564
+ const f = document.createElement("canvas"), k = f.getContext("2d");
565
+ f.width = n.width, f.height = n.height, k == null || k.drawImage(n, 0, 0), ne(f.toDataURL());
566
+ }, n.crossOrigin = "anonymous", n.src = a;
562
567
  }
563
- function He() {
564
- return I.value && I.value && I.value.offsetWidth > 0;
568
+ function $e() {
569
+ return $.value && $.value && $.value.offsetWidth > 0;
565
570
  }
566
571
  function ue() {
567
- if (I.value) {
568
- const a = I.value;
569
- E.value.width = a.offsetWidth, E.value.height = a.offsetHeight, G.value = "calc(50% - " + E.value.width / 2 + "px)";
572
+ if ($.value) {
573
+ const a = $.value;
574
+ z.value.width = a.offsetWidth, z.value.height = a.offsetHeight, J.value = "calc(50% - " + z.value.width / 2 + "px)";
570
575
  }
571
576
  }
572
- function Ie() {
573
- P.value && E.value.width && (U = g.value > 0 ? Math.max(20, g.value / P.value.width * E.value.width) : 20);
574
- }
575
577
  function Ue() {
576
- w.value ? N = Math.max(20, U / s.value) : D.value > 0 && P.value && E.value.height ? N = Math.max(20, D.value / P.value.height * E.value.height) : N = 20;
578
+ L.value && z.value.width && (U = g.value > 0 ? Math.max(20, g.value / L.value.width * z.value.width) : 20);
579
+ }
580
+ function je() {
581
+ w.value ? N = Math.max(20, U / s.value) : B.value > 0 && L.value && z.value.height ? N = Math.max(20, B.value / L.value.height * z.value.height) : N = 20;
577
582
  }
578
583
  function re() {
579
- P.value ? (Ie(), Ue()) : (U = 20, N = 20);
584
+ L.value ? (Ue(), je()) : (U = 20, N = 20);
580
585
  }
581
586
  function Ne() {
582
- const a = I.value, l = v({ x1: 0, x2: 0, y1: 0, y2: 0 });
583
- if (a && d.width && d.height) {
584
- const c = d.width / a.offsetWidth;
585
- l.value = {
586
- x1: Math.round(t.value.x1 * c),
587
- y1: Math.round(t.value.y1 * c),
588
- x2: Math.round(t.value.x2 * c),
589
- y2: Math.round(t.value.y2 * c)
590
- }, A.value || (l.value.x1 = Math.max(l.value.x1, 0), l.value.y1 = Math.max(l.value.y1, 0), l.value.x2 = Math.min(l.value.x2, d.width), l.value.y2 = Math.min(l.value.y2, d.height));
587
+ const a = $.value, n = v({ x1: 0, x2: 0, y1: 0, y2: 0 });
588
+ if (a && b.width && b.height) {
589
+ const f = b.width / a.offsetWidth;
590
+ n.value = {
591
+ x1: Math.round(t.value.x1 * f),
592
+ y1: Math.round(t.value.y1 * f),
593
+ x2: Math.round(t.value.x2 * f),
594
+ y2: Math.round(t.value.y2 * f)
595
+ }, T.value || (n.value.x1 = Math.max(n.value.x1, 0), n.value.y1 = Math.max(n.value.y1, 0), n.value.x2 = Math.min(n.value.x2, b.width), n.value.y2 = Math.min(n.value.y2, b.height));
591
596
  }
592
- return l.value;
597
+ return n.value;
593
598
  }
594
- function je() {
595
- M.value += V.rotate;
596
- const a = I.value, l = v({ x1: 0, x2: 0, y1: 0, y2: 0 });
597
- if (a && d.height && d.width && f.height && f.width) {
598
- const c = d.width / a.offsetWidth;
599
- let z, H;
600
- M.value % 2 ? (z = (d.width - f.height) / 2, H = (d.height - f.width) / 2) : (z = (d.width - f.width) / 2, H = (d.height - f.height) / 2), l.value = {
601
- x1: Math.round(t.value.x1 * c) - z,
602
- y1: Math.round(t.value.y1 * c) - H,
603
- x2: Math.round(t.value.x2 * c) - z,
604
- y2: Math.round(t.value.y2 * c) - H
605
- }, A.value || (l.value.x1 = Math.max(l.value.x1, 0), l.value.y1 = Math.max(l.value.y1, 0), l.value.x2 = Math.min(l.value.x2, d.width), l.value.y2 = Math.min(l.value.y2, d.height));
599
+ function Ie() {
600
+ M.value += I.rotate;
601
+ const a = $.value, n = v({ x1: 0, x2: 0, y1: 0, y2: 0 });
602
+ if (a && b.height && b.width && c.height && c.width) {
603
+ const f = b.width / a.offsetWidth;
604
+ let k, _;
605
+ M.value % 2 ? (k = (b.width - c.height) / 2, _ = (b.height - c.width) / 2) : (k = (b.width - c.width) / 2, _ = (b.height - c.height) / 2), n.value = {
606
+ x1: Math.round(t.value.x1 * f) - k,
607
+ y1: Math.round(t.value.y1 * f) - _,
608
+ x2: Math.round(t.value.x2 * f) - k,
609
+ y2: Math.round(t.value.y2 * f) - _
610
+ }, T.value || (n.value.x1 = Math.max(n.value.x1, 0), n.value.y1 = Math.max(n.value.y1, 0), n.value.x2 = Math.min(n.value.x2, b.width), n.value.y2 = Math.min(n.value.y2, b.height));
606
611
  }
607
- return l.value;
608
- }
609
- function Oe(a, l) {
610
- if (n.value > 0) {
611
- if (!u.value || a > n.value)
612
- return n.value / a;
613
- } else if (R.value > 0 && (!u.value || l > R.value))
614
- return R.value / l;
612
+ return n.value;
613
+ }
614
+ function Oe(a, n) {
615
+ if (l.value > 0) {
616
+ if (!u.value || a > l.value)
617
+ return l.value / a;
618
+ } else if (R.value > 0 && (!u.value || n > R.value))
619
+ return R.value / n;
615
620
  return 1;
616
621
  }
617
622
  function Ve() {
618
- return Math.min(1, Math.max(0, L.value / 100));
623
+ return Math.min(1, Math.max(0, W.value / 100));
619
624
  }
620
625
  function Fe(a) {
621
- return a.toDataURL("image/" + $.value, Ve());
626
+ return a.toDataURL("image/" + P.value, Ve());
622
627
  }
623
628
  function qe() {
624
- if (I.value && I.value && P.value != null) {
625
- const a = Ne(), l = a.x2 - a.x1, c = a.y2 - a.y1, z = document.createElement("canvas");
626
- z.width = l, z.height = c;
627
- const H = z.getContext("2d");
628
- if (H) {
629
- m.value != null && (H.fillStyle = m.value, H.fillRect(0, 0, l, c));
630
- const J = (h.value.scale || 1) * (h.value.flipH ? -1 : 1), Z = (h.value.scale || 1) * (h.value.flipV ? -1 : 1);
631
- d.width && d.height && (H.setTransform(J, 0, 0, Z, d.width / 2, d.height / 2), H.translate(-a.x1 / J, -a.y1 / Z), H.rotate((h.value.rotate || 0) * Math.PI / 180), H.drawImage(P.value, -d.width / 2, -d.height / 2));
632
- const q = {
633
- width: l,
634
- height: c,
629
+ if ($.value && $.value && L.value != null) {
630
+ const a = Ne(), n = a.x2 - a.x1, f = a.y2 - a.y1, k = document.createElement("canvas");
631
+ k.width = n, k.height = f;
632
+ const _ = k.getContext("2d");
633
+ if (_) {
634
+ m.value != null && (_.fillStyle = m.value, _.fillRect(0, 0, n, f));
635
+ const G = (h.value.scale || 1) * (h.value.flipH ? -1 : 1), Z = (h.value.scale || 1) * (h.value.flipV ? -1 : 1);
636
+ b.width && b.height && (_.setTransform(G, 0, 0, Z, b.width / 2, b.height / 2), _.translate(-a.x1 / G, -a.y1 / Z), _.rotate((h.value.rotate || 0) * Math.PI / 180), _.drawImage(L.value, -b.width / 2, -b.height / 2));
637
+ const F = {
638
+ width: n,
639
+ height: f,
635
640
  imagePosition: a,
636
641
  cropperPosition: { ...t.value }
637
642
  };
638
- A.value && (q.offsetImagePosition = je());
639
- const X = Oe(l, c);
640
- return X !== 1 && (q.width = Math.round(l * X), q.height = w.value ? Math.round(q.width / s.value) : Math.round(c * X), r(z, q.width, q.height)), q.base64 = Fe(z), i.emit("imageCropped", q), q;
643
+ T.value && (F.offsetImagePosition = Ie());
644
+ const X = Oe(n, f);
645
+ return X !== 1 && (F.width = Math.round(n * X), F.height = w.value ? Math.round(F.width / s.value) : Math.round(f * X), r(k, F.width, F.height)), F.base64 = Fe(k), i.emit("imageCropped", F), F;
641
646
  }
642
647
  }
643
648
  return null;
644
649
  }
645
650
  function te() {
646
- x.value && qe();
651
+ y.value && qe();
647
652
  }
648
- function xe() {
649
- const a = I.value;
653
+ function ye() {
654
+ const a = $.value;
650
655
  if (a) {
651
656
  if (!w.value)
652
657
  t.value.x1 = 0, t.value.x2 = a.offsetWidth, t.value.y1 = 0, t.value.y2 = a.offsetHeight;
653
658
  else if (a.offsetWidth / s.value < a.offsetHeight) {
654
659
  t.value.x1 = 0, t.value.x2 = a.offsetWidth;
655
- const l = a.offsetWidth / s.value;
656
- t.value.y1 = (a.offsetHeight - l) / 2, t.value.y2 = t.value.y1 + l;
660
+ const n = a.offsetWidth / s.value;
661
+ t.value.y1 = (a.offsetHeight - n) / 2, t.value.y2 = t.value.y1 + n;
657
662
  } else {
658
663
  t.value.y1 = 0, t.value.y2 = a.offsetHeight;
659
- const l = a.offsetHeight * s.value;
660
- t.value.x1 = (a.offsetWidth - l) / 2, t.value.x2 = t.value.x1 + l;
664
+ const n = a.offsetHeight * s.value;
665
+ t.value.x1 = (a.offsetWidth - n) / 2, t.value.x2 = t.value.x1 + n;
661
666
  }
662
- te(), p.value = !0;
667
+ te(), A.value = !0;
663
668
  }
664
669
  }
665
- function be() {
666
- B > 40 ? (o.show({
670
+ function xe() {
671
+ V > 40 ? (o.show({
667
672
  showCloseButton: !1,
668
673
  timeout: 3e3,
669
674
  animate: "fadeIn",
670
675
  toasts: [{ type: "string", title: "提示", msg: "图片加载超时,请重试" }]
671
- }), _ = !0, k.value = !1, i.emit("loadImageFailed")) : He() ? (_ = !1, ue(), re(), xe(), i.emit("cropperReady", { ...E.value })) : (B++, setTimeout(() => be(), 50));
676
+ }), H = !0, d.value = !1, i.emit("loadImageFailed")) : $e() ? (H = !1, ue(), re(), ye(), i.emit("cropperReady", { ...z.value })) : (V++, setTimeout(() => xe(), 50));
672
677
  }
673
678
  function Qe() {
674
- P.value != null && (k.value = !1, i.emit("imageLoaded"), B = 0, setTimeout(() => be()));
679
+ L.value != null && (d.value = !1, i.emit("imageLoaded"), V = 0, setTimeout(() => xe()));
675
680
  }
676
- function Je() {
677
- const a = I.value;
678
- (E.value.width !== (a == null ? void 0 : a.offsetWidth) || E.value.height !== (a == null ? void 0 : a.offsetHeight)) && E.value.width && E.value.height && a && (t.value.x1 = t.value.x1 * a.offsetWidth / E.value.width, t.value.x2 = t.value.x2 * a.offsetWidth / E.value.width, t.value.y1 = t.value.y1 * a.offsetHeight / E.value.height, t.value.y2 = t.value.y2 * a.offsetHeight / E.value.height);
681
+ function Ge() {
682
+ const a = $.value;
683
+ (z.value.width !== (a == null ? void 0 : a.offsetWidth) || z.value.height !== (a == null ? void 0 : a.offsetHeight)) && z.value.width && z.value.height && a && (t.value.x1 = t.value.x1 * a.offsetWidth / z.value.width, t.value.x2 = t.value.x2 * a.offsetWidth / z.value.width, t.value.y1 = t.value.y1 * a.offsetHeight / z.value.height, t.value.y2 = t.value.y2 * a.offsetHeight / z.value.height);
679
684
  }
680
- const Ge = () => {
681
- Je(), ue(), re();
682
- }, Me = () => {
683
- clearTimeout(C), C = setTimeout(Ge, 300);
685
+ const Je = () => {
686
+ Ge(), ue(), re();
687
+ }, be = () => {
688
+ clearTimeout(D), D = setTimeout(Je, 300);
684
689
  };
685
- Ce(() => {
686
- window.addEventListener("resize", Me), ne.value && (Y(), k.value = !0, ye(ne.value));
687
- }), lt(() => {
688
- window.removeEventListener("resize", Me);
690
+ Ae(() => {
691
+ window.addEventListener("resize", be), le.value && (Y(), d.value = !0, pe(le.value));
692
+ }), nt(() => {
693
+ window.removeEventListener("resize", be);
689
694
  });
690
695
  function Ze() {
691
- b.active && (b.active = !1, te());
696
+ x.active && (x.active = !1, te());
692
697
  }
693
698
  function se(a) {
694
699
  return (a.touches && a.touches[0] ? a.touches[0].clientX : a.clientX) || 0;
@@ -696,76 +701,76 @@ function ke(e, i) {
696
701
  function oe(a) {
697
702
  return (a.touches && a.touches[0] ? a.touches[0].clientY : a.clientY) || 0;
698
703
  }
699
- function Ye(a, l, c = null) {
700
- b && b.active || (a.preventDefault && a.preventDefault(), b = {
704
+ function Ye(a, n, f = null) {
705
+ x && x.active || (a.preventDefault && a.preventDefault(), x = {
701
706
  active: !0,
702
- type: l,
703
- position: c,
707
+ type: n,
708
+ position: f,
704
709
  clientX: se(a),
705
710
  clientY: oe(a),
706
711
  ...t.value
707
712
  });
708
713
  }
709
714
  function ce(a = !1) {
710
- t.value.x1 < 0 && (t.value.x2 -= a ? t.value.x1 : 0, t.value.x1 = 0), t.value.y1 < 0 && (t.value.y2 -= a ? t.value.y1 : 0, t.value.y1 = 0), t.value.x2 > E.value.width && (t.value.x1 -= a ? t.value.x2 - E.value.width : 0, t.value.x2 = E.value.width), t.value.y2 > E.value.height && (t.value.y1 -= a ? t.value.y2 - E.value.height : 0, t.value.y2 = E.value.height);
715
+ t.value.x1 < 0 && (t.value.x2 -= a ? t.value.x1 : 0, t.value.x1 = 0), t.value.y1 < 0 && (t.value.y2 -= a ? t.value.y1 : 0, t.value.y1 = 0), t.value.x2 > z.value.width && (t.value.x1 -= a ? t.value.x2 - z.value.width : 0, t.value.x2 = z.value.width), t.value.y2 > z.value.height && (t.value.y1 -= a ? t.value.y2 - z.value.height : 0, t.value.y2 = z.value.height);
711
716
  }
712
717
  function Xe(a) {
713
- const l = se(a) - b.clientX, c = oe(a) - b.clientY;
714
- t.value.x1 = b.x1 + l, t.value.y1 = b.y1 + c, t.value.x2 = b.x2 + l, t.value.y2 = b.y2 + c;
718
+ const n = se(a) - x.clientX, f = oe(a) - x.clientY;
719
+ t.value.x1 = x.x1 + n, t.value.y1 = x.y1 + f, t.value.x2 = x.x2 + n, t.value.y2 = x.y2 + f;
715
720
  }
716
- const { checkAspectRatio: Ke } = Bt(t, E, s, b);
721
+ const { checkAspectRatio: Ke } = Ct(t, z, s, x);
717
722
  function et(a) {
718
- const l = se(a) - b.clientX, c = oe(a) - b.clientY;
719
- switch (b.position) {
723
+ const n = se(a) - x.clientX, f = oe(a) - x.clientY;
724
+ switch (x.position) {
720
725
  case "left":
721
- t.value.x1 = Math.min(b.x1 + l, t.value.x2 - U);
726
+ t.value.x1 = Math.min(x.x1 + n, t.value.x2 - U);
722
727
  break;
723
728
  case "topleft":
724
- t.value.x1 = Math.min(b.x1 + l, t.value.x2 - U), t.value.y1 = Math.min(b.y1 + c, t.value.y2 - N);
729
+ t.value.x1 = Math.min(x.x1 + n, t.value.x2 - U), t.value.y1 = Math.min(x.y1 + f, t.value.y2 - N);
725
730
  break;
726
731
  case "top":
727
- t.value.y1 = Math.min(b.y1 + c, t.value.y2 - N);
732
+ t.value.y1 = Math.min(x.y1 + f, t.value.y2 - N);
728
733
  break;
729
734
  case "topright":
730
- t.value.x2 = Math.max(b.x2 + l, t.value.x1 + U), t.value.y1 = Math.min(b.y1 + c, t.value.y2 - N);
735
+ t.value.x2 = Math.max(x.x2 + n, t.value.x1 + U), t.value.y1 = Math.min(x.y1 + f, t.value.y2 - N);
731
736
  break;
732
737
  case "right":
733
- t.value.x2 = Math.max(b.x2 + l, t.value.x1 + U);
738
+ t.value.x2 = Math.max(x.x2 + n, t.value.x1 + U);
734
739
  break;
735
740
  case "bottomright":
736
- t.value.x2 = Math.max(b.x2 + l, t.value.x1 + U), t.value.y2 = Math.max(b.y2 + c, t.value.y1 + N);
741
+ t.value.x2 = Math.max(x.x2 + n, t.value.x1 + U), t.value.y2 = Math.max(x.y2 + f, t.value.y1 + N);
737
742
  break;
738
743
  case "bottom":
739
- t.value.y2 = Math.max(b.y2 + c, t.value.y1 + N);
744
+ t.value.y2 = Math.max(x.y2 + f, t.value.y1 + N);
740
745
  break;
741
746
  case "bottomleft":
742
- t.value.x1 = Math.min(b.x1 + l, t.value.x2 - U), t.value.y2 = Math.max(b.y2 + c, t.value.y1 + N);
747
+ t.value.x1 = Math.min(x.x1 + n, t.value.x2 - U), t.value.y2 = Math.max(x.y2 + f, t.value.y1 + N);
743
748
  break;
744
749
  case "center":
745
- const { scale: z } = a, H = Math.abs(b.x2 - b.x1) * z, J = Math.abs(b.y2 - b.y1) * z, { x1: Z } = t.value, { y1: q } = t.value;
746
- t.value.x1 = Math.min(b.clientX - H / 2, t.value.x2 - U), t.value.y1 = Math.min(b.clientY - J / 2, t.value.y2 - N), t.value.x2 = Math.max(b.clientX + H / 2, Z + U), t.value.y2 = Math.max(b.clientY + J / 2, q + N);
750
+ const { scale: k } = a, _ = Math.abs(x.x2 - x.x1) * k, G = Math.abs(x.y2 - x.y1) * k, { x1: Z } = t.value, { y1: F } = t.value;
751
+ t.value.x1 = Math.min(x.clientX - _ / 2, t.value.x2 - U), t.value.y1 = Math.min(x.clientY - G / 2, t.value.y2 - N), t.value.x2 = Math.max(x.clientX + _ / 2, Z + U), t.value.y2 = Math.max(x.clientY + G / 2, F + N);
747
752
  break;
748
753
  }
749
754
  w.value && Ke();
750
755
  }
751
756
  function tt(a) {
752
- b && b.active && (a.stopPropagation && a.stopPropagation(), a.preventDefault && a.preventDefault(), clearTimeout(O), O = setTimeout(() => {
753
- b.type === ae.Move ? (Xe(a), ce(!0)) : b.type === ae.Resize && (et(a), ce(!1));
757
+ x && x.active && (a.stopPropagation && a.stopPropagation(), a.preventDefault && a.preventDefault(), clearTimeout(Q), Q = setTimeout(() => {
758
+ x.type === ae.Move ? (Xe(a), ce(!0)) : x.type === ae.Resize && (et(a), ce(!1));
754
759
  }, 300));
755
760
  }
756
- return K(de, (a) => {
757
- Y(), a && a.target && a.target.files && a.target.files.length > 0 && (k.value = !0, pe(a.target.files[0]));
758
- }), K(ne, (a) => {
759
- a ? (Y(), k.value = !0, ye(a)) : (o.show({
761
+ return K(ge, (a) => {
762
+ Y(), a && a.target && a.target.files && a.target.files.length > 0 && (d.value = !0, me(a.target.files[0]));
763
+ }), K(le, (a) => {
764
+ a ? (Y(), d.value = !0, pe(a)) : (o.show({
760
765
  showCloseButton: !1,
761
766
  timeout: 3e3,
762
767
  animate: "fadeIn",
763
768
  toasts: [{ type: "string", title: "提示", msg: "图片路径为空" }]
764
- }), k.value = !1, _ = !0);
765
- }), K(De, (a) => {
766
- Y(), k.value = !0, le(a);
769
+ }), d.value = !1, H = !0);
767
770
  }), K(Be, (a) => {
768
- Y(), a && (k.value = !0, pe(a));
771
+ Y(), d.value = !0, ne(a);
772
+ }), K(Ce, (a) => {
773
+ Y(), a && (d.value = !0, me(a));
769
774
  }), K(
770
775
  () => [
771
776
  e.containWithinAspectRatio,
@@ -775,21 +780,21 @@ function ke(e, i) {
775
780
  e.transform,
776
781
  e.imageChangedEvent
777
782
  ],
778
- ([a, l, c, z, H, J], [Z, q, X, at, it, nt]) => {
779
- S && S.complete && V && (a !== Z || l !== q) && me(), c !== X && (ue(), re(), ce(!1), te()), z !== at && p.value && xe(), H !== it && (We(), te()), J !== nt && (de.value = J);
783
+ ([a, n, f, k, _, G], [Z, F, X, at, it, lt]) => {
784
+ E && E.complete && I && (a !== Z || n !== F) && de(), f !== X && (ue(), re(), ce(!1), te()), k !== at && A.value && ye(), _ !== it && (We(), te()), G !== lt && (ge.value = G);
780
785
  }
781
786
  ), {
782
- uploadError: _,
783
- imageVisible: p,
787
+ uploadError: H,
788
+ imageVisible: A,
784
789
  backgroundColor: m,
785
- sourceImage: I,
790
+ sourceImage: $,
786
791
  safeImgDataUrl: j,
787
- safeTransformStyle: Q,
788
- maxSize: E,
792
+ safeTransformStyle: q,
793
+ maxSize: z,
789
794
  cropper: t,
790
- marginLeft: G,
795
+ marginLeft: J,
791
796
  moveTypes: ie,
792
- isLoading: k,
797
+ isLoading: d,
793
798
  startMove: Ye,
794
799
  imageLoadedInView: Qe,
795
800
  moveStop: Ze,
@@ -798,63 +803,63 @@ function ke(e, i) {
798
803
  }
799
804
  const fe = /* @__PURE__ */ Se({
800
805
  name: "FImageCropper",
801
- props: ge,
806
+ props: he,
802
807
  emits: ["imageCropped", "imageLoaded", "cropperReady", "loadImageFailed"],
803
808
  setup(e, i) {
804
- const r = v(e.alignImage), y = v(e.roundCropper), o = v(e.hideResizeSquares), t = v(e.loadImageErrorText), h = v(e.disabled), g = v(null), {
809
+ const r = v(e.alignImage), p = v(e.roundCropper), o = v(e.hideResizeSquares), t = v(e.loadImageErrorText), h = v(e.disabled), g = v(null), {
805
810
  uploadError: w,
806
811
  imageVisible: s,
807
- backgroundColor: x,
812
+ backgroundColor: y,
808
813
  sourceImage: m,
809
- safeImgDataUrl: n,
814
+ safeImgDataUrl: l,
810
815
  safeTransformStyle: u,
811
- maxSize: A,
816
+ maxSize: T,
812
817
  cropper: M,
813
- marginLeft: $,
814
- moveTypes: L,
818
+ marginLeft: P,
819
+ moveTypes: W,
815
820
  isLoading: R,
816
- startMove: D,
821
+ startMove: B,
817
822
  imageLoadedInView: j,
818
- moveStop: k,
819
- moveImg: p
820
- } = ke(e, i);
821
- function f(C) {
822
- return T("span", {
823
- class: `farris-image-cropper-resize-bar ${C}`,
824
- onMousedown: F((S) => D(S, L.Resize, C), ["prevent"])
823
+ moveStop: d,
824
+ moveImg: A
825
+ } = De(e, i);
826
+ function c(D) {
827
+ return S("span", {
828
+ class: `farris-image-cropper-resize-bar ${D}`,
829
+ onMousedown: O((E) => B(E, W.Resize, D), ["prevent"])
825
830
  }, null);
826
831
  }
827
- function d(C) {
828
- return T("div", null, [T("span", {
829
- class: `farris-image-cropper-resize-bar ${C}`,
830
- onMousedown: F((S) => D(S, L.Resize, C), ["prevent"])
831
- }, [T("span", {
832
+ function b(D) {
833
+ return S("div", null, [S("span", {
834
+ class: `farris-image-cropper-resize-bar ${D}`,
835
+ onMousedown: O((E) => B(E, W.Resize, D), ["prevent"])
836
+ }, [S("span", {
832
837
  class: "farris-image-cropper-square"
833
- }, null)]), T("span", {
838
+ }, null)]), S("span", {
834
839
  class: "farris-image-cropper-resize top"
835
- }, [T("span", {
840
+ }, [S("span", {
836
841
  class: "farris-image-cropper-square"
837
842
  }, null)])]);
838
843
  }
839
- const B = ["top", "right", "bottom", "left"].map((C) => f(C)), O = ["topleft", "topright", "bottomright", "bottomleft"].map((C) => d(C));
840
- return () => T("div", {
844
+ const V = ["top", "right", "bottom", "left"].map((D) => c(D)), Q = ["topleft", "topright", "bottomright", "bottomleft"].map((D) => b(D));
845
+ return () => S("div", {
841
846
  class: ["farris-image-cropper-frame", {
842
847
  "farris-image-cropper-disabled": h.value
843
848
  }],
844
849
  style: {
845
850
  "text-align": r.value
846
851
  },
847
- onMousemove: F((C) => p(C), ["prevent"]),
848
- onTouchmove: F((C) => p(C), ["prevent"]),
849
- onMouseup: F(() => k(), ["prevent"]),
850
- onTouchend: F(() => k(), ["prevent"])
851
- }, [!w && T("div", {
852
+ onMousemove: O((D) => A(D), ["prevent"]),
853
+ onTouchmove: O((D) => A(D), ["prevent"]),
854
+ onMouseup: O(() => d(), ["prevent"]),
855
+ onTouchend: O(() => d(), ["prevent"])
856
+ }, [!w && S("div", {
852
857
  ref: g,
853
858
  class: "farris-image-cropper",
854
859
  style: [{
855
- background: s.value ? x.value : ""
860
+ background: s.value ? y.value : ""
856
861
  }]
857
- }, [n.value && T("img", {
862
+ }, [l.value && S("img", {
858
863
  title: "farris-source-image",
859
864
  ref: m,
860
865
  class: "farris-source-image",
@@ -863,20 +868,20 @@ const fe = /* @__PURE__ */ Se({
863
868
  }, {
864
869
  transform: u.value
865
870
  }],
866
- src: n.value,
871
+ src: l.value,
867
872
  onLoad: () => j()
868
- }, null), A.value && T("div", {
873
+ }, null), T.value && S("div", {
869
874
  class: "farris-image-overlay",
870
875
  style: [{
871
- width: `${A.value.width || 0}px`
876
+ width: `${T.value.width || 0}px`
872
877
  }, {
873
- height: `${A.value.height || 0}px`
878
+ height: `${T.value.height || 0}px`
874
879
  }, {
875
- "margin-left": r.value === "center" ? $.value : ""
880
+ "margin-left": r.value === "center" ? P.value : ""
876
881
  }]
877
- }, null), s.value && T("div", {
882
+ }, null), s.value && S("div", {
878
883
  class: ["farris-image-cropper-wrapper", {
879
- "farris-image-cropper-rounded": y.value
884
+ "farris-image-cropper-rounded": p.value
880
885
  }],
881
886
  style: [{
882
887
  top: `${M.value.y1}px`
@@ -889,166 +894,165 @@ const fe = /* @__PURE__ */ Se({
889
894
  }, {
890
895
  visibility: s.value ? "visible" : "hidden"
891
896
  }, {
892
- "margin-left": r.value === "center" ? $.value : ""
897
+ "margin-left": r.value === "center" ? P.value : ""
893
898
  }],
894
899
  tabindex: "0"
895
- }, [T("div", {
900
+ }, [S("div", {
896
901
  class: "farris-image-cropper-move",
897
- onMousedown: F((C) => D(C, L.Move, "topleft"), ["prevent"])
898
- }, null), !o.value && T("div", null, [O, B])])]), R.value && T("div", {
902
+ onMousedown: O((D) => B(D, W.Move, "topleft"), ["prevent"])
903
+ }, null), !o.value && S("div", null, [Q, V])])]), R.value && S("div", {
899
904
  class: "farris-image-cropper-loading"
900
- }, [T("div", {
905
+ }, [S("div", {
901
906
  class: "farris-image-cropper-loading-spinner"
902
- }, null)]), w && T("div", {
907
+ }, null)]), w && S("div", {
903
908
  class: "farris-image-cropper-error"
904
909
  }, [t.value])]);
905
910
  }
906
911
  });
907
912
  function Wt(e, i, r) {
908
- var k;
909
- function y() {
910
- }
911
- const o = "", t = "", h = v();
912
- function g() {
913
+ var j;
914
+ const p = "", o = "", t = v();
915
+ function h() {
913
916
  return (i == null ? void 0 : i.schema.componentType) !== "frame";
914
917
  }
915
- function w() {
918
+ function g() {
916
919
  return !1;
917
920
  }
918
- function s() {
921
+ function w() {
919
922
  return (i == null ? void 0 : i.schema.componentType) !== "frame";
920
923
  }
921
- function x() {
924
+ function s() {
922
925
  return (i == null ? void 0 : i.schema.componentType) === "frame";
923
926
  }
924
- function m(p) {
925
- if (!p || !p.value)
927
+ function y(d) {
928
+ if (!d || !d.value)
926
929
  return null;
927
- if (p.value.schema && p.value.schema.type === "component")
928
- return p.value;
929
- const f = v(p == null ? void 0 : p.value.parent), d = m(f);
930
- return d || null;
930
+ if (d.value.schema && d.value.schema.type === "component")
931
+ return d.value;
932
+ const A = v(d == null ? void 0 : d.value.parent), c = y(A);
933
+ return c || null;
931
934
  }
932
- function n(p = i) {
933
- const { componentInstance: f, designerItemElementRef: d } = p;
934
- return !f || !f.value ? null : f.value.canMove ? d : n(p.parent);
935
+ function m(d = i) {
936
+ const { componentInstance: A, designerItemElementRef: c } = d;
937
+ return !A || !A.value ? null : A.value.canMove ? c : m(d.parent);
935
938
  }
936
- function u(p) {
939
+ function l(d) {
937
940
  return !!r;
938
941
  }
939
- function A() {
942
+ function u() {
940
943
  return (i == null ? void 0 : i.schema.label) || (i == null ? void 0 : i.schema.title) || (i == null ? void 0 : i.schema.name);
941
944
  }
942
- function M() {
945
+ function T() {
943
946
  }
944
- function $(p, f) {
947
+ function M(d, A) {
945
948
  }
946
- function L(p, f) {
947
- const { componentType: d } = p;
948
- let B = ve(d, p, f);
949
- const O = d.toLowerCase().replace("-", "_");
950
- return B && !B.id && B.type === d && (B.id = `${O}_${Math.random().toString().slice(2, 6)}`), B;
949
+ function P(d, A) {
950
+ const { componentType: c } = d;
951
+ let b = ke(c, d, A);
952
+ const V = c.toLowerCase().replace(/-/g, "_");
953
+ return b && !b.id && b.type === c && (b.id = `${V}_${Math.random().toString().slice(2, 6)}`), b;
951
954
  }
952
- function R(p, f) {
953
- const d = String(p.getAttribute("data-controltype")), B = p.getAttribute("data-feature"), O = B ? JSON.parse(B) : {};
954
- O.parentComponentInstance = h.value;
955
- let C = ve(d, O);
956
- const S = d.toLowerCase().replace("-", "_");
957
- return C && !C.id && C.type === d && (C.id = `${S}_${Math.random().toString().slice(2, 6)}`), C;
955
+ function W(d) {
958
956
  }
959
- function D(p) {
957
+ function R(...d) {
960
958
  }
961
- function j(...p) {
959
+ function B() {
960
+ i != null && i.schema.contents && i.schema.contents.map((d) => {
961
+ var b;
962
+ let A = d.id;
963
+ d.type === "component-ref" && (A = d.component);
964
+ const c = e.value.querySelector(`#${A}-design-item`);
965
+ (b = c == null ? void 0 : c.componentInstance) != null && b.value.onRemoveComponent && c.componentInstance.value.onRemoveComponent();
966
+ });
962
967
  }
963
- return h.value = {
964
- canMove: g(),
965
- canSelectParent: w(),
966
- canDelete: s(),
967
- canNested: !x(),
968
+ return t.value = {
969
+ canMove: h(),
970
+ canSelectParent: g(),
971
+ canDelete: w(),
972
+ canNested: !s(),
968
973
  contents: i == null ? void 0 : i.schema.contents,
969
974
  elementRef: e,
970
- parent: (k = i == null ? void 0 : i.parent) == null ? void 0 : k.componentInstance,
975
+ parent: (j = i == null ? void 0 : i.parent) == null ? void 0 : j.componentInstance,
971
976
  schema: i == null ? void 0 : i.schema,
972
- styles: o,
973
- designerClass: t,
974
- canAccepts: u,
975
- getBelongedComponentInstance: m,
976
- getDraggableDesignItemElement: n,
977
- getDraggingDisplayText: A,
978
- getPropConfig: j,
979
- getDragScopeElement: M,
980
- onAcceptMovedChildElement: $,
981
- onAcceptNewChildElement: R,
982
- onChildElementMovedOut: D,
983
- addNewChildComponentSchema: L,
984
- updateDragAndDropRules: y,
977
+ styles: p,
978
+ designerClass: o,
979
+ canAccepts: l,
980
+ getBelongedComponentInstance: y,
981
+ getDraggableDesignItemElement: m,
982
+ getDraggingDisplayText: u,
983
+ getPropConfig: R,
984
+ getDragScopeElement: T,
985
+ onAcceptMovedChildElement: M,
986
+ onChildElementMovedOut: W,
987
+ addNewChildComponentSchema: P,
985
988
  triggerBelongedComponentToMoveWhenMoved: v(!1),
986
- triggerBelongedComponentToDeleteWhenDeleted: v(!1)
987
- }, h;
989
+ triggerBelongedComponentToDeleteWhenDeleted: v(!1),
990
+ onRemoveComponent: B
991
+ }, t;
988
992
  }
989
993
  const Lt = /* @__PURE__ */ Se({
990
994
  name: "FImageCropperDesign",
991
- props: ge,
995
+ props: he,
992
996
  emits: ["imageCropped", "imageLoaded", "cropperReady", "loadImageFailed"],
993
997
  setup(e, i) {
994
- const r = v(e.alignImage), y = v(e.roundCropper), o = v(e.hideResizeSquares), t = v(e.loadImageErrorText), h = v(e.disabled), g = v(null), {
998
+ const r = v(e.alignImage), p = v(e.roundCropper), o = v(e.hideResizeSquares), t = v(e.loadImageErrorText), h = v(e.disabled), g = v(null), {
995
999
  uploadError: w,
996
1000
  imageVisible: s,
997
- backgroundColor: x,
1001
+ backgroundColor: y,
998
1002
  sourceImage: m,
999
- safeImgDataUrl: n,
1003
+ safeImgDataUrl: l,
1000
1004
  safeTransformStyle: u,
1001
- maxSize: A,
1005
+ maxSize: T,
1002
1006
  cropper: M,
1003
- marginLeft: $,
1004
- moveTypes: L,
1007
+ marginLeft: P,
1008
+ moveTypes: W,
1005
1009
  isLoading: R,
1006
- startMove: D,
1010
+ startMove: B,
1007
1011
  imageLoadedInView: j,
1008
- moveStop: k,
1009
- moveImg: p
1010
- } = ke(e, i), f = v(), d = Te("design-item-context"), B = Wt(f, d);
1011
- Ce(() => {
1012
- f.value.componentInstance = B;
1013
- }), i.expose(B.value);
1014
- function O(W) {
1015
- return T("span", {
1016
- class: `farris-image-cropper-resize-bar ${W}`,
1017
- onMousedown: F((Q) => D(Q, L.Resize, W), ["prevent"])
1012
+ moveStop: d,
1013
+ moveImg: A
1014
+ } = De(e, i), c = v(), b = Te("design-item-context"), V = Wt(c, b);
1015
+ Ae(() => {
1016
+ c.value.componentInstance = V;
1017
+ }), i.expose(V.value);
1018
+ function Q(C) {
1019
+ return S("span", {
1020
+ class: `farris-image-cropper-resize-bar ${C}`,
1021
+ onMousedown: O((q) => B(q, W.Resize, C), ["prevent"])
1018
1022
  }, null);
1019
1023
  }
1020
- function C(W) {
1021
- return T("div", null, [T("span", {
1022
- class: `farris-image-cropper-resize-bar ${W}`,
1023
- onMousedown: F((Q) => D(Q, L.Resize, W), ["prevent"])
1024
- }, [T("span", {
1024
+ function D(C) {
1025
+ return S("div", null, [S("span", {
1026
+ class: `farris-image-cropper-resize-bar ${C}`,
1027
+ onMousedown: O((q) => B(q, W.Resize, C), ["prevent"])
1028
+ }, [S("span", {
1025
1029
  class: "farris-image-cropper-square"
1026
- }, null)]), T("span", {
1030
+ }, null)]), S("span", {
1027
1031
  class: "farris-image-cropper-resize top"
1028
- }, [T("span", {
1032
+ }, [S("span", {
1029
1033
  class: "farris-image-cropper-square"
1030
1034
  }, null)])]);
1031
1035
  }
1032
- const S = ["top", "right", "bottom", "left"].map((W) => O(W)), I = ["topleft", "topright", "bottomright", "bottomleft"].map((W) => C(W));
1033
- return () => T("div", {
1034
- ref: f,
1036
+ const E = ["top", "right", "bottom", "left"].map((C) => Q(C)), $ = ["topleft", "topright", "bottomright", "bottomleft"].map((C) => D(C));
1037
+ return () => S("div", {
1038
+ ref: c,
1035
1039
  class: ["farris-image-cropper-frame", {
1036
1040
  "farris-image-cropper-disabled": h.value
1037
1041
  }],
1038
1042
  style: {
1039
1043
  "text-align": r.value
1040
1044
  },
1041
- onMousemove: F((W) => p(W), ["prevent"]),
1042
- onTouchmove: F((W) => p(W), ["prevent"]),
1043
- onMouseup: F(() => k(), ["prevent"]),
1044
- onTouchend: F(() => k(), ["prevent"])
1045
- }, [!w && T("div", {
1045
+ onMousemove: O((C) => A(C), ["prevent"]),
1046
+ onTouchmove: O((C) => A(C), ["prevent"]),
1047
+ onMouseup: O(() => d(), ["prevent"]),
1048
+ onTouchend: O(() => d(), ["prevent"])
1049
+ }, [!w && S("div", {
1046
1050
  ref: g,
1047
1051
  class: "farris-image-cropper",
1048
1052
  style: [{
1049
- background: s.value ? x.value : ""
1053
+ background: s.value ? y.value : ""
1050
1054
  }]
1051
- }, [n.value && T("img", {
1055
+ }, [l.value && S("img", {
1052
1056
  title: "farris-source-image",
1053
1057
  ref: m,
1054
1058
  class: "farris-source-image",
@@ -1057,20 +1061,20 @@ const Lt = /* @__PURE__ */ Se({
1057
1061
  }, {
1058
1062
  transform: u.value
1059
1063
  }],
1060
- src: n.value,
1064
+ src: l.value,
1061
1065
  onLoad: () => j()
1062
- }, null), A.value && T("div", {
1066
+ }, null), T.value && S("div", {
1063
1067
  class: "farris-image-overlay",
1064
1068
  style: [{
1065
- width: `${A.value.width || 0}px`
1069
+ width: `${T.value.width || 0}px`
1066
1070
  }, {
1067
- height: `${A.value.height || 0}px`
1071
+ height: `${T.value.height || 0}px`
1068
1072
  }, {
1069
- "margin-left": r.value === "center" ? $.value : ""
1073
+ "margin-left": r.value === "center" ? P.value : ""
1070
1074
  }]
1071
- }, null), s.value && T("div", {
1075
+ }, null), s.value && S("div", {
1072
1076
  class: ["farris-image-cropper-wrapper", {
1073
- "farris-image-cropper-rounded": y.value
1077
+ "farris-image-cropper-rounded": p.value
1074
1078
  }],
1075
1079
  style: [{
1076
1080
  top: `${M.value.y1}px`
@@ -1083,34 +1087,34 @@ const Lt = /* @__PURE__ */ Se({
1083
1087
  }, {
1084
1088
  visibility: s.value ? "visible" : "hidden"
1085
1089
  }, {
1086
- "margin-left": r.value === "center" ? $.value : ""
1090
+ "margin-left": r.value === "center" ? P.value : ""
1087
1091
  }],
1088
1092
  tabindex: "0"
1089
- }, [T("div", {
1093
+ }, [S("div", {
1090
1094
  class: "farris-image-cropper-move",
1091
- onMousedown: F((W) => D(W, L.Move, "topleft"), ["prevent"])
1092
- }, null), !o.value && T("div", null, [I, S])])]), R.value && T("div", {
1095
+ onMousedown: O((C) => B(C, W.Move, "topleft"), ["prevent"])
1096
+ }, null), !o.value && S("div", null, [$, E])])]), R.value && S("div", {
1093
1097
  class: "farris-image-cropper-loading"
1094
- }, [T("div", {
1098
+ }, [S("div", {
1095
1099
  class: "farris-image-cropper-loading-spinner"
1096
- }, null)]), w && T("div", {
1100
+ }, null)]), w && S("div", {
1097
1101
  class: "farris-image-cropper-error"
1098
1102
  }, [t.value])]);
1099
1103
  }
1100
- }), Rt = {
1104
+ }), Ht = {
1101
1105
  install(e) {
1102
1106
  e.component(fe.name, fe);
1103
1107
  },
1104
- register(e, i, r, y) {
1105
- e["image-cropper"] = fe, i["image-cropper"] = Ae;
1108
+ register(e, i, r, p) {
1109
+ e["image-cropper"] = fe, i["image-cropper"] = we;
1106
1110
  },
1107
1111
  registerDesigner(e, i, r) {
1108
- e["image-cropper"] = Lt, i["image-cropper"] = Ae;
1112
+ e["image-cropper"] = Lt, i["image-cropper"] = we;
1109
1113
  }
1110
1114
  };
1111
1115
  export {
1112
1116
  fe as ImageCropper,
1113
- Rt as default,
1114
- ge as imageCropperProps,
1115
- Ae as propsResolver
1117
+ Ht as default,
1118
+ he as imageCropperProps,
1119
+ we as propsResolver
1116
1120
  };