@zjhc/ui 0.0.0-stage → 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 (207) hide show
  1. package/LICENSE +51 -0
  2. package/NOTICE +23 -0
  3. package/README.md +177 -2
  4. package/dist/component.d.ts +3 -0
  5. package/dist/components/autocomplete/index.d.ts +5 -0
  6. package/dist/components/autocomplete/src/autoComplete.vue.d.ts +511 -0
  7. package/dist/components/autocomplete/src/autocomplete.d.ts +50 -0
  8. package/dist/components/collapse-container/index.d.ts +6 -0
  9. package/dist/components/collapse-container/src/collapseContainer.vue.d.ts +47 -0
  10. package/dist/components/collapse-container/src/instance.d.ts +2 -0
  11. package/dist/components/collapse-panel/index.d.ts +6 -0
  12. package/dist/components/collapse-panel/src/collapsePanel.vue.d.ts +68 -0
  13. package/dist/components/collapse-panel/src/instance.d.ts +2 -0
  14. package/dist/components/complex-table/index.d.ts +7 -0
  15. package/dist/components/complex-table/src/ComplexTable.vue.d.ts +1428 -0
  16. package/dist/components/complex-table/src/TableOperator.vue.d.ts +41 -0
  17. package/dist/components/complex-table/src/instance.d.ts +4 -0
  18. package/dist/components/dialog/index.d.ts +5 -0
  19. package/dist/components/dialog/src/dialog-content.d.ts +20 -0
  20. package/dist/components/dialog/src/dialog.d.ts +76 -0
  21. package/dist/components/dialog/src/dialog.vue.d.ts +456 -0
  22. package/dist/components/dialog/src/dialogContent.vue.d.ts +74 -0
  23. package/dist/components/dialog/src/use-dialog.d.ts +23 -0
  24. package/dist/components/edit-table-column/EditTableColumn.vue.d.ts +79 -0
  25. package/dist/components/edit-table-column/index.d.ts +6 -0
  26. package/dist/components/edit-table-column/registerComp.d.ts +3 -0
  27. package/dist/components/edit-table-column/type.d.ts +14 -0
  28. package/dist/components/group-container/index.d.ts +6 -0
  29. package/dist/components/group-container/src/groupContainer.vue.d.ts +43 -0
  30. package/dist/components/group-container/src/instance.d.ts +2 -0
  31. package/dist/components/index.d.ts +13 -0
  32. package/dist/components/loading/index.d.ts +11 -0
  33. package/dist/components/loading/src/directive.d.ts +13 -0
  34. package/dist/components/loading/src/loading.d.ts +27 -0
  35. package/dist/components/loading/src/service.d.ts +3 -0
  36. package/dist/components/loading/src/types.d.ts +61 -0
  37. package/dist/components/search-layout/index.d.ts +6 -0
  38. package/dist/components/search-layout/src/instance.d.ts +2 -0
  39. package/dist/components/search-layout/src/searchLayout.vue.d.ts +22 -0
  40. package/dist/components/search-panel/index.d.ts +6 -0
  41. package/dist/components/search-panel/src/instance.d.ts +2 -0
  42. package/dist/components/search-panel/src/searchPanel.vue.d.ts +17 -0
  43. package/dist/components/search-panel-layout/index.d.ts +6 -0
  44. package/dist/components/search-panel-layout/src/layout.d.ts +95 -0
  45. package/dist/components/sticky-toolbar/index.d.ts +6 -0
  46. package/dist/components/sticky-toolbar/src/instance.d.ts +2 -0
  47. package/dist/components/sticky-toolbar/src/stickyToolbar.vue.d.ts +43 -0
  48. package/dist/components/switch-mode/index.d.ts +7 -0
  49. package/dist/components/switch-theme/index.d.ts +7 -0
  50. package/dist/components/table-toolbar/index.d.ts +7 -0
  51. package/dist/components/table-toolbar/src/buttonGroup.vue.d.ts +79 -0
  52. package/dist/components/table-toolbar/src/interface.d.ts +21 -0
  53. package/dist/components/table-toolbar/src/tableToolbar.vue.d.ts +71 -0
  54. package/dist/constants/aria.d.ts +17 -0
  55. package/dist/constants/date.d.ts +3 -0
  56. package/dist/constants/event.d.ts +3 -0
  57. package/dist/constants/index.d.ts +5 -0
  58. package/dist/constants/key.d.ts +1 -0
  59. package/dist/constants/size.d.ts +7 -0
  60. package/dist/defaults.d.ts +5 -0
  61. package/dist/hooks/complex-table/index.d.ts +33 -0
  62. package/dist/hooks/get-cookie/index.d.ts +4 -0
  63. package/dist/hooks/index.d.ts +6 -0
  64. package/dist/hooks/oper-modal/index.d.ts +8 -0
  65. package/dist/hooks/post-message/index.d.ts +19 -0
  66. package/dist/hooks/set-theme/index.d.ts +2 -0
  67. package/dist/hooks/use-draggable-resize/index.d.ts +10 -0
  68. package/dist/hooks/use-loading/index.d.ts +4 -0
  69. package/dist/hooks/use-namespace/index.d.ts +20 -0
  70. package/dist/icons/arrow-down.vue.d.ts +2 -0
  71. package/dist/icons/arrow-up.vue.d.ts +2 -0
  72. package/dist/icons/check.vue.d.ts +2 -0
  73. package/dist/icons/close.vue.d.ts +2 -0
  74. package/dist/icons/copy-document.vue.d.ts +2 -0
  75. package/dist/icons/filter.vue.d.ts +2 -0
  76. package/dist/icons/full-screen.vue.d.ts +2 -0
  77. package/dist/icons/index.d.ts +9 -0
  78. package/dist/icons/loading.vue.d.ts +2 -0
  79. package/dist/icons/minus.vue.d.ts +2 -0
  80. package/dist/index.cjs +3985 -0
  81. package/dist/index.css +2661 -0
  82. package/dist/index.d.ts +10 -0
  83. package/dist/index.mjs +3985 -0
  84. package/dist/make-installer.d.ts +5 -0
  85. package/dist/plugin.d.ts +3 -0
  86. package/dist/types/enhance/accessory.d.ts +45 -0
  87. package/dist/types/enhance/biztrace.d.ts +75 -0
  88. package/dist/types/enhance/form.d.ts +83 -0
  89. package/dist/types/enhance/heai.d.ts +47 -0
  90. package/dist/types/enhance/workflow.d.ts +385 -0
  91. package/dist/types/extension/extension.d.ts +58 -0
  92. package/dist/types/extension/frame.d.ts +48 -0
  93. package/dist/types/extension/job.d.ts +36 -0
  94. package/dist/types/framework/auth.d.ts +38 -0
  95. package/dist/types/framework/config.d.ts +13 -0
  96. package/dist/types/framework/core.d.ts +24 -0
  97. package/dist/types/index.d.ts +11 -0
  98. package/dist/utils/index.d.ts +6 -0
  99. package/dist/utils/style.d.ts +10 -0
  100. package/dist/utils/tools/istype.d.ts +11 -0
  101. package/dist/utils/tools/security.d.ts +2 -0
  102. package/dist/utils/tools/throw-error.d.ts +1 -0
  103. package/dist/utils/tools/tree.d.ts +2 -0
  104. package/dist/utils/vue/index.d.ts +2 -0
  105. package/dist/utils/vue/install.d.ts +6 -0
  106. package/dist/utils/vue/shared.d.ts +10 -0
  107. package/dist/utils/vue/typescript.d.ts +5 -0
  108. package/dist/version.d.ts +1 -0
  109. package/package.json +76 -4
  110. package/theme-chalk/autocomplete.css +144 -0
  111. package/theme-chalk/base-var.css +1037 -0
  112. package/theme-chalk/base.css +120 -0
  113. package/theme-chalk/collapse-container.css +71 -0
  114. package/theme-chalk/collapse-panel.css +49 -0
  115. package/theme-chalk/complextable.css +72 -0
  116. package/theme-chalk/dark.css +134 -0
  117. package/theme-chalk/dialog.css +0 -0
  118. package/theme-chalk/document-tables.css +175 -0
  119. package/theme-chalk/group-container.css +159 -0
  120. package/theme-chalk/index.css +2661 -0
  121. package/theme-chalk/loading.css +86 -0
  122. package/theme-chalk/page.css +34 -0
  123. package/theme-chalk/pub-class.css +417 -0
  124. package/theme-chalk/reset.css +152 -0
  125. package/theme-chalk/search-panel.css +31 -0
  126. package/theme-chalk/searchlayout.css +125 -0
  127. package/theme-chalk/src/autocomplete.scss +103 -0
  128. package/theme-chalk/src/base-var.scss +489 -0
  129. package/theme-chalk/src/base.scss +1 -0
  130. package/theme-chalk/src/black/index.scss +4 -0
  131. package/theme-chalk/src/collapse-container.scss +44 -0
  132. package/theme-chalk/src/collapse-panel.scss +26 -0
  133. package/theme-chalk/src/common/var.scss +154 -0
  134. package/theme-chalk/src/complextable.scss +47 -0
  135. package/theme-chalk/src/dark/css-vars.scss +35 -0
  136. package/theme-chalk/src/dark/var.scss +198 -0
  137. package/theme-chalk/src/dialog.scss +0 -0
  138. package/theme-chalk/src/document-tables.scss +133 -0
  139. package/theme-chalk/src/group-container.scss +139 -0
  140. package/theme-chalk/src/index.scss +17 -0
  141. package/theme-chalk/src/light/css-vars.scss +4 -0
  142. package/theme-chalk/src/light/var.scss +158 -0
  143. package/theme-chalk/src/loading.scss +68 -0
  144. package/theme-chalk/src/mixins/_var.scss +48 -0
  145. package/theme-chalk/src/mixins/config.scss +5 -0
  146. package/theme-chalk/src/mixins/function.scss +133 -0
  147. package/theme-chalk/src/mixins/mixins.scss +211 -0
  148. package/theme-chalk/src/page.scss +8 -0
  149. package/theme-chalk/src/pub-class.scss +127 -0
  150. package/theme-chalk/src/reset.scss +155 -0
  151. package/theme-chalk/src/search-panel.scss +10 -0
  152. package/theme-chalk/src/searchlayout.scss +114 -0
  153. package/theme-chalk/src/sticky-toolbar.scss +59 -0
  154. package/theme-chalk/src/table-toolbar.scss +36 -0
  155. package/theme-chalk/src/var.scss +32 -0
  156. package/theme-chalk/src/zjhc/alert.scss +16 -0
  157. package/theme-chalk/src/zjhc/anchor.scss +10 -0
  158. package/theme-chalk/src/zjhc/autocomplete.scss +11 -0
  159. package/theme-chalk/src/zjhc/backtop.scss +8 -0
  160. package/theme-chalk/src/zjhc/breadcrumb.scss +3 -0
  161. package/theme-chalk/src/zjhc/button.scss +82 -0
  162. package/theme-chalk/src/zjhc/calendar.scss +5 -0
  163. package/theme-chalk/src/zjhc/card.scss +5 -0
  164. package/theme-chalk/src/zjhc/cascader.scss +26 -0
  165. package/theme-chalk/src/zjhc/checkbox.scss +59 -0
  166. package/theme-chalk/src/zjhc/collapse.scss +8 -0
  167. package/theme-chalk/src/zjhc/dateEditor.scss +14 -0
  168. package/theme-chalk/src/zjhc/descriptions.scss +32 -0
  169. package/theme-chalk/src/zjhc/dialog.scss +148 -0
  170. package/theme-chalk/src/zjhc/drawer.scss +4 -0
  171. package/theme-chalk/src/zjhc/dropdown.scss +16 -0
  172. package/theme-chalk/src/zjhc/empty.scss +3 -0
  173. package/theme-chalk/src/zjhc/fontsize.scss +42 -0
  174. package/theme-chalk/src/zjhc/form.scss +33 -0
  175. package/theme-chalk/src/zjhc/index.scss +48 -0
  176. package/theme-chalk/src/zjhc/input.scss +47 -0
  177. package/theme-chalk/src/zjhc/link.scss +20 -0
  178. package/theme-chalk/src/zjhc/main.scss +3 -0
  179. package/theme-chalk/src/zjhc/mention.scss +9 -0
  180. package/theme-chalk/src/zjhc/menu.scss +0 -0
  181. package/theme-chalk/src/zjhc/message-box.scss +57 -0
  182. package/theme-chalk/src/zjhc/message.scss +13 -0
  183. package/theme-chalk/src/zjhc/notification.scss +4 -0
  184. package/theme-chalk/src/zjhc/number.scss +9 -0
  185. package/theme-chalk/src/zjhc/overlay.scss +3 -0
  186. package/theme-chalk/src/zjhc/page.scss +3 -0
  187. package/theme-chalk/src/zjhc/pagination.scss +64 -0
  188. package/theme-chalk/src/zjhc/picker.scss +85 -0
  189. package/theme-chalk/src/zjhc/popover.scss +13 -0
  190. package/theme-chalk/src/zjhc/popper.scss +13 -0
  191. package/theme-chalk/src/zjhc/radio.scss +49 -0
  192. package/theme-chalk/src/zjhc/scrollbar.scss +5 -0
  193. package/theme-chalk/src/zjhc/segmented.scss +18 -0
  194. package/theme-chalk/src/zjhc/select.scss +49 -0
  195. package/theme-chalk/src/zjhc/steps.scss +40 -0
  196. package/theme-chalk/src/zjhc/switch.scss +11 -0
  197. package/theme-chalk/src/zjhc/table-v2.scss +16 -0
  198. package/theme-chalk/src/zjhc/table.scss +44 -0
  199. package/theme-chalk/src/zjhc/tabs.scss +15 -0
  200. package/theme-chalk/src/zjhc/tags.scss +25 -0
  201. package/theme-chalk/src/zjhc/timeline.scss +16 -0
  202. package/theme-chalk/src/zjhc/tour.scss +9 -0
  203. package/theme-chalk/src/zjhc/tree.scss +6 -0
  204. package/theme-chalk/src/zjhc/upload.scss +6 -0
  205. package/theme-chalk/sticky-toolbar.css +71 -0
  206. package/theme-chalk/table-toolbar.css +53 -0
  207. package/theme-chalk/var.css +120 -0
