antd-solid 0.0.16 → 0.0.18

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 (68) hide show
  1. package/css/index.css +1 -1
  2. package/dist/index.esm.js +64 -18
  3. package/dist/index.umd.js +1 -1
  4. package/es/Button/index.js +7 -25
  5. package/es/Checkbox/Group.js +2 -2
  6. package/es/Checkbox/index.js +13 -26
  7. package/es/CodeInput/index.js +0 -3
  8. package/es/Collapse/Item.js +8 -50
  9. package/es/Collapse/index.js +3 -5
  10. package/es/ColorPicker/ColorPickerInput.js +210 -224
  11. package/es/ColorPicker/ColorPickerSelect.js +4 -61
  12. package/es/ColorPicker/ColorPickerSlider.js +67 -100
  13. package/es/ColorPicker/index.js +16 -62
  14. package/es/Command/createCommand.d.ts +1 -1
  15. package/es/ContextMenu/index.js +1 -5
  16. package/es/Cursor/index.js +3 -15
  17. package/es/Divider/index.js +3 -12
  18. package/es/Drawer/index.js +42 -83
  19. package/es/Element/index.js +6 -2
  20. package/es/Empty/PRESENTED_IMAGE_SIMPLE.js +4 -12
  21. package/es/Empty/assets/EmptySvg.js +3 -3
  22. package/es/Empty/assets/SimpleEmptySvg.js +3 -3
  23. package/es/Empty/index.js +4 -12
  24. package/es/Form/FormItem.js +47 -76
  25. package/es/Fragment/index.js +1 -3
  26. package/es/Image/index.js +11 -31
  27. package/es/Input/TextArea.js +5 -31
  28. package/es/Input/index.js +46 -103
  29. package/es/InputNumber/index.js +4 -11
  30. package/es/Menu/InternalMenu.js +37 -93
  31. package/es/Message/Message.js +7 -11
  32. package/es/Modal/index.js +55 -107
  33. package/es/Modal/useModal.js +5 -14
  34. package/es/Modal/warning.js +5 -14
  35. package/es/Popconfirm/index.js +24 -36
  36. package/es/Popover/index.js +11 -20
  37. package/es/Progress/Circle.js +14 -63
  38. package/es/Progress/index.js +14 -38
  39. package/es/Radio/Button.js +4 -20
  40. package/es/Radio/index.js +5 -35
  41. package/es/RangeInput/index.js +22 -76
  42. package/es/Result/index.js +6 -27
  43. package/es/Segmented/index.js +13 -33
  44. package/es/Select/index.js +6 -35
  45. package/es/SelectInput/index.js +48 -112
  46. package/es/Slider/index.js +11 -84
  47. package/es/Space/index.js +2 -2
  48. package/es/Spin/index.js +14 -26
  49. package/es/Switch/index.js +4 -6
  50. package/es/Table/index.js +18 -40
  51. package/es/Tabs/index.js +91 -195
  52. package/es/Timeline/index.js +4 -14
  53. package/es/Tooltip/index.js +20 -48
  54. package/es/Transformer/index.js +59 -123
  55. package/es/Tree/SingleLevelTree.js +30 -191
  56. package/es/TreeFor/index.js +3 -3
  57. package/es/TreeSelect/index.js +4 -6
  58. package/es/Upload/index.js +4 -38
  59. package/es/assets/svg/ColorPickUp.js +6 -19
  60. package/es/assets/svg/Crosshair.js +6 -45
  61. package/es/assets/svg/Resize.js +6 -19
  62. package/es/assets/svg/Rotate.js +13 -14
  63. package/es/assets/svg/RotateArrow.js +20 -15
  64. package/es/hooks/useClickAway.js +6 -4
  65. package/es/utils/DOMRect.d.ts +22 -0
  66. package/es/utils/DOMRect.js +41 -0
  67. package/package.json +14 -15
  68. package/src/index.ts +102 -0
@@ -1,6 +1,6 @@
1
- import { template } from 'solid-js/web';
1
+ import { ssr, ssrHydrationKey } from 'solid-js/web';
2
2
 
