wok-ui-ext 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +75 -0
  3. package/README.md +75 -0
  4. package/dist/alert/index.d.ts +10 -0
  5. package/dist/alert/index.js +48 -0
  6. package/dist/alert/style.css +116 -0
  7. package/dist/avatar/index.d.ts +9 -0
  8. package/dist/avatar/index.js +30 -0
  9. package/dist/avatar/style.css +32 -0
  10. package/dist/badge/index.d.ts +32 -0
  11. package/dist/badge/index.js +61 -0
  12. package/dist/badge/style.css +68 -0
  13. package/dist/breadcrumb/index.d.ts +25 -0
  14. package/dist/breadcrumb/index.js +47 -0
  15. package/dist/breadcrumb/style.css +35 -0
  16. package/dist/button/index.d.ts +34 -0
  17. package/dist/button/index.js +57 -0
  18. package/dist/button/style.css +133 -0
  19. package/dist/card/index.d.ts +25 -0
  20. package/dist/card/index.js +29 -0
  21. package/dist/card/style.css +23 -0
  22. package/dist/collapse/index.d.ts +89 -0
  23. package/dist/collapse/index.js +213 -0
  24. package/dist/collapse/style.css +76 -0
  25. package/dist/context-menu/context-menu.d.ts +113 -0
  26. package/dist/context-menu/context-menu.js +150 -0
  27. package/dist/context-menu/index.d.ts +30 -0
  28. package/dist/context-menu/index.js +42 -0
  29. package/dist/context-menu/style.css +46 -0
  30. package/dist/date-picker/calendar-panel.d.ts +44 -0
  31. package/dist/date-picker/calendar-panel.js +180 -0
  32. package/dist/date-picker/date-picker.d.ts +29 -0
  33. package/dist/date-picker/date-picker.js +81 -0
  34. package/dist/date-picker/date-utils.d.ts +63 -0
  35. package/dist/date-picker/date-utils.js +130 -0
  36. package/dist/date-picker/index.d.ts +7 -0
  37. package/dist/date-picker/index.js +5 -0
  38. package/dist/date-picker/layer.d.ts +19 -0
  39. package/dist/date-picker/layer.js +36 -0
  40. package/dist/date-picker/range-picker.d.ts +30 -0
  41. package/dist/date-picker/range-picker.js +117 -0
  42. package/dist/date-picker/style.css +161 -0
  43. package/dist/description-list/index.d.ts +37 -0
  44. package/dist/description-list/index.js +145 -0
  45. package/dist/description-list/style.css +63 -0
  46. package/dist/divider/index.d.ts +29 -0
  47. package/dist/divider/index.js +29 -0
  48. package/dist/divider/style.css +50 -0
  49. package/dist/drawer/index.d.ts +51 -0
  50. package/dist/drawer/index.js +183 -0
  51. package/dist/drawer/style.css +100 -0
  52. package/dist/dropdown/index.d.ts +38 -0
  53. package/dist/dropdown/index.js +97 -0
  54. package/dist/dropdown/style.css +39 -0
  55. package/dist/empty/index.d.ts +11 -0
  56. package/dist/empty/index.js +20 -0
  57. package/dist/empty/style.css +19 -0
  58. package/dist/floating-layer/index.d.ts +109 -0
  59. package/dist/floating-layer/index.js +337 -0
  60. package/dist/floating-layer/style.css +5 -0
  61. package/dist/form/form-item/index.d.ts +26 -0
  62. package/dist/form/form-item/index.js +21 -0
  63. package/dist/form/form-item/style.css +33 -0
  64. package/dist/form/form-modal/index.d.ts +18 -0
  65. package/dist/form/form-modal/index.js +38 -0
  66. package/dist/form/form.d.ts +21 -0
  67. package/dist/form/form.js +28 -0
  68. package/dist/form/index.d.ts +4 -0
  69. package/dist/form/index.js +4 -0
  70. package/dist/form/select/index.d.ts +48 -0
  71. package/dist/form/select/index.js +94 -0
  72. package/dist/form/select/style.css +29 -0
  73. package/dist/global.css +71 -0
  74. package/dist/i18n/de-DE.d.ts +2 -0
  75. package/dist/i18n/de-DE.js +36 -0
  76. package/dist/i18n/en-US.d.ts +2 -0
  77. package/dist/i18n/en-US.js +36 -0
  78. package/dist/i18n/es-ES.d.ts +2 -0
  79. package/dist/i18n/es-ES.js +36 -0
  80. package/dist/i18n/fr-FR.d.ts +2 -0
  81. package/dist/i18n/fr-FR.js +36 -0
  82. package/dist/i18n/index.d.ts +12 -0
  83. package/dist/i18n/index.js +39 -0
  84. package/dist/i18n/ja-JP.d.ts +2 -0
  85. package/dist/i18n/ja-JP.js +36 -0
  86. package/dist/i18n/ko-KR.d.ts +2 -0
  87. package/dist/i18n/ko-KR.js +36 -0
  88. package/dist/i18n/messages.d.ts +40 -0
  89. package/dist/i18n/messages.js +1 -0
  90. package/dist/i18n/wok-ui/de-DE.d.ts +2 -0
  91. package/dist/i18n/wok-ui/de-DE.js +20 -0
  92. package/dist/i18n/wok-ui/es-ES.d.ts +2 -0
  93. package/dist/i18n/wok-ui/es-ES.js +20 -0
  94. package/dist/i18n/wok-ui/fr-FR.d.ts +2 -0
  95. package/dist/i18n/wok-ui/fr-FR.js +20 -0
  96. package/dist/i18n/wok-ui/ja-JP.d.ts +2 -0
  97. package/dist/i18n/wok-ui/ja-JP.js +20 -0
  98. package/dist/i18n/wok-ui/ko-KR.d.ts +2 -0
  99. package/dist/i18n/wok-ui/ko-KR.js +20 -0
  100. package/dist/i18n/wok-ui/zh-TW.d.ts +2 -0
  101. package/dist/i18n/wok-ui/zh-TW.js +20 -0
  102. package/dist/i18n/zh-CN.d.ts +2 -0
  103. package/dist/i18n/zh-CN.js +36 -0
  104. package/dist/i18n/zh-TW.d.ts +2 -0
  105. package/dist/i18n/zh-TW.js +36 -0
  106. package/dist/icons.d.ts +88 -0
  107. package/dist/icons.js +176 -0
  108. package/dist/image/index.d.ts +38 -0
  109. package/dist/image/index.js +97 -0
  110. package/dist/image/style.css +72 -0
  111. package/dist/image-preview/index.d.ts +26 -0
  112. package/dist/image-preview/index.js +134 -0
  113. package/dist/image-preview/style.css +96 -0
  114. package/dist/index.d.ts +46 -0
  115. package/dist/index.js +45 -0
  116. package/dist/list/index.d.ts +32 -0
  117. package/dist/list/index.js +42 -0
  118. package/dist/list/list-item.d.ts +27 -0
  119. package/dist/list/list-item.js +51 -0
  120. package/dist/list/style.css +20 -0
  121. package/dist/loading/index.d.ts +10 -0
  122. package/dist/loading/index.js +46 -0
  123. package/dist/loading/style.css +48 -0
  124. package/dist/menu/index.d.ts +38 -0
  125. package/dist/menu/index.js +62 -0
  126. package/dist/menu/leaf-item.d.ts +12 -0
  127. package/dist/menu/leaf-item.js +41 -0
  128. package/dist/menu/style.css +117 -0
  129. package/dist/menu/sub-menu.d.ts +21 -0
  130. package/dist/menu/sub-menu.js +85 -0
  131. package/dist/menu/types.d.ts +36 -0
  132. package/dist/menu/types.js +1 -0
  133. package/dist/menu/utils.d.ts +11 -0
  134. package/dist/menu/utils.js +24 -0
  135. package/dist/modal/index.d.ts +23 -0
  136. package/dist/modal/index.js +79 -0
  137. package/dist/modal/modal.d.ts +76 -0
  138. package/dist/modal/modal.js +188 -0
  139. package/dist/modal/style.css +90 -0
  140. package/dist/pagination/index.d.ts +31 -0
  141. package/dist/pagination/index.js +215 -0
  142. package/dist/pagination/style.css +50 -0
  143. package/dist/popconfirm/api.d.ts +43 -0
  144. package/dist/popconfirm/api.js +77 -0
  145. package/dist/popconfirm/component.d.ts +47 -0
  146. package/dist/popconfirm/component.js +48 -0
  147. package/dist/popconfirm/index.d.ts +3 -0
  148. package/dist/popconfirm/index.js +3 -0
  149. package/dist/popconfirm/style.css +22 -0
  150. package/dist/popover/api.d.ts +36 -0
  151. package/dist/popover/api.js +61 -0
  152. package/dist/popover/component.d.ts +38 -0
  153. package/dist/popover/component.js +51 -0
  154. package/dist/popover/index.d.ts +3 -0
  155. package/dist/popover/index.js +3 -0
  156. package/dist/popover/style.css +102 -0
  157. package/dist/progress/index.d.ts +34 -0
  158. package/dist/progress/index.js +70 -0
  159. package/dist/progress/style.css +37 -0
  160. package/dist/quick-input/index.d.ts +2 -0
  161. package/dist/quick-input/index.js +2 -0
  162. package/dist/quick-input/number.d.ts +35 -0
  163. package/dist/quick-input/number.js +68 -0
  164. package/dist/quick-input/text.d.ts +20 -0
  165. package/dist/quick-input/text.js +61 -0
  166. package/dist/result/index.d.ts +39 -0
  167. package/dist/result/index.js +71 -0
  168. package/dist/result/style.css +41 -0
  169. package/dist/search-box/index.d.ts +26 -0
  170. package/dist/search-box/index.js +60 -0
  171. package/dist/search-box/style.css +22 -0
  172. package/dist/segmented/index.d.ts +42 -0
  173. package/dist/segmented/index.js +61 -0
  174. package/dist/segmented/style.css +28 -0
  175. package/dist/skeleton/index.d.ts +22 -0
  176. package/dist/skeleton/index.js +68 -0
  177. package/dist/skeleton/style.css +31 -0
  178. package/dist/steps/index.d.ts +46 -0
  179. package/dist/steps/index.js +95 -0
  180. package/dist/steps/style.css +181 -0
  181. package/dist/switch/index.d.ts +32 -0
  182. package/dist/switch/index.js +74 -0
  183. package/dist/switch/style.css +52 -0
  184. package/dist/table/body.d.ts +21 -0
  185. package/dist/table/body.js +35 -0
  186. package/dist/table/column.d.ts +78 -0
  187. package/dist/table/column.js +113 -0
  188. package/dist/table/header.d.ts +13 -0
  189. package/dist/table/header.js +15 -0
  190. package/dist/table/index.d.ts +41 -0
  191. package/dist/table/index.js +84 -0
  192. package/dist/table/row.d.ts +25 -0
  193. package/dist/table/row.js +74 -0
  194. package/dist/table/style.css +98 -0
  195. package/dist/tabs/index.d.ts +49 -0
  196. package/dist/tabs/index.js +76 -0
  197. package/dist/tabs/style.css +41 -0
  198. package/dist/tag/index.d.ts +53 -0
  199. package/dist/tag/index.js +100 -0
  200. package/dist/tag/style.css +134 -0
  201. package/dist/text/index.d.ts +104 -0
  202. package/dist/text/index.js +143 -0
  203. package/dist/text/style.css +113 -0
  204. package/dist/theme/index.d.ts +14 -0
  205. package/dist/theme/index.js +94 -0
  206. package/dist/theme/themes.d.ts +3 -0
  207. package/dist/theme/themes.js +323 -0
  208. package/dist/theme/types.d.ts +58 -0
  209. package/dist/theme/types.js +1 -0
  210. package/dist/timeline/index.d.ts +28 -0
  211. package/dist/timeline/index.js +35 -0
  212. package/dist/timeline/style.css +53 -0
  213. package/dist/toast/index.d.ts +53 -0
  214. package/dist/toast/index.js +131 -0
  215. package/dist/toast/style.css +76 -0
  216. package/dist/tooltip/api.d.ts +44 -0
  217. package/dist/tooltip/api.js +103 -0
  218. package/dist/tooltip/component.d.ts +28 -0
  219. package/dist/tooltip/component.js +35 -0
  220. package/dist/tooltip/index.d.ts +3 -0
  221. package/dist/tooltip/index.js +3 -0
  222. package/dist/tooltip/style.css +46 -0
  223. package/dist/tree/dragging-img.d.ts +13 -0
  224. package/dist/tree/dragging-img.js +23 -0
  225. package/dist/tree/index.d.ts +180 -0
  226. package/dist/tree/index.js +385 -0
  227. package/dist/tree/node-info.d.ts +63 -0
  228. package/dist/tree/node-info.js +128 -0
  229. package/dist/tree/node.d.ts +132 -0
  230. package/dist/tree/node.js +264 -0
  231. package/dist/tree/style.css +99 -0
  232. package/dist/upload/index.d.ts +48 -0
  233. package/dist/upload/index.js +141 -0
  234. package/dist/upload/style.css +41 -0
  235. package/package.json +51 -0