@@ -0,0 +1,17 @@
1
+ @use './dark/css-vars.scss';
2
+ @use './base.scss';
3
+ @use './reset.scss';
4
+ @use './searchlayout.scss';
5
+ @use './collapse-panel.scss';
6
+ @use './collapse-container.scss';
7
+ @use './sticky-toolbar.scss';
8
+ @use './group-container.scss';
9
+ @use './page.scss';
10
+ @use './table-toolbar.scss';
11
+ @use './complextable.scss';
12
+ @use './autocomplete.scss';
13
+ @use './loading.scss';
14
+ @use './zjhc/index.scss';
15
+ // @use './red/reset.scss' as red;
16
+ @use './black/index.scss' as black;
17
+ @use './pub-class.scss';
@@ -0,0 +1,4 @@
1
+ // CSS3 var
2
+ @use './var' as *;
3
+ @use '../mixins/_var.scss' as *;
4
+ @use '../mixins/mixins.scss' as *;
@@ -0,0 +1,158 @@
1
+ @use 'sass:color';
2
+ @use 'sass:map';
3
+ @use 'sass:math';
4
+
5
+ // 定义可用的主题类型
6
+ $types: primary, success, warning, danger, error, info;
7
+ // 默认颜色映射,使用 deep-merge 来允许用户自定义颜色映射覆盖默认值
8
+ $colors: () !default;
9
+ $colors: map.deep-merge(
10
+ (
11
+ 'white': #ffffff,
12
+ // 白色和黑色作为基本颜色选项
13
+ 'black': #000000,
14
+ 'primary': (
15
+ 'base': #094194,
16
+ ),
17
+ 'success': (
18
+ 'base': #1ebcaf,
19
+ ),
20
+ 'warning': (
21
+ 'base': #ffc23e,
22
+ ),
23
+ 'danger': (
24
+ 'base': #fa5e45,
25
+ ),
26
+ 'error': (
27
+ 'base': #fa5e45,
28
+ ),
29
+ 'info': (
30
+ 'base': #909399,
31
+ ),
32
+ ),
33
+ $colors
34
+ );
35
+ // 主色调
36
+ $color-white: map.get($colors, 'white') !default; // 白色
37
+ $color-black: map.get($colors, 'black') !default; // 黑色
38
+
39
+ // 应用场景颜色
40
+ $color-primary: map.get(
41
+ $colors,
42
+ 'primary',
43
+ 'base'
44
+ ) !default; // 主要颜色,默认使用'base'色调
45
+ $color-success: map.get(
46
+ $colors,
47
+ 'success',
48
+ 'base'
49
+ ) !default; // 成功状态颜色,默认使用'base'色调
50
+ $color-warning: map.get(
51
+ $colors,
52
+ 'warning',
53
+ 'base'
54
+ ) !default; // 警告状态颜色,默认使用'base'色调
55
+ $color-error: map.get(
56
+ $colors,
57
+ 'error',
58
+ 'base'
59
+ ) !default; // 错误状态颜色,默认使用'base'色调
60
+ $color-info: map.get(
61
+ $colors,
62
+ 'info',
63
+ 'base'
64
+ ) !default; // 信息状态颜色,默认使用'base'色调
65
+
66
+ /**
67
+ * 该@mixin用于根据指定的颜色类型、级别和混合模式,创建一个新颜色等级并将其添加到全局颜色地图中。
68
+ * @param $type {string} - 颜色的类型(例如:primary, success等)。
69
+ * @param $number {int} - 颜色的级别,用于计算颜色的混合程度。
70
+ * @param $mode {string} - 混合模式,默认为'light'。可用于指定颜色是明度混合还是饱和度混合等。
71
+ * @param $mix-color {color} - 用于混合的颜色,默认为白色($color-white)。
72
+ */
73
+
74
+ @mixin set-color-mix-level(
75
+ $type,
76
+ $number,
77
+ $mode: 'light',
78
+ $mix-color: $color-white
79
+ ) {
80
+ // 深度合并颜色地图,添加新的颜色等级
81
+ $colors: map.deep-merge(
82
+ (
83
+ $type: (
84
+ '#{$mode}-#{$number}':
85
+ color.mix(
86
+ $mix-color,
87
+ map.get($colors, $type, 'base'),
88
+ math.percentage(math.div($number, 10))
89
+ ),
90
+ ),
91
+ ),
92
+ $colors
93
+ ) !global; // 将局部变量转换为全局变量,确保新的颜色等级可以在整个项目中使用
94
+ }
95
+
96
+ @each $type in $types {
97
+ @for $i from 1 through 9 {
98
+ @include set-color-mix-level($type, $i, 'light', $color-white);
99
+ }
100
+ }
101
+
102
+ @each $type in $types {
103
+ @include set-color-mix-level($type, 2, 'dark', $color-black);
104
+ }
105
+
106
+ // 文本颜色
107
+ $text-color: () !default;
108
+ $text-color: map.merge(
109
+ (
110
+ 'primary': #333333,
111
+ 'regular': #666666,
112
+ 'secondary': #999999,
113
+ 'placeholder': #999999,
114
+ 'disabled': #c0c4cc,
115
+ ),
116
+ $text-color
117
+ );
118
+ // 边框颜色
119
+ $border-color: () !default;
120
+ // border
121
+ $border-color: () !default;
122
+ $border-color: map.merge(
123
+ (
124
+ 'darker': #cdd0d6,
125
+ 'dark': #d4d7de,
126
+ '': #dcdfe6,
127
+ 'light': #e4e7ed,
128
+ 'lighter': #ebeef5,
129
+ 'extra-light': #f2f6fc,
130
+ ),
131
+ $border-color
132
+ );
133
+
134
+ // 填充颜色
135
+ $fill-color: () !default;
136
+ $fill-color: map.merge(
137
+ (
138
+ '': #f0f2f5,
139
+ 'light': #f5f7fa,
140
+ 'lighter': #fafafa,
141
+ 'extra-light': #fafcff,
142
+ 'dark': #ebedf0,
143
+ 'darker': #e6e8eb,
144
+ 'blank': #ffffff,
145
+ ),
146
+ $fill-color
147
+ );
148
+
149
+ // 背景颜色
150
+ $bg-color: () !default;
151
+ $bg-color: map.merge(
152
+ (
153
+ '': #ffffff,
154
+ 'page': #f2f3f5,
155
+ 'overlay': #ffffff,
156
+ ),
157
+ $bg-color
158
+ );
@@ -0,0 +1,68 @@
1
+ @use 'mixins/mixins' as *;
2
+ @use 'mixins/function' as *;
3
+
4
+ @include b(loading-parent) {
5
+ @include m(relative) {
6
+ position: relative !important;
7
+ }
8
+
9
+ @include m(hidden) {
10
+ overflow: hidden !important;
11
+ }
12
+ }
13
+
14
+ @include b(loading-mask) {
15
+ position: absolute;
16
+ z-index: 2000;
17
+ background-color: var(--el-mask-color);
18
+ margin: 0;
19
+ top: 0;
20
+ right: 0;
21
+ bottom: 0;
22
+ left: 0;
23
+ transition: opacity var(--el-transition-duration);
24
+
25
+ @include when(fullscreen) {
26
+ position: fixed;
27
+
28
+ .zjhc-loading-spinner {
29
+ margin-top: calc((0px - var(--el-loading-fullscreen-spinner-size)) / 2);
30
+
31
+ .circular {
32
+ height: var(--el-loading-fullscreen-spinner-size);
33
+ width: var(--elloading-fullscreen-spinner-size);
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ @include b(loading-spinner) {
40
+ top: 50%;
41
+ margin-top: calc((0px - var(--el-loading-spinner-size)) / 2);
42
+ width: 100%;
43
+ text-align: center;
44
+ position: absolute;
45
+ .circular {
46
+ display: inline;
47
+ height: var(--el-loading-fullscreen-spinner-size);
48
+ width: var(--el-loading-fullscreen-spinner-size);
49
+ // .path {
50
+ // width: inherit;
51
+ // height: inherit;
52
+ // }
53
+ }
54
+ .zjhc-loading-text {
55
+ color: var(--el-color-primary);
56
+ margin: 3px 0;
57
+ font-size: 14px;
58
+ }
59
+
60
+ i {
61
+ color: var(--el-color-primary);
62
+ }
63
+ }
64
+
65
+ .zjhc-loading-fade-enter-from,
66
+ .zjhc-loading-fade-leave-to {
67
+ opacity: 0;
68
+ }
@@ -0,0 +1,48 @@
1
+ @use 'sass:map';
2
+ @use 'function' as *;
3
+
4
+ // @include set-css-var-value(('color', 'primary'), red);
5
+ // --zjhc-color-primary: red;
6
+ @mixin set-css-var-value($name, $value) {
7
+ #{joinVarName($name)}: #{$value};
8
+ }
9
+
10
+ // @include set-css-var-type('color', 'primary', $map);
11
+ // --zjhc-color-primary: #{map.get($map, 'primary')};
12
+ @mixin set-css-var-type($name, $type, $variables) {
13
+ #{getCssVarName($name, $type)}: #{map.get($variables, $type)};
14
+ }
15
+
16
+
17
+ @mixin set-css-color-type($colors, $type) {
18
+ @include set-css-var-value(('color', $type), map.get($colors, $type, 'base'));
19
+
20
+ @each $i in (3, 5, 7, 8, 9) {
21
+ @include set-css-var-value(('color', $type, 'light', $i),
22
+ map.get($colors, $type, 'light-#{$i}'));
23
+ }
24
+
25
+ @include set-css-var-value(('color', $type, 'dark-2'),
26
+ map.get($colors, $type, 'dark-2'));
27
+ }
28
+
29
+ /**
30
+ * 设置分组的CSS变量
31
+ * @param $name - 分组名称,用于生成CSS变量名。
32
+ * @param $variables - 一个映射表,包含要设置的变量名和其值。
33
+ * 该mixin遍历$variables映射表,为每个键值对生成相应的CSS变量。如果键是"default",
34
+ * 则设置基础的CSS变量;否则,设置带有特定后缀的CSS变量。
35
+ */
36
+ @mixin set-component-css-var($name, $variables) {
37
+ @each $attribute, $value in $variables {
38
+
39
+ // 根据$attribute的值决定是设置基本变量还是特定属性的变量
40
+ @if $attribute =='default' {
41
+ #{getCssVarName($name)}: #{$value}; // 设置默认的CSS变量
42
+ }
43
+
44
+ @else {
45
+ #{getCssVarName($name, $attribute)}: #{$value}; // 设置具有特定后缀的CSS变量
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,5 @@
1
+ $namespace: 'zjhc' !default; //所有的组件以这个为前缀
2
+ $common-separator: '-' !default; //公共的分隔符
3
+ $element-separator: '__' !default; //元素以__分割,如zjhc-input__inner
4
+ $modifier-separator: '--' !default; //修饰符以--分割,如zjhc-input--mini
5
+ $state-prefix: "is-" !default; //状态前缀,如is-disabled
@@ -0,0 +1,133 @@
1
+ @use 'sass:meta';
2
+ @use 'sass:string';
3
+ @use 'config';
4
+
5
+ /**
6
+ * 该函数将选择器转化为字符串,并截取指定位置的字符。
7
+ * @param $selector - 需要转换的选择器对象。
8
+ * @return 返回转换后的选择器字符串。
9
+ */
10
+ @function selectorToString($selector) {
11
+ $selector: meta.inspect(
12
+ $selector
13
+ ); // 使用inspect函数将选择器转化为字符串,出现错误时会抛出异常
14
+ $selector: string.slice(
15
+ $selector,
16
+ 2,
17
+ -2
18
+ ); // 使用str-slice函数截取字符串,去除首尾字符
19
+ @return $selector;
20
+ }
21
+
22
+ /**
23
+ * 判断父级选择器是否包含'--'
24
+ * @param $selector - 需要检查的选择器,可以是列表或字符串。
25
+ * @returns 如果选择器包含修饰符,则返回 true;否则返回 false。
26
+ */
27
+ @function containsModifier($selector) {
28
+ $selector: selectorToString($selector); // 将选择器转换为字符串
29
+
30
+ @if string.index($selector, config.$modifier-separator) {
31
+ // 使用str-index函数查找'--'的存在位置,如果存在则返回true
32
+ @return true;
33
+ } @else {
34
+ // 如果没有找到修饰符分隔符,返回 false
35
+ @return false;
36
+ }
37
+ }
38
+
39
+ /**
40
+ * 判断父级选择器是否包含'.is-'
41
+ * @param $selector - 需要检查的选择器,可以是任何形式的选择器。
42
+ * @return 返回一个布尔值,如果选择器包含状态前缀则为true,否则为false。
43
+ */
44
+ @function containWhenFlag($selector) {
45
+ $selector: selectorToString($selector); // 将选择器转换为字符串
46
+
47
+ @if string.index($selector, '.' + config.$state-prefix) {
48
+ // 使用str-index函数查找'.is-'的存在位置,如果存在则返回true
49
+ @return true;
50
+ } @else {
51
+ // 如果选择器中不包含状态前缀,返回false
52
+ @return false;
53
+ }
54
+ }
55
+
56
+ /**
57
+ * 判断父级是否包含 ':' (用于判断伪类和伪元素)
58
+ * @param $selector - 需要检查的选择器,可以是任何形式的选择器,函数会将其转换为字符串形式。
59
+ * @return 返回一个布尔值,如果选择器包含伪类,则返回 true;否则返回 false。
60
+ */
61
+ @function containPseudoClass($selector) {
62
+ $selector: selectorToString($selector); // 将选择器转换为字符串
63
+
64
+ @if string.index($selector, ':') {
65
+ // 使用str-index函数查找':'的存在位置,如果存在则返回true
66
+ @return true;
67
+ } @else {
68
+ // 如果选择器中不包含':',返回false
69
+ @return false;
70
+ }
71
+ }
72
+
73
+ /*
74
+ * 判断父级选择器是否包含`--` `.is-` `:`这三种字符
75
+ * @param {String} $selector 选择器
76
+ * @return {String} 如果父级选择器包含以上三种字符中的任意一种,返回true;否则返回false
77
+ */
78
+ @function hitAllSpecialNestRule($selector) {
79
+ @return containsModifier($selector) or containWhenFlag($selector) or
80
+ containPseudoClass($selector); // 判断是否包含特殊字符
81
+ }
82
+
83
+ /**
84
+ * 函数用于将给定列表中的项目连接成一个变量名。
85
+ * @param $list - 一个包含要连接的字符串的列表。
86
+ * @return $name - 连接后的变量名,以"--"和配置中的命名空间开头,每个列表项之间用"-"连接。
87
+ */
88
+ @function joinVarName($list) {
89
+ // 初始化变量名,以"--"和配置中的命名空间开头
90
+ $name: '--' + config.$namespace;
91
+
92
+ // 遍历列表中的每个项目
93
+ @each $item in $list {
94
+ // 如果项目不为空,则将其添加到变量名中
95
+ @if $item != '' {
96
+ $name: $name + '-' + $item;
97
+ }
98
+ }
99
+
100
+ // 返回连接后的变量名
101
+ @return $name;
102
+ }
103
+
104
+ // getCssVarName('button', 'text-color') => '--zjhc-button-text-color'
105
+ @function getCssVarName($args...) {
106
+ @return joinVarName($args);
107
+ }
108
+
109
+ // getCssVar('button', 'text-color') => var(--el-button-text-color)
110
+ @function getCssVar($args...) {
111
+ @return var(#{joinVarName($args)});
112
+ }
113
+
114
+ // getCssVarWithDefault(('button', 'text-color'), red) => var(--el-button-text-color, red)
115
+ @function getCssVarWithDefault($args, $default) {
116
+ @return var(#{joinVarName($args)}, #{$default});
117
+ }
118
+
119
+ // bem('block', 'element', 'modifier') => 'el-block__element--modifier'
120
+ @function bem($block, $element: '', $modifier: '') {
121
+ $name: config.$namespace + config.$common-separator + $block;
122
+
123
+ @if $element != '' {
124
+ $name: $name + config.$element-separator + $element;
125
+ }
126
+
127
+ @if $modifier != '' {
128
+ $name: $name + config.$modifier-separator + $modifier;
129
+ }
130
+
131
+ // @debug $name;
132
+ @return $name;
133
+ }
@@ -0,0 +1,211 @@
1
+ @use 'sass:map';
2
+ @use 'sass:string';
3
+ @use 'config' as *;
4
+ @use 'function' as *;
5
+
6
+ // Break-points
7
+ @mixin res($key, $map: $breakpoints) {
8
+ // loop breakpoint Map, return if present
9
+ @if map.has-key($map, $key) {
10
+ @media only screen and #{string.unquote(map.get($map, $key))} {
11
+ @content;
12
+ }
13
+ } @else {
14
+ @warn "Undefined points: `#{$map}`";
15
+ }
16
+ }
17
+
18
+ // BEM
19
+ @mixin b($block) {
20
+ $B: $namespace + $common-separator + $block !global;
21
+
22
+ .#{$B} {
23
+ @content;
24
+ }
25
+ }
26
+
27
+ @mixin e($element) {
28
+ $E: $element !global;
29
+ $selector: &;
30
+ $currentSelector: '';
31
+ @each $unit in $element {
32
+ $currentSelector: #{$currentSelector +
33
+ '.' +
34
+ $B +
35
+ $element-separator +
36
+ $unit +
37
+ ','};
38
+ }
39
+
40
+ @if hitAllSpecialNestRule($selector) {
41
+ @at-root {
42
+ #{$selector} {
43
+ #{$currentSelector} {
44
+ @content;
45
+ }
46
+ }
47
+ }
48
+ } @else {
49
+ @at-root {
50
+ #{$currentSelector} {
51
+ @content;
52
+ }
53
+ }
54
+ }
55
+ }
56
+
57
+ @mixin m($modifier) {
58
+ $selector: &;
59
+ $currentSelector: '';
60
+ @each $unit in $modifier {
61
+ $currentSelector: #{$currentSelector +
62
+ $selector +
63
+ $modifier-separator +
64
+ $unit +
65
+ ','};
66
+ }
67
+
68
+ @at-root {
69
+ #{$currentSelector} {
70
+ @content;
71
+ }
72
+ }
73
+ }
74
+
75
+ @mixin configurable-m($modifier, $E-flag: false) {
76
+ $selector: &;
77
+ $interpolation: '';
78
+
79
+ @if $E-flag {
80
+ $interpolation: $element-separator + $E-flag;
81
+ }
82
+
83
+ @at-root {
84
+ #{$selector} {
85
+ .#{$B + $interpolation + $modifier-separator + $modifier} {
86
+ @content;
87
+ }
88
+ }
89
+ }
90
+ }
91
+
92
+ @mixin spec-selector(
93
+ $specSelector: '',
94
+ $element: $E,
95
+ $modifier: false,
96
+ $block: $B
97
+ ) {
98
+ $modifierCombo: '';
99
+
100
+ @if $modifier {
101
+ $modifierCombo: $modifier-separator + $modifier;
102
+ }
103
+
104
+ @at-root {
105
+ #{&}#{$specSelector}.#{$block
106
+ + $element-separator
107
+ + $element
108
+ + $modifierCombo} {
109
+ @content;
110
+ }
111
+ }
112
+ }
113
+
114
+ @mixin meb($modifier: false, $element: $E, $block: $B) {
115
+ $selector: &;
116
+ $modifierCombo: '';
117
+
118
+ @if $modifier {
119
+ $modifierCombo: $modifier-separator + $modifier;
120
+ }
121
+
122
+ @at-root {
123
+ #{$selector} {
124
+ .#{$namespace
125
+ + $common-separator
126
+ + $block
127
+ + $element-separator
128
+ + $element
129
+ + $modifierCombo} {
130
+ @content;
131
+ }
132
+ }
133
+ }
134
+ }
135
+
136
+ @mixin when($state) {
137
+ @at-root {
138
+ &.#{$state-prefix + $state} {
139
+ @content;
140
+ }
141
+ }
142
+ }
143
+
144
+ @mixin extend-rule($name) {
145
+ @extend #{'%shared-' + $name} !optional;
146
+ }
147
+
148
+ @mixin share-rule($name) {
149
+ $rule-name: '%shared-' + $name;
150
+
151
+ @at-root #{$rule-name} {
152
+ @content;
153
+ }
154
+ }
155
+
156
+ @mixin pseudo($pseudo) {
157
+ @at-root #{&}#{':#{$pseudo}'} {
158
+ @content;
159
+ }
160
+ }
161
+
162
+ @mixin picker-popper($background, $border, $box-shadow) {
163
+ &.el-popper {
164
+ background: $background;
165
+ border: $border;
166
+ box-shadow: $box-shadow;
167
+
168
+ .el-popper__arrow {
169
+ &::before {
170
+ border: $border;
171
+ }
172
+ }
173
+
174
+ @each $placement,
175
+ $adjacency
176
+ in ('top': 'left', 'bottom': 'right', 'left': 'bottom', 'right': 'top')
177
+ {
178
+ &[data-popper-placement^='#{$placement}'] {
179
+ .el-popper__arrow::before {
180
+ border-#{$placement}-color: transparent;
181
+ border-#{$adjacency}-color: transparent;
182
+ }
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
+ // dark
189
+ @mixin dark($block) {
190
+ html.dark {
191
+ @include b($block) {
192
+ @content;
193
+ }
194
+ }
195
+ }
196
+ // light
197
+ @mixin light($block) {
198
+ html:root {
199
+ @include b($block) {
200
+ @content;
201
+ }
202
+ }
203
+ }
204
+
205
+ @mixin inset-input-border($color, $important: false) {
206
+ @if $important == true {
207
+ box-shadow: 0 0 0 1px $color inset !important;
208
+ } @else {
209
+ box-shadow: 0 0 0 1px $color inset;
210
+ }
211
+ }
@@ -0,0 +1,8 @@
1
+ @use 'mixins/mixins' as *;
2
+ @use 'mixins/function' as *;
3
+
4
+ @include b(page) {
5
+ @include e(container) {
6
+ background-color: getCssVar('page', 'container', 'bg-color');
7
+ }
8
+ }