3
- var _tmpl$ = /*#__PURE__*/template(`<svg width=184 height=100 viewBox="0 0 184 152"xmlns=http://www.w3.org/2000/svg><g fill=none fill-rule=evenodd><g transform="translate(24 31.67)"><ellipse fill-opacity=.8 fill=#F5F5F7 cx=67.797 cy=106.89 rx=67.797 ry=12.668></ellipse><path d="M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z"fill=#AEB8C2></path><path d="M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z"fill=url(#linearGradient-1) transform=translate(13.56)></path><path d="M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z"fill=#F5F5F7></path><path d="M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z"fill=#DCE0E6></path></g><path d="M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z"fill=#DCE0E6></path><g transform="translate(149.65 15.383)"fill=#FFF><ellipse cx=20.654 cy=3.167 rx=2.849 ry=2.815></ellipse><path d="M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z">`);
4
- const EmptySvg = () => _tmpl$();
3
+ var _tmpl$ = ["<svg", " width=\"184\" height=\"100\" viewBox=\"0 0 184 152\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"none\" fill-rule=\"evenodd\"><g transform=\"translate(24 31.67)\"><ellipse fill-opacity=\".8\" fill=\"#F5F5F7\" cx=\"67.797\" cy=\"106.89\" rx=\"67.797\" ry=\"12.668\"></ellipse><path d=\"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z\" fill=\"#AEB8C2\"></path><path d=\"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z\" fill=\"url(#linearGradient-1)\" transform=\"translate(13.56)\"></path><path d=\"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z\" fill=\"#F5F5F7\"></path><path d=\"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z\" fill=\"#DCE0E6\"></path></g><path d=\"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z\" fill=\"#DCE0E6\"></path><g transform=\"translate(149.65 15.383)\" fill=\"#FFF\"><ellipse cx=\"20.654\" cy=\"3.167\" rx=\"2.849\" ry=\"2.815\"></ellipse><path d=\"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z\"></path></g></g></svg>"];
4
+ const EmptySvg = () => ssr(_tmpl$, ssrHydrationKey());
5
5
 
6
6
  export { EmptySvg as default };
@@ -1,6 +1,6 @@
1
- import { template } from 'solid-js/web';
1
+ import { ssr, ssrHydrationKey } from 'solid-js/web';
2
2
 
3
- var _tmpl$ = /*#__PURE__*/template(`<svg width=64 height=41 viewBox="0 0 64 41"xmlns=http://www.w3.org/2000/svg><g transform="translate(0 1)"fill=none fill-rule=evenodd><ellipse fill=#f5f5f5 cx=32 cy=33 rx=32 ry=7></ellipse><g fill-rule=nonzero stroke=#d9d9d9><path d="M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"></path><path d="M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z"fill=#fafafa>`);
4
- const EmptySvg = () => _tmpl$();
3
+ var _tmpl$ = ["<svg", " width=\"64\" height=\"41\" viewBox=\"0 0 64 41\" xmlns=\"http://www.w3.org/2000/svg\"><g transform=\"translate(0 1)\" fill=\"none\" fill-rule=\"evenodd\"><ellipse fill=\"#f5f5f5\" cx=\"32\" cy=\"33\" rx=\"32\" ry=\"7\"></ellipse><g fill-rule=\"nonzero\" stroke=\"#d9d9d9\"><path d=\"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z\"></path><path d=\"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z\" fill=\"#fafafa\"></path></g></g></svg>"];
4
+ const EmptySvg = () => ssr(_tmpl$, ssrHydrationKey());
5
5
 
6
6
  export { EmptySvg as default };
package/es/Empty/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { createComponent, insert, template } from 'solid-js/web';
1
+ import { createComponent, ssr, ssrHydrationKey, escape } from 'solid-js/web';
2
2
  import PRESENTED_IMAGE_SIMPLE from './PRESENTED_IMAGE_SIMPLE.js';
3
3
  import EmptySvg from './assets/EmptySvg.js';
4
4
  import Element from '../Element/index.js';
5
5
 