@@ -0,0 +1,28 @@
1
+ .wok-ui-ext-segmented {
2
+ display: inline-flex;
3
+ flex-wrap: wrap;
4
+ gap: 8px;
5
+ background: var(--color-primary-soft);
6
+ border-radius: 40px;
7
+ padding: 6px 10px;
8
+ border: 1px solid var(--border-medium);
9
+ }
10
+ .wok-ui-ext-segmented .wok-ui-ext-segmented-item {
11
+ padding: 6px 16px;
12
+ border-radius: 30px;
13
+ font-size: 12px;
14
+ font-weight: 500;
15
+ cursor: default;
16
+ background: transparent;
17
+ color: var(--text-tertiary);
18
+ transition: all 0.1s;
19
+ border: none;
20
+ white-space: nowrap;
21
+ user-select: none;
22
+ }
23
+ .wok-ui-ext-segmented .wok-ui-ext-segmented-item.active {
24
+ background: var(--color-primary);
25
+ color: white;
26
+ box-shadow: var(--shadow-primary);
27
+ pointer-events: none;
28
+ }
@@ -0,0 +1,22 @@
1
+ import { DivModule } from 'wok-ui';
2
+ import './style.less';
3
+ /**
4
+ * 骨架屏
5
+ */
6
+ export declare class Skeleton extends DivModule {
7
+ private readonly opts;
8
+ /**
9
+ * 骨架屏
10
+ * @param opts
11
+ * @param opts.rows 骨架屏行数,默认 3
12
+ * @param opts.showAvatar 骨架屏是否显示头像,默认 false,设置为 true 时会显示头像在左侧
13
+ */
14
+ constructor(opts: {
15
+ rows?: number;
16
+ showAvatar?: boolean;
17
+ });
18
+ /**
19
+ * 根据 rows 参数构建线条(line),尽可能让最后两个稍微短一些,倒数第二个 80% 长,最后一个 70% 长
20
+ */
21
+ private buildLines;
22
+ }
@@ -0,0 +1,68 @@
1
+ import { DivModule } from 'wok-ui';
2
+ import './style.css';
3
+ /**
4
+ * 骨架屏
5
+ */
6
+ export class Skeleton extends DivModule {
7
+ /**
8
+ * 骨架屏
9
+ * @param opts
10
+ * @param opts.rows 骨架屏行数,默认 3
11
+ * @param opts.showAvatar 骨架屏是否显示头像,默认 false,设置为 true 时会显示头像在左侧
12
+ */
13
+ constructor(opts) {
14
+ super('wok-ui-ext-skeleton');
15
+ this.opts = opts;
16
+ if (!this.opts.showAvatar) {
17
+ this.addChild(this.buildLines());
18
+ return;
19
+ }
20
+ // 有头像的情况
21
+ /**
22
+ * <div class="wok-ui-ext-skeleton-row">
23
+ <div class="wok-ui-ext-skeleton-avatar"></div>
24
+ <div style="flex:1">
25
+ <div class="wok-ui-ext-skeleton-line" style="width:90%"></div>
26
+ <div class="wok-ui-ext-skeleton-line" style="width:60%"></div>
27
+ </div>
28
+ </div>
29
+ */
30
+ this.addChild({
31
+ classNames: 'wok-ui-ext-skeleton-row',
32
+ children: [
33
+ {
34
+ classNames: 'wok-ui-ext-skeleton-avatar'
35
+ },
36
+ {
37
+ style: {
38
+ flex: '1'
39
+ },
40
+ children: this.buildLines()
41
+ }
42
+ ]
43
+ });
44
+ }
45
+ /**
46
+ * 根据 rows 参数构建线条(line),尽可能让最后两个稍微短一些,倒数第二个 80% 长,最后一个 70% 长
47
+ */
48
+ buildLines() {
49
+ const res = [];
50
+ const rows = this.opts.rows ?? 3;
51
+ for (let i = 0; i < rows; i++) {
52
+ // 判断是否要缩短
53
+ if (rows >= 3 && i >= rows - 2) {
54
+ res.push({
55
+ classNames: 'wok-ui-ext-skeleton-line',
56
+ style: {
57
+ width: i === rows - 1 ? '70%' : '80%'
58
+ }
59
+ });
60
+ continue;
61
+ }
62
+ res.push({
63
+ classNames: 'wok-ui-ext-skeleton-line'
64
+ });
65
+ }
66
+ return res;
67
+ }
68
+ }
@@ -0,0 +1,31 @@
1
+ .wok-ui-ext-skeleton {
2
+ width: 100%;
3
+ }
4
+ .wok-ui-ext-skeleton .wok-ui-ext-skeleton-avatar {
5
+ width: 50px;
6
+ height: 50px;
7
+ border-radius: var(--radius-circle);
8
+ background: var(--color-primary-soft, #e2edff);
9
+ margin-right: 16px;
10
+ }
11
+ .wok-ui-ext-skeleton .wok-ui-ext-skeleton-line {
12
+ height: 18px;
13
+ background: linear-gradient(90deg, var(--color-primary-soft) 25%, var(--bg-content) 50%, var(--color-primary-soft) 75%);
14
+ background-size: 200% 100%;
15
+ animation: skeleton-loading 1.5s infinite;
16
+ border-radius: var(--radius-full);
17
+ margin: 12px 0;
18
+ }
19
+ @keyframes skeleton-loading {
20
+ 0% {
21
+ background-position: 200% 0;
22
+ }
23
+ 100% {
24
+ background-position: -200% 0;
25
+ }
26
+ }
27
+ .wok-ui-ext-skeleton .wok-ui-ext-skeleton-row {
28
+ display: flex;
29
+ align-items: center;
30
+ margin-bottom: 16px;
31
+ }
@@ -0,0 +1,46 @@
1
+ import { FullRenderingModule } from 'wok-ui';
2
+ import { IconInput } from '../icons';
3
+ import './style.less';
4
+ export interface StepItem {
5
+ title: string;
6
+ description?: string;
7
+ icon?: IconInput;
8
+ }
9
+ /**
10
+ * 步骤条组件
11
+ */
12
+ export declare class Steps extends FullRenderingModule {
13
+ private readonly opts;
14
+ /**
15
+ * 当前步骤索引(从 0 开始)
16
+ */
17
+ private current;
18
+ private readonly status;
19
+ private readonly direction;
20
+ private readonly onChange?;
21
+ constructor(opts: {
22
+ /**
23
+ * 步骤项列表
24
+ */
25
+ items: StepItem[];
26
+ /**
27
+ * 当前步骤索引(从 0 开始),默认 0
28
+ */
29
+ current?: number;
30
+ /**
31
+ * 步骤状态:'process' 表示正在处理中,'error' 表示出错
32
+ * 默认会自动根据 current 推断
33
+ */
34
+ status?: 'process' | 'error';
35
+ /**
36
+ * 方向,默认 'horizontal'
37
+ */
38
+ direction?: 'horizontal' | 'vertical';
39
+ /**
40
+ * 点击步骤时触发,参数为步骤索引
41
+ */
42
+ onChange?: (index: number) => void;
43
+ });
44
+ protected buildContent(): void;
45
+ private buildHeadContent;
46
+ }
@@ -0,0 +1,95 @@
1
+ import { FullRenderingModule } from 'wok-ui';
2
+ import { resolveIcon } from '../icons';
3
+ import './style.css';
4
+ /**
5
+ * 步骤条组件
6
+ */
7
+ export class Steps extends FullRenderingModule {
8
+ constructor(opts) {
9
+ super('wok-ui-ext-steps');
10
+ this.opts = opts;
11
+ const { current = 0, status = 'process', direction = 'horizontal', onChange } = opts;
12
+ this.current = current;
13
+ this.status = status;
14
+ this.direction = direction;
15
+ this.onChange = onChange;
16
+ this.el.classList.add(direction === 'vertical' ? 'wok-ui-ext-steps-vertical' : 'wok-ui-ext-steps-horizontal');
17
+ this.render();
18
+ }
19
+ buildContent() {
20
+ const { items } = this.opts;
21
+ const lastIndex = items.length - 1;
22
+ const hasCallback = !!this.onChange;
23
+ for (let i = 0; i < items.length; i++) {
24
+ const item = items[i];
25
+ // 推断步骤状态
26
+ let stepStatus;
27
+ if (i < this.current) {
28
+ stepStatus = this.status === 'error' && i === this.current - 1 ? 'error' : 'finish';
29
+ }
30
+ else if (i === this.current) {
31
+ stepStatus = this.status;
32
+ }
33
+ else {
34
+ stepStatus = 'wait';
35
+ }
36
+ // 构建步骤 body 子元素
37
+ const bodyChildren = [
38
+ { classNames: 'wok-ui-ext-step-title', children: item.title }
39
+ ];
40
+ if (item.description) {
41
+ bodyChildren.push({ classNames: 'wok-ui-ext-step-description', children: item.description });
42
+ }
43
+ this.addChild({
44
+ classNames: ['wok-ui-ext-step-item', `wok-ui-ext-step-${stepStatus}`, hasCallback ? 'wok-ui-ext-step-clickable' : ''],
45
+ style: this.direction === 'horizontal' ? { width: `${100 / items.length}%` } : undefined,
46
+ onClick: hasCallback
47
+ ? () => {
48
+ this.current = i;
49
+ this.render();
50
+ this.onChange?.(i);
51
+ }
52
+ : undefined,
53
+ children: add => {
54
+ // 步骤头:包含连接线与图标
55
+ add({
56
+ classNames: 'wok-ui-ext-step-head',
57
+ children: addHead => {
58
+ // 连接线
59
+ if (i < lastIndex) {
60
+ const isErrorTail = this.status === 'error' && i === this.current - 1;
61
+ addHead({
62
+ classNames: [
63
+ 'wok-ui-ext-step-tail',
64
+ i < this.current ? 'wok-ui-ext-step-tail-active' : '',
65
+ isErrorTail ? 'wok-ui-ext-step-tail-error' : ''
66
+ ]
67
+ });
68
+ }
69
+ // 图标/序号
70
+ addHead({
71
+ classNames: 'wok-ui-ext-step-icon',
72
+ children: this.buildHeadContent(stepStatus, i, item)
73
+ });
74
+ }
75
+ });
76
+ // 步骤主体
77
+ add({
78
+ classNames: 'wok-ui-ext-step-body',
79
+ children: addBody => {
80
+ for (const child of bodyChildren) {
81
+ addBody(child);
82
+ }
83
+ }
84
+ });
85
+ }
86
+ });
87
+ }
88
+ }
89
+ buildHeadContent(status, index, item) {
90
+ if (item.icon && (status === 'finish' || status === 'error')) {
91
+ return resolveIcon(item.icon);
92
+ }
93
+ return String(index + 1);
94
+ }
95
+ }
@@ -0,0 +1,181 @@
1
+ .wok-ui-ext-steps {
2
+ display: flex;
3
+ width: 100%;
4
+ line-height: normal;
5
+ box-sizing: border-box;
6
+ }
7
+ .wok-ui-ext-steps.wok-ui-ext-steps-horizontal {
8
+ flex-direction: row;
9
+ }
10
+ .wok-ui-ext-steps.wok-ui-ext-steps-vertical {
11
+ flex-direction: column;
12
+ }
13
+ .wok-ui-ext-step-item {
14
+ position: relative;
15
+ flex: 1;
16
+ min-width: 0;
17
+ }
18
+ .wok-ui-ext-step-item:last-child {
19
+ flex: none;
20
+ }
21
+ .wok-ui-ext-step-item.wok-ui-ext-step-clickable {
22
+ cursor: pointer;
23
+ }
24
+ .wok-ui-ext-step-item.wok-ui-ext-step-clickable:hover .wok-ui-ext-step-title {
25
+ color: var(--color-primary);
26
+ }
27
+ .wok-ui-ext-step-head {
28
+ position: relative;
29
+ display: inline-flex;
30
+ align-items: center;
31
+ justify-content: center;
32
+ width: 100%;
33
+ padding: 0 8px;
34
+ box-sizing: border-box;
35
+ }
36
+ .wok-ui-ext-step-icon {
37
+ position: relative;
38
+ z-index: 2;
39
+ display: inline-flex;
40
+ align-items: center;
41
+ justify-content: center;
42
+ width: 32px;
43
+ height: 32px;
44
+ font-size: 14px;
45
+ font-weight: var(--font-weight-medium);
46
+ border-radius: 50%;
47
+ box-sizing: border-box;
48
+ background: var(--bg-content);
49
+ border: 1px solid var(--border-medium);
50
+ color: var(--text-placeholder);
51
+ transition: all var(--transition-speed);
52
+ }
53
+ .wok-ui-ext-step-icon .wok-ui-svg-icon {
54
+ font-size: 16px;
55
+ }
56
+ .wok-ui-ext-step-tail {
57
+ position: absolute;
58
+ top: 50%;
59
+ left: 50%;
60
+ right: -50%;
61
+ height: 1px;
62
+ margin-top: -0.5px;
63
+ background: var(--border-medium);
64
+ z-index: 1;
65
+ transition: background var(--transition-speed);
66
+ }
67
+ .wok-ui-ext-step-tail.wok-ui-ext-step-tail-active {
68
+ background: var(--color-primary);
69
+ }
70
+ .wok-ui-ext-step-tail.wok-ui-ext-step-tail-error {
71
+ background: var(--color-danger);
72
+ }
73
+ .wok-ui-ext-step-body {
74
+ margin-top: 8px;
75
+ padding: 0 8px;
76
+ text-align: center;
77
+ box-sizing: border-box;
78
+ }
79
+ .wok-ui-ext-step-title {
80
+ font-size: 14px;
81
+ line-height: 1.5;
82
+ color: var(--text-primary);
83
+ }
84
+ .wok-ui-ext-step-description {
85
+ margin-top: 4px;
86
+ font-size: 12px;
87
+ line-height: 1.5;
88
+ color: var(--text-secondary);
89
+ }
90
+ .wok-ui-ext-step-wait .wok-ui-ext-step-icon {
91
+ border-color: var(--text-placeholder);
92
+ color: var(--text-placeholder);
93
+ background: var(--bg-content);
94
+ }
95
+ .wok-ui-ext-step-wait .wok-ui-ext-step-title {
96
+ color: var(--text-placeholder);
97
+ }
98
+ .wok-ui-ext-step-wait .wok-ui-ext-step-description {
99
+ color: var(--text-placeholder);
100
+ }
101
+ .wok-ui-ext-step-process .wok-ui-ext-step-icon,
102
+ .wok-ui-ext-step-finish .wok-ui-ext-step-icon {
103
+ border-color: var(--color-primary);
104
+ background: var(--color-primary);
105
+ color: #fff;
106
+ }
107
+ .wok-ui-ext-step-process .wok-ui-ext-step-title,
108
+ .wok-ui-ext-step-finish .wok-ui-ext-step-title {
109
+ color: var(--text-primary);
110
+ }
111
+ .wok-ui-ext-step-process .wok-ui-ext-step-description,
112
+ .wok-ui-ext-step-finish .wok-ui-ext-step-description {
113
+ color: var(--text-secondary);
114
+ }
115
+ .wok-ui-ext-step-process .wok-ui-ext-step-title {
116
+ font-weight: var(--font-weight-semibold);
117
+ }
118
+ .wok-ui-ext-step-finish .wok-ui-ext-step-tail {
119
+ background: var(--color-primary);
120
+ }
121
+ .wok-ui-ext-step-error .wok-ui-ext-step-icon {
122
+ border-color: var(--color-danger);
123
+ background: var(--color-danger);
124
+ color: #fff;
125
+ }
126
+ .wok-ui-ext-step-error .wok-ui-ext-step-title,
127
+ .wok-ui-ext-step-error .wok-ui-ext-step-description {
128
+ color: var(--color-danger);
129
+ }
130
+ .wok-ui-ext-steps-horizontal .wok-ui-ext-step-item {
131
+ text-align: center;
132
+ }
133
+ .wok-ui-ext-steps-horizontal .wok-ui-ext-step-item:last-child .wok-ui-ext-step-head {
134
+ width: auto;
135
+ }
136
+ .wok-ui-ext-steps-horizontal .wok-ui-ext-step-item:last-child .wok-ui-ext-step-tail {
137
+ display: none;
138
+ }
139
+ .wok-ui-ext-steps-vertical .wok-ui-ext-step-item {
140
+ display: flex;
141
+ flex: none;
142
+ min-height: 80px;
143
+ text-align: left;
144
+ }
145
+ .wok-ui-ext-steps-vertical .wok-ui-ext-step-item:last-child {
146
+ min-height: auto;
147
+ }
148
+ .wok-ui-ext-steps-vertical .wok-ui-ext-step-item:last-child .wok-ui-ext-step-tail {
149
+ display: none;
150
+ }
151
+ .wok-ui-ext-steps-vertical .wok-ui-ext-step-head {
152
+ flex-direction: column;
153
+ align-items: center;
154
+ justify-content: flex-start;
155
+ width: 32px;
156
+ min-width: 32px;
157
+ padding: 0;
158
+ }
159
+ .wok-ui-ext-steps-vertical .wok-ui-ext-step-icon {
160
+ flex: none;
161
+ }
162
+ .wok-ui-ext-steps-vertical .wok-ui-ext-step-tail {
163
+ top: 32px;
164
+ left: 50%;
165
+ right: auto;
166
+ bottom: 0;
167
+ width: 1px;
168
+ height: auto;
169
+ margin-top: 0;
170
+ transform: translateX(-50%);
171
+ }
172
+ .wok-ui-ext-steps-vertical .wok-ui-ext-step-body {
173
+ flex: 1;
174
+ margin-top: 0;
175
+ margin-left: 12px;
176
+ padding: 0;
177
+ text-align: left;
178
+ }
179
+ .wok-ui-ext-steps-vertical .wok-ui-ext-step-title {
180
+ line-height: 32px;
181
+ }
@@ -0,0 +1,32 @@
1
+ import { DivModule } from 'wok-ui';
2
+ import './style.less';
3
+ /**
4
+ * 开关组件
5
+ */
6
+ export declare class Switch extends DivModule {
7
+ private opts;
8
+ private checked;
9
+ private disabled;
10
+ constructor(opts: {
11
+ /**
12
+ * 开关标签
13
+ */
14
+ label?: string;
15
+ /**
16
+ * 是否默认选中
17
+ */
18
+ checked?: boolean;
19
+ /**
20
+ * 切换回调
21
+ */
22
+ onChange?: (checked: boolean) => void;
23
+ /**
24
+ * 是否禁用
25
+ */
26
+ disabled?: boolean;
27
+ });
28
+ private toggle;
29
+ private update;
30
+ setChecked(checked: boolean): void;
31
+ isChecked(): boolean;
32
+ }
@@ -0,0 +1,74 @@
1
+ import { DivModule } from 'wok-ui';
2
+ import './style.css';
3
+ /**
4
+ * 开关组件
5
+ */
6
+ export class Switch extends DivModule {
7
+ constructor(opts) {
8
+ super();
9
+ this.opts = opts;
10
+ this.checked = false;
11
+ this.disabled = !!opts.disabled;
12
+ this.checked = !!opts.checked;
13
+ this.el.classList.add('wok-ui-ext-switch');
14
+ if (this.checked) {
15
+ this.el.classList.add('checked');
16
+ }
17
+ if (this.disabled) {
18
+ this.el.classList.add('disabled');
19
+ }
20
+ const switchBtn = document.createElement('button');
21
+ switchBtn.className = 'wok-ui-ext-switch-button';
22
+ switchBtn.type = 'button';
23
+ switchBtn.setAttribute('role', 'switch');
24
+ switchBtn.setAttribute('aria-checked', this.checked ? 'true' : 'false');
25
+ if (this.disabled) {
26
+ switchBtn.disabled = true;
27
+ switchBtn.setAttribute('aria-disabled', 'true');
28
+ }
29
+ switchBtn.appendChild(document.createElement('span'));
30
+ switchBtn.addEventListener('click', () => this.toggle());
31
+ switchBtn.addEventListener('keydown', (ev) => {
32
+ if (ev.key === ' ' || ev.key === 'Enter') {
33
+ ev.preventDefault();
34
+ this.toggle();
35
+ }
36
+ });
37
+ this.addChild(switchBtn);
38
+ if (opts.label) {
39
+ this.addChild({
40
+ tag: 'label',
41
+ classNames: 'wok-ui-ext-switch-label',
42
+ attrs: {
43
+ for: undefined
44
+ },
45
+ children: opts.label
46
+ });
47
+ }
48
+ }
49
+ toggle() {
50
+ if (this.disabled) {
51
+ return;
52
+ }
53
+ this.checked = !this.checked;
54
+ this.update();
55
+ this.opts.onChange?.(this.checked);
56
+ }
57
+ update() {
58
+ this.el.classList.toggle('checked', this.checked);
59
+ const btn = this.el.querySelector('.wok-ui-ext-switch-button');
60
+ if (btn) {
61
+ btn.setAttribute('aria-checked', this.checked ? 'true' : 'false');
62
+ }
63
+ }
64
+ setChecked(checked) {
65
+ if (this.checked === checked) {
66
+ return;
67
+ }
68
+ this.checked = checked;
69
+ this.update();
70
+ }
71
+ isChecked() {
72
+ return this.checked;
73
+ }
74
+ }
@@ -0,0 +1,52 @@
1
+ .wok-ui-ext-switch {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ gap: 12px;
5
+ cursor: pointer;
6
+ }
7
+ .wok-ui-ext-switch .wok-ui-ext-switch-button {
8
+ position: relative;
9
+ display: inline-flex;
10
+ width: 52px;
11
+ height: 28px;
12
+ padding: 0;
13
+ border: 1px solid var(--border-medium);
14
+ border-radius: 34px;
15
+ background-color: var(--border-dark);
16
+ cursor: pointer;
17
+ transition: background-color 0.2s, border-color 0.2s;
18
+ outline: none;
19
+ }
20
+ .wok-ui-ext-switch .wok-ui-ext-switch-button:focus-visible {
21
+ box-shadow: 0 0 0 2px var(--color-primary-soft);
22
+ }
23
+ .wok-ui-ext-switch .wok-ui-ext-switch-button span {
24
+ position: absolute;
25
+ top: 2px;
26
+ left: 3px;
27
+ width: 22px;
28
+ height: 22px;
29
+ background-color: white;
30
+ border-radius: 50%;
31
+ transition: transform 0.2s;
32
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
33
+ }
34
+ .wok-ui-ext-switch .wok-ui-ext-switch-label {
35
+ color: var(--text-primary);
36
+ cursor: pointer;
37
+ }
38
+ .wok-ui-ext-switch.checked .wok-ui-ext-switch-button {
39
+ background-color: var(--color-primary);
40
+ border-color: var(--color-primary-dark);
41
+ }
42
+ .wok-ui-ext-switch.checked .wok-ui-ext-switch-button span {
43
+ transform: translateX(24px);
44
+ }
45
+ .wok-ui-ext-switch.disabled {
46
+ opacity: 0.5;
47
+ cursor: not-allowed;
48
+ }
49
+ .wok-ui-ext-switch.disabled .wok-ui-ext-switch-button,
50
+ .wok-ui-ext-switch.disabled .wok-ui-ext-switch-label {
51
+ cursor: not-allowed;
52
+ }
@@ -0,0 +1,21 @@
1
+ import { Module } from 'wok-ui';
2
+ import { TableColumn } from './column';
3
+ /**
4
+ * 躯干
5
+ */
6
+ export declare class Body<T> extends Module {
7
+ constructor(opts: {
8
+ /**
9
+ * 数据列表.
10
+ */
11
+ list: T[];
12
+ /**
13
+ * 列设置.
14
+ */
15
+ cols: TableColumn<T>[];
16
+ /**
17
+ * 空状态的描述
18
+ */
19
+ emptyDesc?: string;
20
+ });
21
+ }
@@ -0,0 +1,35 @@
1
+ import { Module } from 'wok-ui';
2
+ import { getWokUiExtI18n } from '../i18n';
3
+ import { Row } from './row';
4
+ import { Empty } from '../empty';
5
+ /**
6
+ * 躯干
7
+ */
8
+ export class Body extends Module {
9
+ constructor(opts) {
10
+ super(document.createElement('tbody'));
11
+ this.el.classList.add('wok-ui-ext-table-body');
12
+ if (opts.list.length) {
13
+ opts.list.forEach((data, idx) => {
14
+ this.addChild(new Row({
15
+ cols: opts.cols,
16
+ data,
17
+ rowIdx: idx
18
+ }));
19
+ });
20
+ }
21
+ else {
22
+ // 空状态
23
+ const visibleCount = opts.cols.length;
24
+ const emptyText = opts.emptyDesc || getWokUiExtI18n().buildMsg('table-empty');
25
+ this.addChild({
26
+ tag: 'tr',
27
+ children: {
28
+ tag: 'td',
29
+ attrs: { colspan: String(visibleCount || 1) },
30
+ children: new Empty({ text: emptyText, noBorder: true })
31
+ }
32
+ });
33
+ }
34
+ }
35
+ }