solely 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/dist/compiler/ir/buildIR.cjs +1 -1
  2. package/dist/compiler/ir/buildIR.js +1 -1
  3. package/dist/compiler/parser/parser.cjs +1 -1
  4. package/dist/compiler/parser/parser.js +1 -1
  5. package/dist/components/commands/drawer/index.cjs +1 -0
  6. package/dist/components/commands/drawer/index.d.ts +10 -0
  7. package/dist/components/commands/drawer/index.js +1 -0
  8. package/dist/components/commands/drawer/style.css.cjs +1 -0
  9. package/dist/components/commands/drawer/style.css.js +1 -0
  10. package/dist/components/commands/drawer/types.d.ts +48 -0
  11. package/dist/components/commands/index.cjs +1 -0
  12. package/dist/components/commands/index.d.ts +15 -0
  13. package/dist/components/commands/index.js +1 -0
  14. package/dist/components/commands/message/index.cjs +1 -0
  15. package/dist/components/commands/message/index.d.ts +20 -0
  16. package/dist/components/commands/message/index.js +1 -0
  17. package/dist/components/commands/message/style.css.cjs +1 -0
  18. package/dist/components/commands/message/style.css.js +1 -0
  19. package/dist/components/commands/message/types.d.ts +39 -0
  20. package/dist/components/commands/modal/index.cjs +1 -0
  21. package/dist/components/commands/modal/index.d.ts +20 -0
  22. package/dist/components/commands/modal/index.js +1 -0
  23. package/dist/components/commands/modal/style.css.cjs +1 -0
  24. package/dist/components/commands/modal/style.css.js +1 -0
  25. package/dist/components/commands/modal/types.d.ts +70 -0
  26. package/dist/components/commands/popconfirm/index.cjs +1 -0
  27. package/dist/components/commands/popconfirm/index.d.ts +14 -0
  28. package/dist/components/commands/popconfirm/index.js +1 -0
  29. package/dist/components/commands/popconfirm/style.css.cjs +1 -0
  30. package/dist/components/commands/popconfirm/style.css.js +1 -0
  31. package/dist/components/commands/popconfirm/types.d.ts +46 -0
  32. package/dist/components/commands/tooltip/index.cjs +1 -0
  33. package/dist/components/commands/tooltip/index.d.ts +14 -0
  34. package/dist/components/commands/tooltip/index.js +1 -0
  35. package/dist/components/commands/tooltip/style.css.cjs +1 -0
  36. package/dist/components/commands/tooltip/style.css.js +1 -0
  37. package/dist/components/commands/tooltip/types.d.ts +43 -0
  38. package/dist/components/commands/utils.cjs +1 -0
  39. package/dist/components/commands/utils.d.ts +40 -0
  40. package/dist/components/commands/utils.js +1 -0
  41. package/dist/components/elements/alert/index.cjs +1 -0
  42. package/dist/components/elements/alert/index.d.ts +28 -0
  43. package/dist/components/elements/alert/index.html.cjs +1 -0
  44. package/dist/components/elements/alert/index.html.js +1 -0
  45. package/dist/components/elements/alert/index.js +1 -0
  46. package/dist/components/elements/alert/style.css.cjs +1 -0
  47. package/dist/components/elements/alert/style.css.js +1 -0
  48. package/dist/components/elements/alert/types.d.ts +18 -0
  49. package/dist/components/elements/backtop/index.cjs +1 -0
  50. package/dist/components/elements/backtop/index.d.ts +43 -0
  51. package/dist/components/elements/backtop/index.html.cjs +1 -0
  52. package/dist/components/elements/backtop/index.html.js +1 -0
  53. package/dist/components/elements/backtop/index.js +1 -0
  54. package/dist/components/elements/backtop/style.css.cjs +1 -0
  55. package/dist/components/elements/backtop/style.css.js +1 -0
  56. package/dist/components/elements/backtop/types.d.ts +9 -0
  57. package/dist/components/elements/badge/index.cjs +1 -0
  58. package/dist/components/elements/badge/index.d.ts +34 -0
  59. package/dist/components/elements/badge/index.html.cjs +1 -0
  60. package/dist/components/elements/badge/index.html.js +1 -0
  61. package/dist/components/elements/badge/index.js +1 -0
  62. package/dist/components/elements/badge/style.css.cjs +1 -0
  63. package/dist/components/elements/badge/style.css.js +1 -0
  64. package/dist/components/elements/badge/types.d.ts +22 -0
  65. package/dist/components/elements/breadcrumb/index.cjs +1 -0
  66. package/dist/components/elements/breadcrumb/index.d.ts +14 -0
  67. package/dist/components/elements/breadcrumb/index.html.cjs +1 -0
  68. package/dist/components/elements/breadcrumb/index.html.js +1 -0
  69. package/dist/components/elements/breadcrumb/index.js +1 -0
  70. package/dist/components/elements/breadcrumb/style.css.cjs +1 -0
  71. package/dist/components/elements/breadcrumb/style.css.js +1 -0
  72. package/dist/components/elements/breadcrumb/types.d.ts +15 -0
  73. package/dist/components/elements/button/index.cjs +1 -0
  74. package/dist/components/elements/button/index.d.ts +56 -0
  75. package/dist/components/elements/button/index.html.cjs +1 -0
  76. package/dist/components/elements/button/index.html.js +1 -0
  77. package/dist/components/elements/button/index.js +1 -0
  78. package/dist/components/elements/button/style.css.cjs +1 -0
  79. package/dist/components/elements/button/style.css.js +1 -0
  80. package/dist/components/elements/button/types.d.ts +42 -0
  81. package/dist/components/elements/card/index.cjs +1 -0
  82. package/dist/components/elements/card/index.d.ts +26 -0
  83. package/dist/components/elements/card/index.html.cjs +1 -0
  84. package/dist/components/elements/card/index.html.js +1 -0
  85. package/dist/components/elements/card/index.js +1 -0
  86. package/dist/components/elements/card/style.css.cjs +1 -0
  87. package/dist/components/elements/card/style.css.js +1 -0
  88. package/dist/components/elements/card/types.d.ts +28 -0
  89. package/dist/components/elements/checkbox/index.cjs +1 -0
  90. package/dist/components/elements/checkbox/index.d.ts +62 -0
  91. package/dist/components/elements/checkbox/index.html.cjs +1 -0
  92. package/dist/components/elements/checkbox/index.html.js +1 -0
  93. package/dist/components/elements/checkbox/index.js +1 -0
  94. package/dist/components/elements/checkbox/style.css.cjs +1 -0
  95. package/dist/components/elements/checkbox/style.css.js +1 -0
  96. package/dist/components/elements/checkbox/types.d.ts +30 -0
  97. package/dist/components/elements/coordinate-input/index.cjs +1 -0
  98. package/dist/components/elements/coordinate-input/index.d.ts +155 -0
  99. package/dist/components/elements/coordinate-input/index.html.cjs +1 -0
  100. package/dist/components/elements/coordinate-input/index.html.js +1 -0
  101. package/dist/components/elements/coordinate-input/index.js +1 -0
  102. package/dist/components/elements/coordinate-input/style.css.cjs +1 -0
  103. package/dist/components/elements/coordinate-input/style.css.js +1 -0
  104. package/dist/components/elements/coordinate-input/types.d.ts +112 -0
  105. package/dist/components/elements/divider/index.cjs +1 -0
  106. package/dist/components/elements/divider/index.d.ts +13 -0
  107. package/dist/components/elements/divider/index.html.cjs +1 -0
  108. package/dist/components/elements/divider/index.html.js +1 -0
  109. package/dist/components/elements/divider/index.js +1 -0
  110. package/dist/components/elements/divider/style.css.cjs +1 -0
  111. package/dist/components/elements/divider/style.css.js +1 -0
  112. package/dist/components/elements/divider/types.d.ts +15 -0
  113. package/dist/components/elements/empty/index.cjs +1 -0
  114. package/dist/components/elements/empty/index.d.ts +10 -0
  115. package/dist/components/elements/empty/index.html.cjs +1 -0
  116. package/dist/components/elements/empty/index.html.js +1 -0
  117. package/dist/components/elements/empty/index.js +1 -0
  118. package/dist/components/elements/empty/style.css.cjs +1 -0
  119. package/dist/components/elements/empty/style.css.js +1 -0
  120. package/dist/components/elements/empty/types.d.ts +9 -0
  121. package/dist/components/elements/fab/index.cjs +1 -0
  122. package/dist/components/elements/fab/index.d.ts +50 -0
  123. package/dist/components/elements/fab/index.html.cjs +1 -0
  124. package/dist/components/elements/fab/index.html.js +1 -0
  125. package/dist/components/elements/fab/index.js +1 -0
  126. package/dist/components/elements/fab/style.css.cjs +1 -0
  127. package/dist/components/elements/fab/style.css.js +1 -0
  128. package/dist/components/elements/fab/types.d.ts +52 -0
  129. package/dist/components/elements/index.cjs +1 -0
  130. package/dist/components/elements/index.d.ts +57 -0
  131. package/dist/components/elements/index.js +1 -0
  132. package/dist/components/elements/input/index.cjs +1 -0
  133. package/dist/components/elements/input/index.d.ts +109 -0
  134. package/dist/components/elements/input/index.html.cjs +1 -0
  135. package/dist/components/elements/input/index.html.js +1 -0
  136. package/dist/components/elements/input/index.js +1 -0
  137. package/dist/components/elements/input/style.css.cjs +1 -0
  138. package/dist/components/elements/input/style.css.js +1 -0
  139. package/dist/components/elements/input/types.d.ts +66 -0
  140. package/dist/components/elements/pagination/index.cjs +1 -0
  141. package/dist/components/elements/pagination/index.d.ts +80 -0
  142. package/dist/components/elements/pagination/index.html.cjs +1 -0
  143. package/dist/components/elements/pagination/index.html.js +1 -0
  144. package/dist/components/elements/pagination/index.js +1 -0
  145. package/dist/components/elements/pagination/style.css.cjs +1 -0
  146. package/dist/components/elements/pagination/style.css.js +1 -0
  147. package/dist/components/elements/pagination/types.d.ts +28 -0
  148. package/dist/components/elements/progress/index.cjs +1 -0
  149. package/dist/components/elements/progress/index.d.ts +42 -0
  150. package/dist/components/elements/progress/index.html.cjs +1 -0
  151. package/dist/components/elements/progress/index.html.js +1 -0
  152. package/dist/components/elements/progress/index.js +1 -0
  153. package/dist/components/elements/progress/style.css.cjs +1 -0
  154. package/dist/components/elements/progress/style.css.js +1 -0
  155. package/dist/components/elements/progress/types.d.ts +21 -0
  156. package/dist/components/elements/radio/index.cjs +1 -0
  157. package/dist/components/elements/radio/index.d.ts +42 -0
  158. package/dist/components/elements/radio/index.html.cjs +1 -0
  159. package/dist/components/elements/radio/index.html.js +1 -0
  160. package/dist/components/elements/radio/index.js +1 -0
  161. package/dist/components/elements/radio/style.css.cjs +1 -0
  162. package/dist/components/elements/radio/style.css.js +1 -0
  163. package/dist/components/elements/radio/types.d.ts +29 -0
  164. package/dist/components/elements/rate/index.cjs +1 -0
  165. package/dist/components/elements/rate/index.d.ts +47 -0
  166. package/dist/components/elements/rate/index.html.cjs +1 -0
  167. package/dist/components/elements/rate/index.html.js +1 -0
  168. package/dist/components/elements/rate/index.js +1 -0
  169. package/dist/components/elements/rate/style.css.cjs +1 -0
  170. package/dist/components/elements/rate/style.css.js +1 -0
  171. package/dist/components/elements/rate/types.d.ts +19 -0
  172. package/dist/components/elements/select/index.cjs +1 -0
  173. package/dist/components/elements/select/index.d.ts +74 -0
  174. package/dist/components/elements/select/index.html.cjs +1 -0
  175. package/dist/components/elements/select/index.html.js +1 -0
  176. package/dist/components/elements/select/index.js +1 -0
  177. package/dist/components/elements/select/style.css.cjs +1 -0
  178. package/dist/components/elements/select/style.css.js +1 -0
  179. package/dist/components/elements/select/types.d.ts +30 -0
  180. package/dist/components/elements/skeleton/index.cjs +1 -0
  181. package/dist/components/elements/skeleton/index.d.ts +26 -0
  182. package/dist/components/elements/skeleton/index.html.cjs +1 -0
  183. package/dist/components/elements/skeleton/index.html.js +1 -0
  184. package/dist/components/elements/skeleton/index.js +1 -0
  185. package/dist/components/elements/skeleton/style.css.cjs +1 -0
  186. package/dist/components/elements/skeleton/style.css.js +1 -0
  187. package/dist/components/elements/skeleton/types.d.ts +23 -0
  188. package/dist/components/elements/slider/index.cjs +1 -0
  189. package/dist/components/elements/slider/index.d.ts +76 -0
  190. package/dist/components/elements/slider/index.html.cjs +1 -0
  191. package/dist/components/elements/slider/index.html.js +1 -0
  192. package/dist/components/elements/slider/index.js +1 -0
  193. package/dist/components/elements/slider/style.css.cjs +1 -0
  194. package/dist/components/elements/slider/style.css.js +1 -0
  195. package/dist/components/elements/slider/types.d.ts +25 -0
  196. package/dist/components/elements/steps/index.cjs +1 -0
  197. package/dist/components/elements/steps/index.d.ts +31 -0
  198. package/dist/components/elements/steps/index.html.cjs +1 -0
  199. package/dist/components/elements/steps/index.html.js +1 -0
  200. package/dist/components/elements/steps/index.js +1 -0
  201. package/dist/components/elements/steps/style.css.cjs +1 -0
  202. package/dist/components/elements/steps/style.css.js +1 -0
  203. package/dist/components/elements/steps/types.d.ts +18 -0
  204. package/dist/components/elements/switch/index.cjs +1 -0
  205. package/dist/components/elements/switch/index.d.ts +62 -0
  206. package/dist/components/elements/switch/index.html.cjs +1 -0
  207. package/dist/components/elements/switch/index.html.js +1 -0
  208. package/dist/components/elements/switch/index.js +1 -0
  209. package/dist/components/elements/switch/style.css.cjs +1 -0
  210. package/dist/components/elements/switch/style.css.js +1 -0
  211. package/dist/components/elements/switch/types.d.ts +28 -0
  212. package/dist/components/elements/table/index.cjs +1 -0
  213. package/dist/components/elements/table/index.d.ts +46 -0
  214. package/dist/components/elements/table/index.html.cjs +1 -0
  215. package/dist/components/elements/table/index.html.js +1 -0
  216. package/dist/components/elements/table/index.js +1 -0
  217. package/dist/components/elements/table/style.css.cjs +1 -0
  218. package/dist/components/elements/table/style.css.js +1 -0
  219. package/dist/components/elements/table/types.d.ts +38 -0
  220. package/dist/components/elements/tabs/index.cjs +1 -0
  221. package/dist/components/elements/tabs/index.d.ts +54 -0
  222. package/dist/components/elements/tabs/index.html.cjs +1 -0
  223. package/dist/components/elements/tabs/index.html.js +1 -0
  224. package/dist/components/elements/tabs/index.js +1 -0
  225. package/dist/components/elements/tabs/style.css.cjs +1 -0
  226. package/dist/components/elements/tabs/style.css.js +1 -0
  227. package/dist/components/elements/tabs/types.d.ts +30 -0
  228. package/dist/components/elements/tag/index.cjs +1 -0
  229. package/dist/components/elements/tag/index.d.ts +22 -0
  230. package/dist/components/elements/tag/index.html.cjs +1 -0
  231. package/dist/components/elements/tag/index.html.js +1 -0
  232. package/dist/components/elements/tag/index.js +1 -0
  233. package/dist/components/elements/tag/style.css.cjs +1 -0
  234. package/dist/components/elements/tag/style.css.js +1 -0
  235. package/dist/components/elements/tag/types.d.ts +21 -0
  236. package/dist/components/elements/timeline/index.cjs +1 -0
  237. package/dist/components/elements/timeline/index.d.ts +25 -0
  238. package/dist/components/elements/timeline/index.html.cjs +1 -0
  239. package/dist/components/elements/timeline/index.html.js +1 -0
  240. package/dist/components/elements/timeline/index.js +1 -0
  241. package/dist/components/elements/timeline/style.css.cjs +1 -0
  242. package/dist/components/elements/timeline/style.css.js +1 -0
  243. package/dist/components/elements/timeline/types.d.ts +23 -0
  244. package/dist/components/elements/tree/index.cjs +1 -0
  245. package/dist/components/elements/tree/index.d.ts +127 -0
  246. package/dist/components/elements/tree/index.html.cjs +1 -0
  247. package/dist/components/elements/tree/index.html.js +1 -0
  248. package/dist/components/elements/tree/index.js +1 -0
  249. package/dist/components/elements/tree/style.css.cjs +1 -0
  250. package/dist/components/elements/tree/style.css.js +1 -0
  251. package/dist/components/elements/tree/types.d.ts +47 -0
  252. package/dist/components/elements/upload/index.cjs +1 -0
  253. package/dist/components/elements/upload/index.d.ts +74 -0
  254. package/dist/components/elements/upload/index.html.cjs +1 -0
  255. package/dist/components/elements/upload/index.html.js +1 -0
  256. package/dist/components/elements/upload/index.js +1 -0
  257. package/dist/components/elements/upload/style.css.cjs +1 -0
  258. package/dist/components/elements/upload/style.css.js +1 -0
  259. package/dist/components/elements/upload/types.d.ts +48 -0
  260. package/dist/components/elements/utils/helpers.cjs +1 -0
  261. package/dist/components/elements/utils/helpers.d.ts +24 -0
  262. package/dist/components/elements/utils/helpers.js +1 -0
  263. package/dist/components/index.cjs +1 -0
  264. package/dist/components/index.d.ts +21 -0
  265. package/dist/components/index.js +1 -0
  266. package/dist/components/theme/index.cjs +1 -0
  267. package/dist/components/theme/index.d.ts +45 -0
  268. package/dist/components/theme/index.js +1 -0
  269. package/dist/components/theme/variables.css +274 -0
  270. package/dist/index.cjs +1 -1
  271. package/dist/index.js +1 -1
  272. package/dist/plugin.cjs +1 -1
  273. package/dist/plugins/solely-vite-plugin.cjs +1 -1
  274. package/dist/plugins/solely-vite-plugin.js +1 -1
  275. package/dist/router/core.cjs +1 -1
  276. package/dist/router/core.js +1 -1
  277. package/dist/router/router-link.cjs +1 -1
  278. package/dist/router/router-link.js +1 -1
  279. package/dist/router/router-view.cjs +1 -1
  280. package/dist/router/router-view.js +1 -1
  281. package/dist/runtime/component/base-element.cjs +1 -1
  282. package/dist/runtime/component/base-element.d.ts +12 -0
  283. package/dist/runtime/component/base-element.js +1 -1
  284. package/dist/runtime/component/decorators.cjs +1 -1
  285. package/dist/runtime/component/decorators.js +1 -1
  286. package/dist/runtime/index.cjs +1 -1
  287. package/dist/runtime/index.js +1 -1
  288. package/dist/runtime/reactivity/observe.cjs +1 -1
  289. package/dist/runtime/reactivity/observe.js +1 -1
  290. package/dist/runtime/renderer/html-decode.cjs +1 -1
  291. package/dist/runtime/renderer/html-decode.js +1 -1
  292. package/dist/runtime/renderer/renderIR.cjs +1 -1
  293. package/dist/runtime/renderer/renderIR.js +1 -1
  294. package/dist/shared/env.cjs +1 -1
  295. package/dist/shared/env.js +1 -1
  296. package/dist/shared/event-listeners.cjs +1 -1
  297. package/dist/shared/gen-function.cjs +1 -1
  298. package/dist/shared/gen-function.js +1 -1
  299. package/dist/shared/index.cjs +1 -1
  300. package/dist/shared/is-object.js +1 -1
  301. package/dist/shared/templateError.cjs +1 -1
  302. package/dist/shared/templateError.js +1 -1
  303. package/dist/shared/url.cjs +1 -1
  304. package/dist/shared/url.js +1 -1
  305. package/dist/types/index.cjs +1 -1
  306. package/dist/types/lifecycle.cjs +1 -1
  307. package/package.json +43 -1