6
- var _tmpl$ = /*#__PURE__*/template(`<div class="mb-[var(--ant-margin-xs)] flex justify-center">`),
7
- _tmpl$2 = /*#__PURE__*/template(`<div class="text-[var(--ant-color-text)] text-center">`);
6
+ var _tmpl$ = ["<div", " class=\"mb-[var(--ant-margin-xs)] flex justify-center\">", "</div>"],
7
+ _tmpl$2 = ["<div", " class=\"text-[var(--ant-color-text)] text-center\">", "</div>"];
8
8
  const Empty = props => {
9
9
  return createComponent(Element, {
10
10
  get ["class"]() {
@@ -14,15 +14,7 @@ const Empty = props => {
14
14
  return props.style;
15
15
  },
16
16
  get children() {
17
- return [(() => {
18
- var _el$ = _tmpl$();
19
- insert(_el$, createComponent(EmptySvg, {}));
20
- return _el$;
21
- })(), (() => {
22
- var _el$2 = _tmpl$2();
23
- insert(_el$2, () => props.description ?? '暂无数据');
24
- return _el$2;
25
- })()];
17
+ return [ssr(_tmpl$, ssrHydrationKey(), escape(createComponent(EmptySvg, {}))), ssr(_tmpl$2, ssrHydrationKey(), escape(props.description) ?? '暂无数据')];
26
18
  }
27
19
  });
28
20
  };
@@ -1,4 +1,4 @@
1
- import { createComponent, use, insert, effect, className, Dynamic, memo, template } from 'solid-js/web';
1
+ import { createComponent, ssr, ssrHydrationKey, escape, ssrAttribute, Dynamic } from 'solid-js/web';
2
2
  import { useContext, createSignal, createEffect, onCleanup, on, Show } from 'solid-js';
3
3
  import { set, unset, isNil } from 'lodash-es';
4
4
  import { nanoid } from 'nanoid';
@@ -6,11 +6,11 @@ import cs from 'classnames';
6
6
  import FormContext from './context.js';
7
7
  import Element from '../Element/index.js';
8
8
 
9
- var _tmpl$ = /*#__PURE__*/template(`<label class=mr-4px>`),
10
- _tmpl$2 = /*#__PURE__*/template(`<span class=text-[var(--ant-color-error)]>*`),
11
- _tmpl$3 = /*#__PURE__*/template(`<div class="flex items-center"><label>`),
12
- _tmpl$4 = /*#__PURE__*/template(`<div class="absolute top-[100%] text-[var(--ant-color-error)]">`),
13
- _tmpl$5 = /*#__PURE__*/template(`<div class="flex flex-col relative flex-grow-1"><div>`);
9
+ var _tmpl$ = ["<label", " class=\"mr-4px\">", "</label>"],
10
+ _tmpl$2 = ["<span", " class=\"text-[var(--ant-color-error)]\">*</span>"],
11
+ _tmpl$3 = ["<div", " class=\"flex items-center\" style=\"", "\"><label", "><!--$-->", "<!--/--><!--$-->", "<!--/--></label></div>"],
12
+ _tmpl$4 = ["<div", " class=\"absolute top-[100%] text-[var(--ant-color-error)]\">", "</div>"],
13
+ _tmpl$5 = ["<div", " class=\"flex flex-col relative flex-grow-1\" style=\"", "\"><div>", "</div><!--$-->", "<!--/--></div>"];
14
14
  const FormItem = props => {
15
15
  const {
16
16
  formInstance,
@@ -69,77 +69,48 @@ const FormItem = props => {
69
69
  return props.style;
70
70
  },
71
71
  get children() {
72
- return [(() => {
73
- var _el$ = _tmpl$3(),
74
- _el$2 = _el$.firstChild;
75
- var _ref$ = label;
76
- typeof _ref$ === "function" ? use(_ref$, _el$2) : label = _el$2;
77
- insert(_el$2, createComponent(Show, {
78
- get when() {
79
- return !isNil(props.label);
80
- },
81
- get children() {
82
- var _el$3 = _tmpl$();
83
- insert(_el$3, () => props.label);
84
- return _el$3;
85
- }
86
- }), null);
87
- insert(_el$2, createComponent(Show, {
88
- get when() {
89
- return !isNil(props.required);
90
- },
91
- get children() {
92
- return _tmpl$2();
93
- }
94
- }), null);
95
- effect(_p$ => {
96
- var _v$ = layout() === 'horizontal' && maxItemWidth ? `${maxItemWidth() ?? 0}px` : undefined,
97
- _v$2 = cs('shrink-0 leading-32px not[:empty]:h-32px not[:empty]:pr-8px text-right [white-space:nowrap]');
98
- _v$ !== _p$.e && ((_p$.e = _v$) != null ? _el$.style.setProperty("width", _v$) : _el$.style.removeProperty("width"));
99
- _v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
100
- return _p$;
101
- }, {
102
- e: undefined,
103
- t: undefined
104
- });
105
- return _el$;
106
- })(), (() => {
107
- var _el$5 = _tmpl$5(),
108
- _el$6 = _el$5.firstChild;
109
- insert(_el$6, createComponent(Dynamic, {
110
- get component() {
111
- return props.component;
112
- },
113
- get value() {
114
- return memo(() => !!props.name)() ? formInstance?.getFieldValue(props.name) : undefined;
115
- },
116
- get status() {
117
- return errMsg() ? 'error' : undefined;
118
- },
119
- onChange: value => {
120
- if (!isNil(props.name)) formInstance?.setFieldValue(props.name, value);
121
- props.rules?.forEach(rule => {
122
- rule.validate(value).then(() => {
123
- setErrMsg('');
124
- }).catch(err => {
125
- setErrMsg(err.message);
126
- });
72
+ return [ssr(_tmpl$3, ssrHydrationKey(), "width:" + (layout() === 'horizontal' && maxItemWidth ? `${escape(maxItemWidth(), true) ?? 0}px` : escape(undefined, true)), ssrAttribute("class", escape(cs('shrink-0 leading-32px not[:empty]:h-32px not[:empty]:pr-8px text-right [white-space:nowrap]'), true), false), escape(createComponent(Show, {
73
+ get when() {
74
+ return !isNil(props.label);
75
+ },
76
+ get children() {
77
+ return ssr(_tmpl$, ssrHydrationKey(), escape(props.label));
78
+ }
79
+ })), escape(createComponent(Show, {
80
+ get when() {
81
+ return !isNil(props.required);
82
+ },
83
+ get children() {
84
+ return ssr(_tmpl$2, ssrHydrationKey());
85
+ }
86
+ }))), ssr(_tmpl$5, ssrHydrationKey(), "width:" + (layout() === 'horizontal' && maxItemWidth ? `calc(100% - ${escape(maxItemWidth(), true) ?? 0}px)` : escape(undefined, true)), escape(createComponent(Dynamic, {
87
+ get component() {
88
+ return props.component;
89
+ },
90
+ get value() {
91
+ return props.name ? formInstance?.getFieldValue(props.name) : undefined;
92
+ },
93
+ get status() {
94
+ return errMsg() ? 'error' : undefined;
95
+ },
96
+ onChange: value => {
97
+ if (!isNil(props.name)) formInstance?.setFieldValue(props.name, value);
98
+ props.rules?.forEach(rule => {
99
+ rule.validate(value).then(() => {
100
+ setErrMsg('');
101
+ }).catch(err => {
102
+ setErrMsg(err.message);
127
103
  });
128
- }
129
- }));
130
- insert(_el$5, createComponent(Show, {
131
- get when() {
132
- return errMsg();
133
- },
134
- get children() {
135
- var _el$7 = _tmpl$4();
136
- insert(_el$7, errMsg);
137
- return _el$7;
138
- }
139
- }), null);
140
- effect(() => (layout() === 'horizontal' && maxItemWidth ? `calc(100% - ${maxItemWidth() ?? 0}px)` : undefined) != null ? _el$5.style.setProperty("width", layout() === 'horizontal' && maxItemWidth ? `calc(100% - ${maxItemWidth() ?? 0}px)` : undefined) : _el$5.style.removeProperty("width"));
141
- return _el$5;
142
- })()];
104
+ });
105
+ }
106
+ })), escape(createComponent(Show, {
107
+ get when() {
108
+ return errMsg();
109
+ },
110
+ get children() {
111
+ return ssr(_tmpl$4, ssrHydrationKey(), escape(errMsg()));
112
+ }
113
+ })))];
143
114
  }
144
115
  });
145
116
  }
@@ -1,7 +1,5 @@
1
- import { memo } from 'solid-js/web';
2
-
3
1
  const Fragment = props => {
4
- return memo(() => props.children);
2
+ return props.children;
5
3
  };
6
4
 
7
5
  export { Fragment as default };
package/es/Image/index.js CHANGED
@@ -1,37 +1,17 @@
1
- import { spread, mergeProps, effect, className, style, template } from 'solid-js/web';
1
+ import { ssr, ssrHydrationKey, ssrAttribute, escape, ssrStyle, ssrElement, mergeProps } from 'solid-js/web';
2
2
  import cs from 'classnames';
3
3
 
4
- var _tmpl$ = /*#__PURE__*/template(`<div><img>`);
4
+ var _tmpl$ = ["<div", " style=\"", "\">", "</div>"];
5
5
  const Image = props => {
6
- return (() => {
7
- var _el$ = _tmpl$(),
8
- _el$2 = _el$.firstChild;
9
- spread(_el$2, mergeProps(props, {
10
- get src() {
11
- return props.src ? props.src : props.fallback;
12
- },
13
- "onError": e => {
14
- if (props.fallback) {
15
- e.currentTarget.src = props.fallback;
16
- }
17
- }
18
- }), false, false);
19
- effect(_p$ => {
20
- var _v$ = cs(props.rootClass, 'inline-block'),
21
- _v$2 = {
22
- width: typeof props.width === 'string' ? props.width : undefined,
23
- height: typeof props.height === 'string' ? props.height : undefined,
24
- ...props.rootStyle
25
- };
26
- _v$ !== _p$.e && className(_el$, _p$.e = _v$);
27
- _p$.t = style(_el$, _v$2, _p$.t);
28
- return _p$;
29
- }, {
30
- e: undefined,
31
- t: undefined
32
- });
33
- return _el$;
34
- })();
6
+ return ssr(_tmpl$, ssrHydrationKey() + ssrAttribute("class", escape(cs(props.rootClass, 'inline-block'), true), false), ssrStyle({
7
+ width: typeof props.width === 'string' ? props.width : undefined,
8
+ height: typeof props.height === 'string' ? props.height : undefined,
9
+ ...props.rootStyle
10
+ }), ssrElement("img", mergeProps(props, {
11
+ get src() {
12
+ return props.src ? props.src : props.fallback;
13
+ }
14
+ }), undefined, false));
35
15
  };
36
16
 
37
17
  export { Image as default };
@@ -1,4 +1,4 @@
1
- import { createComponent, use, spread, mergeProps, template } from 'solid-js/web';
1
+ import { createComponent, ssrElement, mergeProps } from 'solid-js/web';
2
2
  import { splitProps, onMount } from 'solid-js';
3
3
  import cs from 'classnames';
4
4
  import Element from '../Element/index.js';
@@ -6,20 +6,16 @@ import createControllableValue from '../hooks/createControllableValue.js';
6
6
  import useComponentSize from '../hooks/useComponentSize.js';
7
7
  import { statusClassDict } from './index.js';
8
8
  import useFocus from '../hooks/useFocus.js';
9
- import { setRef } from '../utils/solid.js';
9
+ import 'lodash-es';
10
10
 
11
- var _tmpl$ = /*#__PURE__*/template(`<textarea>`);
12
11
  const TextArea = props => {
13
12
  const size = useComponentSize(() => props.size);
14
13
  const [_, inputProps] = splitProps(props, ['defaultValue', 'value', 'onChange', 'onPressEnter', 'onKeyDown', 'size', 'autoFocus', 'status']);
15
14
  let inputRef;
16
15
  const foucs = useFocus(() => inputRef);
17
16
  onMount(() => {
18
- if (props.autoFocus) {
19
- inputRef?.focus();
20
- }
17
+ if (props.autoFocus) ;
21
18
  });
22
- const isControlled = () => Object.keys(props).includes('value');
23
19
  const [value, setValue] = createControllableValue(props, {
24
20
  trigger: null
25
21
  });
@@ -43,12 +39,7 @@ const TextArea = props => {
43
39
  };
44
40
  },
45
41
  get children() {
46
- var _el$ = _tmpl$();
47
- use(el => {
48
- setRef(props, el);
49
- inputRef = el;
50
- }, _el$);
51
- spread(_el$, mergeProps(inputProps, {
42
+ return ssrElement("textarea", mergeProps(inputProps, {
52
43
  get ["class"]() {
53
44
  return cs('p-[--ant-input-padding] border-1px border-solid bg-[--ant-color-bg-container]', 'w-full h-full [font-size:var(--ant-input-font-size)] [outline:none] placeholder-text-[var(--ant-color-text-placeholder)]', props.disabled && 'color-[var(--ant-color-text-disabled)] cursor-not-allowed', {
54
45
  small: 'rounded-[var(--ant-border-radius-sm)]',
@@ -58,25 +49,8 @@ const TextArea = props => {
58
49
  },
59
50
  get value() {
60
51
  return value() ?? '';
61
- },
62
- "onInput": e => {
63
- setValue(e.target.value);
64
- try {
65
- props.onChange?.(e);
66
- } finally {
67
- if (isControlled() && e.target.value !== props.value) {
68
- e.target.value = props.value ?? '';
69
- }
70
- }
71
- },
72
- "onKeyDown": e => {
73
- if (e.key === 'Enter') {
74
- props.onPressEnter?.(e);
75
- }
76
- props.onKeyDown?.(e);
77
52
  }
78
- }), false, false);
79
- return _el$;
53
+ }), undefined, true);
80
54
  }
81
55
  });
82
56
  };
package/es/Input/index.js CHANGED
@@ -1,9 +1,8 @@
1
- import { delegateEvents, createComponent, insert, effect, className, use, spread, mergeProps, template } from 'solid-js/web';
1
+ import { createComponent, ssr, ssrHydrationKey, ssrAttribute, escape, ssrElement, mergeProps } from 'solid-js/web';
2
2
  import { isNil, omit } from 'lodash-es';
3
3
  import { useContext, splitProps, onMount, createMemo, Show } from 'solid-js';
4
4
  import cs from 'classnames';
5
5
  import createControllableValue from '../hooks/createControllableValue.js';
6
- import { setRef } from '../utils/solid.js';
7
6
  import Element from '../Element/index.js';
8
7
  import TextArea from './TextArea.js';
9
8
  import useComponentSize from '../hooks/useComponentSize.js';
@@ -11,12 +10,12 @@ import './index.scss.js';
11
10
  import useFocus from '../hooks/useFocus.js';
12
11
  import CompactContext from '../Compact/context.js';
13
12
 
14
- var _tmpl$ = /*#__PURE__*/template(`<div>`),
15
- _tmpl$2 = /*#__PURE__*/template(`<div class=mr-4px>`),
16
- _tmpl$3 = /*#__PURE__*/template(`<span class="ml-4px i-ant-design:close-circle-filled cursor-pointer text-[var(--ant-color-text-quaternary)] hover:text-[var(--ant-color-text-tertiary)] active:text-[var(--ant-color-text)]">`),
17
- _tmpl$4 = /*#__PURE__*/template(`<div class=ml-4px>`),
18
- _tmpl$5 = /*#__PURE__*/template(`<div class="[display:var(--actions-display)] absolute top-0 bottom-0 right-0 h-[calc(100%-2px)] translate-y-1px -translate-x-1px">`),
19
- _tmpl$6 = /*#__PURE__*/template(`<div><input>`);
13
+ var _tmpl$ = ["<div", ">", "</div>"],
14
+ _tmpl$2 = ["<div", " class=\"mr-4px\">", "</div>"],
15
+ _tmpl$3 = ["<span", " class=\"ml-4px i-ant-design:close-circle-filled cursor-pointer text-[var(--ant-color-text-quaternary)] hover:text-[var(--ant-color-text-tertiary)] active:text-[var(--ant-color-text)]\"></span>"],
16
+ _tmpl$4 = ["<div", " class=\"ml-4px\">", "</div>"],
17
+ _tmpl$5 = ["<div", " class=\"[display:var(--actions-display)] absolute top-0 bottom-0 right-0 h-[calc(100%-2px)] translate-y-1px -translate-x-1px\">", "</div>"],
18
+ _tmpl$6 = ["<div", "><!--$-->", "<!--/-->", "<!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div>"];
20
19
  const statusClassDict = {
21
20
  default: (disabled, foucs) => {
22
21
  if (disabled) {
@@ -55,11 +54,8 @@ function CommonInput(props) {
55
54
  let inputRef;
56
55
  const foucs = useFocus(() => inputRef);
57
56
  onMount(() => {
58
- if (props.autoFocus) {
59
- inputRef?.focus();
60
- }
57
+ if (props.autoFocus) ;
61
58
  });
62
- const isControlled = () => Object.keys(props).includes('value');
63
59
  const [value, setValue] = createControllableValue(props, {
64
60
  trigger: null
65
61
  });
@@ -104,101 +100,49 @@ function CommonInput(props) {
104
100
  return !isNil(addonBefore());
105
101
  },
106
102
  get children() {
107
- var _el$ = _tmpl$();
108
- insert(_el$, addonBefore);
109
- effect(() => className(_el$, cs('ant-input-addon', 'shrink-0 flex justify-center items-center px-11px bg-[rgba(0,0,0,.02)] [border:1px_solid_var(--ant-color-border)] border-r-0')));
110
- return _el$;
103
+ return ssr(_tmpl$, ssrHydrationKey() + ssrAttribute("class", escape(cs('ant-input-addon', 'shrink-0 flex justify-center items-center px-11px bg-[rgba(0,0,0,.02)] [border:1px_solid_var(--ant-color-border)] border-r-0'), true), false), escape(addonBefore()));
104
+ }
105
+ }), ssr(_tmpl$6, ssrHydrationKey() + ssrAttribute("class", escape(cs('ant-input-affix-wrapper', 'flex items-center w-full relative p:hover-child[input]:border-[--ant-color-primary] bg-[--ant-color-bg-container] p-[--ant-input-padding] border-1px border-solid', ['[--actions-display:none]', !props.disabled && 'hover:[--actions-display:block]'], statusClassDict[props.status ?? 'default'](!!props.disabled, foucs())), true), false), escape(createComponent(Show, {
106
+ get when() {
107
+ return !isNil(prefix());
108
+ },
109
+ get children() {
110
+ return ssr(_tmpl$2, ssrHydrationKey(), escape(prefix()));
111
+ }
112
+ })), ssrElement("input", mergeProps(inputProps, {
113
+ get ["class"]() {
114
+ return cs('w-full h-full [font-size:var(--ant-input-font-size)] [outline:none] placeholder-text-[var(--ant-color-text-placeholder)] bg-transparent', props.disabled && 'color-[var(--ant-color-text-disabled)] cursor-not-allowed', props.class);
115
+ },
116
+ get value() {
117
+ return value() ?? '';
118
+ }
119
+ }), undefined, false), escape(createComponent(Show, {
120
+ get when() {
121
+ return showClearBtn();
122
+ },
123
+ get children() {
124
+ return ssr(_tmpl$3, ssrHydrationKey());
125
+ }
126
+ })), escape(createComponent(Show, {
127
+ get when() {
128
+ return !isNil(suffix());
129
+ },
130
+ get children() {
131
+ return ssr(_tmpl$4, ssrHydrationKey(), escape(suffix()));
132
+ }
133
+ })), escape(createComponent(Show, {
134
+ get when() {
135
+ return !isNil(actions());
136
+ },
137
+ get children() {
138
+ return ssr(_tmpl$5, ssrHydrationKey(), escape(actions()));
111
139
  }
112
- }), (() => {
113
- var _el$2 = _tmpl$6(),
114
- _el$4 = _el$2.firstChild;
115
- insert(_el$2, createComponent(Show, {
116
- get when() {
117
- return !isNil(prefix());
118
- },
119
- get children() {
120
- var _el$3 = _tmpl$2();
121
- insert(_el$3, prefix);
122
- return _el$3;
123
- }
124
- }), _el$4);
125
- use(el => {
126
- setRef(props, el);
127
- inputRef = el;
128
- }, _el$4);
129
- spread(_el$4, mergeProps(inputProps, {
130
- get ["class"]() {
131
- return cs('w-full h-full [font-size:var(--ant-input-font-size)] [outline:none] placeholder-text-[var(--ant-color-text-placeholder)] bg-transparent', props.disabled && 'color-[var(--ant-color-text-disabled)] cursor-not-allowed', props.class);
132
- },
133
- get value() {
134
- return value() ?? '';
135
- },
136
- "onInput": e => {
137
- setValue(e.target.value);
138
- try {
139
- props.onChange?.(e);
140
- } finally {
141
- if (isControlled() && e.target.value !== props.value) {
142
- e.target.value = props.value ?? '';
143
- }
144
- }
145
- },
146
- "onKeyDown": e => {
147
- if (e.key === 'Enter') {
148
- props.onPressEnter?.(e);
149
- }
150
- props.onKeyDown?.(e);
151
- }
152
- }), false, false);
153
- insert(_el$2, createComponent(Show, {
154
- get when() {
155
- return showClearBtn();
156
- },
157
- get children() {
158
- var _el$5 = _tmpl$3();
159
- _el$5.$$click = e => {
160
- e.stopPropagation();
161
- inputRef.value = '';
162
- const inputEvent = new InputEvent('input', {
163
- bubbles: true
164
- });
165
- inputRef.dispatchEvent(inputEvent);
166
- inputRef?.focus();
167
- };
168
- return _el$5;
169
- }
170
- }), null);
171
- insert(_el$2, createComponent(Show, {
172
- get when() {
173
- return !isNil(suffix());
174
- },
175
- get children() {
176
- var _el$6 = _tmpl$4();
177
- insert(_el$6, suffix);
178
- return _el$6;
179
- }
180
- }), null);
181
- insert(_el$2, createComponent(Show, {
182
- get when() {
183
- return !isNil(actions());
184
- },
185
- get children() {
186
- var _el$7 = _tmpl$5();
187
- insert(_el$7, actions);
188
- return _el$7;
189
- }
190
- }), null);
191
- effect(() => className(_el$2, cs('ant-input-affix-wrapper', 'flex items-center w-full relative p:hover-child[input]:border-[--ant-color-primary] bg-[--ant-color-bg-container] p-[--ant-input-padding] border-1px border-solid', ['[--actions-display:none]', !props.disabled && 'hover:[--actions-display:block]'], statusClassDict[props.status ?? 'default'](!!props.disabled, foucs()))));
192
- return _el$2;
193
- })(), createComponent(Show, {
140
+ }))), createComponent(Show, {
194
141
  get when() {
195
142
  return !isNil(addonAfter());
196
143
  },
197
144
  get children() {
198
- var _el$8 = _tmpl$();
199
- insert(_el$8, addonAfter);
200
- effect(() => className(_el$8, cs('ant-input-addon', 'shrink-0 flex justify-center items-center px-11px bg-[rgba(0,0,0,.02)] [border:1px_solid_var(--ant-color-border)] border-l-0')));
201
- return _el$8;
145
+ return ssr(_tmpl$, ssrHydrationKey() + ssrAttribute("class", escape(cs('ant-input-addon', 'shrink-0 flex justify-center items-center px-11px bg-[rgba(0,0,0,.02)] [border:1px_solid_var(--ant-color-border)] border-l-0'), true), false), escape(addonAfter()));
202
146
  }
203
147
  })];
204
148
  }
@@ -208,6 +152,5 @@ const Input = props => {
208
152
  return createComponent(CommonInput, mergeProps(() => omit(props, ['actions'])));
209
153
  };
210
154
  Input.TextArea = TextArea;
211
- delegateEvents(["click"]);
212
155
 
213
156
  export { CommonInput, Input as default, statusClassDict };
@@ -1,12 +1,13 @@
1
- import { delegateEvents, createComponent, mergeProps as mergeProps$1, memo, template } from 'solid-js/web';
1
+ import { createComponent, mergeProps as mergeProps$1, ssr, ssrHydrationKey, ssrAttribute, escape } from 'solid-js/web';
2
2
  import { mergeProps, splitProps, createSignal, untrack, createMemo, createRenderEffect, on } from 'solid-js';
3
3
  import { isNumber, isNil, clamp, floor } from 'lodash-es';
4
4
  import NP from 'number-precision';
5
5
  import { CommonInput } from '../Input/index.js';
6
6
  import { dispatchEventHandlerUnion } from '../utils/solid.js';
7
7
 
8
- var _tmpl$ = /*#__PURE__*/template(`<div class="flex flex-col h-full w-[--ant-input-number-handle-width] [border-left:1px_solid_var(--ant-color-border)] bg-[--ant-color-bg-container]"><div class="text-12px flex justify-center items-center h-1/2 cursor-pointer opacity-70 hover:h-100% hover:text-[var(--ant-color-primary)] transition-color transition-height transition-duration-500"><div class=i-ant-design:up-outlined></div></div><div class="[border-top:1px_solid_var(--ant-color-border)] text-12px flex justify-center items-center h-1/2 cursor-pointer opacity-70 hover:h-100% hover:text-[var(--ant-color-primary)] transition-color transition-height transition-duration-500"><div class=i-ant-design:down-outlined>`);
8
+ var _tmpl$ = ["<div", " class=\"flex flex-col h-full w-[--ant-input-number-handle-width] [border-left:1px_solid_var(--ant-color-border)] bg-[--ant-color-bg-container]\"><div", "><div class=\"i-ant-design:up-outlined\"></div></div><div class=\"", "\"><div class=\"i-ant-design:down-outlined\"></div></div></div>"];
9
9
  const isEmptyValue = value => isNil(value) || value === '';
10
+ const actionBtnClass = 'text-12px flex justify-center items-center h-1/2 cursor-pointer opacity-70 hover:h-100% hover:text-[var(--ant-color-primary)] transition-color transition-height transition-duration-500';
10
11
  const InputNumber = _props => {
11
12
  const props = mergeProps({
12
13
  min: -Infinity,
@@ -75,14 +76,7 @@ const InputNumber = _props => {
75
76
  };
76
77
  },
77
78
  get actions() {
78
- return memo(() => !!props.controls)() ? (() => {
79
- var _el$ = _tmpl$(),
80
- _el$2 = _el$.firstChild,
81
- _el$3 = _el$2.nextSibling;
82
- _el$2.$$click = up;
83
- _el$3.$$click = down;
84
- return _el$;
85
- })() : undefined;
79
+ return props.controls ? ssr(_tmpl$, ssrHydrationKey(), ssrAttribute("class", escape(actionBtnClass, true), false), `[border-top:1px_solid_var(--ant-color-border)] ${escape(actionBtnClass, true)}`) : undefined;
86
80
  },
87
81
  get value() {
88
82
  return `${(focusing() ? value() : displayValue()) ?? ''}`;
@@ -117,6 +111,5 @@ const InputNumber = _props => {
117
111
  }
118
112
  }));
119
113
  };
120
- delegateEvents(["click"]);
121
114
 
122
115
  export { InputNumber as default };