@ticatec/uniface-element 5.0.4 → 5.1.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 (411) hide show
  1. package/README.md +14 -13
  2. package/README_CN.md +17 -15
  3. package/dist/app_layout/ColumnsLayout.svelte +14 -10
  4. package/dist/app_layout/ColumnsLayout.svelte.d.ts +8 -4
  5. package/dist/app_layout/README.md +14 -12
  6. package/dist/app_layout/README_CN.md +14 -12
  7. package/dist/app_layout/RowsLayout.svelte +14 -10
  8. package/dist/app_layout/RowsLayout.svelte.d.ts +8 -4
  9. package/dist/base-calendar/CalendarBase.svelte +4 -10
  10. package/dist/base-calendar/CalendarBase.svelte.d.ts +0 -4
  11. package/dist/base-calendar/DateContext.d.ts +1 -0
  12. package/dist/base-calendar/DateContext.js +5 -8
  13. package/dist/base-calendar/MonthlyCalendar.svelte +11 -3
  14. package/dist/base-calendar/MonthlyCalendar.svelte.d.ts +1 -2
  15. package/dist/base-calendar/YearPickupPanel.svelte +5 -5
  16. package/dist/base-calendar/YearPickupPanel.svelte.d.ts +2 -2
  17. package/dist/base-calendar/dateUtils.js +9 -5
  18. package/dist/composite/pagination_panel/PaginationPanel.svelte +19 -13
  19. package/dist/composite/pagination_panel/PaginationPanel.svelte.d.ts +8 -5
  20. package/dist/composite/pagination_panel/README.md +3 -1
  21. package/dist/composite/pagination_panel/README_CN.md +3 -1
  22. package/dist/composite/transfer/Transfer.svelte +30 -16
  23. package/dist/composite/transfer/Transfer.svelte.d.ts +11 -4
  24. package/dist/composite/transfer/index.d.ts +2 -2
  25. package/dist/data_display/accordion/Accordion.svelte +10 -9
  26. package/dist/data_display/accordion/Accordion.svelte.d.ts +2 -1
  27. package/dist/data_display/accordion/AccordionItemView.svelte +6 -6
  28. package/dist/data_display/accordion/AccordionItemView.svelte.d.ts +1 -1
  29. package/dist/data_display/accordion/README.md +6 -4
  30. package/dist/data_display/accordion/README_CN.md +6 -4
  31. package/dist/data_display/card/Card.svelte +13 -11
  32. package/dist/data_display/card/Card.svelte.d.ts +5 -3
  33. package/dist/data_display/card/CardAction.d.ts +7 -2
  34. package/dist/data_display/card/CommonCardActionBar.svelte +2 -2
  35. package/dist/data_display/card/README.md +11 -9
  36. package/dist/data_display/card/README_CN.md +11 -9
  37. package/dist/data_display/card/index.d.ts +2 -1
  38. package/dist/data_display/concise_data_table/Column.d.ts +0 -6
  39. package/dist/data_display/concise_data_table/ConciseListTable.svelte +6 -5
  40. package/dist/data_display/concise_data_table/ConciseListTable.svelte.d.ts +4 -3
  41. package/dist/data_display/concise_data_table/DataCell.svelte +1 -1
  42. package/dist/data_display/concise_data_table/README.md +7 -5
  43. package/dist/data_display/concise_data_table/README_CN.md +7 -5
  44. package/dist/data_display/concise_data_table/TableOptions.d.ts +1 -1
  45. package/dist/data_display/list_box/ListBox.svelte +11 -15
  46. package/dist/data_display/list_box/ListBox.svelte.d.ts +6 -9
  47. package/dist/data_display/list_box/README.md +10 -8
  48. package/dist/data_display/list_box/README_CN.md +10 -8
  49. package/dist/data_display/list_box/index.d.ts +2 -3
  50. package/dist/data_display/tree_view/README.md +4 -2
  51. package/dist/data_display/tree_view/README_CN.md +4 -2
  52. package/dist/data_display/tree_view/TreeNodeView.svelte +15 -16
  53. package/dist/data_display/tree_view/TreeNodeView.svelte.d.ts +4 -5
  54. package/dist/data_display/tree_view/TreeView.svelte +27 -19
  55. package/dist/data_display/tree_view/TreeView.svelte.d.ts +12 -4
  56. package/dist/data_display/tree_view/index.d.ts +2 -3
  57. package/dist/data_table/DataTable.svelte +46 -15
  58. package/dist/data_table/DataTable.svelte.d.ts +9 -1
  59. package/dist/data_table/README.md +10 -8
  60. package/dist/data_table/README_CN.md +10 -8
  61. package/dist/data_table/UniDataTable.d.ts +4 -4
  62. package/dist/data_table/UniDataTable.js +2 -2
  63. package/dist/data_table/index.d.ts +5 -5
  64. package/dist/data_table/lib/CellAction.d.ts +9 -0
  65. package/dist/data_table/lib/CommonHeaderCell.d.ts +2 -2
  66. package/dist/data_table/lib/CompareFn.d.ts +3 -0
  67. package/dist/data_table/lib/DataColumn.d.ts +7 -12
  68. package/dist/data_table/lib/FormatCellFn.d.ts +2 -0
  69. package/dist/data_table/lib/HrefLink.d.ts +3 -3
  70. package/dist/data_table/lib/IndicatorColumn.d.ts +2 -1
  71. package/dist/data_table/lib/RowAction.d.ts +14 -20
  72. package/dist/data_table/lib/virtualWindow.d.ts +37 -0
  73. package/dist/data_table/lib/virtualWindow.js +41 -0
  74. package/dist/data_table/parts/ActionCell.svelte +3 -3
  75. package/dist/data_table/parts/ActionCell.svelte.d.ts +1 -1
  76. package/dist/data_table/parts/ActionsPanel.svelte +17 -2
  77. package/dist/data_table/parts/ActionsPanel.svelte.d.ts +3 -0
  78. package/dist/data_table/parts/ActionsRow.svelte +7 -5
  79. package/dist/data_table/parts/ContentPanel.svelte +40 -15
  80. package/dist/data_table/parts/ContentPanel.svelte.d.ts +11 -6
  81. package/dist/data_table/parts/FixedColumnsPanel.svelte +32 -16
  82. package/dist/data_table/parts/FixedColumnsPanel.svelte.d.ts +8 -5
  83. package/dist/data_table/parts/FixedHeaderPanel.svelte +14 -15
  84. package/dist/data_table/parts/FixedHeaderPanel.svelte.d.ts +4 -4
  85. package/dist/data_table/parts/FixedRow.svelte +9 -9
  86. package/dist/data_table/parts/FixedRow.svelte.d.ts +3 -3
  87. package/dist/data_table/parts/HrefCell.svelte +1 -1
  88. package/dist/data_table/parts/PopupMenu.svelte +3 -3
  89. package/dist/data_table/parts/PopupMenu.svelte.d.ts +1 -1
  90. package/dist/data_table/parts/TableHeaderPanel.svelte +14 -14
  91. package/dist/data_table/parts/TableHeaderPanel.svelte.d.ts +4 -4
  92. package/dist/data_table/parts/TextCell.svelte +1 -1
  93. package/dist/feedback/progress-bar/ProgressBar.svelte +13 -10
  94. package/dist/feedback/progress-bar/ProgressBar.svelte.d.ts +6 -3
  95. package/dist/form/FormEditor.svelte +2 -2
  96. package/dist/form/FormEditor.svelte.d.ts +1 -1
  97. package/dist/form/attachment_files/AttachmentEditor.svelte +407 -92
  98. package/dist/form/attachment_files/AttachmentEditor.svelte.d.ts +71 -15
  99. package/dist/form/attachment_files/AttachmentFile.d.ts +35 -8
  100. package/dist/form/attachment_files/AttachmentFile.js +54 -29
  101. package/dist/form/attachment_files/AttachmentListItem.svelte +208 -0
  102. package/dist/form/attachment_files/AttachmentListItem.svelte.d.ts +25 -0
  103. package/dist/form/attachment_files/AttachmentTile.svelte +296 -0
  104. package/dist/form/attachment_files/AttachmentTile.svelte.d.ts +25 -0
  105. package/dist/form/attachment_files/FileUpload.d.ts +2 -2
  106. package/dist/form/attachment_files/README.md +71 -452
  107. package/dist/form/attachment_files/README_CN.md +68 -449
  108. package/dist/form/attachment_files/UploadTask.d.ts +27 -0
  109. package/dist/form/attachment_files/index.d.ts +8 -5
  110. package/dist/form/attachment_files/index.js +4 -2
  111. package/dist/form/cascade_options_select/CascadeOptionSelect.svelte +16 -15
  112. package/dist/form/cascade_options_select/CascadeOptionSelect.svelte.d.ts +6 -5
  113. package/dist/form/cascade_options_select/IsLeaf.d.ts +4 -0
  114. package/dist/form/cascade_options_select/IsLeaf.js +1 -0
  115. package/dist/form/cascade_options_select/OptionsBox.svelte +4 -4
  116. package/dist/form/cascade_options_select/OptionsBox.svelte.d.ts +2 -2
  117. package/dist/form/color_picker/ColorPicker.svelte +3 -3
  118. package/dist/form/color_picker/ColorPickerPanel.svelte +1 -1
  119. package/dist/form/common_editor/BasePicker.svelte +7 -7
  120. package/dist/form/common_editor/BasePicker.svelte.d.ts +3 -3
  121. package/dist/form/common_editor/CommonEditor.svelte +8 -8
  122. package/dist/form/common_editor/CommonEditor.svelte.d.ts +2 -2
  123. package/dist/form/common_editor/CommonPicker.svelte +43 -31
  124. package/dist/form/common_editor/CommonPicker.svelte.d.ts +6 -6
  125. package/dist/form/common_editor/CommonPickerProps.d.ts +2 -2
  126. package/dist/form/common_editor/CommonPopupEditor.svelte +13 -13
  127. package/dist/form/common_editor/CommonPopupEditor.svelte.d.ts +3 -4
  128. package/dist/form/common_editor/NumberInput.svelte +10 -2
  129. package/dist/form/common_editor/NumberInput.svelte.d.ts +1 -1
  130. package/dist/form/common_range_editor/CommonRangeEditor.svelte +17 -17
  131. package/dist/form/common_range_editor/CommonRangeEditor.svelte.d.ts +5 -5
  132. package/dist/form/date_picker/DatePicker.svelte +5 -5
  133. package/dist/form/date_picker/DatePicker.svelte.d.ts +1 -1
  134. package/dist/form/date_picker/DateTimePicker.svelte +16 -6
  135. package/dist/form/date_picker/README.md +7 -5
  136. package/dist/form/date_picker/README_CN.md +7 -5
  137. package/dist/form/date_picker/ScrollBar.svelte +21 -20
  138. package/dist/form/date_picker/ScrollBar.svelte.d.ts +3 -3
  139. package/dist/form/date_range/DateRangeEditor.svelte +6 -6
  140. package/dist/form/events.d.ts +70 -0
  141. package/dist/form/events.js +6 -0
  142. package/dist/form/group_box/group-check-box/GroupCheckBox.svelte +9 -7
  143. package/dist/form/group_box/group-check-box/GroupCheckBox.svelte.d.ts +4 -3
  144. package/dist/form/group_box/group-check-box/README.md +5 -3
  145. package/dist/form/group_box/group-check-box/README_CN.md +5 -3
  146. package/dist/form/group_box/group-radio-box/GroupRadioBox.svelte +9 -7
  147. package/dist/form/group_box/group-radio-box/GroupRadioBox.svelte.d.ts +4 -3
  148. package/dist/form/group_box/group-radio-box/README.md +3 -1
  149. package/dist/form/group_box/group-radio-box/README_CN.md +3 -1
  150. package/dist/form/image_editor/ImageEditor.svelte +118 -0
  151. package/dist/form/image_editor/ImageEditor.svelte.d.ts +52 -0
  152. package/dist/form/image_editor/ImageFile.d.ts +11 -0
  153. package/dist/form/image_editor/ImageFile.js +1 -0
  154. package/dist/form/{image-files → image_editor}/ImagePreview.svelte +10 -2
  155. package/dist/form/image_editor/README.md +89 -0
  156. package/dist/form/image_editor/README_CN.md +89 -0
  157. package/dist/form/image_editor/index.d.ts +11 -0
  158. package/dist/form/image_editor/index.js +4 -0
  159. package/dist/form/input_options_select/InputOptionsSelect.svelte +11 -8
  160. package/dist/form/input_options_select/InputOptionsSelect.svelte.d.ts +2 -1
  161. package/dist/form/input_options_select/README.md +44 -218
  162. package/dist/form/input_options_select/README_CN.md +38 -211
  163. package/dist/form/lookup_editor/LookupEditor.svelte +7 -10
  164. package/dist/form/lookup_editor/LookupEditor.svelte.d.ts +2 -1
  165. package/dist/form/memo_editor/MemoEditor.svelte +2 -2
  166. package/dist/form/memo_editor/MemoEditor.svelte.d.ts +1 -1
  167. package/dist/form/number_editor/NumberEditor.svelte +13 -1
  168. package/dist/form/number_editor/NumberEditor.svelte.d.ts +1 -1
  169. package/dist/form/number_range/NumberRange.svelte +5 -5
  170. package/dist/form/options_multi_select/OptionsMultiSelect.svelte +13 -13
  171. package/dist/form/options_multi_select/OptionsMultiSelect.svelte.d.ts +3 -2
  172. package/dist/form/options_multi_select/README.md +5 -3
  173. package/dist/form/options_multi_select/README_CN.md +5 -3
  174. package/dist/form/options_select/OptionsSelect.svelte +19 -15
  175. package/dist/form/options_select/OptionsSelect.svelte.d.ts +2 -1
  176. package/dist/form/options_select/README.md +9 -7
  177. package/dist/form/options_select/README_CN.md +8 -6
  178. package/dist/form/prompts_text_editor/PromptsTextEditor.svelte +6 -5
  179. package/dist/form/prompts_text_editor/PromptsTextEditor.svelte.d.ts +2 -1
  180. package/dist/form/prompts_text_editor/README.md +16 -14
  181. package/dist/form/prompts_text_editor/README_CN.md +16 -14
  182. package/dist/form/search_box/SearchBox.svelte +3 -2
  183. package/dist/form/search_box/SearchBox.svelte.d.ts +1 -1
  184. package/dist/form/switch/README.md +7 -5
  185. package/dist/form/switch/README_CN.md +7 -5
  186. package/dist/form/switch/Switch.svelte +7 -5
  187. package/dist/form/switch/Switch.svelte.d.ts +4 -2
  188. package/dist/form/text_editor/PasswordEditor.svelte +2 -2
  189. package/dist/form/text_editor/PasswordEditor.svelte.d.ts +1 -1
  190. package/dist/form/text_editor/TextEditor.svelte +6 -4
  191. package/dist/form/text_editor/TextEditor.svelte.d.ts +1 -1
  192. package/dist/form/time_editor/README.md +4 -2
  193. package/dist/form/time_editor/README_CN.md +4 -2
  194. package/dist/form/time_editor/TimeEditor.svelte +10 -7
  195. package/dist/form/time_editor/TimeEditor.svelte.d.ts +2 -1
  196. package/dist/form/types.d.ts +5 -42
  197. package/dist/form/unit-number-editor/README.md +21 -19
  198. package/dist/form/unit-number-editor/README_CN.md +21 -19
  199. package/dist/form/unit-number-editor/UnitNumberEditor.svelte +12 -11
  200. package/dist/form/unit-number-editor/UnitNumberEditor.svelte.d.ts +4 -3
  201. package/dist/general/button/Button.svelte +4 -1
  202. package/dist/general/button/Button.svelte.d.ts +3 -1
  203. package/dist/general/button/IconButton.svelte +11 -5
  204. package/dist/general/button/IconButton.svelte.d.ts +5 -2
  205. package/dist/general/button/IconButton_README.md +9 -6
  206. package/dist/general/button/IconButton_README_CN.md +9 -6
  207. package/dist/general/button/TextButton.svelte +15 -5
  208. package/dist/general/button/TextButton.svelte.d.ts +6 -2
  209. package/dist/general/button/TextButton_README.md +10 -6
  210. package/dist/general/button/TextButton_README_CN.md +10 -6
  211. package/dist/general/icon/Icon.svelte +6 -4
  212. package/dist/general/icon/Icon.svelte.d.ts +3 -2
  213. package/dist/general/tag/Tag.svelte +8 -4
  214. package/dist/general/tag/Tag.svelte.d.ts +3 -1
  215. package/dist/i18nRes/i18nRes.d.ts +45 -2
  216. package/dist/i18nRes/i18nRes.js +7 -2
  217. package/dist/layouts/action_bar/ActionBar.svelte +5 -4
  218. package/dist/layouts/action_bar/ActionBar.svelte.d.ts +2 -1
  219. package/dist/layouts/action_bar/ButtonAction.d.ts +1 -23
  220. package/dist/layouts/action_bar/README.md +20 -18
  221. package/dist/layouts/action_bar/README_CN.md +19 -17
  222. package/dist/layouts/box/Box.svelte +4 -3
  223. package/dist/layouts/box/Box.svelte.d.ts +2 -1
  224. package/dist/layouts/box/README.md +13 -11
  225. package/dist/layouts/box/README_CN.md +13 -11
  226. package/dist/layouts/form_field/FormField.svelte +5 -4
  227. package/dist/layouts/form_field/FormField.svelte.d.ts +3 -2
  228. package/dist/layouts/form_field/README.md +11 -9
  229. package/dist/layouts/form_field/README_CN.md +9 -7
  230. package/dist/layouts/form_panel/flex_row_form/Cell.svelte +3 -1
  231. package/dist/layouts/form_panel/flex_row_form/Cell.svelte.d.ts +3 -1
  232. package/dist/layouts/form_panel/flex_row_form/Row.svelte +3 -1
  233. package/dist/layouts/form_panel/flex_row_form/Row.svelte.d.ts +3 -1
  234. package/dist/layouts/form_panel/grid_form/GridField.svelte +8 -4
  235. package/dist/layouts/form_panel/grid_form/GridField.svelte.d.ts +6 -2
  236. package/dist/layouts/form_panel/grid_form/GridForm.svelte +3 -1
  237. package/dist/layouts/form_panel/grid_form/GridForm.svelte.d.ts +3 -1
  238. package/dist/layouts/form_panel/grid_form/README.md +6 -4
  239. package/dist/layouts/form_panel/grid_form/README_CN.md +6 -4
  240. package/dist/layouts/page/Page.svelte +7 -7
  241. package/dist/layouts/page/Page.svelte.d.ts +2 -2
  242. package/dist/layouts/page/PageHeader.svelte +4 -4
  243. package/dist/layouts/page/PageHeader.svelte.d.ts +1 -1
  244. package/dist/layouts/page/README.md +18 -18
  245. package/dist/layouts/page/README_CN.md +18 -18
  246. package/dist/navigation/nav_menu/MenuItem.d.ts +1 -1
  247. package/dist/navigation/nav_menu/NavigatorMenu.svelte +16 -14
  248. package/dist/navigation/nav_menu/NavigatorMenu.svelte.d.ts +7 -5
  249. package/dist/navigation/nav_menu/NavigatorMenuItem.svelte +2 -2
  250. package/dist/navigation/nav_menu/NavigatorMenuItem.svelte.d.ts +2 -2
  251. package/dist/navigation/nav_menu/README.md +8 -6
  252. package/dist/navigation/nav_menu/README_CN.md +8 -6
  253. package/dist/navigation/nav_menu/index.d.ts +2 -2
  254. package/dist/navigation/navigator/Navigator.svelte +5 -4
  255. package/dist/navigation/navigator/Navigator.svelte.d.ts +3 -2
  256. package/dist/navigation/navigator/README.md +12 -10
  257. package/dist/navigation/navigator/README_CN.md +12 -10
  258. package/dist/navigation/pagination/Pagination.svelte +23 -15
  259. package/dist/navigation/pagination/Pagination.svelte.d.ts +6 -4
  260. package/dist/navigation/progress_step_bar/ProgressStep.d.ts +2 -1
  261. package/dist/navigation/progress_step_bar/ProgressStepBar.svelte +5 -4
  262. package/dist/navigation/progress_step_bar/ProgressStepBar.svelte.d.ts +2 -1
  263. package/dist/navigation/progress_step_bar/ProgressStepBlock.svelte +3 -3
  264. package/dist/navigation/progress_step_bar/ProgressStepBlock.svelte.d.ts +1 -1
  265. package/dist/navigation/progress_step_bar/README.md +37 -35
  266. package/dist/navigation/progress_step_bar/README_CN.md +36 -34
  267. package/dist/navigation/tabs/Tabs.svelte +14 -5
  268. package/dist/navigation/tabs/Tabs.svelte.d.ts +11 -4
  269. package/dist/navigation/tabs/index.d.ts +2 -2
  270. package/dist/overlay/common/ModalPopover.svelte +5 -4
  271. package/dist/overlay/common/ModalPopover.svelte.d.ts +2 -1
  272. package/dist/overlay/common/Popover.svelte +4 -3
  273. package/dist/overlay/common/Popover.svelte.d.ts +2 -1
  274. package/dist/overlay/context-menu/ContextMenuItem.d.ts +3 -3
  275. package/dist/overlay/context-menu/ContextMenuPanel.svelte +4 -4
  276. package/dist/overlay/context-menu/index.d.ts +2 -2
  277. package/dist/overlay/dialog/CommonDialog.svelte +17 -13
  278. package/dist/overlay/dialog/CommonDialog.svelte.d.ts +9 -5
  279. package/dist/overlay/dialog/Dialog.svelte +25 -19
  280. package/dist/overlay/dialog/Dialog.svelte.d.ts +11 -5
  281. package/dist/overlay/dialog/DialogActions.d.ts +1 -1
  282. package/dist/overlay/dialog/DialogCloseConfirm.d.ts +4 -1
  283. package/dist/overlay/dialog/DialogCloseConfirm.js +1 -1
  284. package/dist/overlay/dialog/DialogManager.svelte.js +2 -1
  285. package/dist/overlay/dialog/README.md +19 -17
  286. package/dist/overlay/dialog/README_CN.md +19 -17
  287. package/dist/overlay/dialog/index.d.ts +2 -2
  288. package/dist/overlay/message-box/IMessageBox.d.ts +4 -4
  289. package/dist/overlay/message-box/MessageBox.svelte.js +3 -3
  290. package/dist/ticatec-uniface-web.css +38 -12
  291. package/dist/types.d.ts +38 -46
  292. package/dist/unifaceContext.d.ts +2 -2
  293. package/dist/utils/prefixFilter.js +0 -1
  294. package/docs/NAMING.md +362 -0
  295. package/docs/NAMING_CN.md +362 -0
  296. package/docs/components/README.md +16 -14
  297. package/docs/components/accordion/README.md +13 -2
  298. package/docs/components/accordion/example.svelte +1 -0
  299. package/docs/components/action-bar/README.md +4 -4
  300. package/docs/components/attachment-editor/README.md +224 -0
  301. package/docs/components/attachment-editor/example.svelte +22 -0
  302. package/docs/components/box/README.md +1 -1
  303. package/docs/components/button/README.md +8 -1
  304. package/docs/components/button/example.svelte +1 -0
  305. package/docs/components/card/README.md +19 -5
  306. package/docs/components/cascade-options-select/README.md +11 -5
  307. package/docs/components/columns-layout/README.md +8 -4
  308. package/docs/components/columns-layout/example.svelte +4 -0
  309. package/docs/components/common-dialog/README.md +19 -10
  310. package/docs/components/common-dialog/example.svelte +2 -1
  311. package/docs/components/concise-data-table/README.md +18 -29
  312. package/docs/components/concise-data-table/example.svelte +1 -1
  313. package/docs/components/context-menu/README.md +5 -5
  314. package/docs/components/context-menu/example.svelte +1 -1
  315. package/docs/components/criteria-field/README.md +1 -0
  316. package/docs/components/criteria-field/example.svelte +1 -0
  317. package/docs/components/data-table/README.md +63 -40
  318. package/docs/components/data-table/example.svelte +2 -2
  319. package/docs/components/date-picker/README.md +1 -1
  320. package/docs/components/date-time-picker/README.md +1 -1
  321. package/docs/components/dialog/README.md +21 -14
  322. package/docs/components/dialog/example.svelte +1 -1
  323. package/docs/components/form-field/README.md +3 -3
  324. package/docs/components/grid-form/README.md +15 -5
  325. package/docs/components/grid-form/example.svelte +1 -1
  326. package/docs/components/group-check-box/README.md +3 -3
  327. package/docs/components/group-radio-box/README.md +3 -3
  328. package/docs/components/icon/README.md +6 -5
  329. package/docs/components/icon-button/README.md +10 -1
  330. package/docs/components/icon-button/example.svelte +1 -0
  331. package/docs/components/image-editor/README.md +262 -0
  332. package/docs/components/{image-files → image-editor}/example.svelte +5 -3
  333. package/docs/components/input-options-select/README.md +2 -2
  334. package/docs/components/list-box/README.md +12 -13
  335. package/docs/components/list-box/example.svelte +3 -3
  336. package/docs/components/lookup-editor/README.md +1 -1
  337. package/docs/components/navigator/README.md +2 -1
  338. package/docs/components/navigator/example.svelte +1 -0
  339. package/docs/components/navigator-menu/README.md +24 -21
  340. package/docs/components/navigator-menu/example.svelte +4 -2
  341. package/docs/components/options-multi-select/README.md +2 -2
  342. package/docs/components/options-select/README.md +4 -4
  343. package/docs/components/page/README.md +2 -2
  344. package/docs/components/page-stack/README.md +67 -0
  345. package/docs/components/page-stack/example.svelte +7 -0
  346. package/docs/components/pagination/README.md +24 -7
  347. package/docs/components/pagination/example.svelte +5 -2
  348. package/docs/components/pagination-panel/README.md +25 -10
  349. package/docs/components/pagination-panel/example.svelte +5 -4
  350. package/docs/components/password-editor/README.md +128 -0
  351. package/docs/components/{attachment-files → password-editor}/example.svelte +5 -5
  352. package/docs/components/progress-bar/README.md +14 -4
  353. package/docs/components/progress-bar/example.svelte +1 -1
  354. package/docs/components/progress-step-bar/README.md +16 -7
  355. package/docs/components/progress-step-bar/example.svelte +5 -1
  356. package/docs/components/prompts-text-editor/README.md +8 -6
  357. package/docs/components/prompts-text-editor/example.svelte +0 -1
  358. package/docs/components/rows-layout/README.md +8 -4
  359. package/docs/components/rows-layout/example.svelte +4 -0
  360. package/docs/components/switch/README.md +2 -2
  361. package/docs/components/tabs/README.md +24 -9
  362. package/docs/components/tag/README.md +13 -2
  363. package/docs/components/tag/example.svelte +1 -0
  364. package/docs/components/text-button/README.md +20 -1
  365. package/docs/components/text-button/example.svelte +2 -0
  366. package/docs/components/time-editor/README.md +1 -1
  367. package/docs/components/transfer/README.md +16 -9
  368. package/docs/components/tree-view/README.md +29 -13
  369. package/docs/components/tree-view/example.svelte +2 -1
  370. package/docs/components/unit-number-editor/README.md +11 -8
  371. package/docs/components/unit-number-editor/example.svelte +0 -1
  372. package/package.json +13 -7
  373. package/dist/data_table/lib/CompareFunction.d.ts +0 -3
  374. package/dist/data_table/lib/FormatCell.d.ts +0 -2
  375. package/dist/form/attachment_files/FileRender.svelte +0 -125
  376. package/dist/form/attachment_files/FileRender.svelte.d.ts +0 -9
  377. package/dist/form/attachment_files/FileUploadBar.svelte +0 -66
  378. package/dist/form/attachment_files/FileUploadBar.svelte.d.ts +0 -8
  379. package/dist/form/attachment_files/FileUploadPanel.svelte +0 -161
  380. package/dist/form/attachment_files/FileUploadPanel.svelte.d.ts +0 -14
  381. package/dist/form/attachment_files/UploadFile.d.ts +0 -43
  382. package/dist/form/attachment_files/UploadFile.js +0 -80
  383. package/dist/form/cascade_options_select/CascadePanel.svelte +0 -52
  384. package/dist/form/cascade_options_select/CascadePanel.svelte.d.ts +0 -26
  385. package/dist/form/cascade_options_select/isLeafDetermine.d.ts +0 -4
  386. package/dist/form/common_editor/EditorEvents.d.ts +0 -14
  387. package/dist/form/common_editor/EditorEvents.js +0 -2
  388. package/dist/form/image-files/ImageFile.d.ts +0 -12
  389. package/dist/form/image-files/ImageFilesField.svelte +0 -128
  390. package/dist/form/image-files/ImageFilesField.svelte.d.ts +0 -18
  391. package/dist/form/image-files/ImageRender.svelte +0 -95
  392. package/dist/form/image-files/ImageRender.svelte.d.ts +0 -10
  393. package/dist/form/image-files/README.md +0 -468
  394. package/dist/form/image-files/README_CN.md +0 -468
  395. package/dist/form/image-files/index.d.ts +0 -10
  396. package/dist/form/image-files/index.js +0 -2
  397. package/dist/layout/flex/FlexBlock.svelte +0 -17
  398. package/dist/layout/flex/FlexBlock.svelte.d.ts +0 -38
  399. package/dist/layout/flex/README.md +0 -148
  400. package/dist/layout/flex/README_CN.md +0 -148
  401. package/dist/layout/flex/index.d.ts +0 -2
  402. package/dist/layout/flex/index.js +0 -2
  403. package/dist/layout/index.d.ts +0 -0
  404. package/dist/layout/index.js +0 -1
  405. package/docs/components/attachment-files/README.md +0 -332
  406. package/docs/components/image-files/README.md +0 -174
  407. /package/dist/data_table/lib/{FormatCell.js → CellAction.js} +0 -0
  408. /package/dist/data_table/lib/{CompareFunction.js → CompareFn.js} +0 -0
  409. /package/dist/{form/cascade_options_select/isLeafDetermine.js → data_table/lib/FormatCellFn.js} +0 -0
  410. /package/dist/form/{image-files/ImageFile.js → attachment_files/UploadTask.js} +0 -0
  411. /package/dist/form/{image-files → image_editor}/ImagePreview.svelte.d.ts +0 -0
