antd-solid 0.0.28 → 0.0.30
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/css/index.css +1 -1
- package/dist/index.esm.js +657 -363
- package/dist/index.umd.js +1 -1
- package/es/ConfigProvider/utils/index.js +1 -0
- package/es/DatePicker/Panel.d.ts +10 -0
- package/es/DatePicker/Panel.js +179 -0
- package/es/DatePicker/RangePicker.d.ts +11 -0
- package/es/DatePicker/RangePicker.js +27 -0
- package/es/DatePicker/index.d.ts +24 -0
- package/es/DatePicker/index.js +64 -0
- package/es/Input/TextArea.js +8 -1
- package/es/Input/index.js +8 -1
- package/es/Modal/index.js +2 -2
- package/es/Popconfirm/index.d.ts +4 -0
- package/es/Popconfirm/index.js +12 -14
- package/es/RangeInput/index.d.ts +1 -0
- package/es/RangeInput/index.js +5 -2
- package/es/SelectInput/index.d.ts +2 -2
- package/es/SelectInput/index.js +6 -2
- package/es/index.d.ts +3 -1
- package/es/index.js +1 -0
- package/es/locale/en_US.js +15 -0
- package/es/locale/index.d.ts +5 -1
- package/es/locale/zh_CN.js +15 -0
- package/package.json +15 -13
|
@@ -155,6 +155,7 @@ function createCssVariables(token, theme = 'light') {
|
|
|
155
155
|
'--ant-tree-node-wrapper-padding': '2px 0',
|
|
156
156
|
'--ant-tree-node-selected-bg': aliasToken.controlItemBgActive,
|
|
157
157
|
'--ant-tree-node-hover-bg': aliasToken.controlItemBgHover,
|
|
158
|
+
'--ant-date-picker-cell-hover-bg': aliasToken.controlItemBgHover,
|
|
158
159
|
'--ant-alert-default-padding': '8px 12px',
|
|
159
160
|
'--ant-tabs-card-bg': aliasToken.colorFillAlter,
|
|
160
161
|
'--ant-progress-remaining-color': mapToken.colorFillSecondary,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Component } from 'solid-js';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
export interface PanelProps {
|
|
4
|
+
defaultValue?: dayjs.Dayjs | dayjs.Dayjs[] | undefined;
|
|
5
|
+
value?: dayjs.Dayjs | dayjs.Dayjs[] | undefined;
|
|
6
|
+
onChange?: (date: dayjs.Dayjs | dayjs.Dayjs[] | undefined) => void;
|
|
7
|
+
multiple?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const Panel: Component<PanelProps>;
|
|
10
|
+
export default Panel;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { delegateEvents, insert, createComponent, memo, effect, className, template } from 'solid-js/web';
|
|
2
|
+
import { createMemo, createSignal, Show, For } from 'solid-js';
|
|
3
|
+
import cs from 'classnames';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
import createControllableValue from '../hooks/createControllableValue.js';
|
|
6
|
+
import Button from '../Button/index.js';
|
|
7
|
+
import useLocale from '../hooks/useLocale.js';
|
|
8
|
+
|
|
9
|
+
var _tmpl$ = /*#__PURE__*/template(`<span class=i-ant-design:left-outlined>`),
|
|
10
|
+
_tmpl$2 = /*#__PURE__*/template(`<span class=i-ant-design:right-outlined>`),
|
|
11
|
+
_tmpl$3 = /*#__PURE__*/template(`<div><div class="h-40px flex items-center border-0 border-b border-solid border-[--ant-color-border]"><div class="w-full flex justify-center"></div></div><div class=flex>`),
|
|
12
|
+
_tmpl$4 = /*#__PURE__*/template(`<div class=p-[var(--ant-padding-xs)_calc(var(--ant-padding)+.5*var(--ant-padding-xxs))]><table><thead><tr><th class="w-36px h-36px"></th><th class="w-36px h-36px"></th><th class="w-36px h-36px"></th><th class="w-36px h-36px"></th><th class="w-36px h-36px"></th><th class="w-36px h-36px"></th><th class="w-36px h-36px"></th></tr></thead><tbody>`),
|
|
13
|
+
_tmpl$5 = /*#__PURE__*/template(`<tr>`),
|
|
14
|
+
_tmpl$6 = /*#__PURE__*/template(`<td class="w-36px h-36px"><div>`);
|
|
15
|
+
const monthList = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
16
|
+
const Panel = props => {
|
|
17
|
+
const locale = useLocale();
|
|
18
|
+
const [value, setValue] = createControllableValue(props);
|
|
19
|
+
const valueArr = createMemo(() => {
|
|
20
|
+
const _value = value();
|
|
21
|
+
if (!_value) return [];
|
|
22
|
+
return Array.isArray(_value) ? _value : [_value];
|
|
23
|
+
});
|
|
24
|
+
const [currentMonth, setCurrentMonth] = createSignal(dayjs().startOf('month'));
|
|
25
|
+
return (() => {
|
|
26
|
+
var _el$ = _tmpl$3(),
|
|
27
|
+
_el$2 = _el$.firstChild,
|
|
28
|
+
_el$4 = _el$2.firstChild,
|
|
29
|
+
_el$6 = _el$2.nextSibling;
|
|
30
|
+
insert(_el$2, createComponent(Button, {
|
|
31
|
+
type: "text",
|
|
32
|
+
onClick: () => {
|
|
33
|
+
setCurrentMonth(prev => prev.subtract(1, 'M'));
|
|
34
|
+
},
|
|
35
|
+
get children() {
|
|
36
|
+
return _tmpl$();
|
|
37
|
+
}
|
|
38
|
+
}), _el$4);
|
|
39
|
+
insert(_el$4, createComponent(Button, {
|
|
40
|
+
type: "text",
|
|
41
|
+
get children() {
|
|
42
|
+
return memo(() => locale().locale === 'en')() ? monthList[currentMonth().month()] : `${currentMonth().year()}年`;
|
|
43
|
+
}
|
|
44
|
+
}), null);
|
|
45
|
+
insert(_el$4, createComponent(Button, {
|
|
46
|
+
type: "text",
|
|
47
|
+
get children() {
|
|
48
|
+
return memo(() => locale().locale === 'en')() ? currentMonth().year() : `${currentMonth().month() + 1}月`;
|
|
49
|
+
}
|
|
50
|
+
}), null);
|
|
51
|
+
insert(_el$4, createComponent(Show, {
|
|
52
|
+
get when() {
|
|
53
|
+
return props.multiple;
|
|
54
|
+
},
|
|
55
|
+
get children() {
|
|
56
|
+
return [createComponent(Button, {
|
|
57
|
+
type: "text",
|
|
58
|
+
get children() {
|
|
59
|
+
return `${currentMonth().add(1, 'M').year()}年`;
|
|
60
|
+
}
|
|
61
|
+
}), createComponent(Button, {
|
|
62
|
+
type: "text",
|
|
63
|
+
get children() {
|
|
64
|
+
return `${currentMonth().add(1, 'M').month() + 1}月`;
|
|
65
|
+
}
|
|
66
|
+
})];
|
|
67
|
+
}
|
|
68
|
+
}), null);
|
|
69
|
+
insert(_el$2, createComponent(Button, {
|
|
70
|
+
type: "text",
|
|
71
|
+
onClick: () => {
|
|
72
|
+
setCurrentMonth(prev => prev.add(1, 'M'));
|
|
73
|
+
},
|
|
74
|
+
get children() {
|
|
75
|
+
return _tmpl$2();
|
|
76
|
+
}
|
|
77
|
+
}), null);
|
|
78
|
+
insert(_el$6, createComponent(Weeks, {
|
|
79
|
+
get month() {
|
|
80
|
+
return currentMonth();
|
|
81
|
+
},
|
|
82
|
+
get value() {
|
|
83
|
+
return valueArr();
|
|
84
|
+
},
|
|
85
|
+
onChange: date => {
|
|
86
|
+
if (props.multiple) {
|
|
87
|
+
setValue([date, valueArr()[1]]);
|
|
88
|
+
} else {
|
|
89
|
+
setValue(date);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}), null);
|
|
93
|
+
insert(_el$6, createComponent(Show, {
|
|
94
|
+
get when() {
|
|
95
|
+
return props.multiple;
|
|
96
|
+
},
|
|
97
|
+
get children() {
|
|
98
|
+
return createComponent(Weeks, {
|
|
99
|
+
get month() {
|
|
100
|
+
return currentMonth().add(1, 'M');
|
|
101
|
+
},
|
|
102
|
+
get value() {
|
|
103
|
+
return valueArr();
|
|
104
|
+
},
|
|
105
|
+
onChange: date => {
|
|
106
|
+
if (props.multiple) {
|
|
107
|
+
setValue([valueArr()[0], date]);
|
|
108
|
+
} else {
|
|
109
|
+
setValue(date);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}), null);
|
|
115
|
+
return _el$;
|
|
116
|
+
})();
|
|
117
|
+
};
|
|
118
|
+
const Weeks = props => {
|
|
119
|
+
const locale = useLocale();
|
|
120
|
+
// 添加6周的天数
|
|
121
|
+
const weeks = createMemo(() => {
|
|
122
|
+
const month = props.month;
|
|
123
|
+
let startDay = month.day();
|
|
124
|
+
startDay = startDay === 0 ? 7 : startDay;
|
|
125
|
+
const start = month.add(startDay === 1 ? 0 : 1 - startDay, 'day');
|
|
126
|
+
return Array.from({
|
|
127
|
+
length: 6
|
|
128
|
+
}, (_, weekIndex) => Array.from({
|
|
129
|
+
length: 7
|
|
130
|
+
}, (__, dayIndex) => start.add(weekIndex * 7 + dayIndex, 'day')));
|
|
131
|
+
});
|
|
132
|
+
return (() => {
|
|
133
|
+
var _el$7 = _tmpl$4(),
|
|
134
|
+
_el$8 = _el$7.firstChild,
|
|
135
|
+
_el$9 = _el$8.firstChild,
|
|
136
|
+
_el$10 = _el$9.firstChild,
|
|
137
|
+
_el$11 = _el$10.firstChild,
|
|
138
|
+
_el$12 = _el$11.nextSibling,
|
|
139
|
+
_el$13 = _el$12.nextSibling,
|
|
140
|
+
_el$14 = _el$13.nextSibling,
|
|
141
|
+
_el$15 = _el$14.nextSibling,
|
|
142
|
+
_el$16 = _el$15.nextSibling,
|
|
143
|
+
_el$17 = _el$16.nextSibling,
|
|
144
|
+
_el$18 = _el$9.nextSibling;
|
|
145
|
+
insert(_el$11, () => locale().DatePicker.Mon);
|
|
146
|
+
insert(_el$12, () => locale().DatePicker.Tue);
|
|
147
|
+
insert(_el$13, () => locale().DatePicker.Wed);
|
|
148
|
+
insert(_el$14, () => locale().DatePicker.Thu);
|
|
149
|
+
insert(_el$15, () => locale().DatePicker.Fri);
|
|
150
|
+
insert(_el$16, () => locale().DatePicker.Sat);
|
|
151
|
+
insert(_el$17, () => locale().DatePicker.Sun);
|
|
152
|
+
insert(_el$18, createComponent(For, {
|
|
153
|
+
get each() {
|
|
154
|
+
return weeks();
|
|
155
|
+
},
|
|
156
|
+
children: week => (() => {
|
|
157
|
+
var _el$19 = _tmpl$5();
|
|
158
|
+
insert(_el$19, createComponent(For, {
|
|
159
|
+
each: week,
|
|
160
|
+
children: day => (() => {
|
|
161
|
+
var _el$20 = _tmpl$6(),
|
|
162
|
+
_el$21 = _el$20.firstChild;
|
|
163
|
+
_el$21.$$click = () => {
|
|
164
|
+
props.onChange(day);
|
|
165
|
+
};
|
|
166
|
+
insert(_el$21, () => day.date());
|
|
167
|
+
effect(() => className(_el$21, cs(day.isSame(props.value[0]) || day.isSame(props.value[1]) ? 'bg-[--ant-color-primary]' : day.isAfter(props.value[0]) && props.value[1] && day.isBefore(props.value[1]) ? 'bg-#e6f4ff' : 'hover:bg-[--ant-date-picker-cell-hover-bg]', !day.isSame(props.month, 'M') && 'text-[--ant-color-text-disabled]', 'w-full h-full cursor-pointer flex justify-center items-center rounded-[--ant-border-radius-sm]')));
|
|
168
|
+
return _el$20;
|
|
169
|
+
})()
|
|
170
|
+
}));
|
|
171
|
+
return _el$19;
|
|
172
|
+
})()
|
|
173
|
+
}));
|
|
174
|
+
return _el$7;
|
|
175
|
+
})();
|
|
176
|
+
};
|
|
177
|
+
delegateEvents(["click"]);
|
|
178
|
+
|
|
179
|
+
export { Panel as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Component } from 'solid-js';
|
|
2
|
+
import type dayjs from 'dayjs';
|
|
3
|
+
export interface RangePickerProps {
|
|
4
|
+
value?: dayjs.Dayjs[];
|
|
5
|
+
defaultValue?: dayjs.Dayjs[];
|
|
6
|
+
onChange?: (value: dayjs.Dayjs[]) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
allowClear?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const RangePicker: Component<RangePickerProps>;
|
|
11
|
+
export default RangePicker;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createComponent, mergeProps } from 'solid-js/web';
|
|
2
|
+
import RangeInput from '../RangeInput/index.js';
|
|
3
|
+
import createControllableValue from '../hooks/createControllableValue.js';
|
|
4
|
+
import Panel from './Panel.js';
|
|
5
|
+
|
|
6
|
+
const RangePicker = props => {
|
|
7
|
+
const [value, setValue] = createControllableValue(props);
|
|
8
|
+
return createComponent(RangeInput, mergeProps(props, {
|
|
9
|
+
optionLabelRender: v => v?.format('YYYY-MM-DD'),
|
|
10
|
+
get value() {
|
|
11
|
+
return value();
|
|
12
|
+
},
|
|
13
|
+
onChange: setValue,
|
|
14
|
+
placeholder: ['开始日期', '结束日期'],
|
|
15
|
+
content: () => createComponent(Panel, mergeProps(props, {
|
|
16
|
+
multiple: true,
|
|
17
|
+
onChange: date => {
|
|
18
|
+
setValue(date);
|
|
19
|
+
}
|
|
20
|
+
})),
|
|
21
|
+
tooltipContentStyle: {
|
|
22
|
+
width: 'fit-content'
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { RangePicker as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { type Key } from '../types';
|
|
3
|
+
import { type SelectInputProps } from '../SelectInput';
|
|
4
|
+
export interface DatePickerProps extends Pick<SelectInputProps<Key>, 'ref' | 'multiple' | 'allowClear' | 'class' | 'style' | 'disabled' | 'placeholder' | 'status' | 'size' | 'variant' | 'suffixIcon' | 'placement' | 'getPopupContainer' | 'defaultOpen' | 'open' | 'onOpenChange'> {
|
|
5
|
+
defaultValue?: dayjs.Dayjs | null;
|
|
6
|
+
value?: dayjs.Dayjs | null;
|
|
7
|
+
onChange?: (date: dayjs.Dayjs | undefined, dateString: string | undefined) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface DatePickerLocale {
|
|
10
|
+
placeholder: string;
|
|
11
|
+
today: string;
|
|
12
|
+
Mon: string;
|
|
13
|
+
Tue: string;
|
|
14
|
+
Wed: string;
|
|
15
|
+
Thu: string;
|
|
16
|
+
Fri: string;
|
|
17
|
+
Sat: string;
|
|
18
|
+
Sun: string;
|
|
19
|
+
}
|
|
20
|
+
declare function DatePicker(props: DatePickerProps): import("solid-js").JSX.Element;
|
|
21
|
+
declare namespace DatePicker {
|
|
22
|
+
var RangePicker: import("solid-js").Component<import("./RangePicker").RangePickerProps>;
|
|
23
|
+
}
|
|
24
|
+
export default DatePicker;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createComponent, mergeProps, insert, template } from 'solid-js/web';
|
|
2
|
+
import { splitProps } from 'solid-js';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import createControllableValue from '../hooks/createControllableValue.js';
|
|
5
|
+
import SelectInput from '../SelectInput/index.js';
|
|
6
|
+
import Button from '../Button/index.js';
|
|
7
|
+
import RangePicker from './RangePicker.js';
|
|
8
|
+
import Panel from './Panel.js';
|
|
9
|
+
import useLocale from '../hooks/useLocale.js';
|
|
10
|
+
|
|
11
|
+
var _tmpl$ = /*#__PURE__*/template(`<div><div class="h-40px flex justify-center items-center border-t border-solid border-[--ant-color-border]">`);
|
|
12
|
+
function DatePicker(props) {
|
|
13
|
+
const locale = useLocale();
|
|
14
|
+
const [selectInputProps] = splitProps(props, ['ref', 'multiple', 'allowClear', 'class', 'style', 'disabled', 'placeholder', 'status', 'size', 'variant', 'suffixIcon', 'placement', 'getPopupContainer', 'defaultOpen', 'open', 'onOpenChange']);
|
|
15
|
+
const [value, _setValue] = createControllableValue(props, {
|
|
16
|
+
trigger: false
|
|
17
|
+
});
|
|
18
|
+
const setValue = v => {
|
|
19
|
+
_setValue(v);
|
|
20
|
+
props.onChange?.(v, v?.format('YYYY-MM-DD'));
|
|
21
|
+
};
|
|
22
|
+
return createComponent(SelectInput, mergeProps({
|
|
23
|
+
get placeholder() {
|
|
24
|
+
return locale().DatePicker.placeholder;
|
|
25
|
+
}
|
|
26
|
+
}, selectInputProps, {
|
|
27
|
+
get style() {
|
|
28
|
+
return {
|
|
29
|
+
'--ant-select-popup-match-width': undefined,
|
|
30
|
+
// 覆盖掉内部的值
|
|
31
|
+
...selectInputProps.style
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
get value() {
|
|
35
|
+
return value()?.format('YYYY-MM-DD');
|
|
36
|
+
},
|
|
37
|
+
content: close => (() => {
|
|
38
|
+
var _el$ = _tmpl$(),
|
|
39
|
+
_el$2 = _el$.firstChild;
|
|
40
|
+
insert(_el$, createComponent(Panel, mergeProps(props, {
|
|
41
|
+
onChange: date => {
|
|
42
|
+
if (!Array.isArray(date)) {
|
|
43
|
+
setValue(date);
|
|
44
|
+
close();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
})), _el$2);
|
|
48
|
+
insert(_el$2, createComponent(Button, {
|
|
49
|
+
type: "link",
|
|
50
|
+
onClick: () => {
|
|
51
|
+
setValue(dayjs());
|
|
52
|
+
close();
|
|
53
|
+
},
|
|
54
|
+
get children() {
|
|
55
|
+
return locale().DatePicker.today;
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
return _el$;
|
|
59
|
+
})()
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
DatePicker.RangePicker = RangePicker;
|
|
63
|
+
|
|
64
|
+
export { DatePicker as default };
|
package/es/Input/TextArea.js
CHANGED
|
@@ -23,6 +23,7 @@ const TextArea = props => {
|
|
|
23
23
|
const [value, setValue] = createControllableValue(props, {
|
|
24
24
|
trigger: null
|
|
25
25
|
});
|
|
26
|
+
let isComposition = false;
|
|
26
27
|
return createComponent(Element, {
|
|
27
28
|
get ["class"]() {
|
|
28
29
|
return cs(props.rootClass, 'flex');
|
|
@@ -69,8 +70,14 @@ const TextArea = props => {
|
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
},
|
|
73
|
+
"onCompositionStart": () => {
|
|
74
|
+
isComposition = true;
|
|
75
|
+
},
|
|
76
|
+
"onCompositionEnd": () => {
|
|
77
|
+
isComposition = false;
|
|
78
|
+
},
|
|
72
79
|
"onKeyDown": e => {
|
|
73
|
-
if (e.key === 'Enter') {
|
|
80
|
+
if (e.key === 'Enter' && !isComposition) {
|
|
74
81
|
props.onPressEnter?.(e);
|
|
75
82
|
}
|
|
76
83
|
props.onKeyDown?.(e);
|
package/es/Input/index.js
CHANGED
|
@@ -67,6 +67,7 @@ function CommonInput(props) {
|
|
|
67
67
|
const prefix = createMemo(() => props.prefix);
|
|
68
68
|
const suffix = createMemo(() => props.suffix);
|
|
69
69
|
const actions = createMemo(() => props.actions);
|
|
70
|
+
let isComposition = false;
|
|
70
71
|
return createComponent(Element, {
|
|
71
72
|
block: true,
|
|
72
73
|
get ["class"]() {
|
|
@@ -155,8 +156,14 @@ function CommonInput(props) {
|
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
},
|
|
159
|
+
"onCompositionStart": () => {
|
|
160
|
+
isComposition = true;
|
|
161
|
+
},
|
|
162
|
+
"onCompositionEnd": () => {
|
|
163
|
+
isComposition = false;
|
|
164
|
+
},
|
|
158
165
|
"onKeyDown": e => {
|
|
159
|
-
if (e.key === 'Enter') {
|
|
166
|
+
if (e.key === 'Enter' && !isComposition) {
|
|
160
167
|
props.onPressEnter?.(e);
|
|
161
168
|
}
|
|
162
169
|
props.onKeyDown?.(e);
|
package/es/Modal/index.js
CHANGED
|
@@ -178,7 +178,7 @@ const Modal = _props => {
|
|
|
178
178
|
props.onCancel?.();
|
|
179
179
|
},
|
|
180
180
|
get children() {
|
|
181
|
-
return locale().Modal
|
|
181
|
+
return locale().Modal.cancelText;
|
|
182
182
|
}
|
|
183
183
|
}, () => props.cancelButtonProps)), null);
|
|
184
184
|
insert(_el$8, createComponent(Button, mergeProps$1({
|
|
@@ -186,7 +186,7 @@ const Modal = _props => {
|
|
|
186
186
|
loading: "auto",
|
|
187
187
|
onClick: async () => await props.onOk?.(),
|
|
188
188
|
get children() {
|
|
189
|
-
return locale().Modal
|
|
189
|
+
return locale().Modal.okText;
|
|
190
190
|
}
|
|
191
191
|
}, () => props.okButtonProps)), null);
|
|
192
192
|
return _el$8;
|
package/es/Popconfirm/index.d.ts
CHANGED
|
@@ -17,5 +17,9 @@ export interface PopconfirmProps extends Pick<TooltipProps, 'placement' | 'arrow
|
|
|
17
17
|
*/
|
|
18
18
|
cancelText?: string;
|
|
19
19
|
}
|
|
20
|
+
export interface PopconfirmLocale {
|
|
21
|
+
okText: string;
|
|
22
|
+
cancelText: string;
|
|
23
|
+
}
|
|
20
24
|
declare const Popconfirm: Component<PopconfirmProps>;
|
|
21
25
|
export default Popconfirm;
|
package/es/Popconfirm/index.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { createComponent, mergeProps
|
|
2
|
-
import {
|
|
1
|
+
import { createComponent, mergeProps, insert, template } from 'solid-js/web';
|
|
2
|
+
import { splitProps, createSignal, untrack } from 'solid-js';
|
|
3
3
|
import Button from '../Button/index.js';
|
|
4
4
|
import Tooltip from '../Tooltip/index.js';
|
|
5
|
+
import useLocale from '../hooks/useLocale.js';
|
|
5
6
|
|
|
6
7
|
var _tmpl$ = /*#__PURE__*/template(`<div><div class="mb-8px flex items-center"><span class="i-ant-design:exclamation-circle-fill text-#faad14"></span><span class="ml-8px font-600"></span></div><div class="ml-22px mb-8px"></div><div class=text-right>`);
|
|
7
8
|
const Popconfirm = props => {
|
|
8
|
-
const
|
|
9
|
-
okText: '确定',
|
|
10
|
-
cancelText: '取消'
|
|
11
|
-
}, props);
|
|
9
|
+
const locale = useLocale();
|
|
12
10
|
const [tooltipProps] = splitProps(props, ['placement', 'arrow', 'getPopupContainer']);
|
|
13
11
|
const [open, setOpen] = createSignal(false);
|
|
14
|
-
return createComponent(Tooltip, mergeProps
|
|
12
|
+
return createComponent(Tooltip, mergeProps({
|
|
15
13
|
plain: true,
|
|
16
14
|
trigger: "click",
|
|
17
15
|
get open() {
|
|
@@ -25,17 +23,17 @@ const Popconfirm = props => {
|
|
|
25
23
|
_el$4 = _el$3.nextSibling,
|
|
26
24
|
_el$5 = _el$2.nextSibling,
|
|
27
25
|
_el$6 = _el$5.nextSibling;
|
|
28
|
-
insert(_el$4, () =>
|
|
29
|
-
insert(_el$5, () =>
|
|
26
|
+
insert(_el$4, () => props.title);
|
|
27
|
+
insert(_el$5, () => props.content);
|
|
30
28
|
insert(_el$6, createComponent(Button, {
|
|
31
29
|
"class": "ml-8px",
|
|
32
30
|
size: "small",
|
|
33
31
|
onClick: () => {
|
|
34
32
|
setOpen(false);
|
|
35
|
-
untrack(() =>
|
|
33
|
+
untrack(() => props.onCancel?.());
|
|
36
34
|
},
|
|
37
35
|
get children() {
|
|
38
|
-
return
|
|
36
|
+
return props.cancelText ?? locale()?.Popconfirm.cancelText;
|
|
39
37
|
}
|
|
40
38
|
}), null);
|
|
41
39
|
insert(_el$6, createComponent(Button, {
|
|
@@ -44,17 +42,17 @@ const Popconfirm = props => {
|
|
|
44
42
|
size: "small",
|
|
45
43
|
onClick: () => {
|
|
46
44
|
setOpen(false);
|
|
47
|
-
untrack(() =>
|
|
45
|
+
untrack(() => props.onConfirm?.());
|
|
48
46
|
},
|
|
49
47
|
get children() {
|
|
50
|
-
return
|
|
48
|
+
return props.okText ?? locale()?.Popconfirm.okText;
|
|
51
49
|
}
|
|
52
50
|
}), null);
|
|
53
51
|
return _el$;
|
|
54
52
|
})()
|
|
55
53
|
}, tooltipProps, {
|
|
56
54
|
get children() {
|
|
57
|
-
return
|
|
55
|
+
return props.children;
|
|
58
56
|
}
|
|
59
57
|
}));
|
|
60
58
|
};
|
package/es/RangeInput/index.d.ts
CHANGED
package/es/RangeInput/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { delegateEvents, createComponent, use, insert, effect, setAttribute, className,
|
|
1
|
+
import { delegateEvents, createComponent, use, insert, effect, style, setAttribute, className, template } from 'solid-js/web';
|
|
2
2
|
import { useContext, createSignal, createEffect, on, createMemo, Show } from 'solid-js';
|
|
3
3
|
import cs from 'classnames';
|
|
4
4
|
import { compact, isNil } from 'lodash-es';
|
|
@@ -116,7 +116,10 @@ function RangeInput(props) {
|
|
|
116
116
|
tempValue,
|
|
117
117
|
setSingleValue
|
|
118
118
|
}));
|
|
119
|
-
effect(
|
|
119
|
+
effect(_$p => style(_el$8, {
|
|
120
|
+
width: `${width()}px`,
|
|
121
|
+
...props.tooltipContentStyle
|
|
122
|
+
}, _$p));
|
|
120
123
|
return _el$8;
|
|
121
124
|
})(),
|
|
122
125
|
get children() {
|
|
@@ -3,8 +3,8 @@ import { type TooltipProps } from '../Tooltip';
|
|
|
3
3
|
export interface SelectInputProps<T> extends Pick<TooltipProps, 'getPopupContainer' | 'defaultOpen' | 'open' | 'onOpenChange'> {
|
|
4
4
|
ref?: Ref<HTMLDivElement>;
|
|
5
5
|
multiple?: boolean;
|
|
6
|
-
defaultValue?: T[] | null;
|
|
7
|
-
value?: T[] | null;
|
|
6
|
+
defaultValue?: T | T[] | null;
|
|
7
|
+
value?: T | T[] | null;
|
|
8
8
|
onChange?: (value: T[]) => void;
|
|
9
9
|
labelRender?: (value: T) => JSXElement;
|
|
10
10
|
placeholder?: string;
|
package/es/SelectInput/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { delegateEvents, createComponent, use, insert, effect, style, Dynamic, setAttribute, className, template } from 'solid-js/web';
|
|
2
2
|
import { useContext, mergeProps, createMemo, createSignal, Show, For } from 'solid-js';
|
|
3
3
|
import cs from 'classnames';
|
|
4
|
-
import { compact, pick, isUndefined } from 'lodash-es';
|
|
4
|
+
import { isNil, compact, pick, isUndefined } from 'lodash-es';
|
|
5
5
|
import Tooltip from '../Tooltip/index.js';
|
|
6
6
|
import createControllableValue from '../hooks/createControllableValue.js';
|
|
7
7
|
import useClickAway from '../hooks/useClickAway.js';
|
|
@@ -33,7 +33,11 @@ function SelectInput(_props) {
|
|
|
33
33
|
const [value, setValue] = createControllableValue(props, {
|
|
34
34
|
defaultValue: []
|
|
35
35
|
});
|
|
36
|
-
const valueArr = createMemo(() =>
|
|
36
|
+
const valueArr = createMemo(() => {
|
|
37
|
+
const _value = value();
|
|
38
|
+
if (isNil(_value)) return [];
|
|
39
|
+
return Array.isArray(_value) ? _value : [_value];
|
|
40
|
+
});
|
|
37
41
|
const [open, setOpen] = createControllableValue(_props, {
|
|
38
42
|
defaultValue: false,
|
|
39
43
|
defaultValuePropName: 'defaultOpen',
|
package/es/index.d.ts
CHANGED
|
@@ -8,8 +8,10 @@ export { default as Modal } from './Modal';
|
|
|
8
8
|
export type { ModalProps } from './Modal';
|
|
9
9
|
export { default as Drawer } from './Drawer';
|
|
10
10
|
export type { DrawerProps } from './Drawer';
|
|
11
|
-
export
|
|
11
|
+
export { default as DatePicker } from './DatePicker';
|
|
12
|
+
export type { DatePickerProps } from './DatePicker';
|
|
12
13
|
export { default as RangeInput } from './RangeInput';
|
|
14
|
+
export type { RangeInputProps } from './RangeInput';
|
|
13
15
|
export type { SelectInputProps } from './SelectInput';
|
|
14
16
|
export { default as SelectInput } from './SelectInput';
|
|
15
17
|
export { default as Select } from './Select';
|
package/es/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { default as InputNumber } from './InputNumber/index.js';
|
|
|
4
4
|
export { default as Timeline } from './Timeline/index.js';
|
|
5
5
|
export { default as Modal } from './Modal/index.js';
|
|
6
6
|
export { default as Drawer } from './Drawer/index.js';
|
|
7
|
+
export { default as DatePicker } from './DatePicker/index.js';
|
|
7
8
|
export { default as RangeInput } from './RangeInput/index.js';
|
|
8
9
|
export { default as SelectInput } from './SelectInput/index.js';
|
|
9
10
|
export { default as Select } from './Select/index.js';
|
package/es/locale/en_US.js
CHANGED
|
@@ -3,6 +3,21 @@ const locale = {
|
|
|
3
3
|
Modal: {
|
|
4
4
|
okText: 'OK',
|
|
5
5
|
cancelText: 'Cancel'
|
|
6
|
+
},
|
|
7
|
+
Popconfirm: {
|
|
8
|
+
okText: 'OK',
|
|
9
|
+
cancelText: 'Cancel'
|
|
10
|
+
},
|
|
11
|
+
DatePicker: {
|
|
12
|
+
placeholder: 'Please enter the date',
|
|
13
|
+
today: 'Today',
|
|
14
|
+
Mon: 'Mon',
|
|
15
|
+
Tue: 'Tue',
|
|
16
|
+
Wed: 'Wed',
|
|
17
|
+
Thu: 'Thu',
|
|
18
|
+
Fri: 'Fri',
|
|
19
|
+
Sat: 'Sat',
|
|
20
|
+
Sun: 'Sun'
|
|
6
21
|
}
|
|
7
22
|
};
|
|
8
23
|
|
package/es/locale/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { type DatePickerLocale } from '../DatePicker';
|
|
1
2
|
import { type ModalLocale } from '../Modal';
|
|
3
|
+
import { type PopconfirmLocale } from '../Popconfirm';
|
|
2
4
|
export interface Locale {
|
|
3
5
|
locale: string;
|
|
4
|
-
Modal
|
|
6
|
+
Modal: ModalLocale;
|
|
7
|
+
Popconfirm: PopconfirmLocale;
|
|
8
|
+
DatePicker: DatePickerLocale;
|
|
5
9
|
}
|
package/es/locale/zh_CN.js
CHANGED
|
@@ -3,6 +3,21 @@ const locale = {
|
|
|
3
3
|
Modal: {
|
|
4
4
|
okText: '确定',
|
|
5
5
|
cancelText: '取消'
|
|
6
|
+
},
|
|
7
|
+
Popconfirm: {
|
|
8
|
+
okText: '确定',
|
|
9
|
+
cancelText: '取消'
|
|
10
|
+
},
|
|
11
|
+
DatePicker: {
|
|
12
|
+
placeholder: '请输入日期',
|
|
13
|
+
today: '今天',
|
|
14
|
+
Mon: '一',
|
|
15
|
+
Tue: '二',
|
|
16
|
+
Wed: '三',
|
|
17
|
+
Thu: '四',
|
|
18
|
+
Fri: '五',
|
|
19
|
+
Sat: '六',
|
|
20
|
+
Sun: '日'
|
|
6
21
|
}
|
|
7
22
|
};
|
|
8
23
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-solid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.esm.js",
|
|
6
|
-
"module": "
|
|
7
|
-
"types": "
|
|
6
|
+
"module": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
8
|
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"docs:dev": "vitepress dev docs",
|
|
11
|
+
"docs:build": "node scripts/annotationNonProductionCode && vitepress build docs && node scripts/cancelAnnotationNonProductionCode",
|
|
12
|
+
"docs:preview": "vitepress preview docs",
|
|
13
|
+
"build": "rm -rf dist && rm -rf es && rm -rf css && NODE_ENV=production && npx rollup -c && npm run build:unocss",
|
|
14
|
+
"build:unocss": "npx unocss './src/**' -o css/index.css -m",
|
|
15
|
+
"test": "vitest",
|
|
16
|
+
"prepare": "husky install"
|
|
17
|
+
},
|
|
9
18
|
"devDependencies": {
|
|
10
19
|
"@iconify-json/ant-design": "^1.1.5",
|
|
11
20
|
"@rollup/plugin-babel": "^6.0.3",
|
|
@@ -53,6 +62,7 @@
|
|
|
53
62
|
"@ant-design/colors": "^7.0.2",
|
|
54
63
|
"@ctrl/tinycolor": "^4.1.0",
|
|
55
64
|
"classnames": "^2.3.2",
|
|
65
|
+
"dayjs": "^1.11.19",
|
|
56
66
|
"lodash-es": "^4.17.21",
|
|
57
67
|
"nanoid": "^5.0.1",
|
|
58
68
|
"number-precision": "^1.6.0",
|
|
@@ -71,13 +81,5 @@
|
|
|
71
81
|
"dist",
|
|
72
82
|
"es",
|
|
73
83
|
"css"
|
|
74
|
-
]
|
|
75
|
-
|
|
76
|
-
"docs:dev": "vitepress dev docs",
|
|
77
|
-
"docs:build": "node scripts/annotationNonProductionCode && vitepress build docs && node scripts/cancelAnnotationNonProductionCode",
|
|
78
|
-
"docs:preview": "vitepress preview docs",
|
|
79
|
-
"build": "rm -rf dist && rm -rf es && rm -rf css && NODE_ENV=production && npx rollup -c && npm run build:unocss",
|
|
80
|
-
"build:unocss": "npx unocss './src/**' -o css/index.css -m",
|
|
81
|
-
"test": "vitest"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
+
]
|
|
85
|
+
}
|