funda-ui 4.5.666 → 4.5.671

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 (65) hide show
  1. package/ColorPicker/index.js +3 -1
  2. package/Date/index.js +14 -1
  3. package/DragDropList/index.css +188 -0
  4. package/DragDropList/index.d.ts +44 -0
  5. package/DragDropList/index.js +1587 -0
  6. package/Input/index.d.ts +2 -0
  7. package/Input/index.js +14 -1
  8. package/LICENSE +21 -0
  9. package/MultipleSelect/index.css +237 -144
  10. package/MultipleSelect/index.d.ts +24 -10
  11. package/MultipleSelect/index.js +2240 -1225
  12. package/README.md +3 -1
  13. package/RangeSlider/index.js +14 -1
  14. package/Textarea/index.d.ts +2 -0
  15. package/Textarea/index.js +14 -1
  16. package/Tree/index.d.ts +1 -0
  17. package/Tree/index.js +29 -0
  18. package/Utils/useBoundedDrag.d.ts +125 -0
  19. package/Utils/useBoundedDrag.js +380 -0
  20. package/Utils/useDragDropPosition.d.ts +169 -0
  21. package/Utils/useDragDropPosition.js +456 -0
  22. package/Utils/useIsMobile.d.ts +2 -0
  23. package/Utils/useIsMobile.js +168 -0
  24. package/all.d.ts +1 -0
  25. package/all.js +1 -1
  26. package/lib/cjs/ColorPicker/index.js +3 -1
  27. package/lib/cjs/Date/index.js +14 -1
  28. package/lib/cjs/DragDropList/index.d.ts +44 -0
  29. package/lib/cjs/DragDropList/index.js +1587 -0
  30. package/lib/cjs/Input/index.d.ts +2 -0
  31. package/lib/cjs/Input/index.js +14 -1
  32. package/lib/cjs/MultipleSelect/index.d.ts +24 -10
  33. package/lib/cjs/MultipleSelect/index.js +2240 -1225
  34. package/lib/cjs/RangeSlider/index.js +14 -1
  35. package/lib/cjs/Textarea/index.d.ts +2 -0
  36. package/lib/cjs/Textarea/index.js +14 -1
  37. package/lib/cjs/Tree/index.d.ts +1 -0
  38. package/lib/cjs/Tree/index.js +29 -0
  39. package/lib/cjs/Utils/useBoundedDrag.d.ts +125 -0
  40. package/lib/cjs/Utils/useBoundedDrag.js +380 -0
  41. package/lib/cjs/Utils/useDragDropPosition.d.ts +169 -0
  42. package/lib/cjs/Utils/useDragDropPosition.js +456 -0
  43. package/lib/cjs/Utils/useIsMobile.d.ts +2 -0
  44. package/lib/cjs/Utils/useIsMobile.js +168 -0
  45. package/lib/cjs/index.d.ts +1 -0
  46. package/lib/cjs/index.js +1 -1
  47. package/lib/css/DragDropList/index.css +188 -0
  48. package/lib/css/MultipleSelect/index.css +237 -144
  49. package/lib/esm/ColorPicker/index.tsx +53 -49
  50. package/lib/esm/DragDropList/index.scss +245 -0
  51. package/lib/esm/DragDropList/index.tsx +494 -0
  52. package/lib/esm/Input/index.tsx +17 -3
  53. package/lib/esm/MultipleSelect/index.scss +288 -183
  54. package/lib/esm/MultipleSelect/index.tsx +305 -166
  55. package/lib/esm/MultipleSelect/utils/func.ts +21 -1
  56. package/lib/esm/Tabs/Tabs.tsx +1 -1
  57. package/lib/esm/Textarea/index.tsx +18 -1
  58. package/lib/esm/Tree/TreeList.tsx +32 -0
  59. package/lib/esm/Tree/index.tsx +3 -0
  60. package/lib/esm/Utils/hooks/useBoundedDrag.tsx +301 -0
  61. package/lib/esm/Utils/hooks/useDragDropPosition.tsx +420 -0
  62. package/lib/esm/Utils/hooks/useIsMobile.tsx +56 -0
  63. package/lib/esm/index.js +1 -0
  64. package/package.json +1 -1
  65. package/lib/esm/MultipleSelect/ItemList.tsx +0 -323
