funda-ui 1.0.287 → 1.0.290
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/DynamicFields/index.js
CHANGED
|
@@ -121,6 +121,7 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
121
121
|
confirmText = props.confirmText,
|
|
122
122
|
onAdd = props.onAdd,
|
|
123
123
|
onRemove = props.onRemove;
|
|
124
|
+
var PER_ROW_DOM_STRING = '.dynamic-fields__append .dynamic-fields__data__wrapper';
|
|
124
125
|
var DO_NOT_REMOVE_DOM = typeof doNotRemoveDom === 'undefined' ? false : true;
|
|
125
126
|
var uniqueID = (0,react__WEBPACK_IMPORTED_MODULE_0__.useId)().replace(/\:/g, "-");
|
|
126
127
|
var idRes = id || uniqueID;
|
|
@@ -137,7 +138,7 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
137
138
|
setTmpl = _useState4[1];
|
|
138
139
|
function checkMaxStatus() {
|
|
139
140
|
//button status
|
|
140
|
-
if (rootRef.current.
|
|
141
|
+
if (rootRef.current.querySelectorAll(PER_ROW_DOM_STRING).length + 1 >= parseFloat(maxFields)) {
|
|
141
142
|
addBtnRef.current.style.setProperty('display', 'none', 'important');
|
|
142
143
|
}
|
|
143
144
|
}
|
|
@@ -154,11 +155,13 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
154
155
|
|
|
155
156
|
//
|
|
156
157
|
setTimeout(function () {
|
|
157
|
-
var perRow = [].slice.call(rootRef.current.
|
|
158
|
+
var perRow = [].slice.call(rootRef.current.querySelectorAll(PER_ROW_DOM_STRING));
|
|
158
159
|
|
|
159
160
|
// update index
|
|
160
161
|
perRow.forEach(function (el, i) {
|
|
161
162
|
el.dataset.index = i.toString();
|
|
163
|
+
var pnode = el.firstChild;
|
|
164
|
+
if (pnode !== null) pnode.dataset.index = i.toString();
|
|
162
165
|
});
|
|
163
166
|
|
|
164
167
|
//
|
|
@@ -170,20 +173,22 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
170
173
|
var curKey = e.currentTarget.closest('.dynamic-fields__data__wrapper').dataset.key;
|
|
171
174
|
if (confirm(confirmText || '')) {
|
|
172
175
|
//button status
|
|
173
|
-
if (rootRef.current.
|
|
176
|
+
if (rootRef.current.querySelectorAll(PER_ROW_DOM_STRING).length <= parseFloat(maxFields)) {
|
|
174
177
|
addBtnRef.current.style.setProperty('display', 'inline', 'important');
|
|
175
178
|
}
|
|
176
179
|
var curItem = rootRef.current.querySelector(".dynamic-fields__append [data-key=\"".concat(curKey, "\"]"));
|
|
177
180
|
var curIndex = curItem.dataset.index;
|
|
178
|
-
if (curItem !== null && !DO_NOT_REMOVE_DOM) curItem.remove();
|
|
181
|
+
if (curItem !== null && !DO_NOT_REMOVE_DOM) curItem.remove(); // Do not delete the parent node, otherwise an error may be reported when using routing: DOMException: Failed to execute 'removeChild' on 'Node'
|
|
179
182
|
|
|
180
183
|
//
|
|
181
184
|
setTimeout(function () {
|
|
182
|
-
var perRow = [].slice.call(rootRef.current.
|
|
185
|
+
var perRow = [].slice.call(rootRef.current.querySelectorAll(PER_ROW_DOM_STRING));
|
|
183
186
|
|
|
184
187
|
// update index
|
|
185
188
|
perRow.forEach(function (el, i) {
|
|
186
189
|
el.dataset.index = i.toString();
|
|
190
|
+
var pnode = el.firstChild;
|
|
191
|
+
if (pnode !== null) pnode.dataset.index = i.toString();
|
|
187
192
|
});
|
|
188
193
|
|
|
189
194
|
//
|
|
@@ -212,7 +217,8 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
212
217
|
fill: "#000"
|
|
213
218
|
})))));
|
|
214
219
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
215
|
-
key: 'tmpl-' + i
|
|
220
|
+
key: 'tmpl-' + i,
|
|
221
|
+
"data-index": i
|
|
216
222
|
}, isNew ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, item, addBtn) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
217
223
|
className: "dynamic-fields__data__wrapper position-relative",
|
|
218
224
|
"data-key": i,
|
|
@@ -121,6 +121,7 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
121
121
|
confirmText = props.confirmText,
|
|
122
122
|
onAdd = props.onAdd,
|
|
123
123
|
onRemove = props.onRemove;
|
|
124
|
+
var PER_ROW_DOM_STRING = '.dynamic-fields__append .dynamic-fields__data__wrapper';
|
|
124
125
|
var DO_NOT_REMOVE_DOM = typeof doNotRemoveDom === 'undefined' ? false : true;
|
|
125
126
|
var uniqueID = (0,react__WEBPACK_IMPORTED_MODULE_0__.useId)().replace(/\:/g, "-");
|
|
126
127
|
var idRes = id || uniqueID;
|
|
@@ -137,7 +138,7 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
137
138
|
setTmpl = _useState4[1];
|
|
138
139
|
function checkMaxStatus() {
|
|
139
140
|
//button status
|
|
140
|
-
if (rootRef.current.
|
|
141
|
+
if (rootRef.current.querySelectorAll(PER_ROW_DOM_STRING).length + 1 >= parseFloat(maxFields)) {
|
|
141
142
|
addBtnRef.current.style.setProperty('display', 'none', 'important');
|
|
142
143
|
}
|
|
143
144
|
}
|
|
@@ -154,11 +155,13 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
154
155
|
|
|
155
156
|
//
|
|
156
157
|
setTimeout(function () {
|
|
157
|
-
var perRow = [].slice.call(rootRef.current.
|
|
158
|
+
var perRow = [].slice.call(rootRef.current.querySelectorAll(PER_ROW_DOM_STRING));
|
|
158
159
|
|
|
159
160
|
// update index
|
|
160
161
|
perRow.forEach(function (el, i) {
|
|
161
162
|
el.dataset.index = i.toString();
|
|
163
|
+
var pnode = el.firstChild;
|
|
164
|
+
if (pnode !== null) pnode.dataset.index = i.toString();
|
|
162
165
|
});
|
|
163
166
|
|
|
164
167
|
//
|
|
@@ -170,20 +173,22 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
170
173
|
var curKey = e.currentTarget.closest('.dynamic-fields__data__wrapper').dataset.key;
|
|
171
174
|
if (confirm(confirmText || '')) {
|
|
172
175
|
//button status
|
|
173
|
-
if (rootRef.current.
|
|
176
|
+
if (rootRef.current.querySelectorAll(PER_ROW_DOM_STRING).length <= parseFloat(maxFields)) {
|
|
174
177
|
addBtnRef.current.style.setProperty('display', 'inline', 'important');
|
|
175
178
|
}
|
|
176
179
|
var curItem = rootRef.current.querySelector(".dynamic-fields__append [data-key=\"".concat(curKey, "\"]"));
|
|
177
180
|
var curIndex = curItem.dataset.index;
|
|
178
|
-
if (curItem !== null && !DO_NOT_REMOVE_DOM) curItem.remove();
|
|
181
|
+
if (curItem !== null && !DO_NOT_REMOVE_DOM) curItem.remove(); // Do not delete the parent node, otherwise an error may be reported when using routing: DOMException: Failed to execute 'removeChild' on 'Node'
|
|
179
182
|
|
|
180
183
|
//
|
|
181
184
|
setTimeout(function () {
|
|
182
|
-
var perRow = [].slice.call(rootRef.current.
|
|
185
|
+
var perRow = [].slice.call(rootRef.current.querySelectorAll(PER_ROW_DOM_STRING));
|
|
183
186
|
|
|
184
187
|
// update index
|
|
185
188
|
perRow.forEach(function (el, i) {
|
|
186
189
|
el.dataset.index = i.toString();
|
|
190
|
+
var pnode = el.firstChild;
|
|
191
|
+
if (pnode !== null) pnode.dataset.index = i.toString();
|
|
187
192
|
});
|
|
188
193
|
|
|
189
194
|
//
|
|
@@ -212,7 +217,8 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
212
217
|
fill: "#000"
|
|
213
218
|
})))));
|
|
214
219
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
215
|
-
key: 'tmpl-' + i
|
|
220
|
+
key: 'tmpl-' + i,
|
|
221
|
+
"data-index": i
|
|
216
222
|
}, isNew ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, item, addBtn) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
217
223
|
className: "dynamic-fields__data__wrapper position-relative",
|
|
218
224
|
"data-key": i,
|
|
@@ -48,6 +48,7 @@ const DynamicFields = (props: DynamicFieldsProps) => {
|
|
|
48
48
|
onRemove
|
|
49
49
|
} = props;
|
|
50
50
|
|
|
51
|
+
const PER_ROW_DOM_STRING = '.dynamic-fields__append .dynamic-fields__data__wrapper';
|
|
51
52
|
const DO_NOT_REMOVE_DOM = typeof doNotRemoveDom === 'undefined' ? false : true;
|
|
52
53
|
const uniqueID = useId().replace(/\:/g, "-");
|
|
53
54
|
const idRes = id || uniqueID;
|
|
@@ -59,7 +60,7 @@ const DynamicFields = (props: DynamicFieldsProps) => {
|
|
|
59
60
|
|
|
60
61
|
function checkMaxStatus() {
|
|
61
62
|
//button status
|
|
62
|
-
if (rootRef.current.
|
|
63
|
+
if (rootRef.current.querySelectorAll(PER_ROW_DOM_STRING).length + 1 >= parseFloat(maxFields)) {
|
|
63
64
|
addBtnRef.current.style.setProperty('display', 'none', 'important');
|
|
64
65
|
}
|
|
65
66
|
}
|
|
@@ -77,11 +78,14 @@ const DynamicFields = (props: DynamicFieldsProps) => {
|
|
|
77
78
|
|
|
78
79
|
//
|
|
79
80
|
setTimeout(() => {
|
|
80
|
-
const perRow = [].slice.call(rootRef.current.
|
|
81
|
+
const perRow = [].slice.call(rootRef.current.querySelectorAll(PER_ROW_DOM_STRING));
|
|
81
82
|
|
|
82
83
|
// update index
|
|
83
84
|
perRow.forEach((el: HTMLDivElement, i: number) => {
|
|
84
85
|
el.dataset.index = i.toString();
|
|
86
|
+
|
|
87
|
+
const pnode = el.firstChild as HTMLDivElement;
|
|
88
|
+
if (pnode !== null) pnode.dataset.index = i.toString();
|
|
85
89
|
});
|
|
86
90
|
|
|
87
91
|
//
|
|
@@ -99,23 +103,27 @@ const DynamicFields = (props: DynamicFieldsProps) => {
|
|
|
99
103
|
if (confirm(confirmText || '')) {
|
|
100
104
|
|
|
101
105
|
//button status
|
|
102
|
-
if (rootRef.current.
|
|
106
|
+
if (rootRef.current.querySelectorAll(PER_ROW_DOM_STRING).length <= parseFloat(maxFields)) {
|
|
103
107
|
addBtnRef.current.style.setProperty('display', 'inline', 'important');
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
|
|
107
111
|
const curItem = rootRef.current.querySelector(`.dynamic-fields__append [data-key="${curKey}"]`);
|
|
108
112
|
const curIndex = curItem.dataset.index;
|
|
109
|
-
if (curItem !== null && !DO_NOT_REMOVE_DOM) curItem.remove();
|
|
110
|
-
|
|
113
|
+
if (curItem !== null && !DO_NOT_REMOVE_DOM) curItem.remove(); // Do not delete the parent node, otherwise an error may be reported when using routing: DOMException: Failed to execute 'removeChild' on 'Node'
|
|
111
114
|
|
|
115
|
+
|
|
112
116
|
//
|
|
113
|
-
setTimeout(() => {
|
|
114
|
-
const perRow = [].slice.call(rootRef.current.
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
const perRow = [].slice.call(rootRef.current.querySelectorAll(PER_ROW_DOM_STRING));
|
|
115
119
|
|
|
116
120
|
// update index
|
|
117
121
|
perRow.forEach((el: HTMLDivElement, i: number) => {
|
|
118
122
|
el.dataset.index = i.toString();
|
|
123
|
+
|
|
124
|
+
const pnode = el.firstChild as HTMLDivElement;
|
|
125
|
+
if (pnode !== null) pnode.dataset.index = i.toString();
|
|
126
|
+
|
|
119
127
|
});
|
|
120
128
|
|
|
121
129
|
//
|
|
@@ -135,7 +143,7 @@ const DynamicFields = (props: DynamicFieldsProps) => {
|
|
|
135
143
|
{iconRemove ? <>{iconRemove}</> : <><svg width="20px" height="20px" viewBox="0 0 24 24" fill="none"><path fillRule="evenodd" clipRule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10ZM8 11a1 1 0 1 0 0 2h8a1 1 0 1 0 0-2H8Z" fill="#000" /></svg></>}
|
|
136
144
|
</a></>;
|
|
137
145
|
|
|
138
|
-
return <div key={'tmpl-' + i}>
|
|
146
|
+
return <div key={'tmpl-' + i} data-index={i}>
|
|
139
147
|
{isNew ? <>
|
|
140
148
|
{item}
|
|
141
149
|
{addBtn}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "UIUX Lab",
|
|
3
3
|
"email": "uiuxlab@gmail.com",
|
|
4
4
|
"name": "funda-ui",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.290",
|
|
6
6
|
"description": "React components using pure Bootstrap 5+ which does not contain any external style and script libraries.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|