@@ -1,15 +1,17 @@
1
1
  <script lang="ts">
2
2
  interface Props {
3
- checkLabel?: string;
4
- uncheckLabel?: string;
3
+ /** 开启状态显示的文字 */
4
+ checkedText?: string;
5
+ /** 关闭状态显示的文字 */
6
+ uncheckedText?: string;
5
7
  readonly?: boolean;
6
8
  disabled?: boolean;
7
9
  value?: boolean;
8
10
  }
9
11
 
10
12
  let {
11
- checkLabel = "On",
12
- uncheckLabel = "Off",
13
+ checkedText = "On",
14
+ uncheckedText = "Off",
13
15
  readonly = false,
14
16
  disabled = false,
15
17
  value = $bindable(false)
@@ -27,7 +29,7 @@
27
29
  <label class="switch" class:readonly class:disabled>
28
30
  <input type="checkbox" bind:checked={value} disabled={disabled} aria-readonly={readonly} onclick={toggleSwitch}>
29
31
  <span class="slider" aria-hidden="true"></span>
30
- <span class="text" aria-hidden="true">{value ? uncheckLabel : checkLabel}</span>
32
+ <span class="text" aria-hidden="true">{value ? uncheckedText : checkedText}</span>
31
33
  </label>
32
34
  </div>
33
35
 
@@ -1,6 +1,8 @@
1
1
  interface Props {
2
- checkLabel?: string;
3
- uncheckLabel?: string;
2
+ /** 开启状态显示的文字 */
3
+ checkedText?: string;
4
+ /** 关闭状态显示的文字 */
5
+ uncheckedText?: string;
4
6
  readonly?: boolean;
5
7
  disabled?: boolean;
6
8
  value?: boolean;
@@ -4,7 +4,7 @@
4
4
  import Icon from "../../general/icon";
5
5
  import CommonEditor from "../common_editor/CommonEditor.svelte";
6
6
  import type CommonFieldProps from "../common_editor/CommonFieldProps";
7
- import type {KeyboardEvents} from "../common_editor/EditorEvents";
7
+ import type {KeyboardEvents} from "../events";
8
8
 
9
9
  const excludeAttrs = ['type', 'readonly', 'disabled', 'required', 'wrap', 'value', 'placeholder'];
10
10
 
@@ -61,7 +61,7 @@
61
61
  <input bind:this={editor} bind:value type={showPassword ? 'text' : 'password'} {...input$} onchange={handleChangeEvent} {...eventHandlers()} />
62
62
  {#snippet trailingIcon()}
63
63
  <div class="password-icon">
64
- <Icon name={iconName()} onclick={togglePassword} />
64
+ <Icon name={iconName()} tabindex={-1} onclick={togglePassword} />
65
65
  </div>
66
66
  {/snippet}
67
67
  </CommonEditor>
@@ -1,5 +1,5 @@
1
1
  import type CommonFieldProps from "../common_editor/CommonFieldProps";
2
- import type { KeyboardEvents } from "../common_editor/EditorEvents";
2
+ import type { KeyboardEvents } from "../events";
3
3
  interface Props extends CommonFieldProps, KeyboardEvents {
4
4
  value?: string;
5
5
  [key: `input\$${string}`]: any;
@@ -1,10 +1,10 @@
1
1
  <script lang="ts">
2
2
 
3
3
  import type {CaseMode} from "../types";
4
- import prefixFilter, {filterProps} from "../../utils/prefixFilter";
4
+ import prefixFilter, {eventFilter} from "../../utils/prefixFilter";
5
5
  import CommonEditor from "../common_editor/CommonEditor.svelte";
6
6
  import type CommonEditorProps from "../common_editor/CommonEditorProps";
7
- import {keyboardAttrs, type KeyboardEvents} from "../common_editor/EditorEvents";
7
+ import type {KeyboardEvents} from "../events";
8
8
  import type {Snippet} from "svelte";
9
9
 
10
10
  const excludeAttrs = ['type', 'readonly', 'disabled', 'required', 'wrap', 'value'];
@@ -70,7 +70,9 @@
70
70
  }
71
71
 
72
72
  let input$ = $derived(prefixFilter(restProps, 'input$', excludeAttrs));
73
- let eventHandlers = $derived(filterProps(restProps, keyboardAttrs));
73
+ // Forward every on* handler a consumer passes (onfocus/onblur/onkeydown/…) to the native input.
74
+ // Kept reactive on purpose (see SearchBox). Internal oninput/onchange are spread AFTER this so they win.
75
+ let eventHandlers = $derived(eventFilter(restProps));
74
76
 
75
77
  const clear = () => {
76
78
  value = undefined;
@@ -80,7 +82,7 @@
80
82
  </script>
81
83
 
82
84
 
83
- <CommonEditor textValue={value} {clear} {suffix} {prefix} {readonly} {disabled} {variant} {theme} {compact} {leadingIcon} {trailingIcon} {tooltip}
85
+ <CommonEditor textValue={value} {clear} {style} {suffix} {prefix} {readonly} {disabled} {variant} {theme} {compact} {leadingIcon} {trailingIcon} {tooltip}
84
86
  {error}>
85
87
  <input bind:this={editor} {...input$} {placeholder} {...eventHandlers}
86
88
  oninput={handleInput} onchange={handleChange} bind:value/>
@@ -1,6 +1,6 @@
1
1
  import type { CaseMode } from "../types";
2
2
  import type CommonEditorProps from "../common_editor/CommonEditorProps";
3
- import { type KeyboardEvents } from "../common_editor/EditorEvents";
3
+ import type { KeyboardEvents } from "../events";
4
4
  interface Props extends CommonEditorProps, KeyboardEvents {
5
5
  caseMode?: CaseMode;
6
6
  /**
@@ -1,5 +1,7 @@
1
1
  # TimeEditor
2
2
 
3
+ > **Renamed in 5.1.0**: this document uses the names from the [API Naming Guide](../../../docs/NAMING.md); the old names `mandatory` were removed in 5.1.0 (no compatibility aliases are kept).
4
+
3
5
  A specialized time input component with interactive time selection functionality. Features keyboard navigation, automatic validation, and support for both minute and second precision. The component stores time as a numeric value representing total minutes (with fractional seconds).
4
6
 
5
7
  ## Features
@@ -41,7 +43,7 @@ import TimeEditor from "@ticatec/uniface-element/TimeEditor";
41
43
  |------|------|---------|-------------|
42
44
  | `value` | `number \| undefined` | `undefined` | Time value in minutes (e.g. `90.5` = 1:30:30). Bindable. |
43
45
  | `precision` | `"M" \| "S"` | `"M"` | Time precision: `"M"` for minutes (HH:MM), `"S"` for seconds (HH:MM:SS). |
44
- | `mandatory` | `boolean` | `false` | When true, show `00:00` instead of `__:__` for empty fields. |
46
+ | `clearable` | `boolean` | `true` | Whether the value can be cleared (shows the clear button). The old `mandatory` prop meant the opposite (`mandatory={true}` = `clearable={false}`) and was removed in 5.1.0. |
45
47
  | `variant` | `"" \| "plain" \| "outlined" \| "filled"` | `""` | Visual style variant. |
46
48
  | `compact` | `boolean` | `false` | Compact spacing layout. |
47
49
  | `disabled` | `boolean` | `false` | Disables the editor. |
@@ -173,7 +175,7 @@ Range: `0` to `1439` minutes (23:59).
173
175
  <!-- Mandatory mode (shows zeros) -->
174
176
  <div class="form-group">
175
177
  <label>Required Time:</label>
176
- <TimeEditor bind:value={requiredTime} mandatory />
178
+ <TimeEditor bind:value={requiredTime} clearable={false} />
177
179
  </div>
178
180
  ```
179
181
 
@@ -1,5 +1,7 @@
1
1
  # TimeEditor 时间输入组件
2
2
 
3
+ > **5.1.0 重命名**:本文使用 [API 命名规范](../../../docs/NAMING_CN.md) 中的名字;旧名 `mandatory` 已在 5.1.0 移除(5.1.0 不保留兼容别名)。
4
+
3
5
  专业的时间输入组件,支持交互式的时分/时分秒选择功能。具有键盘导航、自动校验,支持分钟(HH:MM)和秒(HH:MM:SS)两种精度。组件内部以分钟数(含小数秒)存储时间值。
4
6
 
5
7
  ## 功能特性
@@ -41,7 +43,7 @@ import TimeEditor from "@ticatec/uniface-element/TimeEditor";
41
43
  |------|------|--------|------|
42
44
  | `value` | `number \| undefined` | `undefined` | 时间值(分钟数),如 `90.5` = 1:30:30。可双向绑定。 |
43
45
  | `precision` | `"M" \| "S"` | `"M"` | 时间精度:`"M"` 为分钟(HH:MM),`"S"` 为秒(HH:MM:SS)。 |
44
- | `mandatory` | `boolean` | `false` | true 时,空值显示 `00:00` 而非 `__:__`。 |
46
+ | `clearable` | `boolean` | `true` | 是否允许清空(显示清空按钮)。旧名 `mandatory` 语义相反(`mandatory={true}` = `clearable={false}`),5.1.0 已移除。 |
45
47
  | `variant` | `"" \| "plain" \| "outlined" \| "filled"` | `""` | 视觉样式变体。 |
46
48
  | `compact` | `boolean` | `false` | 紧凑间距布局。 |
47
49
  | `disabled` | `boolean` | `false` | 禁用编辑器。 |
@@ -173,7 +175,7 @@ TimeEditor 以分钟数存储时间:
173
175
  <!-- 必填模式(显示零) -->
174
176
  <div class="form-group">
175
177
  <label>必填时间:</label>
176
- <TimeEditor bind:value={requiredTime} mandatory />
178
+ <TimeEditor bind:value={requiredTime} clearable={false} />
177
179
  </div>
178
180
  ```
179
181
 
@@ -8,7 +8,8 @@
8
8
 
9
9
  interface Props extends CommonFieldProps {
10
10
  precision?: TimePrecision;
11
- mandatory?: boolean;
11
+ /** 是否允许清空(显示清空按钮),默认 true */
12
+ clearable?: boolean;
12
13
  suffix?: string;
13
14
  prefix?: string;
14
15
  value?: number | undefined;
@@ -19,7 +20,7 @@
19
20
  let {
20
21
  disabled = false,
21
22
  readonly = false,
22
- mandatory = false,
23
+ clearable = true,
23
24
  precision = 'M',
24
25
  variant,
25
26
  theme,
@@ -35,6 +36,7 @@
35
36
  trailingIcon,
36
37
  }: Props = $props();
37
38
 
39
+
38
40
  let editor: HTMLInputElement;
39
41
  let hasFocus = $state(false);
40
42
  let cursorIndex = 0;
@@ -60,7 +62,7 @@
60
62
 
61
63
  function toTimeText(v: number | undefined): string {
62
64
  if (v == null) {
63
- return mandatory ? getEmptyStr().replaceAll('_', '0') : getEmptyStr();
65
+ return clearable ? getEmptyStr() : getEmptyStr().replaceAll('_', '0');
64
66
  }
65
67
  const totalMinutes = Math.floor(v);
66
68
  const hh = Math.min(23, Math.floor(totalMinutes / 60));
@@ -151,10 +153,10 @@
151
153
  moveCursor(1);
152
154
  break;
153
155
  case 'Delete':
154
- textValue = replaceChar(cursorIndex, mandatory ? '0' : '_');
156
+ textValue = replaceChar(cursorIndex, clearable ? '_' : '0');
155
157
  break;
156
158
  case 'Backspace':
157
- textValue = replaceChar(cursorIndex, mandatory ? '0' : '_');
159
+ textValue = replaceChar(cursorIndex, clearable ? '_' : '0');
158
160
  await tick();
159
161
  moveCursor(cursorIndex > 0 ? -1 : 0);
160
162
  break;
@@ -192,7 +194,8 @@
192
194
  editor.focus();
193
195
  }
194
196
 
195
- let canClean = $derived(textValue !== getEmptyStr());
197
+ // 只有允许清空且当前有内容时才显示清空按钮
198
+ const showClear = $derived(clearable && textValue !== getEmptyStr());
196
199
  </script>
197
200
 
198
201
  <CommonEditor
@@ -207,7 +210,7 @@
207
210
  {compact}
208
211
  {leadingIcon}
209
212
  {trailingIcon}
210
- {canClean}
213
+ clearable={showClear}
211
214
  {clear}>
212
215
  <input
213
216
  bind:this={editor}
@@ -3,7 +3,8 @@ import type CommonFieldProps from "../common_editor/CommonFieldProps";
3
3
  type TimePrecision = 'M' | 'S';
4
4
  interface Props extends CommonFieldProps {
5
5
  precision?: TimePrecision;
6
- mandatory?: boolean;
6
+ /** 是否允许清空(显示清空按钮),默认 true */
7
+ clearable?: boolean;
7
8
  suffix?: string;
8
9
  prefix?: string;
9
10
  value?: number | undefined;
@@ -1,45 +1,8 @@
1
1
  export type EditorVariant = '' | 'plain' | 'outlined' | 'filled';
2
2
  export type InputType = 'text' | 'search' | 'email' | 'tel' | 'url' | 'password' | 'number';
3
3
  export type CaseMode = 'upper' | 'lower';
4
- export interface EditorEvents {
5
- onblur?: (e: FocusEvent) => void;
6
- onfocus?: (e: FocusEvent) => void;
7
- onfocusin?: (e: FocusEvent) => void;
8
- onfocusout?: (e: FocusEvent) => void;
9
- oninput?: (e: InputEvent) => void;
10
- onchange?: (value: any) => void;
11
- onbeforeinput?: (e: InputEvent) => void;
12
- onkeydown?: (e: KeyboardEvent) => void;
13
- onkeyup?: (e: KeyboardEvent) => void;
14
- onkeypress?: (e: KeyboardEvent) => void;
15
- oncompositionstart?: (e: CompositionEvent) => void;
16
- oncompositionend?: (e: CompositionEvent) => void;
17
- oncompositionupdate?: (e: CompositionEvent) => void;
18
- oncopy?: (e: ClipboardEvent) => void;
19
- oncut?: (e: ClipboardEvent) => void;
20
- onpaste?: (e: ClipboardEvent) => void;
21
- onselect?: (e: Event) => void;
22
- oninvalid?: (e: Event) => void;
23
- onreset?: (e: Event) => void;
24
- onclick?: (e: MouseEvent) => void;
25
- ondblclick?: (e: MouseEvent) => void;
26
- onmousedown?: (e: MouseEvent) => void;
27
- onmouseup?: (e: MouseEvent) => void;
28
- onmouseover?: (e: MouseEvent) => void;
29
- onmousemove?: (e: MouseEvent) => void;
30
- onmouseout?: (e: MouseEvent) => void;
31
- onmouseenter?: (e: MouseEvent) => void;
32
- onmouseleave?: (e: MouseEvent) => void;
33
- onwheel?: (e: WheelEvent) => void;
34
- ontouchstart?: (e: TouchEvent) => void;
35
- ontouchend?: (e: TouchEvent) => void;
36
- ontouchmove?: (e: TouchEvent) => void;
37
- ontouchcancel?: (e: TouchEvent) => void;
38
- ondrag?: (e: DragEvent) => void;
39
- ondragstart?: (e: DragEvent) => void;
40
- ondragend?: (e: DragEvent) => void;
41
- ondragover?: (e: DragEvent) => void;
42
- ondragenter?: (e: DragEvent) => void;
43
- ondragleave?: (e: DragEvent) => void;
44
- ondrop?: (e: DragEvent) => void;
45
- }
4
+ /**
5
+ * 删除文件前的否决钩子(NAMING R2):返回 false 取消删除。
6
+ * @template T 文件对象类型(AttachmentFile / ImageFile)
7
+ */
8
+ export type BeforeRemove<T = any> = (file: T) => boolean | void | Promise<boolean | void>;
@@ -1,5 +1,7 @@
1
1
  # UnitNumberEditor
2
2
 
3
+ > **Renamed in 5.1.0**: this document uses the names from the [API Naming Guide](../../../docs/NAMING.md); the old names `units` were removed in 5.1.0 (no compatibility aliases are kept).
4
+
3
5
  A numeric input with built-in unit conversion. Users type a value in any unit (kg, lb, m, ft, …) and the component converts it to a standard unit via a configurable `ratio`. A dropdown on the trailing side switches units; the displayed value updates accordingly.
4
6
 
5
7
  The `value` prop is always in the **standard unit** (the one whose `ratio === 1`). The displayed value is `value × unit.ratio`.
@@ -45,7 +47,7 @@ import UnitNumberEditor, { type UnitOption } from "@ticatec/uniface-element/Unit
45
47
  <UnitNumberEditor
46
48
  bind:value={weightValue}
47
49
  bind:unitCode={weightUnit}
48
- units={weightUnits}
50
+ options={weightUnits}
49
51
  placeholder="Enter weight"
50
52
  />
51
53
  ```
@@ -55,8 +57,8 @@ import UnitNumberEditor, { type UnitOption } from "@ticatec/uniface-element/Unit
55
57
  | Prop | Type | Default | Description |
56
58
  |------|------|---------|-------------|
57
59
  | `value` | `number \| undefined` | `undefined` | Value in the **standard unit** (the unit with `ratio === 1`). Supports `bind:value`. |
58
- | `unitCode` | `string \| undefined` | first unit's code | Currently selected unit code. Supports `bind:unitCode`. Falls back to standard unit, then `units[0]`. |
59
- | `units` | `Array<UnitOption>` | — (required) | Available units. One should have `ratio: 1`. |
60
+ | `unitCode` | `string \| undefined` | first unit's code | Currently selected unit code. Supports `bind:unitCode`. Falls back to standard unit, then `options[0]`. |
61
+ | `options` | `Array<UnitOption>` | — (required) | Available options. One should have `ratio: 1`. |
60
62
  | `variant` | `"" \| "plain" \| "outlined" \| "filled"` | `""` | Visual variant. |
61
63
  | `compact` | `boolean` | `false` | Use compact spacing. |
62
64
  | `disabled` | `boolean` | `false` | Disable editing (renders a read-only display). |
@@ -133,7 +135,7 @@ Switch back to lb → display = 45.36 × 2.20462 ≈ 100
133
135
  <UnitNumberEditor
134
136
  bind:value={weight}
135
137
  bind:unitCode={weightUnit}
136
- units={weightUnits}
138
+ options={weightUnits}
137
139
  onchange={handleChange}
138
140
  placeholder="Enter weight"
139
141
  />
@@ -158,7 +160,7 @@ Switch back to lb → display = 45.36 × 2.20462 ≈ 100
158
160
  <UnitNumberEditor
159
161
  bind:value={distance}
160
162
  bind:unitCode={distanceUnit}
161
- units={distanceUnits}
163
+ options={distanceUnits}
162
164
  placeholder="Enter distance"
163
165
  />
164
166
  ```
@@ -173,7 +175,7 @@ Switch back to lb → display = 45.36 × 2.20462 ≈ 100
173
175
  let unit = "kg";
174
176
  let isFocused = false;
175
177
 
176
- const units: UnitOption[] = [
178
+ const options: UnitOption[] = [
177
179
  { code: "kg", text: "Kilograms", ratio: 1, precision: 2 },
178
180
  { code: "lb", text: "Pounds", ratio: 2.20462, precision: 2 }
179
181
  ];
@@ -185,7 +187,7 @@ Switch back to lb → display = 45.36 × 2.20462 ≈ 100
185
187
  <UnitNumberEditor
186
188
  bind:value={value}
187
189
  bind:unitCode={unit}
188
- units={units}
190
+ options={options}
189
191
  onfocus={handleFocus}
190
192
  onblur={handleBlur}
191
193
  placeholder="Enter value"
@@ -205,15 +207,15 @@ Switch back to lb → display = 45.36 × 2.20462 ≈ 100
205
207
  let v3: number | undefined = 300;
206
208
  let u1 = "m", u2 = "m", u3 = "m";
207
209
 
208
- const units: UnitOption[] = [
210
+ const options: UnitOption[] = [
209
211
  { code: "m", text: "Meters", ratio: 1, precision: 2 },
210
212
  { code: "ft", text: "Feet", ratio: 3.28084, precision: 2 }
211
213
  ];
212
214
  </script>
213
215
 
214
- <UnitNumberEditor bind:value={v1} bind:unitCode={u1} units={units} placeholder="Default" />
215
- <UnitNumberEditor bind:value={v2} bind:unitCode={u2} units={units} variant="outlined" placeholder="Outlined" />
216
- <UnitNumberEditor bind:value={v3} bind:unitCode={u3} units={units} variant="filled" placeholder="Filled" />
216
+ <UnitNumberEditor bind:value={v1} bind:unitCode={u1} options={options} placeholder="Default" />
217
+ <UnitNumberEditor bind:value={v2} bind:unitCode={u2} options={options} variant="outlined" placeholder="Outlined" />
218
+ <UnitNumberEditor bind:value={v3} bind:unitCode={u3} options={options} variant="filled" placeholder="Filled" />
217
219
  ```
218
220
 
219
221
  ### Custom Leading Icon
@@ -235,7 +237,7 @@ Switch back to lb → display = 45.36 × 2.20462 ≈ 100
235
237
  <UnitNumberEditor
236
238
  bind:value={price}
237
239
  bind:unitCode={currency}
238
- units={currencies}
240
+ options={currencies}
239
241
  prefix="$"
240
242
  >
241
243
  {#snippet leadingIcon()}
@@ -254,7 +256,7 @@ Switch back to lb → display = 45.36 × 2.20462 ≈ 100
254
256
  let value: number | undefined;
255
257
  let unit = "kg";
256
258
 
257
- const units: UnitOption[] = [
259
+ const options: UnitOption[] = [
258
260
  { code: "kg", text: "Kilograms", ratio: 1, precision: 2 },
259
261
  { code: "lb", text: "Pounds", ratio: 2.20462, precision: 2 }
260
262
  ];
@@ -268,7 +270,7 @@ Switch back to lb → display = 45.36 × 2.20462 ≈ 100
268
270
  bind:this={editor}
269
271
  bind:value={value}
270
272
  bind:unitCode={unit}
271
- units={units}
273
+ options={options}
272
274
  placeholder="Click the button to focus me"
273
275
  />
274
276
  ```
@@ -283,15 +285,15 @@ Switch back to lb → display = 45.36 × 2.20462 ≈ 100
283
285
  let readonlyValue: number | undefined = 75;
284
286
  let unit = "kg";
285
287
 
286
- const units: UnitOption[] = [
288
+ const options: UnitOption[] = [
287
289
  { code: "kg", text: "Kilograms", ratio: 1, precision: 2 },
288
290
  { code: "lb", text: "Pounds", ratio: 2.20462, precision: 2 }
289
291
  ];
290
292
  </script>
291
293
 
292
- <UnitNumberEditor bind:value={normalValue} bind:unitCode={unit} units={units} placeholder="Normal" />
293
- <UnitNumberEditor bind:value={readonlyValue} bind:unitCode={unit} units={units} readonly />
294
- <UnitNumberEditor bind:value={normalValue} bind:unitCode={unit} units={units} disabled />
294
+ <UnitNumberEditor bind:value={normalValue} bind:unitCode={unit} options={options} placeholder="Normal" />
295
+ <UnitNumberEditor bind:value={readonlyValue} bind:unitCode={unit} options={options} readonly />
296
+ <UnitNumberEditor bind:value={normalValue} bind:unitCode={unit} options={options} disabled />
295
297
  ```
296
298
 
297
299
  ### Cooking Converter
@@ -316,7 +318,7 @@ Switch back to lb → display = 45.36 × 2.20462 ≈ 100
316
318
  <UnitNumberEditor
317
319
  bind:value={amount}
318
320
  bind:unitCode={unit}
319
- units={volumeUnits}
321
+ options={volumeUnits}
320
322
  placeholder="Enter amount"
321
323
  />
322
324
  <p>Standard unit value: {amount ?? "—"} ml</p>
@@ -1,5 +1,7 @@
1
1
  # UnitNumberEditor 带单位的数字输入
2
2
 
3
+ > **5.1.0 重命名**:本文使用 [API 命名规范](../../../docs/NAMING_CN.md) 中的名字;旧名 `units` 已在 5.1.0 移除(5.1.0 不保留兼容别名)。
4
+
3
5
  内置单位转换的数字输入组件。用户可以在任意单位(kg、lb、m、ft 等)中输入数值,组件会通过可配置的 `ratio` 自动转换为标准单位。右侧下拉菜单可切换单位,显示值会相应更新。
4
6
 
5
7
  `value` 属性始终表示**标准单位**(`ratio === 1` 的单位)中的值。显示值为 `value × unit.ratio`。
@@ -45,7 +47,7 @@ import UnitNumberEditor, { type UnitOption } from "@ticatec/uniface-element/Unit
45
47
  <UnitNumberEditor
46
48
  bind:value={weightValue}
47
49
  bind:unitCode={weightUnit}
48
- units={weightUnits}
50
+ options={weightUnits}
49
51
  placeholder="输入重量"
50
52
  />
51
53
  ```
@@ -55,8 +57,8 @@ import UnitNumberEditor, { type UnitOption } from "@ticatec/uniface-element/Unit
55
57
  | 属性 | 类型 | 默认值 | 说明 |
56
58
  |------|------|--------|------|
57
59
  | `value` | `number \| undefined` | `undefined` | **标准单位**中的值(`ratio === 1` 的单位)。支持 `bind:value`。 |
58
- | `unitCode` | `string \| undefined` | 第一个单位的 code | 当前选中的单位代码。支持 `bind:unitCode`。不匹配时回退到标准单位,再回退到 `units[0]`。 |
59
- | `units` | `Array<UnitOption>` | —(必填) | 可用单位列表。其中应有一个 `ratio: 1`。 |
60
+ | `unitCode` | `string \| undefined` | 第一个单位的 code | 当前选中的单位代码。支持 `bind:unitCode`。不匹配时回退到标准单位,再回退到 `options[0]`。 |
61
+ | `options` | `Array<UnitOption>` | —(必填) | 可用单位列表。其中应有一个 `ratio: 1`。 |
60
62
  | `variant` | `"" \| "plain" \| "outlined" \| "filled"` | `""` | 视觉变体。 |
61
63
  | `compact` | `boolean` | `false` | 使用紧凑间距。 |
62
64
  | `disabled` | `boolean` | `false` | 禁用编辑(显示为只读)。 |
@@ -133,7 +135,7 @@ interface UnitOption {
133
135
  <UnitNumberEditor
134
136
  bind:value={weight}
135
137
  bind:unitCode={weightUnit}
136
- units={weightUnits}
138
+ options={weightUnits}
137
139
  onchange={handleChange}
138
140
  placeholder="输入重量"
139
141
  />
@@ -158,7 +160,7 @@ interface UnitOption {
158
160
  <UnitNumberEditor
159
161
  bind:value={distance}
160
162
  bind:unitCode={distanceUnit}
161
- units={distanceUnits}
163
+ options={distanceUnits}
162
164
  placeholder="输入距离"
163
165
  />
164
166
  ```
@@ -173,7 +175,7 @@ interface UnitOption {
173
175
  let unit = "kg";
174
176
  let isFocused = false;
175
177
 
176
- const units: UnitOption[] = [
178
+ const options: UnitOption[] = [
177
179
  { code: "kg", text: "千克", ratio: 1, precision: 2 },
178
180
  { code: "lb", text: "磅", ratio: 2.20462, precision: 2 }
179
181
  ];
@@ -185,7 +187,7 @@ interface UnitOption {
185
187
  <UnitNumberEditor
186
188
  bind:value={value}
187
189
  bind:unitCode={unit}
188
- units={units}
190
+ options={options}
189
191
  onfocus={handleFocus}
190
192
  onblur={handleBlur}
191
193
  placeholder="输入值"
@@ -205,15 +207,15 @@ interface UnitOption {
205
207
  let v3: number | undefined = 300;
206
208
  let u1 = "m", u2 = "m", u3 = "m";
207
209
 
208
- const units: UnitOption[] = [
210
+ const options: UnitOption[] = [
209
211
  { code: "m", text: "米", ratio: 1, precision: 2 },
210
212
  { code: "ft", text: "英尺", ratio: 3.28084, precision: 2 }
211
213
  ];
212
214
  </script>
213
215
 
214
- <UnitNumberEditor bind:value={v1} bind:unitCode={u1} units={units} placeholder="默认" />
215
- <UnitNumberEditor bind:value={v2} bind:unitCode={u2} units={units} variant="outlined" placeholder="描边" />
216
- <UnitNumberEditor bind:value={v3} bind:unitCode={u3} units={units} variant="filled" placeholder="填充" />
216
+ <UnitNumberEditor bind:value={v1} bind:unitCode={u1} options={options} placeholder="默认" />
217
+ <UnitNumberEditor bind:value={v2} bind:unitCode={u2} options={options} variant="outlined" placeholder="描边" />
218
+ <UnitNumberEditor bind:value={v3} bind:unitCode={u3} options={options} variant="filled" placeholder="填充" />
217
219
  ```
218
220
 
219
221
  ### 自定义前导图标
@@ -235,7 +237,7 @@ interface UnitOption {
235
237
  <UnitNumberEditor
236
238
  bind:value={price}
237
239
  bind:unitCode={currency}
238
- units={currencies}
240
+ options={currencies}
239
241
  prefix="$"
240
242
  >
241
243
  {#snippet leadingIcon()}
@@ -254,7 +256,7 @@ interface UnitOption {
254
256
  let value: number | undefined;
255
257
  let unit = "kg";
256
258
 
257
- const units: UnitOption[] = [
259
+ const options: UnitOption[] = [
258
260
  { code: "kg", text: "千克", ratio: 1, precision: 2 },
259
261
  { code: "lb", text: "磅", ratio: 2.20462, precision: 2 }
260
262
  ];
@@ -268,7 +270,7 @@ interface UnitOption {
268
270
  bind:this={editor}
269
271
  bind:value={value}
270
272
  bind:unitCode={unit}
271
- units={units}
273
+ options={options}
272
274
  placeholder="点击按钮聚焦我"
273
275
  />
274
276
  ```
@@ -283,15 +285,15 @@ interface UnitOption {
283
285
  let readonlyValue: number | undefined = 75;
284
286
  let unit = "kg";
285
287
 
286
- const units: UnitOption[] = [
288
+ const options: UnitOption[] = [
287
289
  { code: "kg", text: "千克", ratio: 1, precision: 2 },
288
290
  { code: "lb", text: "磅", ratio: 2.20462, precision: 2 }
289
291
  ];
290
292
  </script>
291
293
 
292
- <UnitNumberEditor bind:value={normalValue} bind:unitCode={unit} units={units} placeholder="正常" />
293
- <UnitNumberEditor bind:value={readonlyValue} bind:unitCode={unit} units={units} readonly />
294
- <UnitNumberEditor bind:value={normalValue} bind:unitCode={unit} units={units} disabled />
294
+ <UnitNumberEditor bind:value={normalValue} bind:unitCode={unit} options={options} placeholder="正常" />
295
+ <UnitNumberEditor bind:value={readonlyValue} bind:unitCode={unit} options={options} readonly />
296
+ <UnitNumberEditor bind:value={normalValue} bind:unitCode={unit} options={options} disabled />
295
297
  ```
296
298
 
297
299
  ### 烹饪单位转换器
@@ -316,7 +318,7 @@ interface UnitOption {
316
318
  <UnitNumberEditor
317
319
  bind:value={amount}
318
320
  bind:unitCode={unit}
319
- units={volumeUnits}
321
+ options={volumeUnits}
320
322
  placeholder="输入数量"
321
323
  />
322
324
  <p>标准单位值:{amount ?? "—"} ml</p>
@@ -16,7 +16,8 @@
16
16
  error?: string;
17
17
  value?: number;
18
18
  unitCode?: string;
19
- units: Array<UnitOption>;
19
+ /** 可选单位列表 */
20
+ options?: Array<UnitOption>;
20
21
  disabled?: boolean;
21
22
  readonly?: boolean;
22
23
  prefix?: string;
@@ -24,8 +25,8 @@
24
25
  menu$height?: number;
25
26
  placeholder?: string;
26
27
  onchange?: (value: number | undefined) => void;
27
- onfocus?: (e: FocusEvent) => void;
28
- onblur?: (e: FocusEvent) => void;
28
+ onfocus?: (event: FocusEvent) => void;
29
+ onblur?: (event: FocusEvent) => void;
29
30
  leadingIcon?: Snippet;
30
31
  }
31
32
 
@@ -38,7 +39,7 @@
38
39
  error,
39
40
  value = $bindable<number | undefined>(),
40
41
  unitCode = $bindable<string | undefined>(),
41
- units,
42
+ options = [],
42
43
  disabled = false,
43
44
  readonly = false,
44
45
  prefix,
@@ -55,8 +56,8 @@
55
56
  let unitValue = $state<number | undefined>(value);
56
57
  let oldValue = value;
57
58
  let isUserChange = false;
58
- const standardUnit = $derived(units.find(item => item.ratio === 1));
59
- const unit = $derived(units.find(item => item.code === unitCode) ?? standardUnit ?? units[0]);
59
+ const standardUnit = $derived(options.find(item => item.ratio === 1));
60
+ const unit = $derived(options.find(item => item.code === unitCode) ?? standardUnit ?? options[0]);
60
61
  const mh = $derived(`height: ${menu$height > 0 ? menu$height + 'px' : 'auto'}`);
61
62
 
62
63
  export function focus() {
@@ -96,7 +97,7 @@
96
97
  const handleUnitClick = (item: UnitOption) => (e: MouseEvent) => {
97
98
  unitCode = item.code;
98
99
  calculateUnitValue(item);
99
- editorRef?.closePopup();
100
+ editorRef?.close();
100
101
  setTimeout(() => editor?.focus(), 50);
101
102
  e.stopPropagation();
102
103
  e.preventDefault();
@@ -129,8 +130,8 @@
129
130
 
130
131
  // Initialize / sync unitCode only if user hasn't explicitly cleared it
131
132
  $effect(() => {
132
- if (units.length > 0 && unitCode != null) {
133
- const resolved = units.find(item => item.code === unitCode) ?? standardUnit ?? units[0];
133
+ if (options.length > 0 && unitCode != null) {
134
+ const resolved = options.find(item => item.code === unitCode) ?? standardUnit ?? options[0];
134
135
  if (unitCode !== resolved?.code) {
135
136
  unitCode = resolved?.code;
136
137
  }
@@ -189,9 +190,9 @@
189
190
  onchange={handleValueChange}
190
191
  />
191
192
 
192
- {#snippet popupLayer()}
193
+ {#snippet popup()}
193
194
  <div class="options-popover" style={mh} role="listbox">
194
- {#each units as op}
195
+ {#each options as op}
195
196
  <div class="option-item"
196
197
  onclick={handleUnitClick(op)} onkeydown={handleUnitKeyDown(op)}
197
198
  role="option" tabindex="0" aria-selected={op.code === unitCode}>