@@ -137,59 +137,63 @@ const ColorPicker = forwardRef((props: ColorPickerProps, externalRef: any) => {
137
137
  )} ref={rootRef}>
138
138
  {label ? <>{typeof label === 'string' ? <label htmlFor={idRes} className="form-label" dangerouslySetInnerHTML={{ __html: `${label}` }}></label> : <label htmlFor={idRes} className="form-label">{label}</label>}</> : null}
139
139
 
140
+ <div className="position-relative">
140
141
  <div className="input-group">
141
- <input
142
- ref={(node) => {
143
- valRef.current = node;
144
- if (typeof externalRef === 'function') {
145
- externalRef(node);
146
- } else if (externalRef) {
147
- externalRef.current = node;
148
- }
149
- }}
150
-
151
-
152
- tabIndex={tabIndex || 0}
153
- type='color'
154
- className={combinedCls(
155
- clsWrite(controlClassName, 'form-control custom-colorpicker-control flex-grow-0'),
156
- controlExClassName
157
- )}
158
- value={changedVal}
159
- onFocus={handleFocus}
160
- onBlur={handleBlur}
161
- onChange={handleChange}
162
- disabled={disabled || null}
163
- readOnly={readOnly || null}
164
- style={style}
165
- {...attributes}
166
- />
167
-
168
- {/* Prevents the color from automatically becoming #000000 when it is empty */}
169
- <input
170
- tabIndex={-1}
171
- type="hidden"
172
- id={idRes}
173
- name={name}
174
- value={changedVal} // do not use `defaultValue`
175
- onChange={() => void(0)}
176
- required={required || null}
177
- {...attributes}
178
- />
179
-
180
- {changedVal !== '' ? <><button tabIndex={-1} type="button" className={clearBtnClassName || 'btn btn-link btn-sm'} onClick={(e: React.MouseEvent) => {
181
- setChangedVal('');
182
- onChange?.(e);
183
- onClear?.(e);
184
- }}>{clearBtnLabel || 'clear'}
185
- </button></> : null}
186
-
142
+ <input
143
+ ref={(node) => {
144
+ valRef.current = node;
145
+ if (typeof externalRef === 'function') {
146
+ externalRef(node);
147
+ } else if (externalRef) {
148
+ externalRef.current = node;
149
+ }
150
+ }}
151
+
152
+
153
+ tabIndex={tabIndex || 0}
154
+ type='color'
155
+ className={combinedCls(
156
+ clsWrite(controlClassName, 'form-control custom-colorpicker-control flex-grow-0'),
157
+ controlExClassName
158
+ )}
159
+ value={changedVal}
160
+ onFocus={handleFocus}
161
+ onBlur={handleBlur}
162
+ onChange={handleChange}
163
+ disabled={disabled || null}
164
+ readOnly={readOnly || null}
165
+ style={style}
166
+ {...attributes}
167
+ />
168
+
169
+ {/* Prevents the color from automatically becoming #000000 when it is empty */}
170
+ <input
171
+ tabIndex={-1}
172
+ type="hidden"
173
+ id={idRes}
174
+ name={name}
175
+ value={changedVal} // do not use `defaultValue`
176
+ onChange={() => void(0)}
177
+ required={required || null}
178
+ {...attributes}
179
+ />
180
+
181
+ {changedVal !== '' ? <><button tabIndex={-1} type="button" className={clearBtnClassName || 'btn btn-link btn-sm'} onClick={(e: React.MouseEvent) => {
182
+ setChangedVal('');
183
+ onChange?.(e);
184
+ onClear?.(e);
185
+ }}>{clearBtnLabel || 'clear'}
186
+ </button></> : null}
187
+
188
+
189
+ </div>
190
+ {required ? <>{requiredLabel || requiredLabel === '' ? requiredLabel : <span className="position-absolute end-0 top-0 my-2 mx-2"><span className="text-danger">*</span></span>}</> : ''}
191
+
192
+ {changedVal === '' ? <><div className="custom-colorpicker__transparent-placeholder"></div></> : null}
187
193
 