@@ -0,0 +1 @@
1
+ const i='<div\n class="timeline"\n :class="this.getTimelineClasses()"\n>\n <ul class="timeline__list">\n <For each="$data.parsedItems" item="item" index="index">\n <li\n class="timeline__item"\n :class="this.getItemClasses(item, index)"\n >\n <div class="timeline__item-tail"></div>\n <div class="timeline__item-wrapper">\n <div class="timeline__item-head">\n <If test="item.loading">\n <div\n class="timeline__dot"\n :class="this.getDotClasses(item)"\n :style="this.getDotStyle(item)"\n ></div>\n </If>\n <ElseIf test="item.icon">\n <div\n class="timeline__icon-wrapper"\n :style="this.getIconStyle(item)"\n >{{item.icon}}</div>\n </ElseIf>\n <Else>\n <div\n class="timeline__dot"\n :class="this.getDotClasses(item)"\n :style="this.getDotStyle(item)"\n ></div>\n </Else>\n </div>\n <div class="timeline__item-content">\n <div class="timeline__title">{{item.title}}</div>\n <If test="item.content">\n <div class="timeline__content-text">{{item.content}}</div>\n </If>\n <If test="item.time">\n <div class="timeline__time">{{item.time}}</div>\n </If>\n </div>\n </div>\n </li>\n </For>\n\n <If test="$data.pending">\n <li class="timeline__item timeline__item--pending">\n <div class="timeline__item-tail"></div>\n <div class="timeline__item-wrapper">\n <div class="timeline__item-head">\n <div class="timeline__dot"></div>\n </div>\n <div class="timeline__item-content">\n <span>{{$data.pendingContent || \'待定\'}}</span>\n </div>\n </div>\n </li>\n </If>\n </ul>\n</div>\n';export{i as default};
@@ -0,0 +1 @@
1
+ import e from"./style.css.js";import t from"./index.html.js";import{safeJsonParse as r}from"../utils/helpers.js";import o from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";var a=Object.defineProperty;Object.getOwnPropertyDescriptor;let n=class extends o{isHorizontal(){var e;return(null==(e=this.$data.mode)?void 0:e.startsWith("horizontal-"))??!1}isAlternate(){return"alternate"===this.$data.mode||"horizontal-alternate"===this.$data.mode}getTimelineClasses(){const e={};return this.$data.mode&&(e[`timeline--${this.$data.mode}`]=!0),"filled"===this.$data.variant&&(e["timeline--filled"]=!0),e}getItemClasses(e,t){const r="alternate"===this.$data.mode,o="horizontal-alternate"===this.$data.mode;let i=!1,a=!1,n=!1,s=!1;return r?"left"===e.position?i=!0:"right"===e.position?a=!0:(i=t%2==0,a=t%2==1):o&&("top"===e.verticalPosition?n=!0:"bottom"===e.verticalPosition?s=!0:(n=t%2==0,s=t%2==1)),{"timeline__item--left":i,"timeline__item--right":a,"timeline__item--top":n,"timeline__item--bottom":s,"timeline__item--loading":!!e.loading}}getDotClasses(e){const t={};return e.color&&["blue","green","red","orange","gray"].includes(e.color)&&(t[`timeline__dot--${e.color}`]=!0),t}getDotStyle(e){const t=e.color;return!t||n.PRESET_COLORS.includes(t)?"":"filled"===this.$data.variant?`background-color: ${t};`:`border-color: ${t};`}getIconStyle(e){const t=e.color;return!t||n.PRESET_COLORS.includes(t)?"":`color: ${t}; background-color: ${t}15;`}mounted(){this.parseItems()}parseItems(){let e=r(this.$data.items,[]);this.$data.reverse&&(e=e.reverse()),this.$data.parsedItems=e}setItems(e){this.$data.items=JSON.stringify(e),this.parseItems()}};var s,l,m;m=["blue","green","red","orange","gray"],(l="PRESET_COLORS")in(s=n)?a(s,l,{enumerable:!0,configurable:!0,writable:!0,value:m}):s[l]=m,n=((e,t)=>{for(var r,o=t,i=e.length-1;i>=0;i--)(r=e[i])&&(o=r(o)||o);return o})([i({tagName:"solely-timeline",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"mode",type:"string",default:"left"},{name:"items",type:"string",default:"[]"},{name:"pending",type:"boolean",default:!1},{name:"pendingContent",type:"string",default:"待定"},{name:"reverse",type:"boolean",default:!1},{name:"variant",type:"string",default:"outlined"}]})],n);export{n as SolelyTimeline};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default="*,*:before,*:after{box-sizing:border-box}:host{display:block;width:100%;font-size:var(--solely-font-size-md)}.timeline{--timeline-dot-size: 10px;--timeline-icon-size: 32px;--timeline-tail-color: var(--solely-border-color);--timeline-font-family: var(--solely-font-family);width:100%;font-family:var(--timeline-font-family);font-size:var(--solely-font-size-md);color:var(--solely-text-primary);line-height:1.5714;list-style:none;margin:0;padding:0;box-sizing:border-box}.timeline__list{position:relative;margin:0;padding:0;list-style:none}.timeline__item{position:relative;padding-bottom:20px;margin:0;list-style:none;box-sizing:border-box}.timeline__item:last-child{padding-bottom:0}.timeline__item-wrapper{display:flex;align-items:flex-start}.timeline__item-tail{position:absolute;top:16px;left:7px;width:2px;height:calc(100% - 6px);background:var(--timeline-tail-color);transition:background var(--solely-transition-duration)}.timeline__item:last-child>.timeline__item-tail{display:none}.timeline__item-head{position:relative;flex-shrink:0;width:16px;height:16px;margin-top:3px}.timeline__dot{position:absolute;top:3px;left:3px;width:var(--timeline-dot-size);height:var(--timeline-dot-size);border-radius:50%;border:2px solid var(--solely-primary);background-color:var(--solely-component-bg);background-clip:padding-box;transition:all var(--solely-transition-duration);box-sizing:border-box}.timeline__icon-wrapper{position:absolute;top:0;left:0;width:var(--timeline-icon-size);height:var(--timeline-icon-size);display:inline-flex;align-items:center;justify-content:center;background-color:var(--solely-primary-light);border:none;border-radius:50%;font-size:18px;line-height:1;color:var(--solely-primary);transform:translate(calc(-1 * (var(--timeline-icon-size) - 16px) / 2),calc(-1 * (var(--timeline-icon-size) - 16px) / 2));cursor:default;transition:all var(--solely-transition-duration)}.timeline__item-content{position:relative;flex:1 1 auto;min-width:0;margin-left:var(--solely-spacing-md);word-break:break-word}.timeline__title{display:inline-block;margin-bottom:var(--solely-spacing-xs);font-weight:500;font-size:var(--solely-font-size-md);color:var(--solely-text-primary);line-height:1.5714}.timeline__content-text{font-size:var(--solely-font-size-md);color:var(--solely-text-secondary);line-height:1.5714;word-break:break-word;margin-top:var(--solely-spacing-xs)}.timeline__time{font-size:var(--solely-font-size-md);color:var(--solely-text-tertiary);margin-top:var(--solely-spacing-xs)}.timeline--left .timeline__item-tail{left:7px}.timeline--left .timeline__item-head{left:0}.timeline--left .timeline__item-content{margin-left:var(--solely-spacing-md)}.timeline--right .timeline__item-wrapper{flex-direction:row-reverse}.timeline--right .timeline__item-tail{right:7px;left:auto}.timeline--right .timeline__item-head{right:0;left:auto}.timeline--right .timeline__item-content{margin-left:0;margin-right:var(--solely-spacing-md);text-align:right}.timeline--alternate .timeline__item{min-height:48px;overflow:visible}.timeline--alternate .timeline__item-tail{left:50%;transform:translate(-50%);top:16px}.timeline--alternate .timeline__item-wrapper{display:block;position:relative}.timeline--alternate .timeline__item-head{position:absolute;left:50%;top:0;transform:translate(-50%);z-index:2;margin-top:3px}.timeline--alternate .timeline__item-content{width:100%;min-height:48px;box-sizing:border-box;margin-left:0;padding-top:3px}.timeline--alternate .timeline__item:nth-child(odd) .timeline__item-content{text-align:right;padding-right:calc(50% + 20px)}.timeline--alternate .timeline__item:nth-child(2n) .timeline__item-content{text-align:left;padding-left:calc(50% + 20px)}.timeline--horizontal-top,.timeline--horizontal-bottom,.timeline--horizontal-alternate{overflow-x:auto;overflow-y:hidden}.timeline--horizontal-top .timeline__list,.timeline--horizontal-bottom .timeline__list,.timeline--horizontal-alternate .timeline__list{display:flex;align-items:stretch}.timeline--horizontal-top .timeline__item,.timeline--horizontal-bottom .timeline__item,.timeline--horizontal-alternate .timeline__item{display:block;position:relative;flex:1 1 0;min-width:100px;max-width:240px;padding:0!important}.timeline--horizontal-top .timeline__item-wrapper,.timeline--horizontal-bottom .timeline__item-wrapper,.timeline--horizontal-alternate .timeline__item-wrapper{display:block;width:100%;height:100%}.timeline--horizontal-top .timeline__item-head,.timeline--horizontal-bottom .timeline__item-head,.timeline--horizontal-alternate .timeline__item-head{position:absolute;left:50%;transform:translate(-50%);z-index:2;margin:0;width:16px;height:16px}.timeline--horizontal-top .timeline__dot,.timeline--horizontal-bottom .timeline__dot,.timeline--horizontal-alternate .timeline__dot{position:absolute;top:3px;left:3px}.timeline--horizontal-top .timeline__icon-wrapper,.timeline--horizontal-bottom .timeline__icon-wrapper,.timeline--horizontal-alternate .timeline__icon-wrapper{position:absolute;top:0;left:0;transform:translate(-8px,-8px)}.timeline--horizontal-top .timeline__item-tail,.timeline--horizontal-bottom .timeline__item-tail,.timeline--horizontal-alternate .timeline__item-tail{position:absolute;left:calc(50% + 5px);right:calc(-50% + 5px);width:auto;height:2px}.timeline--horizontal-top .timeline__item:last-child>.timeline__item-tail,.timeline--horizontal-bottom .timeline__item:last-child>.timeline__item-tail,.timeline--horizontal-alternate .timeline__item:last-child>.timeline__item-tail{display:none!important}.timeline--horizontal-top .timeline__item-content,.timeline--horizontal-bottom .timeline__item-content,.timeline--horizontal-alternate .timeline__item-content{text-align:center;margin-left:0;padding:var(--solely-spacing-sm) var(--solely-spacing-md)}.timeline--horizontal-top .timeline__item{min-height:80px}.timeline--horizontal-top .timeline__item-head{top:var(--solely-spacing-sm)}.timeline--horizontal-top .timeline__item-tail{top:15px}.timeline--horizontal-top .timeline__item-content{padding-top:36px;padding-bottom:var(--solely-spacing-xs)}.timeline--horizontal-bottom .timeline__item{min-height:80px}.timeline--horizontal-bottom .timeline__item-head{bottom:var(--solely-spacing-sm);top:auto}.timeline--horizontal-bottom .timeline__item-tail{bottom:15px;top:auto}.timeline--horizontal-bottom .timeline__item-content{padding-bottom:36px;padding-top:var(--solely-spacing-xs)}.timeline--horizontal-alternate .timeline__item{min-height:120px}.timeline--horizontal-alternate .timeline__item-head{top:50%;transform:translate(-50%,-50%)}.timeline--horizontal-alternate .timeline__item-tail{top:50%;transform:translateY(-50%)}.timeline--horizontal-alternate .timeline__item:nth-child(odd) .timeline__item-content{padding-top:100px;padding-bottom:var(--solely-spacing-xs)}.timeline--horizontal-alternate .timeline__item:nth-child(2n) .timeline__item-content{padding-bottom:0;padding-top:var(--solely-spacing-xs)}.timeline__item--left .timeline__item-content{text-align:right;padding-right:calc(50% + 20px);margin-left:0}.timeline__item--right .timeline__item-content{text-align:left;padding-left:calc(50% + 20px);margin-left:0}.timeline__item--top .timeline__item-content{padding-top:calc(50% + 20px);padding-bottom:var(--solely-spacing-xs)}.timeline__item--bottom .timeline__item-content{padding-bottom:calc(50% + 20px);padding-top:var(--solely-spacing-xs)}.timeline__item--pending>.timeline__item-tail{display:block!important;background-color:transparent!important;background-image:repeating-linear-gradient(to bottom,var(--timeline-tail-color) 0,var(--timeline-tail-color) 4px,transparent 4px,transparent 8px)!important;animation:timeline-tail-flow 1s linear infinite}.timeline--horizontal-top .timeline__item--pending>.timeline__item-tail,.timeline--horizontal-bottom .timeline__item--pending>.timeline__item-tail,.timeline--horizontal-alternate .timeline__item--pending>.timeline__item-tail{background-image:repeating-linear-gradient(90deg,rgba(5,5,5,.15) 0,rgba(5,5,5,.15) 4px,transparent 4px,transparent 8px)!important}.timeline__item--pending .timeline__dot{background-color:transparent!important;border-color:var(--solely-primary)!important;border-style:dashed;animation:timeline-pending-pulse 1.5s ease-in-out infinite}.timeline__item--pending .timeline__item-content{color:var(--solely-text-tertiary)}.timeline__dot--blue{border-color:var(--solely-primary)!important}.timeline__dot--green{border-color:var(--solely-success)!important}.timeline__dot--red{border-color:var(--solely-error)!important}.timeline__dot--orange{border-color:var(--solely-warning)!important}.timeline__dot--gray{border-color:var(--solely-border-color)!important}.timeline--filled .timeline__dot{border-width:0!important;background-clip:border-box}.timeline--filled .timeline__dot--blue{background-color:var(--solely-primary)!important}.timeline--filled .timeline__dot--green{background-color:var(--solely-success)!important}.timeline--filled .timeline__dot--red{background-color:var(--solely-error)!important}.timeline--filled .timeline__dot--orange{background-color:var(--solely-warning)!important}.timeline--filled .timeline__dot--gray{background-color:var(--solely-border-color)!important}.timeline__item--loading .timeline__dot{border-color:var(--solely-primary) var(--solely-primary-light) var(--solely-primary) var(--solely-primary-light);animation:timeline-loading-spin .8s linear infinite}@keyframes timeline-tail-flow{0%{background-position:0 0}to{background-position:0 16px}}@keyframes timeline-pending-pulse{0%,to{opacity:1}50%{opacity:.45}}@keyframes timeline-loading-spin{to{transform:rotate(360deg)}}";
@@ -0,0 +1 @@
1
+ const i="*,*:before,*:after{box-sizing:border-box}:host{display:block;width:100%;font-size:var(--solely-font-size-md)}.timeline{--timeline-dot-size: 10px;--timeline-icon-size: 32px;--timeline-tail-color: var(--solely-border-color);--timeline-font-family: var(--solely-font-family);width:100%;font-family:var(--timeline-font-family);font-size:var(--solely-font-size-md);color:var(--solely-text-primary);line-height:1.5714;list-style:none;margin:0;padding:0;box-sizing:border-box}.timeline__list{position:relative;margin:0;padding:0;list-style:none}.timeline__item{position:relative;padding-bottom:20px;margin:0;list-style:none;box-sizing:border-box}.timeline__item:last-child{padding-bottom:0}.timeline__item-wrapper{display:flex;align-items:flex-start}.timeline__item-tail{position:absolute;top:16px;left:7px;width:2px;height:calc(100% - 6px);background:var(--timeline-tail-color);transition:background var(--solely-transition-duration)}.timeline__item:last-child>.timeline__item-tail{display:none}.timeline__item-head{position:relative;flex-shrink:0;width:16px;height:16px;margin-top:3px}.timeline__dot{position:absolute;top:3px;left:3px;width:var(--timeline-dot-size);height:var(--timeline-dot-size);border-radius:50%;border:2px solid var(--solely-primary);background-color:var(--solely-component-bg);background-clip:padding-box;transition:all var(--solely-transition-duration);box-sizing:border-box}.timeline__icon-wrapper{position:absolute;top:0;left:0;width:var(--timeline-icon-size);height:var(--timeline-icon-size);display:inline-flex;align-items:center;justify-content:center;background-color:var(--solely-primary-light);border:none;border-radius:50%;font-size:18px;line-height:1;color:var(--solely-primary);transform:translate(calc(-1 * (var(--timeline-icon-size) - 16px) / 2),calc(-1 * (var(--timeline-icon-size) - 16px) / 2));cursor:default;transition:all var(--solely-transition-duration)}.timeline__item-content{position:relative;flex:1 1 auto;min-width:0;margin-left:var(--solely-spacing-md);word-break:break-word}.timeline__title{display:inline-block;margin-bottom:var(--solely-spacing-xs);font-weight:500;font-size:var(--solely-font-size-md);color:var(--solely-text-primary);line-height:1.5714}.timeline__content-text{font-size:var(--solely-font-size-md);color:var(--solely-text-secondary);line-height:1.5714;word-break:break-word;margin-top:var(--solely-spacing-xs)}.timeline__time{font-size:var(--solely-font-size-md);color:var(--solely-text-tertiary);margin-top:var(--solely-spacing-xs)}.timeline--left .timeline__item-tail{left:7px}.timeline--left .timeline__item-head{left:0}.timeline--left .timeline__item-content{margin-left:var(--solely-spacing-md)}.timeline--right .timeline__item-wrapper{flex-direction:row-reverse}.timeline--right .timeline__item-tail{right:7px;left:auto}.timeline--right .timeline__item-head{right:0;left:auto}.timeline--right .timeline__item-content{margin-left:0;margin-right:var(--solely-spacing-md);text-align:right}.timeline--alternate .timeline__item{min-height:48px;overflow:visible}.timeline--alternate .timeline__item-tail{left:50%;transform:translate(-50%);top:16px}.timeline--alternate .timeline__item-wrapper{display:block;position:relative}.timeline--alternate .timeline__item-head{position:absolute;left:50%;top:0;transform:translate(-50%);z-index:2;margin-top:3px}.timeline--alternate .timeline__item-content{width:100%;min-height:48px;box-sizing:border-box;margin-left:0;padding-top:3px}.timeline--alternate .timeline__item:nth-child(odd) .timeline__item-content{text-align:right;padding-right:calc(50% + 20px)}.timeline--alternate .timeline__item:nth-child(2n) .timeline__item-content{text-align:left;padding-left:calc(50% + 20px)}.timeline--horizontal-top,.timeline--horizontal-bottom,.timeline--horizontal-alternate{overflow-x:auto;overflow-y:hidden}.timeline--horizontal-top .timeline__list,.timeline--horizontal-bottom .timeline__list,.timeline--horizontal-alternate .timeline__list{display:flex;align-items:stretch}.timeline--horizontal-top .timeline__item,.timeline--horizontal-bottom .timeline__item,.timeline--horizontal-alternate .timeline__item{display:block;position:relative;flex:1 1 0;min-width:100px;max-width:240px;padding:0!important}.timeline--horizontal-top .timeline__item-wrapper,.timeline--horizontal-bottom .timeline__item-wrapper,.timeline--horizontal-alternate .timeline__item-wrapper{display:block;width:100%;height:100%}.timeline--horizontal-top .timeline__item-head,.timeline--horizontal-bottom .timeline__item-head,.timeline--horizontal-alternate .timeline__item-head{position:absolute;left:50%;transform:translate(-50%);z-index:2;margin:0;width:16px;height:16px}.timeline--horizontal-top .timeline__dot,.timeline--horizontal-bottom .timeline__dot,.timeline--horizontal-alternate .timeline__dot{position:absolute;top:3px;left:3px}.timeline--horizontal-top .timeline__icon-wrapper,.timeline--horizontal-bottom .timeline__icon-wrapper,.timeline--horizontal-alternate .timeline__icon-wrapper{position:absolute;top:0;left:0;transform:translate(-8px,-8px)}.timeline--horizontal-top .timeline__item-tail,.timeline--horizontal-bottom .timeline__item-tail,.timeline--horizontal-alternate .timeline__item-tail{position:absolute;left:calc(50% + 5px);right:calc(-50% + 5px);width:auto;height:2px}.timeline--horizontal-top .timeline__item:last-child>.timeline__item-tail,.timeline--horizontal-bottom .timeline__item:last-child>.timeline__item-tail,.timeline--horizontal-alternate .timeline__item:last-child>.timeline__item-tail{display:none!important}.timeline--horizontal-top .timeline__item-content,.timeline--horizontal-bottom .timeline__item-content,.timeline--horizontal-alternate .timeline__item-content{text-align:center;margin-left:0;padding:var(--solely-spacing-sm) var(--solely-spacing-md)}.timeline--horizontal-top .timeline__item{min-height:80px}.timeline--horizontal-top .timeline__item-head{top:var(--solely-spacing-sm)}.timeline--horizontal-top .timeline__item-tail{top:15px}.timeline--horizontal-top .timeline__item-content{padding-top:36px;padding-bottom:var(--solely-spacing-xs)}.timeline--horizontal-bottom .timeline__item{min-height:80px}.timeline--horizontal-bottom .timeline__item-head{bottom:var(--solely-spacing-sm);top:auto}.timeline--horizontal-bottom .timeline__item-tail{bottom:15px;top:auto}.timeline--horizontal-bottom .timeline__item-content{padding-bottom:36px;padding-top:var(--solely-spacing-xs)}.timeline--horizontal-alternate .timeline__item{min-height:120px}.timeline--horizontal-alternate .timeline__item-head{top:50%;transform:translate(-50%,-50%)}.timeline--horizontal-alternate .timeline__item-tail{top:50%;transform:translateY(-50%)}.timeline--horizontal-alternate .timeline__item:nth-child(odd) .timeline__item-content{padding-top:100px;padding-bottom:var(--solely-spacing-xs)}.timeline--horizontal-alternate .timeline__item:nth-child(2n) .timeline__item-content{padding-bottom:0;padding-top:var(--solely-spacing-xs)}.timeline__item--left .timeline__item-content{text-align:right;padding-right:calc(50% + 20px);margin-left:0}.timeline__item--right .timeline__item-content{text-align:left;padding-left:calc(50% + 20px);margin-left:0}.timeline__item--top .timeline__item-content{padding-top:calc(50% + 20px);padding-bottom:var(--solely-spacing-xs)}.timeline__item--bottom .timeline__item-content{padding-bottom:calc(50% + 20px);padding-top:var(--solely-spacing-xs)}.timeline__item--pending>.timeline__item-tail{display:block!important;background-color:transparent!important;background-image:repeating-linear-gradient(to bottom,var(--timeline-tail-color) 0,var(--timeline-tail-color) 4px,transparent 4px,transparent 8px)!important;animation:timeline-tail-flow 1s linear infinite}.timeline--horizontal-top .timeline__item--pending>.timeline__item-tail,.timeline--horizontal-bottom .timeline__item--pending>.timeline__item-tail,.timeline--horizontal-alternate .timeline__item--pending>.timeline__item-tail{background-image:repeating-linear-gradient(90deg,rgba(5,5,5,.15) 0,rgba(5,5,5,.15) 4px,transparent 4px,transparent 8px)!important}.timeline__item--pending .timeline__dot{background-color:transparent!important;border-color:var(--solely-primary)!important;border-style:dashed;animation:timeline-pending-pulse 1.5s ease-in-out infinite}.timeline__item--pending .timeline__item-content{color:var(--solely-text-tertiary)}.timeline__dot--blue{border-color:var(--solely-primary)!important}.timeline__dot--green{border-color:var(--solely-success)!important}.timeline__dot--red{border-color:var(--solely-error)!important}.timeline__dot--orange{border-color:var(--solely-warning)!important}.timeline__dot--gray{border-color:var(--solely-border-color)!important}.timeline--filled .timeline__dot{border-width:0!important;background-clip:border-box}.timeline--filled .timeline__dot--blue{background-color:var(--solely-primary)!important}.timeline--filled .timeline__dot--green{background-color:var(--solely-success)!important}.timeline--filled .timeline__dot--red{background-color:var(--solely-error)!important}.timeline--filled .timeline__dot--orange{background-color:var(--solely-warning)!important}.timeline--filled .timeline__dot--gray{background-color:var(--solely-border-color)!important}.timeline__item--loading .timeline__dot{border-color:var(--solely-primary) var(--solely-primary-light) var(--solely-primary) var(--solely-primary-light);animation:timeline-loading-spin .8s linear infinite}@keyframes timeline-tail-flow{0%{background-position:0 0}to{background-position:0 16px}}@keyframes timeline-pending-pulse{0%,to{opacity:1}50%{opacity:.45}}@keyframes timeline-loading-spin{to{transform:rotate(360deg)}}";export{i as default};
@@ -0,0 +1,23 @@
1
+ export type TimelineMode = 'left' | 'right' | 'alternate' | 'horizontal-top' | 'horizontal-bottom' | 'horizontal-alternate';
2
+ export type TimelineItemPosition = 'left' | 'right';
3
+ export type TimelineItemVerticalPosition = 'top' | 'bottom';
4
+ export type TimelineVariant = 'filled' | 'outlined';
5
+ export interface TimelineItem {
6
+ title: string;
7
+ content?: string;
8
+ time?: string;
9
+ label?: string;
10
+ color?: string;
11
+ position?: TimelineItemPosition;
12
+ verticalPosition?: TimelineItemVerticalPosition;
13
+ icon?: string;
14
+ loading?: boolean;
15
+ }
16
+ export interface TimelineProps {
17
+ mode?: TimelineMode;
18
+ items?: string;
19
+ pending?: boolean;
20
+ pendingContent?: string;
21
+ reverse?: boolean;
22
+ variant?: TimelineVariant;
23
+ }
@@ -0,0 +1 @@
1
+ "use strict";var e=Object.defineProperty;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./style.css.cjs"),s=require("./index.html.cjs"),n=require("../utils/helpers.cjs"),a=require("../../../runtime/component/base-element.cjs"),r=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyTree=class extends a.default{constructor(){var t;super(...arguments),((t,s,n)=>{s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n})(this,"symbol"!=typeof(t="treeData")?t+"":t,[])}getTreeClasses(){return{"tree--show-line":!!this.$data.showLine}}getNodeClasses(e){const t={"tree__node--filtered":!!e.isFiltered,"tree__node--last-child":!!e.isLastChild};return void 0!==e.level&&(t[`tree__node--level-${e.level}`]=!0),t}getContentClasses(e){return{"tree__content--selected":!!e.selected,"tree__content--disabled":!!e.disabled}}getSwitcherClasses(e){return{"tree__switcher--expanded":!!e.expanded,"tree__switcher--leaf":!e.children||0===e.children.length}}getCheckboxClasses(e){return{"tree__checkbox--checked":!!e.checked,"tree__checkbox--half-checked":!!e.halfChecked,"tree__checkbox--disabled":!!e.disabled}}getTitleClasses(e){return{"tree__title--highlight":!!e.highlight}}mounted(){this.parseTreeData()}parseTreeData(){this.treeData=n.safeJsonParse(this.$data.treeData,[]),this.flattenTree()}flattenTree(){const e=[],t=this.$data.searchable?(this.$data.searchValue||"").toLowerCase():"",s=(n,a)=>{for(let r=0;r<n.length;r++){const d=n[r],c=d.children&&d.children.length>0,h=this.$data.defaultExpandAll||d.expanded,i=t&&d.title.toLowerCase().includes(t),l={...d,level:a,expanded:h,isFiltered:!(!t||i||this.hasMatchingDescendant(d,t)),highlight:!!i,isLastChild:r===n.length-1};e.push(l),c&&h&&d.children&&s(d.children,a+1)}};s(this.treeData,0),this.$data.flattenedTree=e}hasMatchingDescendant(e,t){if(!e.children||0===e.children.length)return!1;for(const s of e.children){if(s.title.toLowerCase().includes(t))return!0;if(this.hasMatchingDescendant(s,t))return!0}return!1}handleToggle(e,t){if(t.stopPropagation(),this.$data.disabled)return;const s=this.findNode(this.treeData,e.key);s&&(s.expanded=!s.expanded,this.flattenTree(),this.emit("expand",{expandedKeys:this.getExpandedKeys(),node:s}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleNodeClick(e){if(this.$data.disabled||e.disabled)return;this.$data.multiple||this.clearSelection();const t=this.findNode(this.treeData,e.key);t&&(t.selected=!t.selected,this.flattenTree(),this.emit("select",{selectedKeys:this.getSelectedKeys(),selectedNodes:this.getSelectedNodes(),node:t}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleCheck(e,t){if(t.stopPropagation(),this.$data.disabled||e.disabled)return;const s=this.findNode(this.treeData,e.key);if(s){const e=!s.checked;this.updateNodeCheckState(s,e),this.flattenTree(),this.emit("check",{checkedKeys:this.getCheckedKeys(),checkedNodes:this.getCheckedNodes(),node:s}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}}updateNodeCheckState(e,t){if(e.checked=t,e.halfChecked=!1,e.children)for(const s of e.children)this.updateNodeCheckState(s,t);this.updateParentCheckState(this.treeData,e)}updateParentCheckState(e,t){for(const s of e)if(s.children){if(s.children.includes(t)){const e=s.children.every(e=>e.checked),t=s.children.some(e=>e.checked||e.halfChecked);return s.checked=e,s.halfChecked=!e&&t,!0}if(this.updateParentCheckState(s.children,t)){const e=s.children.every(e=>e.checked),t=s.children.some(e=>e.checked||e.halfChecked);return s.checked=e,s.halfChecked=!e&&t,!0}}return!1}findNode(e,t){for(const s of e){if(s.key===t)return s;if(s.children){const e=this.findNode(s.children,t);if(e)return e}}return null}clearSelection(){const e=t=>{for(const s of t)s.selected=!1,s.children&&e(s.children)};e(this.treeData)}getCheckedKeys(){const e=[],t=s=>{for(const n of s)n.checked&&e.push(n.key),n.children&&t(n.children)};return t(this.treeData),e}set checkedKeys(e){const t=e=>{for(const s of e)s.checked=!1,s.halfChecked=!1,s.children&&t(s.children)};t(this.treeData);const s=(e,t)=>{for(const n of e)t.includes(n.key)&&(n.checked=!0),n.children&&s(n.children,t)};s(this.treeData,e),this.flattenTree(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getExpandedKeys(){const e=[],t=s=>{for(const n of s)n.expanded&&e.push(n.key),n.children&&t(n.children)};return t(this.treeData),e}set expandedKeys(e){const t=s=>{for(const n of s)n.expanded=e.includes(n.key),n.children&&t(n.children)};t(this.treeData),this.flattenTree(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getSelectedKeys(){const e=[],t=s=>{for(const n of s)n.selected&&e.push(n.key),n.children&&t(n.children)};return t(this.treeData),e}getSelectedNodes(){const e=[],t=s=>{for(const n of s)n.selected&&e.push(n),n.children&&t(n.children)};return t(this.treeData),e}getCheckedNodes(){const e=[],t=s=>{for(const n of s)n.checked&&e.push(n),n.children&&t(n.children)};return t(this.treeData),e}setTreeData(e){this.treeData=e,this.$data.treeData=JSON.stringify(e),this.flattenTree()}getTreeData(){return this.treeData}},exports.SolelyTree=((e,t)=>{for(var s,n=t,a=e.length-1;a>=0;a--)(s=e[a])&&(n=s(n)||n);return n})([r.CustomElement({tagName:"solely-tree",template:s.default,styles:t.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"treeData",type:"string"},{name:"showLine",type:"boolean",default:!1},{name:"multiple",type:"boolean",default:!1},{name:"checkable",type:"boolean",default:!1},{name:"defaultExpandAll",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"searchable",type:"boolean",default:!1},{name:"searchValue",type:"string"},{name:"block",type:"boolean",default:!1}]})],exports.SolelyTree);
@@ -0,0 +1,127 @@
1
+ import { BaseElement } from '../../../runtime/component';
2
+ import { TreeProps, TreeNode } from './types';
3
+ declare class SolelyTree extends BaseElement<TreeProps & {
4
+ flattenedTree: Array<TreeNode & {
5
+ level: number;
6
+ isFiltered?: boolean;
7
+ highlight?: boolean;
8
+ isLastChild?: boolean;
9
+ }>;
10
+ }> {
11
+ treeData: TreeNode[];
12
+ /**
13
+ * 获取 tree class 对象
14
+ */
15
+ getTreeClasses(): Record<string, boolean>;
16
+ /**
17
+ * 获取 node class 对象
18
+ */
19
+ getNodeClasses(node: TreeNode & {
20
+ isFiltered?: boolean;
21
+ isLastChild?: boolean;
22
+ level?: number;
23
+ }): Record<string, boolean>;
24
+ /**
25
+ * 获取 content class 对象
26
+ */
27
+ getContentClasses(node: TreeNode): Record<string, boolean>;
28
+ /**
29
+ * 获取 switcher class 对象
30
+ */
31
+ getSwitcherClasses(node: TreeNode): Record<string, boolean>;
32
+ /**
33
+ * 获取 checkbox class 对象
34
+ */
35
+ getCheckboxClasses(node: TreeNode): Record<string, boolean>;
36
+ /**
37
+ * 获取 title class 对象
38
+ */
39
+ getTitleClasses(node: TreeNode & {
40
+ highlight?: boolean;
41
+ }): Record<string, boolean>;
42
+ mounted(): void;
43
+ /**
44
+ * 解析树形数据
45
+ */
46
+ parseTreeData(): void;
47
+ /**
48
+ * 扁平化树形数据
49
+ */
50
+ flattenTree(): void;
51
+ /**
52
+ * 检查是否有匹配的后代节点
53
+ */
54
+ hasMatchingDescendant(node: TreeNode, searchValue: string): boolean;
55
+ /**
56
+ * 切换展开/折叠
57
+ */
58
+ handleToggle(node: TreeNode & {
59
+ level: number;
60
+ }, event: MouseEvent): void;
61
+ /**
62
+ * 节点点击
63
+ */
64
+ handleNodeClick(node: TreeNode & {
65
+ level: number;
66
+ }): void;
67
+ /**
68
+ * 勾选节点
69
+ */
70
+ handleCheck(node: TreeNode & {
71
+ level: number;
72
+ }, event: MouseEvent): void;
73
+ /**
74
+ * 更新节点勾选状态(包括子节点)
75
+ */
76
+ updateNodeCheckState(node: TreeNode, checked: boolean): void;
77
+ /**
78
+ * 更新父节点勾选状态
79
+ */
80
+ updateParentCheckState(nodes: TreeNode[], targetNode: TreeNode): boolean;
81
+ /**
82
+ * 查找节点
83
+ */
84
+ findNode(nodes: TreeNode[], key: string): TreeNode | null;
85
+ /**
86
+ * 清除选中状态
87
+ */
88
+ clearSelection(): void;
89
+ /**
90
+ * 获取勾选的节点 key
91
+ */
92
+ getCheckedKeys(): string[];
93
+ /**
94
+ * 设置勾选的节点 key
95
+ */
96
+ set checkedKeys(keys: string[]);
97
+ /**
98
+ * 获取展开的节点 key
99
+ */
100
+ getExpandedKeys(): string[];
101
+ /**
102
+ * 设置展开的节点 key
103
+ */
104
+ set expandedKeys(keys: string[]);
105
+ /**
106
+ * 获取选中的节点 key
107
+ */
108
+ getSelectedKeys(): string[];
109
+ /**
110
+ * 获取选中的节点
111
+ */
112
+ getSelectedNodes(): TreeNode[];
113
+ /**
114
+ * 获取勾选的节点
115
+ */
116
+ getCheckedNodes(): TreeNode[];
117
+ /**
118
+ * 设置树形数据
119
+ */
120
+ setTreeData(data: TreeNode[]): void;
121
+ /**
122
+ * 获取树形数据
123
+ */
124
+ getTreeData(): TreeNode[];
125
+ }
126
+ export default SolelyTree;
127
+ export { SolelyTree };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div class="tree" :class="this.getTreeClasses()">\n <ul class="tree__list">\n <For each="$data.flattenedTree" item="node">\n <li\n class="tree__node"\n :class="this.getNodeClasses(node)"\n :style="\'padding-left: \' + (node.level * 24 + 12) + \'px\'"\n >\n <div\n class="tree__content"\n :class="this.getContentClasses(node)"\n @click="this.handleNodeClick(node)"\n >\n \x3c!-- 展开/折叠图标 --\x3e\n <span\n class="tree__switcher"\n :class="this.getSwitcherClasses(node)"\n @click="this.handleToggle(node, event)"\n >\n ▶\n </span>\n\n \x3c!-- 复选框 --\x3e\n <If condition="$data.checkable">\n <span\n class="tree__checkbox"\n :class="this.getCheckboxClasses(node)"\n @click="this.handleCheck(node, event)"\n ></span>\n </If>\n\n \x3c!-- 节点图标 --\x3e\n <If condition="node.icon">\n <span class="tree__icon">{{node.icon}}</span>\n </If>\n\n \x3c!-- 节点标题 --\x3e\n <span class="tree__title">{{node.title}}</span>\n </div>\n </li>\n </For>\n </ul>\n</div>\n';
@@ -0,0 +1 @@
1
+ const n='<div class="tree" :class="this.getTreeClasses()">\n <ul class="tree__list">\n <For each="$data.flattenedTree" item="node">\n <li\n class="tree__node"\n :class="this.getNodeClasses(node)"\n :style="\'padding-left: \' + (node.level * 24 + 12) + \'px\'"\n >\n <div\n class="tree__content"\n :class="this.getContentClasses(node)"\n @click="this.handleNodeClick(node)"\n >\n \x3c!-- 展开/折叠图标 --\x3e\n <span\n class="tree__switcher"\n :class="this.getSwitcherClasses(node)"\n @click="this.handleToggle(node, event)"\n >\n ▶\n </span>\n\n \x3c!-- 复选框 --\x3e\n <If condition="$data.checkable">\n <span\n class="tree__checkbox"\n :class="this.getCheckboxClasses(node)"\n @click="this.handleCheck(node, event)"\n ></span>\n </If>\n\n \x3c!-- 节点图标 --\x3e\n <If condition="node.icon">\n <span class="tree__icon">{{node.icon}}</span>\n </If>\n\n \x3c!-- 节点标题 --\x3e\n <span class="tree__title">{{node.title}}</span>\n </div>\n </li>\n </For>\n </ul>\n</div>\n';export{n as default};
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty;import t from"./style.css.js";import s from"./index.html.js";import{safeJsonParse as n}from"../utils/helpers.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as d}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let r=class extends a{constructor(){var t;super(...arguments),((t,s,n)=>{s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n})(this,"symbol"!=typeof(t="treeData")?t+"":t,[])}getTreeClasses(){return{"tree--show-line":!!this.$data.showLine}}getNodeClasses(e){const t={"tree__node--filtered":!!e.isFiltered,"tree__node--last-child":!!e.isLastChild};return void 0!==e.level&&(t[`tree__node--level-${e.level}`]=!0),t}getContentClasses(e){return{"tree__content--selected":!!e.selected,"tree__content--disabled":!!e.disabled}}getSwitcherClasses(e){return{"tree__switcher--expanded":!!e.expanded,"tree__switcher--leaf":!e.children||0===e.children.length}}getCheckboxClasses(e){return{"tree__checkbox--checked":!!e.checked,"tree__checkbox--half-checked":!!e.halfChecked,"tree__checkbox--disabled":!!e.disabled}}getTitleClasses(e){return{"tree__title--highlight":!!e.highlight}}mounted(){this.parseTreeData()}parseTreeData(){this.treeData=n(this.$data.treeData,[]),this.flattenTree()}flattenTree(){const e=[],t=this.$data.searchable?(this.$data.searchValue||"").toLowerCase():"",s=(n,a)=>{for(let d=0;d<n.length;d++){const r=n[d],h=r.children&&r.children.length>0,c=this.$data.defaultExpandAll||r.expanded,i=t&&r.title.toLowerCase().includes(t),l={...r,level:a,expanded:c,isFiltered:!(!t||i||this.hasMatchingDescendant(r,t)),highlight:!!i,isLastChild:d===n.length-1};e.push(l),h&&c&&r.children&&s(r.children,a+1)}};s(this.treeData,0),this.$data.flattenedTree=e}hasMatchingDescendant(e,t){if(!e.children||0===e.children.length)return!1;for(const s of e.children){if(s.title.toLowerCase().includes(t))return!0;if(this.hasMatchingDescendant(s,t))return!0}return!1}handleToggle(e,t){if(t.stopPropagation(),this.$data.disabled)return;const s=this.findNode(this.treeData,e.key);s&&(s.expanded=!s.expanded,this.flattenTree(),this.emit("expand",{expandedKeys:this.getExpandedKeys(),node:s}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleNodeClick(e){if(this.$data.disabled||e.disabled)return;this.$data.multiple||this.clearSelection();const t=this.findNode(this.treeData,e.key);t&&(t.selected=!t.selected,this.flattenTree(),this.emit("select",{selectedKeys:this.getSelectedKeys(),selectedNodes:this.getSelectedNodes(),node:t}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleCheck(e,t){if(t.stopPropagation(),this.$data.disabled||e.disabled)return;const s=this.findNode(this.treeData,e.key);if(s){const e=!s.checked;this.updateNodeCheckState(s,e),this.flattenTree(),this.emit("check",{checkedKeys:this.getCheckedKeys(),checkedNodes:this.getCheckedNodes(),node:s}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}}updateNodeCheckState(e,t){if(e.checked=t,e.halfChecked=!1,e.children)for(const s of e.children)this.updateNodeCheckState(s,t);this.updateParentCheckState(this.treeData,e)}updateParentCheckState(e,t){for(const s of e)if(s.children){if(s.children.includes(t)){const e=s.children.every(e=>e.checked),t=s.children.some(e=>e.checked||e.halfChecked);return s.checked=e,s.halfChecked=!e&&t,!0}if(this.updateParentCheckState(s.children,t)){const e=s.children.every(e=>e.checked),t=s.children.some(e=>e.checked||e.halfChecked);return s.checked=e,s.halfChecked=!e&&t,!0}}return!1}findNode(e,t){for(const s of e){if(s.key===t)return s;if(s.children){const e=this.findNode(s.children,t);if(e)return e}}return null}clearSelection(){const e=t=>{for(const s of t)s.selected=!1,s.children&&e(s.children)};e(this.treeData)}getCheckedKeys(){const e=[],t=s=>{for(const n of s)n.checked&&e.push(n.key),n.children&&t(n.children)};return t(this.treeData),e}set checkedKeys(e){const t=e=>{for(const s of e)s.checked=!1,s.halfChecked=!1,s.children&&t(s.children)};t(this.treeData);const s=(e,t)=>{for(const n of e)t.includes(n.key)&&(n.checked=!0),n.children&&s(n.children,t)};s(this.treeData,e),this.flattenTree(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getExpandedKeys(){const e=[],t=s=>{for(const n of s)n.expanded&&e.push(n.key),n.children&&t(n.children)};return t(this.treeData),e}set expandedKeys(e){const t=s=>{for(const n of s)n.expanded=e.includes(n.key),n.children&&t(n.children)};t(this.treeData),this.flattenTree(),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}getSelectedKeys(){const e=[],t=s=>{for(const n of s)n.selected&&e.push(n.key),n.children&&t(n.children)};return t(this.treeData),e}getSelectedNodes(){const e=[],t=s=>{for(const n of s)n.selected&&e.push(n),n.children&&t(n.children)};return t(this.treeData),e}getCheckedNodes(){const e=[],t=s=>{for(const n of s)n.checked&&e.push(n),n.children&&t(n.children)};return t(this.treeData),e}setTreeData(e){this.treeData=e,this.$data.treeData=JSON.stringify(e),this.flattenTree()}getTreeData(){return this.treeData}};r=((e,t)=>{for(var s,n=t,a=e.length-1;a>=0;a--)(s=e[a])&&(n=s(n)||n);return n})([d({tagName:"solely-tree",template:s,styles:t,shadowDOM:{use:!0,mode:"open"},props:[{name:"treeData",type:"string"},{name:"showLine",type:"boolean",default:!1},{name:"multiple",type:"boolean",default:!1},{name:"checkable",type:"boolean",default:!1},{name:"defaultExpandAll",type:"boolean",default:!1},{name:"disabled",type:"boolean",default:!1},{name:"searchable",type:"boolean",default:!1},{name:"searchValue",type:"string"},{name:"block",type:"boolean",default:!1}]})],r);export{r as SolelyTree};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='*,*:before,*:after{box-sizing:border-box}:host{display:inline-block}:host([block]){display:block;width:100%}:host([block]) .tree{width:100%}:host([block]) .tree__content{width:100%}.tree{font-family:var(--solely-font-family);font-size:var(--solely-font-size-md)}.tree__list{margin:0;padding:0;list-style:none}.tree__node{position:relative}.tree__content{display:flex;align-items:center;padding:4px 0;cursor:pointer;transition:all var(--solely-transition-duration);border-radius:var(--solely-border-radius-sm)}.tree__content:hover{background-color:var(--solely-gray-1)}.tree__content--selected{background-color:var(--solely-primary-light);color:var(--solely-primary)}.tree__content--disabled{cursor:not-allowed;color:var(--solely-text-tertiary)}.tree__switcher{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin-right:4px;color:var(--solely-text-tertiary);cursor:pointer;transition:transform var(--solely-transition-duration);font-size:12px}.tree__switcher--expanded{transform:rotate(90deg)}.tree__switcher--leaf{visibility:hidden}.tree__checkbox{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:8px;border:1px solid var(--solely-border-color);border-radius:2px;background-color:var(--solely-component-bg);cursor:pointer;transition:all var(--solely-transition-duration)}.tree__checkbox:hover{border-color:var(--solely-primary)}.tree__checkbox--checked{background-color:var(--solely-primary);border-color:var(--solely-primary)}.tree__checkbox--checked:after{content:"✓";color:var(--solely-white);font-size:12px}.tree__checkbox--half-checked{background-color:var(--solely-primary);border-color:var(--solely-primary)}.tree__checkbox--half-checked:after{content:"";width:8px;height:2px;background-color:var(--solely-component-bg)}.tree__checkbox--disabled{cursor:not-allowed;background-color:var(--solely-gray-2);border-color:var(--solely-border-color)}.tree__icon{margin-right:4px;color:var(--solely-text-tertiary);font-size:14px}.tree__title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tree__children{margin:0;padding:0 0 0 24px;list-style:none}.tree--show-line .tree__node{position:relative}.tree--show-line .tree__node:before{content:"";position:absolute;top:0;left:calc(16px + (var(--level, 0) * 24px));width:1px;height:100%;background-color:var(--solely-border-color)}.tree--show-line .tree__node--level-0:before{display:none}.tree--show-line .tree__node--last-child:before{height:50%}.tree--show-line .tree__content:before{content:"";position:absolute;top:50%;left:calc(16px + (var(--level, 0) * 24px));width:12px;height:1px;background-color:var(--solely-border-color);transform:translateY(-50%)}.tree--show-line .tree__node--level-0 .tree__content:before{display:none}.tree--show-line .tree__node--level-1{--level: 1}.tree--show-line .tree__node--level-2{--level: 2}.tree--show-line .tree__node--level-3{--level: 3}.tree--show-line .tree__node--level-4{--level: 4}.tree--show-line .tree__node--level-5{--level: 5}.tree__title--highlight{color:var(--solely-primary);font-weight:500}.tree__node--filtered{display:none}';
@@ -0,0 +1 @@
1
+ const e='*,*:before,*:after{box-sizing:border-box}:host{display:inline-block}:host([block]){display:block;width:100%}:host([block]) .tree{width:100%}:host([block]) .tree__content{width:100%}.tree{font-family:var(--solely-font-family);font-size:var(--solely-font-size-md)}.tree__list{margin:0;padding:0;list-style:none}.tree__node{position:relative}.tree__content{display:flex;align-items:center;padding:4px 0;cursor:pointer;transition:all var(--solely-transition-duration);border-radius:var(--solely-border-radius-sm)}.tree__content:hover{background-color:var(--solely-gray-1)}.tree__content--selected{background-color:var(--solely-primary-light);color:var(--solely-primary)}.tree__content--disabled{cursor:not-allowed;color:var(--solely-text-tertiary)}.tree__switcher{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin-right:4px;color:var(--solely-text-tertiary);cursor:pointer;transition:transform var(--solely-transition-duration);font-size:12px}.tree__switcher--expanded{transform:rotate(90deg)}.tree__switcher--leaf{visibility:hidden}.tree__checkbox{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:8px;border:1px solid var(--solely-border-color);border-radius:2px;background-color:var(--solely-component-bg);cursor:pointer;transition:all var(--solely-transition-duration)}.tree__checkbox:hover{border-color:var(--solely-primary)}.tree__checkbox--checked{background-color:var(--solely-primary);border-color:var(--solely-primary)}.tree__checkbox--checked:after{content:"✓";color:var(--solely-white);font-size:12px}.tree__checkbox--half-checked{background-color:var(--solely-primary);border-color:var(--solely-primary)}.tree__checkbox--half-checked:after{content:"";width:8px;height:2px;background-color:var(--solely-component-bg)}.tree__checkbox--disabled{cursor:not-allowed;background-color:var(--solely-gray-2);border-color:var(--solely-border-color)}.tree__icon{margin-right:4px;color:var(--solely-text-tertiary);font-size:14px}.tree__title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tree__children{margin:0;padding:0 0 0 24px;list-style:none}.tree--show-line .tree__node{position:relative}.tree--show-line .tree__node:before{content:"";position:absolute;top:0;left:calc(16px + (var(--level, 0) * 24px));width:1px;height:100%;background-color:var(--solely-border-color)}.tree--show-line .tree__node--level-0:before{display:none}.tree--show-line .tree__node--last-child:before{height:50%}.tree--show-line .tree__content:before{content:"";position:absolute;top:50%;left:calc(16px + (var(--level, 0) * 24px));width:12px;height:1px;background-color:var(--solely-border-color);transform:translateY(-50%)}.tree--show-line .tree__node--level-0 .tree__content:before{display:none}.tree--show-line .tree__node--level-1{--level: 1}.tree--show-line .tree__node--level-2{--level: 2}.tree--show-line .tree__node--level-3{--level: 3}.tree--show-line .tree__node--level-4{--level: 4}.tree--show-line .tree__node--level-5{--level: 5}.tree__title--highlight{color:var(--solely-primary);font-weight:500}.tree__node--filtered{display:none}';export{e as default};
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Tree 组件类型定义
3
+ */
4
+ export interface TreeNode {
5
+ /** 节点唯一标识 */
6
+ key: string;
7
+ /** 节点标题 */
8
+ title: string;
9
+ /** 子节点 */
10
+ children?: TreeNode[];
11
+ /** 是否禁用 */
12
+ disabled?: boolean;
13
+ /** 是否可选 */
14
+ selectable?: boolean;
15
+ /** 是否已选中(点击选择状态) */
16
+ selected?: boolean;
17
+ /** 是否已勾选 */
18
+ checked?: boolean;
19
+ /** 是否半选 */
20
+ halfChecked?: boolean;
21
+ /** 是否展开 */
22
+ expanded?: boolean;
23
+ /** 是否叶子节点 */
24
+ isLeaf?: boolean;
25
+ /** 自定义图标 */
26
+ icon?: string;
27
+ }
28
+ export interface TreeProps {
29
+ /** 树形数据(JSON字符串) */
30
+ treeData?: string;
31
+ /** 是否显示连接线 */
32
+ showLine?: boolean;
33
+ /** 是否支持多选 */
34
+ multiple?: boolean;
35
+ /** 是否支持勾选 */
36
+ checkable?: boolean;
37
+ /** 是否默认展开所有节点 */
38
+ defaultExpandAll?: boolean;
39
+ /** 是否禁用 */
40
+ disabled?: boolean;
41
+ /** 是否可搜索 */
42
+ searchable?: boolean;
43
+ /** 搜索关键词 */
44
+ searchValue?: string;
45
+ /** 是否撑满父容器宽度 */
46
+ block?: boolean;
47
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),s=require("../utils/helpers.cjs"),a=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyUpload=class extends a.default{getUploadClasses(){const e={};return this.$data.listType&&(e[`upload--${this.$data.listType}`]=!0),e["is-disabled"]=!!this.$data.disabled,e}get fileList(){return this.$data.parsedFileList}getDragClasses(){return{"upload__drag--active":!!this.$data.isDragging}}mounted(){this.parseFileList(),this.$data.isDragging=!1}parseFileList(){this.$data.parsedFileList=s.safeJsonParse(this.$data.fileList,[])}triggerUpload(){var e;if(this.$data.disabled)return;const t=null==(e=this.shadowRoot)?void 0:e.querySelector('input[type="file"]');t&&t.click()}handleFileChange(e){const t=e.target,s=t.files;s&&s.length>0&&this.handleFiles(s),t.value=""}handleFiles(e){const t=this.$data.maxCount||1/0,s=this.$data.maxSize||1/0;Array.from(e).forEach(e=>{if(this.$data.parsedFileList.length>=t)return void this.emit("error",{file:{name:e.name,size:e.size},message:`文件数量超过限制 (最多 ${t} 个)`});if(e.size>s)return void this.emit("error",{file:{name:e.name,size:e.size},message:`文件大小超过限制 (${this.formatSize(s)})`});const a={uid:Date.now()+Math.random().toString(36).substr(2,9),name:e.name,size:e.size,type:e.type,status:"uploading",percent:0};this.$data.parsedFileList.push(a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.uploadFile(a,e)})}uploadFile(e,t){if(!this.$data.action)return e.status="done",e.percent=100,e.url=URL.createObjectURL(t),this.refresh(),this.emit("success",{file:e,fileList:this.$data.parsedFileList}),void this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}));const s=new XMLHttpRequest,a=new FormData;a.append("file",t),s.upload.addEventListener("progress",t=>{t.lengthComputable&&(e.percent=Math.round(t.loaded/t.total*100),this.$data.parsedFileList=[...this.$data.parsedFileList])}),s.addEventListener("load",()=>{if(s.status>=200&&s.status<300){e.status="done",e.percent=100;try{const t=JSON.parse(s.responseText);t.url&&(e.url=t.url)}catch{}this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("success",{file:e,fileList:this.$data.parsedFileList})}else e.status="error",e.error=s.statusText,this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("error",{file:e,message:s.statusText});this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),s.addEventListener("error",()=>{e.status="error",e.error="网络错误",this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("error",{file:e,message:"网络错误"}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),s.open("POST",this.$data.action,!0),s.send(a)}handleDragOver(e){e.preventDefault(),this.$data.isDragging=!0}handleDragLeave(e){e.preventDefault(),this.$data.isDragging=!1}handleDrop(e){var t;e.preventDefault(),this.$data.isDragging=!1;const s=null==(t=e.dataTransfer)?void 0:t.files;s&&s.length>0&&this.handleFiles(s)}handleRemove(e){const t=this.$data.parsedFileList.findIndex(t=>t.uid===e.uid);t>-1&&(this.$data.parsedFileList.splice(t,1),this.emit("remove",{file:e,fileList:this.$data.parsedFileList}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}formatSize(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB"][t]}getStatusText(e){return{uploading:"上传中",done:"完成",error:"失败",removed:"已删除"}[e||""]||""}getFileList(){return this.$data.parsedFileList}clear(){this.$data.parsedFileList=[]}},exports.SolelyUpload=((e,t)=>{for(var s,a=t,i=e.length-1;i>=0;i--)(s=e[i])&&(a=s(a)||a);return a})([i.CustomElement({tagName:"solely-upload",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"action",type:"string"},{name:"accept",type:"string"},{name:"multiple",type:"boolean",default:!1},{name:"fileList",type:"string"},{name:"listType",type:"string"},{name:"disabled",type:"boolean",default:!1},{name:"showUploadList",type:"boolean",default:!0},{name:"buttonText",type:"string"},{name:"drag",type:"boolean",default:!1},{name:"maxCount",type:"number"},{name:"maxSize",type:"number"},{name:"block",type:"boolean",default:!1}]})],exports.SolelyUpload);
@@ -0,0 +1,74 @@
1
+ import { BaseElement } from '../../../runtime/component';
2
+ import { UploadProps, UploadFile } from './types';
3
+ declare class SolelyUpload extends BaseElement<UploadProps & {
4
+ parsedFileList: UploadFile[];
5
+ isDragging: boolean;
6
+ }> {
7
+ /**
8
+ * 获取 upload class 对象
9
+ */
10
+ getUploadClasses(): Record<string, boolean>;
11
+ /**
12
+ * 暴露 fileList 属性,使外部可通过 event.target.fileList 访问
13
+ */
14
+ get fileList(): UploadFile[];
15
+ /**
16
+ * 获取 drag class 对象
17
+ */
18
+ getDragClasses(): Record<string, boolean>;
19
+ mounted(): void;
20
+ /**
21
+ * 解析文件列表
22
+ */
23
+ parseFileList(): void;
24
+ /**
25
+ * 触发文件选择
26
+ */
27
+ triggerUpload(): void;
28
+ /**
29
+ * 文件选择变化
30
+ */
31
+ handleFileChange(event: Event): void;
32
+ /**
33
+ * 处理文件
34
+ */
35
+ handleFiles(files: FileList): void;
36
+ /**
37
+ * 上传文件
38
+ */
39
+ uploadFile(uploadFile: UploadFile, file: File): void;
40
+ /**
41
+ * 拖拽悬停
42
+ */
43
+ handleDragOver(event: DragEvent): void;
44
+ /**
45
+ * 拖拽离开
46
+ */
47
+ handleDragLeave(event: DragEvent): void;
48
+ /**
49
+ * 拖拽放下
50
+ */
51
+ handleDrop(event: DragEvent): void;
52
+ /**
53
+ * 移除文件
54
+ */
55
+ handleRemove(file: UploadFile): void;
56
+ /**
57
+ * 格式化文件大小
58
+ */
59
+ formatSize(bytes: number): string;
60
+ /**
61
+ * 获取状态文本
62
+ */
63
+ getStatusText(status?: string): string;
64
+ /**
65
+ * 获取文件列表
66
+ */
67
+ getFileList(): UploadFile[];
68
+ /**
69
+ * 清空文件列表
70
+ */
71
+ clear(): void;
72
+ }
73
+ export default SolelyUpload;
74
+ export { SolelyUpload };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div\n class="upload"\n :class="this.getUploadClasses()"\n>\n \x3c!-- 拖拽上传 --\x3e\n <If condition="$data.drag">\n <div\n class="upload__drag"\n :class="this.getDragClasses()"\n @click="this.triggerUpload(event)"\n @dragover="this.handleDragOver(event)"\n @dragleave="this.handleDragLeave(event)"\n @drop="this.handleDrop(event)"\n >\n <div class="upload__drag-icon">☁️</div>\n <div class="upload__drag-text">{{$data.buttonText || \'点击或拖拽文件到此区域上传\'}}</div>\n <div class="upload__drag-hint">支持单个或批量上传</div>\n </div>\n </If>\n\n \x3c!-- 普通上传按钮 --\x3e\n <If condition="!$data.drag">\n <div\n class="upload__button"\n @click="this.triggerUpload(event)"\n >\n <span>+</span>\n <span>{{$data.buttonText || \'上传文件\'}}</span>\n </div>\n </If>\n\n \x3c!-- 隐藏的文件输入 --\x3e\n <input\n ref="fileInput"\n type="file"\n class="upload__input"\n :accept="$data.accept"\n :multiple="$data.multiple"\n @change="this.handleFileChange(event)"\n />\n\n \x3c!-- 文件列表 --\x3e\n <If condition="$data.showUploadList && $data.parsedFileList?.length > 0">\n <ul class="upload__list">\n <For each="$data.parsedFileList" item="file">\n <li\n class="upload__list-item"\n :class="{ \'upload__list-item--error\': file.status === \'error\' }"\n >\n <If condition="file.url && ($data.listType === \'picture\' || $data.listType === \'picture-card\')">\n <img\n class="upload__list-thumb"\n :src="file.url"\n :alt="file.name"\n />\n </If>\n <div class="upload__list-info">\n <div class="upload__list-name">{{file.name}}</div>\n <If condition="file.size">\n <div class="upload__list-size">{{this.formatSize(file.size)}}</div>\n </If>\n <If condition="file.status === \'uploading\'">\n <div class="upload__progress">\n <div class="upload__progress-bar" :style="\'width: \' + (file.percent || 0) + \'%\'"></div>\n </div>\n </If>\n </div>\n <span\n class="upload__list-status"\n :class="\'upload__list-status--\' + file.status"\n >\n {{this.getStatusText(file.status)}}\n </span>\n <span class="upload__list-remove" @click="this.handleRemove(file)">×</span>\n </li>\n </For>\n </ul>\n </If>\n</div>\n';
@@ -0,0 +1 @@
1
+ const n='<div\n class="upload"\n :class="this.getUploadClasses()"\n>\n \x3c!-- 拖拽上传 --\x3e\n <If condition="$data.drag">\n <div\n class="upload__drag"\n :class="this.getDragClasses()"\n @click="this.triggerUpload(event)"\n @dragover="this.handleDragOver(event)"\n @dragleave="this.handleDragLeave(event)"\n @drop="this.handleDrop(event)"\n >\n <div class="upload__drag-icon">☁️</div>\n <div class="upload__drag-text">{{$data.buttonText || \'点击或拖拽文件到此区域上传\'}}</div>\n <div class="upload__drag-hint">支持单个或批量上传</div>\n </div>\n </If>\n\n \x3c!-- 普通上传按钮 --\x3e\n <If condition="!$data.drag">\n <div\n class="upload__button"\n @click="this.triggerUpload(event)"\n >\n <span>+</span>\n <span>{{$data.buttonText || \'上传文件\'}}</span>\n </div>\n </If>\n\n \x3c!-- 隐藏的文件输入 --\x3e\n <input\n ref="fileInput"\n type="file"\n class="upload__input"\n :accept="$data.accept"\n :multiple="$data.multiple"\n @change="this.handleFileChange(event)"\n />\n\n \x3c!-- 文件列表 --\x3e\n <If condition="$data.showUploadList && $data.parsedFileList?.length > 0">\n <ul class="upload__list">\n <For each="$data.parsedFileList" item="file">\n <li\n class="upload__list-item"\n :class="{ \'upload__list-item--error\': file.status === \'error\' }"\n >\n <If condition="file.url && ($data.listType === \'picture\' || $data.listType === \'picture-card\')">\n <img\n class="upload__list-thumb"\n :src="file.url"\n :alt="file.name"\n />\n </If>\n <div class="upload__list-info">\n <div class="upload__list-name">{{file.name}}</div>\n <If condition="file.size">\n <div class="upload__list-size">{{this.formatSize(file.size)}}</div>\n </If>\n <If condition="file.status === \'uploading\'">\n <div class="upload__progress">\n <div class="upload__progress-bar" :style="\'width: \' + (file.percent || 0) + \'%\'"></div>\n </div>\n </If>\n </div>\n <span\n class="upload__list-status"\n :class="\'upload__list-status--\' + file.status"\n >\n {{this.getStatusText(file.status)}}\n </span>\n <span class="upload__list-remove" @click="this.handleRemove(file)">×</span>\n </li>\n </For>\n </ul>\n </If>\n</div>\n';export{n as default};
@@ -0,0 +1 @@
1
+ import e from"./style.css.js";import t from"./index.html.js";import{safeJsonParse as s}from"../utils/helpers.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let r=class extends a{getUploadClasses(){const e={};return this.$data.listType&&(e[`upload--${this.$data.listType}`]=!0),e["is-disabled"]=!!this.$data.disabled,e}get fileList(){return this.$data.parsedFileList}getDragClasses(){return{"upload__drag--active":!!this.$data.isDragging}}mounted(){this.parseFileList(),this.$data.isDragging=!1}parseFileList(){this.$data.parsedFileList=s(this.$data.fileList,[])}triggerUpload(){var e;if(this.$data.disabled)return;const t=null==(e=this.shadowRoot)?void 0:e.querySelector('input[type="file"]');t&&t.click()}handleFileChange(e){const t=e.target,s=t.files;s&&s.length>0&&this.handleFiles(s),t.value=""}handleFiles(e){const t=this.$data.maxCount||1/0,s=this.$data.maxSize||1/0;Array.from(e).forEach(e=>{if(this.$data.parsedFileList.length>=t)return void this.emit("error",{file:{name:e.name,size:e.size},message:`文件数量超过限制 (最多 ${t} 个)`});if(e.size>s)return void this.emit("error",{file:{name:e.name,size:e.size},message:`文件大小超过限制 (${this.formatSize(s)})`});const a={uid:Date.now()+Math.random().toString(36).substr(2,9),name:e.name,size:e.size,type:e.type,status:"uploading",percent:0};this.$data.parsedFileList.push(a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.uploadFile(a,e)})}uploadFile(e,t){if(!this.$data.action)return e.status="done",e.percent=100,e.url=URL.createObjectURL(t),this.refresh(),this.emit("success",{file:e,fileList:this.$data.parsedFileList}),void this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}));const s=new XMLHttpRequest,a=new FormData;a.append("file",t),s.upload.addEventListener("progress",t=>{t.lengthComputable&&(e.percent=Math.round(t.loaded/t.total*100),this.$data.parsedFileList=[...this.$data.parsedFileList])}),s.addEventListener("load",()=>{if(s.status>=200&&s.status<300){e.status="done",e.percent=100;try{const t=JSON.parse(s.responseText);t.url&&(e.url=t.url)}catch{}this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("success",{file:e,fileList:this.$data.parsedFileList})}else e.status="error",e.error=s.statusText,this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("error",{file:e,message:s.statusText});this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),s.addEventListener("error",()=>{e.status="error",e.error="网络错误",this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("error",{file:e,message:"网络错误"}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),s.open("POST",this.$data.action,!0),s.send(a)}handleDragOver(e){e.preventDefault(),this.$data.isDragging=!0}handleDragLeave(e){e.preventDefault(),this.$data.isDragging=!1}handleDrop(e){var t;e.preventDefault(),this.$data.isDragging=!1;const s=null==(t=e.dataTransfer)?void 0:t.files;s&&s.length>0&&this.handleFiles(s)}handleRemove(e){const t=this.$data.parsedFileList.findIndex(t=>t.uid===e.uid);t>-1&&(this.$data.parsedFileList.splice(t,1),this.emit("remove",{file:e,fileList:this.$data.parsedFileList}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}formatSize(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB"][t]}getStatusText(e){return{uploading:"上传中",done:"完成",error:"失败",removed:"已删除"}[e||""]||""}getFileList(){return this.$data.parsedFileList}clear(){this.$data.parsedFileList=[]}};r=((e,t)=>{for(var s,a=t,i=e.length-1;i>=0;i--)(s=e[i])&&(a=s(a)||a);return a})([i({tagName:"solely-upload",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"action",type:"string"},{name:"accept",type:"string"},{name:"multiple",type:"boolean",default:!1},{name:"fileList",type:"string"},{name:"listType",type:"string"},{name:"disabled",type:"boolean",default:!1},{name:"showUploadList",type:"boolean",default:!0},{name:"buttonText",type:"string"},{name:"drag",type:"boolean",default:!1},{name:"maxCount",type:"number"},{name:"maxSize",type:"number"},{name:"block",type:"boolean",default:!1}]})],r);export{r as SolelyUpload};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default="*,*:before,*:after{box-sizing:border-box}:host{display:inline-block}:host([block]){display:block;width:100%}:host([block]) .upload__button{width:100%;justify-content:center}:host([block]) .upload__drag{width:100%}.upload{font-family:var(--solely-font-family)}.upload__button{display:inline-flex;align-items:center;gap:var(--solely-spacing-xs);padding:var(--solely-spacing-sm) var(--solely-spacing-md);color:var(--solely-text-primary);background-color:var(--solely-component-bg);border:1px dashed var(--solely-border-color);border-radius:var(--solely-border-radius-md);cursor:pointer;transition:all var(--solely-transition-duration);font-size:var(--solely-font-size-md)}.upload__button:hover{border-color:var(--solely-primary);color:var(--solely-primary)}.upload.is-disabled .upload__button{cursor:not-allowed;opacity:var(--solely-disabled-opacity)}.upload__drag{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:var(--solely-spacing-xl);border:2px dashed var(--solely-border-color);border-radius:var(--solely-border-radius-md);background-color:var(--solely-gray-1);cursor:pointer;transition:all var(--solely-transition-duration);text-align:center}.upload__drag:hover{border-color:var(--solely-primary)}.upload__drag--active{border-color:var(--solely-primary);background-color:var(--solely-primary-light)}.upload__drag-icon{font-size:48px;color:var(--solely-text-tertiary);margin-bottom:var(--solely-spacing-md)}.upload__drag-text{font-size:var(--solely-font-size-md);color:var(--solely-text-primary);margin-bottom:var(--solely-spacing-xs)}.upload__drag-hint{font-size:var(--solely-font-size-sm);color:var(--solely-text-tertiary)}.upload__list{margin-top:var(--solely-spacing-md);padding:0;list-style:none}.upload__list-item{display:flex;align-items:center;padding:var(--solely-spacing-sm);margin-bottom:var(--solely-spacing-xs);border-radius:var(--solely-border-radius-md);background-color:var(--solely-gray-1);transition:all var(--solely-transition-duration)}.upload__list-item:hover{background-color:var(--solely-gray-2)}.upload__list-item--error{background-color:var(--solely-error-light)}.upload__list-item--error .upload__list-name{color:var(--solely-error)}.upload__list-thumb{width:48px;height:48px;margin-right:var(--solely-spacing-sm);border-radius:var(--solely-border-radius-sm);object-fit:cover;background-color:var(--solely-gray-3)}.upload__list-info{flex:1;min-width:0}.upload__list-name{font-size:var(--solely-font-size-md);color:var(--solely-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.upload__list-size{font-size:var(--solely-font-size-sm);color:var(--solely-text-tertiary);margin-top:2px}.upload__list-status{margin-left:var(--solely-spacing-sm);font-size:var(--solely-font-size-sm)}.upload__list-status--uploading{color:var(--solely-primary)}.upload__list-status--done{color:var(--solely-success)}.upload__list-status--error{color:var(--solely-error)}.upload__list-remove{margin-left:var(--solely-spacing-sm);padding:var(--solely-spacing-xs);color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);font-size:16px;line-height:1}.upload__list-remove:hover{color:var(--solely-error)}.upload__progress{width:100%;height:2px;background-color:var(--solely-gray-3);border-radius:1px;margin-top:var(--solely-spacing-xs);overflow:hidden}.upload__progress-bar{height:100%;background-color:var(--solely-primary);transition:width .3s ease}.upload--text .upload__list-item,.upload--picture .upload__list-item{display:flex;align-items:center}.upload--picture .upload__list-thumb{width:48px;height:48px;border-radius:var(--solely-border-radius-sm)}.upload--picture-card .upload__button{width:104px;height:104px;padding:0;flex-direction:column;justify-content:center}.upload--picture-card .upload__list{display:flex;flex-wrap:wrap;gap:var(--solely-spacing-sm)}.upload--picture-card .upload__list-item{width:104px;height:104px;padding:0;margin-bottom:0;position:relative}.upload--picture-card .upload__list-thumb{width:100%;height:100%;margin-right:0;border-radius:var(--solely-border-radius-md)}.upload--picture-card .upload__list-info{display:none}.upload--picture-card .upload__list-remove{position:absolute;top:4px;right:4px;margin-left:0;background-color:#00000080;color:var(--solely-white);border-radius:50%;width:20px;height:20px;display:flex;align-items:center;justify-content:center;font-size:12px}.upload--picture-card .upload__list-remove:hover{background-color:#000000b3;color:var(--solely-white)}.upload__input{display:none}";
@@ -0,0 +1 @@
1
+ const o="*,*:before,*:after{box-sizing:border-box}:host{display:inline-block}:host([block]){display:block;width:100%}:host([block]) .upload__button{width:100%;justify-content:center}:host([block]) .upload__drag{width:100%}.upload{font-family:var(--solely-font-family)}.upload__button{display:inline-flex;align-items:center;gap:var(--solely-spacing-xs);padding:var(--solely-spacing-sm) var(--solely-spacing-md);color:var(--solely-text-primary);background-color:var(--solely-component-bg);border:1px dashed var(--solely-border-color);border-radius:var(--solely-border-radius-md);cursor:pointer;transition:all var(--solely-transition-duration);font-size:var(--solely-font-size-md)}.upload__button:hover{border-color:var(--solely-primary);color:var(--solely-primary)}.upload.is-disabled .upload__button{cursor:not-allowed;opacity:var(--solely-disabled-opacity)}.upload__drag{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:var(--solely-spacing-xl);border:2px dashed var(--solely-border-color);border-radius:var(--solely-border-radius-md);background-color:var(--solely-gray-1);cursor:pointer;transition:all var(--solely-transition-duration);text-align:center}.upload__drag:hover{border-color:var(--solely-primary)}.upload__drag--active{border-color:var(--solely-primary);background-color:var(--solely-primary-light)}.upload__drag-icon{font-size:48px;color:var(--solely-text-tertiary);margin-bottom:var(--solely-spacing-md)}.upload__drag-text{font-size:var(--solely-font-size-md);color:var(--solely-text-primary);margin-bottom:var(--solely-spacing-xs)}.upload__drag-hint{font-size:var(--solely-font-size-sm);color:var(--solely-text-tertiary)}.upload__list{margin-top:var(--solely-spacing-md);padding:0;list-style:none}.upload__list-item{display:flex;align-items:center;padding:var(--solely-spacing-sm);margin-bottom:var(--solely-spacing-xs);border-radius:var(--solely-border-radius-md);background-color:var(--solely-gray-1);transition:all var(--solely-transition-duration)}.upload__list-item:hover{background-color:var(--solely-gray-2)}.upload__list-item--error{background-color:var(--solely-error-light)}.upload__list-item--error .upload__list-name{color:var(--solely-error)}.upload__list-thumb{width:48px;height:48px;margin-right:var(--solely-spacing-sm);border-radius:var(--solely-border-radius-sm);object-fit:cover;background-color:var(--solely-gray-3)}.upload__list-info{flex:1;min-width:0}.upload__list-name{font-size:var(--solely-font-size-md);color:var(--solely-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.upload__list-size{font-size:var(--solely-font-size-sm);color:var(--solely-text-tertiary);margin-top:2px}.upload__list-status{margin-left:var(--solely-spacing-sm);font-size:var(--solely-font-size-sm)}.upload__list-status--uploading{color:var(--solely-primary)}.upload__list-status--done{color:var(--solely-success)}.upload__list-status--error{color:var(--solely-error)}.upload__list-remove{margin-left:var(--solely-spacing-sm);padding:var(--solely-spacing-xs);color:var(--solely-text-tertiary);cursor:pointer;transition:color var(--solely-transition-duration);font-size:16px;line-height:1}.upload__list-remove:hover{color:var(--solely-error)}.upload__progress{width:100%;height:2px;background-color:var(--solely-gray-3);border-radius:1px;margin-top:var(--solely-spacing-xs);overflow:hidden}.upload__progress-bar{height:100%;background-color:var(--solely-primary);transition:width .3s ease}.upload--text .upload__list-item,.upload--picture .upload__list-item{display:flex;align-items:center}.upload--picture .upload__list-thumb{width:48px;height:48px;border-radius:var(--solely-border-radius-sm)}.upload--picture-card .upload__button{width:104px;height:104px;padding:0;flex-direction:column;justify-content:center}.upload--picture-card .upload__list{display:flex;flex-wrap:wrap;gap:var(--solely-spacing-sm)}.upload--picture-card .upload__list-item{width:104px;height:104px;padding:0;margin-bottom:0;position:relative}.upload--picture-card .upload__list-thumb{width:100%;height:100%;margin-right:0;border-radius:var(--solely-border-radius-md)}.upload--picture-card .upload__list-info{display:none}.upload--picture-card .upload__list-remove{position:absolute;top:4px;right:4px;margin-left:0;background-color:#00000080;color:var(--solely-white);border-radius:50%;width:20px;height:20px;display:flex;align-items:center;justify-content:center;font-size:12px}.upload--picture-card .upload__list-remove:hover{background-color:#000000b3;color:var(--solely-white)}.upload__input{display:none}";export{o as default};
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Upload 组件类型定义
3
+ */
4
+ export type UploadListType = 'text' | 'picture' | 'picture-card';
5
+ export interface UploadFile {
6
+ /** 文件唯一标识 */
7
+ uid: string;
8
+ /** 文件名 */
9
+ name: string;
10
+ /** 文件大小 */
11
+ size?: number;
12
+ /** 文件类型 */
13
+ type?: string;
14
+ /** 上传状态 */
15
+ status?: 'uploading' | 'done' | 'error' | 'removed';
16
+ /** 上传进度 */
17
+ percent?: number;
18
+ /** 文件URL */
19
+ url?: string;
20
+ /** 错误信息 */
21
+ error?: string;
22
+ }
23
+ export interface UploadProps {
24
+ /** 上传地址 */
25
+ action?: string;
26
+ /** 接受上传的文件类型 */
27
+ accept?: string;
28
+ /** 是否支持多选 */
29
+ multiple?: boolean;
30
+ /** 上传文件列表(JSON字符串) */
31
+ fileList?: string;
32
+ /** 上传列表的内建样式 */
33
+ listType?: UploadListType;
34
+ /** 是否禁用 */
35
+ disabled?: boolean;
36
+ /** 是否显示上传列表 */
37
+ showUploadList?: boolean;
38
+ /** 上传按钮文字 */
39
+ buttonText?: string;
40
+ /** 是否支持拖拽上传 */
41
+ drag?: boolean;
42
+ /** 最大文件数量 */
43
+ maxCount?: number;
44
+ /** 文件大小限制(字节) */
45
+ maxSize?: number;
46
+ /** 是否撑满父容器宽度 */
47
+ block?: boolean;
48
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports.safeJsonParse=function(t,e){try{return JSON.parse(t||JSON.stringify(e))}catch{return e}},exports.throttle=function(t,e){let r=0;return function(...n){const o=Date.now();o-r>=e&&(r=o,t.apply(this,n))}};
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 通用工具函数
3
+ */
4
+ /**
5
+ * 安全地解析 JSON 字符串
6
+ * @param json - 要解析的 JSON 字符串
7
+ * @param defaultValue - 解析失败时的默认值
8
+ * @returns 解析后的值或默认值
9
+ */
10
+ export declare function safeJsonParse<T>(json: string | undefined, defaultValue: T): T;
11
+ /**
12
+ * 创建防抖函数
13
+ * @param fn - 要防抖的函数
14
+ * @param delay - 延迟时间(毫秒)
15
+ * @returns 防抖后的函数
16
+ */
17
+ export declare function debounce<T extends (...args: unknown[]) => void>(fn: T, delay: number): T;
18
+ /**
19
+ * 创建节流函数
20
+ * @param fn - 要节流的函数
21
+ * @param interval - 间隔时间(毫秒)
22
+ * @returns 节流后的函数
23
+ */
24
+ export declare function throttle<T extends (...args: unknown[]) => void>(fn: T, interval: number): T;
@@ -0,0 +1 @@
1
+ function t(t,n){try{return JSON.parse(t||JSON.stringify(n))}catch{return n}}function n(t,n){let r=0;return function(...e){const c=Date.now();c-r>=n&&(r=c,t.apply(this,e))}}export{t as safeJsonParse,n as throttle};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./theme/index.cjs"),r=require("./elements/button/index.cjs"),t=require("./elements/input/index.cjs"),l=require("./elements/fab/index.cjs"),o=require("./elements/card/index.cjs"),n=require("./elements/tag/index.cjs"),s=require("./elements/badge/index.cjs"),i=require("./elements/alert/index.cjs"),a=require("./elements/switch/index.cjs"),p=require("./elements/checkbox/index.cjs"),c=require("./elements/radio/index.cjs"),d=require("./elements/select/index.cjs"),m=require("./elements/progress/index.cjs"),y=require("./elements/divider/index.cjs"),x=require("./elements/tabs/index.cjs"),u=require("./elements/table/index.cjs"),b=require("./elements/skeleton/index.cjs"),S=require("./elements/empty/index.cjs"),j=require("./elements/pagination/index.cjs"),g=require("./elements/breadcrumb/index.cjs"),P=require("./elements/steps/index.cjs"),f=require("./elements/timeline/index.cjs"),q=require("./elements/backtop/index.cjs"),O=require("./elements/upload/index.cjs"),T=require("./elements/rate/index.cjs"),h=require("./elements/slider/index.cjs"),I=require("./elements/tree/index.cjs"),A=require("./elements/coordinate-input/index.cjs"),k=require("./commands/message/index.cjs"),C=require("./commands/modal/index.cjs"),B=require("./commands/tooltip/index.cjs"),D=require("./commands/drawer/index.cjs"),N=require("./commands/popconfirm/index.cjs"),M=require("./commands/utils.cjs");exports.getTheme=e.getTheme,exports.initTheme=e.initTheme,exports.persistTheme=e.persistTheme,exports.setTheme=e.setTheme,exports.toggleTheme=e.toggleTheme,Object.defineProperty(exports,"SolelyButton",{enumerable:!0,get:()=>r.SolelyButton}),Object.defineProperty(exports,"SolelyInput",{enumerable:!0,get:()=>t.SolelyInput}),Object.defineProperty(exports,"SolelyFab",{enumerable:!0,get:()=>l.SolelyFab}),Object.defineProperty(exports,"SolelyCard",{enumerable:!0,get:()=>o.SolelyCard}),Object.defineProperty(exports,"SolelyTag",{enumerable:!0,get:()=>n.SolelyTag}),Object.defineProperty(exports,"SolelyBadge",{enumerable:!0,get:()=>s.SolelyBadge}),Object.defineProperty(exports,"SolelyAlert",{enumerable:!0,get:()=>i.SolelyAlert}),Object.defineProperty(exports,"SolelySwitch",{enumerable:!0,get:()=>a.SolelySwitch}),Object.defineProperty(exports,"SolelyCheckbox",{enumerable:!0,get:()=>p.SolelyCheckbox}),Object.defineProperty(exports,"SolelyRadio",{enumerable:!0,get:()=>c.SolelyRadio}),Object.defineProperty(exports,"SolelySelect",{enumerable:!0,get:()=>d.SolelySelect}),Object.defineProperty(exports,"SolelyProgress",{enumerable:!0,get:()=>m.SolelyProgress}),Object.defineProperty(exports,"SolelyDivider",{enumerable:!0,get:()=>y.SolelyDivider}),Object.defineProperty(exports,"SolelyTabs",{enumerable:!0,get:()=>x.SolelyTabs}),Object.defineProperty(exports,"SolelyTable",{enumerable:!0,get:()=>u.SolelyTable}),Object.defineProperty(exports,"SolelySkeleton",{enumerable:!0,get:()=>b.SolelySkeleton}),Object.defineProperty(exports,"SolelyEmpty",{enumerable:!0,get:()=>S.SolelyEmpty}),Object.defineProperty(exports,"SolelyPagination",{enumerable:!0,get:()=>j.SolelyPagination}),Object.defineProperty(exports,"SolelyBreadcrumb",{enumerable:!0,get:()=>g.SolelyBreadcrumb}),Object.defineProperty(exports,"SolelySteps",{enumerable:!0,get:()=>P.SolelySteps}),Object.defineProperty(exports,"SolelyTimeline",{enumerable:!0,get:()=>f.SolelyTimeline}),Object.defineProperty(exports,"SolelyBackTop",{enumerable:!0,get:()=>q.SolelyBackTop}),Object.defineProperty(exports,"SolelyUpload",{enumerable:!0,get:()=>O.SolelyUpload}),Object.defineProperty(exports,"SolelyRate",{enumerable:!0,get:()=>T.SolelyRate}),Object.defineProperty(exports,"SolelySlider",{enumerable:!0,get:()=>h.SolelySlider}),Object.defineProperty(exports,"SolelyTree",{enumerable:!0,get:()=>I.SolelyTree}),Object.defineProperty(exports,"SolelyCoordinateInput",{enumerable:!0,get:()=>A.SolelyCoordinateInput}),exports.Message=k.Message,exports.Modal=C.Modal,exports.Tooltip=B.Tooltip,exports.Drawer=D.Drawer,exports.Popconfirm=N.Popconfirm,exports.ANIMATION_DURATION=M.ANIMATION_DURATION,exports.Z_INDEX=M.Z_INDEX,exports.addClosingAnimation=M.addClosingAnimation,exports.calculatePosition=M.calculatePosition,exports.createElement=M.createElement,exports.generateId=M.generateId,exports.injectStyle=M.injectStyle,exports.removeStyle=M.removeStyle,exports.safeAsyncCallback=M.safeAsyncCallback;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Solely 组件库 - 统一入口
3
+ *
4
+ * 使用方式:
5
+ * ```typescript
6
+ * // 导入所有组件
7
+ * import 'solely/components';
8
+ *
9
+ * // 导入主题 CSS(需手动引入)
10
+ * import 'solely/theme/variables.css';
11
+ *
12
+ * // 仅导入自定义元素组件
13
+ * import { SolelyButton } from 'solely/components/elements';
14
+ *
15
+ * // 导入主题系统
16
+ * import { setTheme, toggleTheme } from 'solely/components/theme';
17
+ * ```
18
+ */
19
+ export * from './theme';
20
+ export * from './elements';
21
+ export * from './commands';
@@ -0,0 +1 @@
1
+ import{getTheme as e,initTheme as m,persistTheme as o,setTheme as t,toggleTheme as r}from"./theme/index.js";import{SolelyButton as i}from"./elements/button/index.js";import{SolelyInput as s}from"./elements/input/index.js";import{SolelyFab as n}from"./elements/fab/index.js";import{SolelyCard as d}from"./elements/card/index.js";import{SolelyTag as p}from"./elements/tag/index.js";import{SolelyBadge as l}from"./elements/badge/index.js";import{SolelyAlert as f}from"./elements/alert/index.js";import{SolelySwitch as x}from"./elements/switch/index.js";import{SolelyCheckbox as j}from"./elements/checkbox/index.js";import{SolelyRadio as a}from"./elements/radio/index.js";import{SolelySelect as c}from"./elements/select/index.js";import{SolelyProgress as b}from"./elements/progress/index.js";import{SolelyDivider as u}from"./elements/divider/index.js";import{SolelyTabs as g}from"./elements/tabs/index.js";import{SolelyTable as h}from"./elements/table/index.js";import{SolelySkeleton as k}from"./elements/skeleton/index.js";import{SolelyEmpty as w}from"./elements/empty/index.js";import{SolelyPagination as v}from"./elements/pagination/index.js";import{SolelyBreadcrumb as y}from"./elements/breadcrumb/index.js";import{SolelySteps as q}from"./elements/steps/index.js";import{SolelyTimeline as z}from"./elements/timeline/index.js";import{SolelyBackTop as A}from"./elements/backtop/index.js";import{SolelyUpload as B}from"./elements/upload/index.js";import{SolelyRate as C}from"./elements/rate/index.js";import{SolelySlider as D}from"./elements/slider/index.js";import{SolelyTree as E}from"./elements/tree/index.js";import{SolelyCoordinateInput as F}from"./elements/coordinate-input/index.js";import{Message as G}from"./commands/message/index.js";import{Modal as H}from"./commands/modal/index.js";import{Tooltip as I}from"./commands/tooltip/index.js";import{Drawer as J}from"./commands/drawer/index.js";import{Popconfirm as K}from"./commands/popconfirm/index.js";import{ANIMATION_DURATION as L,Z_INDEX as M,addClosingAnimation as N,calculatePosition as O,createElement as P,generateId as Q,injectStyle as R,removeStyle as S,safeAsyncCallback as T}from"./commands/utils.js";export{L as ANIMATION_DURATION,J as Drawer,G as Message,H as Modal,K as Popconfirm,f as SolelyAlert,A as SolelyBackTop,l as SolelyBadge,y as SolelyBreadcrumb,i as SolelyButton,d as SolelyCard,j as SolelyCheckbox,F as SolelyCoordinateInput,u as SolelyDivider,w as SolelyEmpty,n as SolelyFab,s as SolelyInput,v as SolelyPagination,b as SolelyProgress,a as SolelyRadio,C as SolelyRate,c as SolelySelect,k as SolelySkeleton,D as SolelySlider,q as SolelySteps,x as SolelySwitch,h as SolelyTable,g as SolelyTabs,p as SolelyTag,z as SolelyTimeline,E as SolelyTree,B as SolelyUpload,I as Tooltip,M as Z_INDEX,N as addClosingAnimation,O as calculatePosition,P as createElement,Q as generateId,e as getTheme,m as initTheme,R as injectStyle,o as persistTheme,S as removeStyle,T as safeAsyncCallback,t as setTheme,r as toggleTheme};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let e={theme:"light"};function t(t){if(e={...e,...t},document.documentElement.setAttribute("data-theme",t.theme),t.colors){const e=document.documentElement;Object.entries(t.colors).forEach(([t,o])=>{e.style.setProperty(`--solely-${t}`,o??"")})}}function o(){return{...e}}function r(){const o="light"===e.theme?"dark":"light";t({...e,theme:o})}function s(){const e=localStorage.getItem("solely-theme");if(e)try{return void t(JSON.parse(e))}catch{}t({theme:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"})}function n(){window.addEventListener("beforeunload",()=>{localStorage.setItem("solely-theme",JSON.stringify(e))})}"undefined"!=typeof window&&(s(),n());const i={setTheme:t,getTheme:o,toggleTheme:r,initTheme:s,persistTheme:n};exports.default=i,exports.getTheme=o,exports.initTheme=s,exports.persistTheme=n,exports.setTheme=t,exports.toggleTheme=r;