diginet-core-ui 1.3.86 → 1.3.87
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/components/form-control/input-base/index.js +25 -19
- package/icons/basic.js +76 -0
- package/package.json +1 -1
- package/readme.md +4 -0
|
@@ -51,7 +51,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
51
51
|
hoverTooltip,
|
|
52
52
|
iconStyle,
|
|
53
53
|
inputProps,
|
|
54
|
-
inputRef:
|
|
54
|
+
inputRef: inputRefProp,
|
|
55
55
|
inputStyle,
|
|
56
56
|
maxRows,
|
|
57
57
|
multiline,
|
|
@@ -84,7 +84,8 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
84
84
|
bind,
|
|
85
85
|
value
|
|
86
86
|
} = useInput(defaultValue, valueProp, _onChange, onInput, delayOnChange);
|
|
87
|
-
if (!
|
|
87
|
+
if (!inputRefProp) inputRefProp = useRef(null);
|
|
88
|
+
const inputRef = useRef(null);
|
|
88
89
|
const ref = useRef(null);
|
|
89
90
|
const valueArray = useRef([]);
|
|
90
91
|
const canvas = document.createElement('canvas');
|
|
@@ -115,28 +116,28 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
115
116
|
};
|
|
116
117
|
useEffect(() => {
|
|
117
118
|
if (defaultValue !== undefined && defaultValue !== '') {
|
|
118
|
-
if (multiline && !/\d+/.test(rows)) {
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
if (multiline && !/\d+/.test(rows) && inputRef.current) {
|
|
120
|
+
inputRef.current.style.height = 0;
|
|
121
|
+
inputRef.current.style.height = Math.max(24, inputRef.current.scrollHeight) + 'px';
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
}, []);
|
|
124
125
|
useEffect(() => {
|
|
125
|
-
if (multiline && !/\d+/.test(rows) && !(
|
|
126
|
-
|
|
126
|
+
if (multiline && !/\d+/.test(rows) && inputRef.current && !(inputRef.current.value || inputRef.current.value === 0)) {
|
|
127
|
+
inputRef.current.style.height = '24px';
|
|
127
128
|
}
|
|
128
129
|
if (autoFocus) {
|
|
129
|
-
|
|
130
|
+
inputRef.current.focus();
|
|
130
131
|
}
|
|
131
132
|
}, [multiline]);
|
|
132
133
|
useEffect(() => {
|
|
133
134
|
const defaultHeight = 24;
|
|
134
135
|
if (valueProp !== undefined) {
|
|
135
136
|
valueArray.current.push(valueProp);
|
|
136
|
-
|
|
137
|
+
inputRefProp.current.value = valueProp;
|
|
137
138
|
if (multiline && !/\d+/.test(rows)) {
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
inputRef.current.style.height = 0;
|
|
140
|
+
inputRef.current.style.height = Math.max(defaultHeight, inputRef.current.scrollHeight) + 'px';
|
|
140
141
|
} else {
|
|
141
142
|
dynamicWidth({
|
|
142
143
|
target: {
|
|
@@ -146,15 +147,15 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
return () => {
|
|
149
|
-
if (valueProp !== undefined && multiline && !/\d+/.test(rows) &&
|
|
150
|
-
|
|
150
|
+
if (valueProp !== undefined && multiline && !/\d+/.test(rows) && inputRef.current) {
|
|
151
|
+
inputRef.current.style.height = defaultHeight + 'px';
|
|
151
152
|
}
|
|
152
153
|
};
|
|
153
154
|
}, [valueProp]);
|
|
154
155
|
/* End handler */
|
|
155
156
|
|
|
156
157
|
useImperativeHandle(reference, () => {
|
|
157
|
-
const currentRef =
|
|
158
|
+
const currentRef = inputRefProp.current || {};
|
|
158
159
|
const _instance = {
|
|
159
160
|
...action
|
|
160
161
|
}; // methods
|
|
@@ -169,14 +170,14 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
169
170
|
styleInputBase.current = style;
|
|
170
171
|
};
|
|
171
172
|
const dynamicWidth = e => {
|
|
172
|
-
if (!autoWidth || !
|
|
173
|
-
if (!canvas || !styleInputBase.current || !
|
|
173
|
+
if (!autoWidth || !inputRefProp.current) return;
|
|
174
|
+
if (!canvas || !styleInputBase.current || !inputRefProp.current) return;
|
|
174
175
|
const context = canvas.getContext('2d');
|
|
175
176
|
context.font = styleInputBase.current.font;
|
|
176
177
|
const {
|
|
177
178
|
width
|
|
178
179
|
} = context.measureText(e.target.value);
|
|
179
|
-
|
|
180
|
+
inputRefProp.current.style.width = `${Math.max(width, widthInit.current)}px`;
|
|
180
181
|
};
|
|
181
182
|
|
|
182
183
|
/* Start component */
|
|
@@ -224,7 +225,11 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
224
225
|
readOnly: readOnly,
|
|
225
226
|
style: inputStyle || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.style),
|
|
226
227
|
className: classNames('DGN-UI-InputBase-Textarea', inputProps.className),
|
|
227
|
-
ref:
|
|
228
|
+
ref: refs => {
|
|
229
|
+
if (!refs) return;
|
|
230
|
+
inputRef.current = refs;
|
|
231
|
+
typeof inputRefProp === 'function' ? inputRefProp(refs) : inputRefProp.current = refs;
|
|
232
|
+
},
|
|
228
233
|
onKeyDown: onKeyDown,
|
|
229
234
|
onKeyUp: onKeyUp,
|
|
230
235
|
onInput: onInputTextArea,
|
|
@@ -249,7 +254,8 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
249
254
|
className: classNames('DGN-UI-InputBase-Input', newClass, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className),
|
|
250
255
|
ref: refs => {
|
|
251
256
|
if (!refs) return;
|
|
252
|
-
|
|
257
|
+
inputRef.current = refs;
|
|
258
|
+
typeof inputRefProp === 'function' ? inputRefProp(refs) : inputRefProp.current = refs;
|
|
253
259
|
saveInitInfo(refs);
|
|
254
260
|
},
|
|
255
261
|
css: _InputCSS,
|
package/icons/basic.js
CHANGED
|
@@ -4056,6 +4056,34 @@ export const Update = /*#__PURE__*/memo(({
|
|
|
4056
4056
|
fill: colors[color] || color
|
|
4057
4057
|
}));
|
|
4058
4058
|
});
|
|
4059
|
+
export const Upload = /*#__PURE__*/memo(({
|
|
4060
|
+
width,
|
|
4061
|
+
height,
|
|
4062
|
+
color = '#7F828E',
|
|
4063
|
+
viewBox = false
|
|
4064
|
+
}) => {
|
|
4065
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
4066
|
+
width: width || 24,
|
|
4067
|
+
height: height || 24,
|
|
4068
|
+
viewBox: "0 0 24 24",
|
|
4069
|
+
fill: "none"
|
|
4070
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
4071
|
+
fillRule: "evenodd",
|
|
4072
|
+
clipRule: "evenodd",
|
|
4073
|
+
d: "M15 10V16H9V10H5L12 3L19 10H15ZM19 20V18H5V20H19Z",
|
|
4074
|
+
fill: colors[color] || color
|
|
4075
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
4076
|
+
width: width || 14,
|
|
4077
|
+
height: height || 17,
|
|
4078
|
+
viewBox: "0 0 14 17",
|
|
4079
|
+
fill: "none"
|
|
4080
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
4081
|
+
fillRule: "evenodd",
|
|
4082
|
+
clipRule: "evenodd",
|
|
4083
|
+
d: "M10 7V13H4V7H0L7 0L14 7H10ZM14 17V15H0V17H14Z",
|
|
4084
|
+
fill: colors[color] || color
|
|
4085
|
+
}));
|
|
4086
|
+
});
|
|
4059
4087
|
export const Palette = /*#__PURE__*/memo(({
|
|
4060
4088
|
width,
|
|
4061
4089
|
height,
|
|
@@ -6077,6 +6105,54 @@ export const Website = /*#__PURE__*/memo(({
|
|
|
6077
6105
|
fill: colors[color] || color
|
|
6078
6106
|
}));
|
|
6079
6107
|
});
|
|
6108
|
+
export const Workflow = /*#__PURE__*/memo(({
|
|
6109
|
+
width,
|
|
6110
|
+
height,
|
|
6111
|
+
color = '#7F828E',
|
|
6112
|
+
viewBox = false
|
|
6113
|
+
}) => {
|
|
6114
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
6115
|
+
width: width || 24,
|
|
6116
|
+
height: height || 24,
|
|
6117
|
+
viewBox: "0 0 24 24",
|
|
6118
|
+
fill: "none"
|
|
6119
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
6120
|
+
fillRule: "evenodd",
|
|
6121
|
+
clipRule: "evenodd",
|
|
6122
|
+
d: "M8 5L5 8L5 6H2V4H5L5 2L8 5Z",
|
|
6123
|
+
fill: colors[color] || color
|
|
6124
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
6125
|
+
fillRule: "evenodd",
|
|
6126
|
+
clipRule: "evenodd",
|
|
6127
|
+
d: "M22 19L19 22L19 20H16V18H19L19 16L22 19Z",
|
|
6128
|
+
fill: colors[color] || color
|
|
6129
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
6130
|
+
fillRule: "evenodd",
|
|
6131
|
+
clipRule: "evenodd",
|
|
6132
|
+
d: "M14.8293 6C14.4175 7.16519 13.3062 8 12 8C10.3431 8 9 6.65685 9 5C9 3.34315 10.3431 2 12 2C13.3062 2 14.4175 2.83481 14.8293 4L18 4L20 4V6V9.17071C21.1652 9.58254 22 10.6938 22 12C22 13.6569 20.6569 15 19 15C17.6938 15 16.5825 14.1652 16.1707 13H7.82929C7.52801 13.8524 6.85241 14.528 6 14.8293L6 18H9.17071C9.58254 16.8348 10.6938 16 12 16C13.6569 16 15 17.3431 15 19C15 20.6569 13.6569 22 12 22C10.6938 22 9.58254 21.1652 9.17071 20H6H4V18L4 14.8293C2.83481 14.4175 2 13.3062 2 12C2 10.3431 3.34315 9 5 9C6.30622 9 7.41746 9.83481 7.82929 11H16.1707C16.472 10.1476 17.1476 9.47199 18 9.17071V6H14.8293Z",
|
|
6133
|
+
fill: colors[color] || color
|
|
6134
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
6135
|
+
width: width || 20,
|
|
6136
|
+
height: height || 20,
|
|
6137
|
+
viewBox: "0 0 20 20",
|
|
6138
|
+
fill: "none"
|
|
6139
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
6140
|
+
fillRule: "evenodd",
|
|
6141
|
+
clipRule: "evenodd",
|
|
6142
|
+
d: "M6 3L3 6L3 4H0V2H3L3 0L6 3Z",
|
|
6143
|
+
fill: colors[color] || color
|
|
6144
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
6145
|
+
fillRule: "evenodd",
|
|
6146
|
+
clipRule: "evenodd",
|
|
6147
|
+
d: "M20 17L17 20L17 18H14V16H17L17 14L20 17Z",
|
|
6148
|
+
fill: colors[color] || color
|
|
6149
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
6150
|
+
fillRule: "evenodd",
|
|
6151
|
+
clipRule: "evenodd",
|
|
6152
|
+
d: "M12.8293 4C12.4175 5.16519 11.3062 6 10 6C8.34315 6 7 4.65685 7 3C7 1.34315 8.34315 0 10 0C11.3062 0 12.4175 0.834808 12.8293 2L16 2L18 2V4V7.17071C19.1652 7.58254 20 8.69378 20 10C20 11.6569 18.6569 13 17 13C15.6938 13 14.5825 12.1652 14.1707 11H5.82929C5.52801 11.8524 4.85241 12.528 4 12.8293L4 16H7.17071C7.58254 14.8348 8.69378 14 10 14C11.6569 14 13 15.3431 13 17C13 18.6569 11.6569 20 10 20C8.69378 20 7.58254 19.1652 7.17071 18H4H2V16L2 12.8293C0.834808 12.4175 0 11.3062 0 10C0 8.34315 1.34315 7 3 7C4.30622 7 5.41746 7.83481 5.82929 9H14.1707C14.472 8.14759 15.1476 7.47199 16 7.17071V4H12.8293Z",
|
|
6153
|
+
fill: colors[color] || color
|
|
6154
|
+
}));
|
|
6155
|
+
});
|
|
6080
6156
|
export const Write = /*#__PURE__*/memo(({
|
|
6081
6157
|
width,
|
|
6082
6158
|
height,
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -38,6 +38,10 @@ npm test
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Changelog
|
|
41
|
+
## 1.3.87
|
|
42
|
+
- \[Added\]: Icon – Upload, Workflow
|
|
43
|
+
- \[Fixed\]: InputBase – Fix not run when inputRef is function
|
|
44
|
+
|
|
41
45
|
## 1.3.86
|
|
42
46
|
- \[Changed\]: Icon – Optimize code
|
|
43
47
|
- \[Fixed\]: Dropdown – Fix bug cannot select multiple after search
|