188
194
  </div>
189
- {required ? <>{requiredLabel || requiredLabel === '' ? requiredLabel : <span className="position-absolute end-0 top-0 my-2 mx-2"><span className="text-danger">*</span></span>}</> : ''}
190
-
191
- {changedVal === '' ? <><div className="custom-colorpicker__transparent-placeholder"></div></> : null}
192
195
 
196
+
193
197
  </div>
194
198
 
195
199
 
@@ -0,0 +1,245 @@
1
+ /* ======================================================
2
+ <!-- DragDrop List -->
3
+ /* ====================================================== */
4
+ .custom-draggable-list {
5
+
6
+ --custom-draggable-content-bg: transparent;
7
+ --custom-draggable-content-color: inherit;
8
+ --custom-draggable-border-color: #ddd;
9
+ --custom-draggable-wrapper-radius: 0.25rem;
10
+ --custom-draggable-control-radius: 0.25rem;
11
+ --custom-draggable-primary-color: #ffa940;
12
+ --custom-draggable-content-diff-bg: #fafafa;
13
+ --custom-draggable-content-diff-border-color: #d9d9d9;
14
+ --custom-draggable-control-fs: 0.75rem;
15
+ --custom-draggable-control-w: 100px;
16
+ --custom-draggable-btn-confirm-bg: #52c41a;
17
+ --custom-draggable-btn-cancel-bg: #ff4d4f;
18
+ --custom-draggable-btn-color: #fff;
19
+
20
+
21
+ list-style: none;
22
+ padding: 0;
23
+ margin: 0;
24
+ width: 100%;
25
+ position: relative;
26
+ border: 1px solid var(--custom-draggable-border-color);
27
+ border-radius: var(--custom-draggable-wrapper-radius);
28
+
29
+ li {
30
+ margin: 0;
31
+ padding: 0;
32
+ }
33
+
34
+ .custom-draggable-list__item {
35
+ padding: 0;
36
+ position: relative;
37
+ transition: transform 0.15s ease;
38
+ position: relative;
39
+
40
+ .custom-draggable-list__itemcontent {
41
+ padding: 10px 15px;
42
+ background: var(--custom-draggable-content-bg);
43
+ color: var(--custom-draggable-content-color);
44
+ border-bottom: 1px solid var(--custom-draggable-border-color);
45
+ display: flex;
46
+ align-items: center;
47
+ user-select: none;
48
+ transition: all 0.15s ease;
49
+
50
+ .custom-draggable-list__itemcontent-inner {
51
+ display: flex;
52
+ align-items: center;
53
+ justify-content: space-between;
54
+ width: 100%;
55
+
56
+ }
57
+ }
58
+
59
+ &:last-child {
60
+ .custom-draggable-list__itemcontent {
61
+ border-bottom: none;
62
+ }
63
+ }
64
+
65
+ &.disabled {
66
+ pointer-events: none !important;
67
+ opacity: .4 !important;
68
+ }
69
+ }
70
+
71
+ &.alternate-collapse {
72
+ .custom-draggable-list__collapse-arrow {
73
+ cursor: pointer;
74
+ display: inline-block;
75
+ width: 20px;
76
+ text-align: center;
77
+ user-select: none;
78
+ margin-left: .2rem;
79
+
80
+ svg {
81
+ transition: all 0.15s ease;
82
+ }
83
+
84
+ &:hover {
85
+ opacity: 0.7;
86
+ }
87
+ }
88
+
89
+ .custom-draggable-list__item {
90
+ &.has-children {
91
+ position: relative;
92
+ }
93
+
94
+ &.collapsed {
95
+ .custom-draggable-list__collapse-arrow svg {
96
+ transform: rotate(-90deg);
97
+ }
98
+ }
99
+ }
100
+ }
101
+
102
+ .custom-draggable-list__item.draggable .custom-draggable-list__itemcontent {
103
+ padding-left: 1.5em;
104
+ }
105
+
106
+
107
+ &.handle-pos-right .custom-draggable-list__item.draggable .custom-draggable-list__itemcontent,
108
+ &.icon-hide .custom-draggable-list__item.draggable .custom-draggable-list__itemcontent {
109
+ padding-left: .5rem;
110
+ }
111
+
112
+
113
+ .custom-draggable-list__item {
114
+ &.block.draggable {
115
+ cursor: move;
116
+ }
117
+
118
+ &.dragging .custom-draggable-list__itemcontent {
119
+ background: #fff9e6;
120
+ border: 1px dashed #ffd591;
121
+ opacity: 0.8;
122
+ }
123
+
124
+ &.drag-over .custom-draggable-list__itemcontent {
125
+ background: #fff9e6;
126
+ border: 2px solid #ffd591;
127
+ }
128
+
129
+ &.drag-over-top::before {
130
+ content: '';
131
+ position: absolute;
132
+ top: -3px;
133
+ left: 0;
134
+ right: 0;
135
+ height: 2px;
136
+ background: var(--custom-draggable-primary-color);
137
+ border-radius: 1px;
138
+ }
139
+
140
+ &.drag-over-bottom::after {
141
+ content: '';
142
+ position: absolute;
143
+ bottom: -3px;
144
+ left: 0;
145
+ right: 0;
146
+ height: 2px;
147
+ background: var(--custom-draggable-primary-color);
148
+ border-radius: 1px;
149
+ }
150
+ }
151
+
152
+ /* Fix the problem that mobile terminals cannot be touched, DO NOT USE "<svg>" */
153
+ .custom-draggable-list__handle {
154
+ color: #999;
155
+ padding: 5px;
156
+ cursor: move;
157
+ transition: color 0.15s ease;
158
+ position: absolute;
159
+ width: 1em;
160
+ height: 1em;
161
+ top: 50%;
162
+ transform: translateY(-50%);
163
+ z-index: 1;
164
+ display: flex;
165
+ align-items: center;
166
+ font-size: 0.75rem;
167
+
168
+ &.left {
169
+ left: 0;
170
+ }
171
+
172
+ &.right {
173
+ right: 1em;
174
+ }
175
+ }
176
+
177
+ .custom-draggable-list__item,
178
+ .custom-draggable-list__itemcontent {
179
+ transition: all 0.15s ease;
180
+ }
181
+
182
+
183
+ .custom-draggable-list__item {
184
+ &.editing .custom-draggable-list__itemcontent,
185
+ &:hover .custom-draggable-list__itemcontent {
186
+ background: var(--custom-draggable-content-diff-bg);
187
+ border-color: var(--custom-draggable-content-diff-border-color);
188
+ }
189
+
190
+
191
+ &.block:hover .custom-draggable-list__handle {
192
+ color: var(--custom-draggable-primary-color);
193
+ }
194
+
195
+ }
196
+
197
+ &.handle .custom-draggable-list__handle:hover {
198
+ color: var(--custom-draggable-primary-color);
199
+ }
200
+
201
+ /* FORM */
202
+ .custom-draggable-list__edit-form {
203
+ display: flex;
204
+ flex: 1;
205
+ gap: 10px;
206
+ align-items: center;
207
+
208
+ input {
209
+ padding: 4px 8px;
210
+ border: 1px solid var(--custom-draggable-border-color);
211
+ border-radius: var(--custom-draggable-control-radius);
212
+ font-size: var(--custom-draggable-control-fs);
213
+ width: var(--custom-draggable-control-w);
214
+ }
215
+ }
216
+
217
+ .custom-draggable-list__edit-buttons {
218
+ display: flex;
219
+ gap: 5px;
220
+
221
+ button {
222
+ padding: .2rem .5rem;
223
+ border: none;
224
+ font-size: 0.75rem;
225
+ border-radius: var(--custom-draggable-control-radius);
226
+ cursor: pointer;
227
+
228
+ &:first-child {
229
+ background: var(--custom-draggable-btn-confirm-bg);
230
+ color: var(--custom-draggable-btn-color);
231
+ }
232
+
233
+ &:last-child {
234
+ background: var(--custom-draggable-btn-cancel-bg);
235
+ color: var(--custom-draggable-btn-color);
236
+ }
237
+
238
+ &:hover {
239
+ opacity: 0.8;
240
+ }
241
+ }
242
+ }
243
+
244
+ }
245
+