cdui-js 1.0.13 → 1.0.14
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.
- package/build/css.ts +9 -18
- package/css/all.css +8 -3
- package/css/base.css +4 -0
- package/css/button.css +3 -0
- package/css/canlendar.css +1 -26
- package/css/carousel.css +0 -3
- package/css/combobox.css +5 -25
- package/css/datepicker.css +38 -0
- package/css/form.css +19 -0
- package/css/popup.css +33 -0
- package/css/textbox.css +5 -0
- package/{css → demo/css}/build.ts +1 -1
- package/{css → demo/css}/css.md +45 -4
- package/demo/icons/build.ts +17 -0
- package/{index.html → demo/index.html} +20 -2
- package/demo/src/App.tsx +15 -0
- package/demo/src/css/all.css +3 -0
- package/demo/src/css/atomic.css +935 -0
- package/demo/src/main.ts +10 -0
- package/demo/{pages → src/pages}/Canlendar.tsx +1 -1
- package/demo/src/pages/ComboBox.tsx +10 -0
- package/demo/src/pages/DatePicker.tsx +5 -0
- package/demo/src/pages/Form.tsx +66 -0
- package/{vite.config.ts → demo/vite.config.ts} +2 -2
- package/icons/backward.svg +2 -2
- package/icons/close.svg +3 -3
- package/icons/dropdown.svg +2 -2
- package/icons/forward.svg +2 -2
- package/package.json +4 -2
- package/src/components/Button.tsx +5 -0
- package/src/components/Canlendar.tsx +23 -45
- package/src/components/Carousel.tsx +13 -4
- package/src/components/CollapsiblePanel.tsx +2 -4
- package/src/components/ComboBox.tsx +50 -146
- package/src/components/DatePicker.tsx +91 -0
- package/src/components/Dialog.ts +1 -1
- package/src/components/Form.tsx +141 -418
- package/src/components/Icon.tsx +2 -1
- package/src/components/Popup.tsx +220 -0
- package/src/components/Pulldown.tsx +2 -3
- package/src/components/TextBox.tsx +8 -0
- package/src/dom.ts +55 -39
- package/src/http.ts +23 -19
- package/src/i18n/languages/en.json +3 -3
- package/src/index.ts +5 -1
- package/src/reactive.ts +9 -0
- package/demo/App.tsx +0 -31
- package/demo/main.ts +0 -7
- package/demo/pages/ComboBox.tsx +0 -10
- package/demo/pages/Form.tsx +0 -32
- package/icons/build.ts +0 -24
- /package/demo/{test.js → src/test.js} +0 -0
package/build/css.ts
CHANGED
|
@@ -162,22 +162,6 @@ export const rules: Rule[] = [
|
|
|
162
162
|
outputs.push(`${selector}.icon { width: ${value}; height: ${value}; }`);
|
|
163
163
|
},
|
|
164
164
|
},
|
|
165
|
-
{
|
|
166
|
-
match: '.button',
|
|
167
|
-
build: (outputs: string[], selector: string, value: string) => {
|
|
168
|
-
outputs.push(`${selector} { ${value} }`);
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
match: '.link',
|
|
173
|
-
build: (outputs: string[], selector: string, value: string) => {
|
|
174
|
-
if (selector === '.link') {
|
|
175
|
-
outputs.push(`a, .link { ${value} }`);
|
|
176
|
-
} else {
|
|
177
|
-
outputs.push(`${selector} { ${value} }`);
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
165
|
];
|
|
182
166
|
|
|
183
167
|
const findRule = (name: string) => {
|
|
@@ -269,7 +253,10 @@ export const buildCSS = (cssRuleFile: string, cssFile?: string) => {
|
|
|
269
253
|
continue;
|
|
270
254
|
}
|
|
271
255
|
|
|
272
|
-
|
|
256
|
+
// 其它格式原样输出
|
|
257
|
+
if (!/\{\s*\}/.test(line)) {
|
|
258
|
+
outputs.push(line);
|
|
259
|
+
}
|
|
273
260
|
break;
|
|
274
261
|
|
|
275
262
|
case '+': // 上级选择器
|
|
@@ -287,7 +274,11 @@ export const buildCSS = (cssRuleFile: string, cssFile?: string) => {
|
|
|
287
274
|
break;
|
|
288
275
|
|
|
289
276
|
default:
|
|
290
|
-
|
|
277
|
+
// 其它格式原样输出
|
|
278
|
+
if (!/\{\s*\}/.test(line)) {
|
|
279
|
+
outputs.push(line);
|
|
280
|
+
}
|
|
281
|
+
break;
|
|
291
282
|
}
|
|
292
283
|
}
|
|
293
284
|
|
package/css/all.css
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
@import url(base.css);
|
|
2
2
|
|
|
3
|
+
@import url(atomic/all.css);
|
|
4
|
+
|
|
3
5
|
@import url(icon.css);
|
|
4
6
|
|
|
7
|
+
@import url(button.css);
|
|
8
|
+
@import url(textbox.css);
|
|
9
|
+
@import url(popup.css);
|
|
5
10
|
@import url(combobox.css);
|
|
6
|
-
@import url(carousel.css);
|
|
7
11
|
@import url(canlendar.css);
|
|
8
|
-
|
|
9
|
-
@import url(
|
|
12
|
+
@import url(datepicker.css);
|
|
13
|
+
@import url(form.css);
|
|
14
|
+
@import url(carousel.css);
|
package/css/base.css
CHANGED
package/css/button.css
ADDED
package/css/canlendar.css
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
.canlendar {
|
|
2
2
|
max-width: 380px;
|
|
3
3
|
height: 320px;
|
|
4
|
-
border: 1px solid #e4e4e4;
|
|
5
4
|
border-radius: 12px;
|
|
6
5
|
padding: 16px;
|
|
7
6
|
font-size: 12px;
|
|
@@ -23,24 +22,18 @@
|
|
|
23
22
|
font-size: 14px;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
.canlendar-
|
|
25
|
+
.canlendar-header > .icon {
|
|
27
26
|
box-sizing: border-box;
|
|
28
27
|
width: 40px;
|
|
29
28
|
height: 100%;
|
|
30
29
|
padding: 0 11px;
|
|
31
|
-
stroke: #1b212d;
|
|
32
30
|
cursor: pointer;
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
.canlendar-switch:last-child {
|
|
36
|
-
transform: rotateZ(180deg);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
33
|
.canlendar-weeks > span {
|
|
40
34
|
flex: auto;
|
|
41
35
|
text-align: center;
|
|
42
36
|
vertical-align: middle;
|
|
43
|
-
color: #888f97;
|
|
44
37
|
}
|
|
45
38
|
|
|
46
39
|
.canlendar-body {
|
|
@@ -57,15 +50,9 @@
|
|
|
57
50
|
}
|
|
58
51
|
|
|
59
52
|
.canlendar-date.disabled {
|
|
60
|
-
color: #e4e4e4;
|
|
61
53
|
cursor: not-allowed;
|
|
62
54
|
}
|
|
63
55
|
|
|
64
|
-
.canlendar-date.prev-month,
|
|
65
|
-
.canlendar-date.next-month {
|
|
66
|
-
color: #888f97;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
56
|
.canlendar-date.today,
|
|
70
57
|
.canlendar-date.selected {
|
|
71
58
|
position: relative;
|
|
@@ -80,15 +67,3 @@
|
|
|
80
67
|
border-radius: 40px;
|
|
81
68
|
z-index: -1;
|
|
82
69
|
}
|
|
83
|
-
|
|
84
|
-
.canlendar-date.today::before {
|
|
85
|
-
background: #f5f5f5;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.canlendar-date.selected {
|
|
89
|
-
color: white;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.canlendar-date.selected::before {
|
|
93
|
-
background: #ff4000;
|
|
94
|
-
}
|
package/css/carousel.css
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
height: 36px;
|
|
15
15
|
border-radius: 36px;
|
|
16
16
|
padding: 8px;
|
|
17
|
-
background: rgba(255, 255, 255, 0.1);
|
|
18
17
|
cursor: pointer;
|
|
19
18
|
}
|
|
20
19
|
|
|
@@ -37,10 +36,8 @@
|
|
|
37
36
|
height: 6px;
|
|
38
37
|
border-radius: 10px;
|
|
39
38
|
margin: 0 2px;
|
|
40
|
-
background: rgba(65, 72, 90, 1);
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
.carousel-dot.selected {
|
|
44
42
|
width: 16px;
|
|
45
|
-
background: white;
|
|
46
43
|
}
|
package/css/combobox.css
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
position: relative;
|
|
3
3
|
width: 100px;
|
|
4
4
|
height: 32px;
|
|
5
|
-
border: 1px solid silver;
|
|
6
|
-
background: white;
|
|
7
5
|
overflow: visible;
|
|
8
6
|
}
|
|
9
7
|
|
|
@@ -15,11 +13,12 @@
|
|
|
15
13
|
height: 100%;
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
.combobox-
|
|
16
|
+
.combobox-input {
|
|
19
17
|
flex: auto;
|
|
20
18
|
width: 100%;
|
|
21
19
|
height: 100%;
|
|
22
20
|
outline: none;
|
|
21
|
+
border: none;
|
|
23
22
|
padding: 0 4px;
|
|
24
23
|
background: inherit;
|
|
25
24
|
color: inherit;
|
|
@@ -27,32 +26,13 @@
|
|
|
27
26
|
font-size: inherit;
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
.combobox-host >
|
|
29
|
+
.combobox-host > .icon {
|
|
31
30
|
display: flex;
|
|
32
31
|
justify-items: center;
|
|
33
32
|
align-items: center;
|
|
34
|
-
|
|
33
|
+
height: 100%;
|
|
34
|
+
padding: 0 4px;
|
|
35
35
|
stroke: inherit;
|
|
36
36
|
fill: inherit;
|
|
37
37
|
cursor: pointer;
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
.combobox-popup {
|
|
41
|
-
position: absolute;
|
|
42
|
-
top: calc(100% + 4px);
|
|
43
|
-
left: 0;
|
|
44
|
-
width: auto;
|
|
45
|
-
z-index: 100;
|
|
46
|
-
will-change: height;
|
|
47
|
-
transition: height 0.2s linear;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.combobox-popup-top {
|
|
51
|
-
top: auto;
|
|
52
|
-
bottom: calc(100% + 4px);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.combobox-popup-right {
|
|
56
|
-
left: auto;
|
|
57
|
-
right: 0;
|
|
58
|
-
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.datepicker {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100px;
|
|
4
|
+
height: 32px;
|
|
5
|
+
overflow: visible;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.datepicker-host {
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.datepicker-input {
|
|
17
|
+
flex: auto;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
outline: none;
|
|
21
|
+
border: none;
|
|
22
|
+
padding: 0 4px;
|
|
23
|
+
background: inherit;
|
|
24
|
+
color: inherit;
|
|
25
|
+
vertical-align: top;
|
|
26
|
+
font-size: inherit;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.datepicker-host > .icon {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-items: center;
|
|
32
|
+
align-items: center;
|
|
33
|
+
height: 100%;
|
|
34
|
+
padding: 0 4px;
|
|
35
|
+
stroke: inherit;
|
|
36
|
+
fill: inherit;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
package/css/form.css
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.form-align-left,
|
|
2
|
+
.form-align-right {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.form-align-left > label,
|
|
8
|
+
.form-align-right > label {
|
|
9
|
+
width: 100px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.form-align-left > label {
|
|
13
|
+
text-align: right;
|
|
14
|
+
padding-right: 8px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.form-align-right > label {
|
|
18
|
+
padding-left: 8px;
|
|
19
|
+
}
|
package/css/popup.css
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.popup {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: calc(100% + 4px);
|
|
4
|
+
left: -1px;
|
|
5
|
+
z-index: 100;
|
|
6
|
+
/* 不允许内边距,否则动画的高度不能小于内边距 */
|
|
7
|
+
padding: 0 !important;
|
|
8
|
+
will-change: height;
|
|
9
|
+
transition: height 0.2s linear;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.popup-top {
|
|
14
|
+
top: auto;
|
|
15
|
+
bottom: calc(100% + 4px);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.popup-right {
|
|
19
|
+
left: auto;
|
|
20
|
+
right: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.le-480 .popup {
|
|
24
|
+
position: fixed;
|
|
25
|
+
top: auto;
|
|
26
|
+
bottom: 0;
|
|
27
|
+
left: -1px;
|
|
28
|
+
right: -1px;
|
|
29
|
+
width: 100% !important;
|
|
30
|
+
max-width: 100% !important;
|
|
31
|
+
max-height: 80%;
|
|
32
|
+
border-radius: 12px 12px 0 0;
|
|
33
|
+
}
|
package/css/textbox.css
ADDED
package/{css → demo/css}/css.md
RENAMED
|
@@ -242,8 +242,6 @@
|
|
|
242
242
|
.icon-c-selected: #ffffff;
|
|
243
243
|
.icon-c-primary-selected: #FF4000;
|
|
244
244
|
|
|
245
|
-
+ .dark
|
|
246
|
-
|
|
247
245
|
|
|
248
246
|
# icon-size 图标大小
|
|
249
247
|
|
|
@@ -270,7 +268,50 @@
|
|
|
270
268
|
.button-primary:hover { background-color: #FF7A51; }
|
|
271
269
|
.button-primary:disabled { background-color:#FFD1C3; }
|
|
272
270
|
|
|
271
|
+
|
|
273
272
|
# link 链接
|
|
274
273
|
|
|
275
|
-
.link {}
|
|
276
|
-
.link-primary {};
|
|
274
|
+
.link { }
|
|
275
|
+
.link-primary { };
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
# textbox 文本框
|
|
279
|
+
|
|
280
|
+
.textbox { border: 1px solid #e4e4e4; }
|
|
281
|
+
.textbox:focus { border: 1px solid #1b212d; }
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
# combobox 下拉框
|
|
285
|
+
|
|
286
|
+
.combobox { border: 1px solid #e4e4e4; background: white; }
|
|
287
|
+
.combobox:has(.combobox-input:focus) { border: 1px solid #1b212d; }
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
# canlendar 日历
|
|
291
|
+
|
|
292
|
+
.canlendar { border: 1px solid #e4e4e4; }
|
|
293
|
+
.canlendar-header > .icon { stroke: #1b212d; }
|
|
294
|
+
.canlendar-weeks > span { color: #888f97; }
|
|
295
|
+
.canlendar-date.disabled { color: #e4e4e4; }
|
|
296
|
+
.canlendar-date.prev-month, .canlendar-date.next-month { color: #888f97; }
|
|
297
|
+
.canlendar-date.today::before { background: #f5f5f5; }
|
|
298
|
+
.canlendar-date.selected { color: white; }
|
|
299
|
+
.canlendar-date.selected::before { background: #ff4000; }
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
# datepicker 日期选择
|
|
303
|
+
|
|
304
|
+
.datepicker { border: 1px solid #e4e4e4; background: white; }
|
|
305
|
+
.datepicker:has(.datepicker-input:focus) { border: 1px solid #1b212d; }
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
# popup 弹出层
|
|
309
|
+
|
|
310
|
+
.popup { border: 1px solid #e4e4e4; background: white; }
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
# carousel 轮播
|
|
314
|
+
|
|
315
|
+
.carousel-backward, .carousel-forward { background: rgba(255, 255, 255, 0.1); }
|
|
316
|
+
.carousel-dot { background: rgba(65, 72, 90, 1); }
|
|
317
|
+
.carousel-dot.selected { background: white; }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
|
|
4
|
+
import { loadIconFile, loadIconsDirectory, saveIconsModule, saveIconsToHtml } from '../../build/icons';
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
const icons = [
|
|
10
|
+
loadIconFile(path.join(__dirname, '../../icons/backward.svg')),
|
|
11
|
+
loadIconFile(path.join(__dirname, '../../icons/close.svg')),
|
|
12
|
+
loadIconFile(path.join(__dirname, '../../icons/dropdown.svg')),
|
|
13
|
+
loadIconFile(path.join(__dirname, '../../icons/forward.svg')),
|
|
14
|
+
loadIconFile(path.join(__dirname, '../../icons/toggle.svg')),
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
saveIconsToHtml(path.join(__dirname, '../index.html'), icons.join('\n'));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
|
|
4
4
|
<head>
|
|
5
|
-
<title>
|
|
5
|
+
<title>cdui-js demo</title>
|
|
6
6
|
<meta name="description" content="stock" />
|
|
7
7
|
<meta charset="UTF-8" />
|
|
8
8
|
<meta name="renderer" content="webkit" />
|
|
@@ -15,6 +15,24 @@
|
|
|
15
15
|
</head>
|
|
16
16
|
|
|
17
17
|
<body>
|
|
18
|
+
<svg id="ICONS" aria-hidden="true" style="position: absolute; width: 0px; height: 0px; overflow: hidden;"
|
|
19
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
20
|
+
<symbol id="icon-backward" viewBox="0 0 16 16" fill="none">
|
|
21
|
+
<path d="M10.3661 2.72003L6.01942 7.0667C5.50609 7.58003 5.50609 8.42003 6.01942 8.93336L10.3661 13.28" stroke="#1B212D" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
22
|
+
</symbol>
|
|
23
|
+
<symbol id="icon-close" viewBox="0 0 14 14" fill="none">
|
|
24
|
+
<path d="M0.750078 11.3565L11.3567 0.749922M11.3567 11.3565L0.750078 0.749922" stroke="#8693B6" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
25
|
+
</symbol>
|
|
26
|
+
<symbol id="icon-dropdown" viewBox="0 0 16 16" fill="none">
|
|
27
|
+
<path d="M2.72 5.63428L7.06667 9.98094C7.58 10.4943 8.42 10.4943 8.93333 9.98094L13.28 5.63428" stroke="#1B212D" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
28
|
+
</symbol>
|
|
29
|
+
<symbol id="icon-forward" viewBox="0 0 16 16" fill="none">
|
|
30
|
+
<path d="M5.63391 2.72003L9.98058 7.0667C10.4939 7.58003 10.4939 8.42003 9.98058 8.93336L5.63391 13.28" stroke="#1B212D" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
31
|
+
</symbol>
|
|
32
|
+
<symbol id="icon-toggle" viewBox="0 0 10 6" fill="none">
|
|
33
|
+
<path d="M9.14515 0.5L5.58667 4.30333C5.16642 4.7525 4.47873 4.7525 4.05848 4.30333L0.5 0.5" stroke="white" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
34
|
+
</symbol>
|
|
35
|
+
</svg>
|
|
18
36
|
<script type="text/javascript">
|
|
19
37
|
window.addEventListener(
|
|
20
38
|
'resize',
|
|
@@ -73,7 +91,7 @@
|
|
|
73
91
|
);
|
|
74
92
|
</script>
|
|
75
93
|
<!-- ssr-body -->
|
|
76
|
-
<script type="module" src="./
|
|
94
|
+
<script type="module" src="./src/main.ts"></script>
|
|
77
95
|
</body>
|
|
78
96
|
|
|
79
97
|
</html>
|
package/demo/src/App.tsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CanlendarPage } from './pages/Canlendar';
|
|
2
|
+
import { ComboBoxPage } from './pages/ComboBox';
|
|
3
|
+
import { DatePickerPage } from './pages/DatePicker';
|
|
4
|
+
import { FormPage } from './pages/Form';
|
|
5
|
+
|
|
6
|
+
export const App = () => {
|
|
7
|
+
return (
|
|
8
|
+
<div style={{ 'min-height': '100%' }}>
|
|
9
|
+
<CanlendarPage></CanlendarPage>
|
|
10
|
+
<DatePickerPage></DatePickerPage>
|
|
11
|
+
<ComboBoxPage></ComboBoxPage>
|
|
12
|
+
<FormPage></FormPage>
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
};
|