szld-libs 0.4.35 → 0.4.37
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/dist/szld-components.es.js +2357 -2351
- package/dist/szld-components.umd.js +33 -33
- package/es/components/DynamicForm/mySelect/index.js +1 -0
- package/es/components/DynamicForm/useDynamicForm.js +10 -8
- package/es/components/DynamicFormMobile/useDynamicForm.js +15 -12
- package/es/mock/index.js +550 -40
- package/es/utils/method.d.ts +1 -0
- package/lib/components/DynamicForm/mySelect/index.js +1 -0
- package/lib/components/DynamicForm/useDynamicForm.js +10 -8
- package/lib/components/DynamicFormMobile/useDynamicForm.js +15 -12
- package/lib/mock/index.js +550 -40
- package/lib/utils/method.d.ts +1 -0
- package/package.json +1 -1
|
@@ -193,7 +193,9 @@ function useDynamicForm(props) {
|
|
|
193
193
|
parentFormListField,
|
|
194
194
|
isShowLabel = true
|
|
195
195
|
}) => {
|
|
196
|
+
var _a;
|
|
196
197
|
const formListInitValue = func.handleSetFormItemInitialValue(itemWithJson);
|
|
198
|
+
const hidden = (_a = itemWithJson.json) == null ? void 0 : _a.hidden;
|
|
197
199
|
let children = itemWithJson.children || [];
|
|
198
200
|
if (Array.isArray(children == null ? void 0 : children[0]) && children.length) {
|
|
199
201
|
children = children[0];
|
|
@@ -205,7 +207,7 @@ function useDynamicForm(props) {
|
|
|
205
207
|
}
|
|
206
208
|
return [itemWithJson.attrid, field.name];
|
|
207
209
|
};
|
|
208
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
210
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: hidden ? 0 : 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
209
211
|
antd.Collapse,
|
|
210
212
|
{
|
|
211
213
|
bordered: false,
|
|
@@ -300,10 +302,11 @@ function useDynamicForm(props) {
|
|
|
300
302
|
isShowLabel = true
|
|
301
303
|
}) => {
|
|
302
304
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
303
|
-
|
|
305
|
+
const hidden = (_a = itemWithJson.json) == null ? void 0 : _a.hidden;
|
|
306
|
+
if (((_b = itemWithJson.json) == null ? void 0 : _b.hide) === true) {
|
|
304
307
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
305
308
|
}
|
|
306
|
-
if (itemWithJson.attrtype === 1) {
|
|
309
|
+
if (itemWithJson.attrtype === 1 && !hidden) {
|
|
307
310
|
return renderNestedFormList({
|
|
308
311
|
itemWithJson,
|
|
309
312
|
colNum,
|
|
@@ -323,12 +326,11 @@ function useDynamicForm(props) {
|
|
|
323
326
|
}
|
|
324
327
|
if (itemWithJson.attrtype === 0) {
|
|
325
328
|
const initialValue = func.handleSetFormItemInitialValue(itemWithJson);
|
|
326
|
-
const message2 = (
|
|
327
|
-
const hidden = (_c = itemWithJson.json) == null ? void 0 : _c.hidden;
|
|
329
|
+
const message2 = (_c = itemWithJson.json) == null ? void 0 : _c["default-prompt"];
|
|
328
330
|
const placeholder = func.handleGetPlaceholder(itemWithJson, langId);
|
|
329
331
|
const { combinations = [] } = itemWithJson.json || {};
|
|
330
332
|
if (combinations == null ? void 0 : combinations.length) {
|
|
331
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
333
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: hidden ? 0 : 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
332
334
|
antd.Form.Item,
|
|
333
335
|
{
|
|
334
336
|
label: (_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["combination-name"],
|
|
@@ -391,7 +393,7 @@ function useDynamicForm(props) {
|
|
|
391
393
|
) });
|
|
392
394
|
}
|
|
393
395
|
const formItemName = isFormListItem && formListField ? Array.isArray(formListField.name) ? [...formListField.name, itemWithJson.attrid] : [formListField.name, itemWithJson.attrid] : itemWithJson.attrid;
|
|
394
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
396
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: hidden ? 0 : 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
395
397
|
antd.Form.Item,
|
|
396
398
|
{
|
|
397
399
|
name: formItemName,
|
|
@@ -653,7 +655,7 @@ function useDynamicForm(props) {
|
|
|
653
655
|
antd.DatePicker,
|
|
654
656
|
{
|
|
655
657
|
multiple: true,
|
|
656
|
-
maxTagCount: ((_p = item == null ? void 0 : item.json) == null ? void 0 : _p["max-tag-count"]) ||
|
|
658
|
+
maxTagCount: ((_p = item == null ? void 0 : item.json) == null ? void 0 : _p["max-tag-count"]) || 1,
|
|
657
659
|
disabled: readonly || ((_q = item.json) == null ? void 0 : _q.readonly) || false,
|
|
658
660
|
style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
|
|
659
661
|
}
|
|
@@ -254,12 +254,13 @@ function useDynamicForm(props) {
|
|
|
254
254
|
formListField,
|
|
255
255
|
isShowLabel = true
|
|
256
256
|
}) => {
|
|
257
|
-
var _a, _b, _c, _d, _e, _f;
|
|
258
|
-
|
|
257
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
258
|
+
const hidden = (_a = itemWithJson.json) == null ? void 0 : _a.hidden;
|
|
259
|
+
if (((_b = itemWithJson.json) == null ? void 0 : _b.hide) === true || (hideAttrList == null ? void 0 : hideAttrList.includes(itemWithJson.attrid))) {
|
|
259
260
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
260
261
|
}
|
|
261
|
-
readonly = ((
|
|
262
|
-
if (itemWithJson.attrtype === 1) {
|
|
262
|
+
readonly = ((_c = itemWithJson.json) == null ? void 0 : _c.readonly) || readonly || false;
|
|
263
|
+
if (itemWithJson.attrtype === 1 && !hidden) {
|
|
263
264
|
return renderNestedFormList({
|
|
264
265
|
itemWithJson,
|
|
265
266
|
colNum,
|
|
@@ -279,12 +280,12 @@ function useDynamicForm(props) {
|
|
|
279
280
|
}
|
|
280
281
|
if (itemWithJson.attrtype === 0) {
|
|
281
282
|
const initialValue = func.handleSetFormItemInitialValue(itemWithJson);
|
|
282
|
-
const message2 = (
|
|
283
|
+
const message2 = (_d = itemWithJson.json) == null ? void 0 : _d["default-prompt"];
|
|
283
284
|
const placeholder = func.handleGetPlaceholder(itemWithJson, langId);
|
|
284
285
|
const { combinations = [] } = itemWithJson.json || {};
|
|
285
286
|
if (combinations == null ? void 0 : combinations.length) {
|
|
286
287
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { children: combinations.map((item, index) => {
|
|
287
|
-
var _a2, _b2, _c2, _d2, _e2, _f2,
|
|
288
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
288
289
|
let initValue = func.handleSetFormItemInitialValue(item);
|
|
289
290
|
let width = defaultWidth;
|
|
290
291
|
const mode = item.json.input || "text";
|
|
@@ -302,7 +303,8 @@ function useDynamicForm(props) {
|
|
|
302
303
|
style: {
|
|
303
304
|
flex: width,
|
|
304
305
|
pointerEvents: readonly ? "none" : "auto",
|
|
305
|
-
opacity: readonly ? 0.5 : 1
|
|
306
|
+
opacity: readonly ? 0.5 : 1,
|
|
307
|
+
display: hidden ? "none" : "block"
|
|
306
308
|
},
|
|
307
309
|
label: index === 0 ? (_b2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b2["combination-name"] : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { visibility: "hidden" }, children: (_c2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c2["combination-name"] }),
|
|
308
310
|
required: index === 0 ? (_d2 = item.json) == null ? void 0 : _d2.must : false,
|
|
@@ -318,7 +320,7 @@ function useDynamicForm(props) {
|
|
|
318
320
|
...((_f2 = itemWithJson.json) == null ? void 0 : _f2.regexp) ? [
|
|
319
321
|
{
|
|
320
322
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
321
|
-
message: ((
|
|
323
|
+
message: ((_g2 = itemWithJson.json) == null ? void 0 : _g2["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
|
|
322
324
|
}
|
|
323
325
|
] : []
|
|
324
326
|
],
|
|
@@ -349,19 +351,20 @@ function useDynamicForm(props) {
|
|
|
349
351
|
initialValue,
|
|
350
352
|
style: {
|
|
351
353
|
pointerEvents: readonly ? "none" : "auto",
|
|
352
|
-
opacity: readonly ? 0.5 : 1
|
|
354
|
+
opacity: readonly ? 0.5 : 1,
|
|
355
|
+
display: hidden ? "none" : "block"
|
|
353
356
|
},
|
|
354
357
|
rules: [
|
|
355
|
-
...((
|
|
358
|
+
...((_e = itemWithJson.json) == null ? void 0 : _e.must) ? [
|
|
356
359
|
{
|
|
357
360
|
required: true,
|
|
358
361
|
message: `${placeholder}${itemWithJson.attrname}`
|
|
359
362
|
}
|
|
360
363
|
] : [],
|
|
361
|
-
...((
|
|
364
|
+
...((_f = itemWithJson.json) == null ? void 0 : _f.regexp) ? [
|
|
362
365
|
{
|
|
363
366
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
364
|
-
message: ((
|
|
367
|
+
message: ((_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
|
|
365
368
|
}
|
|
366
369
|
] : []
|
|
367
370
|
],
|