szld-libs 0.4.9 → 0.4.11

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.
@@ -257,10 +257,11 @@ function useDynamicForm(props) {
257
257
  formListField,
258
258
  isShowLabel = true
259
259
  }) => {
260
- var _a, _b, _c, _d, _e;
260
+ var _a, _b, _c, _d, _e, _f;
261
261
  if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true || (hideAttrList == null ? void 0 : hideAttrList.includes(itemWithJson.attrid))) {
262
262
  return /* @__PURE__ */ jsx(Fragment$1, {});
263
263
  }
264
+ readonly = ((_b = itemWithJson.json) == null ? void 0 : _b.readonly) || readonly || false;
264
265
  if (itemWithJson.attrtype === 1) {
265
266
  return renderNestedFormList({
266
267
  itemWithJson,
@@ -281,12 +282,12 @@ function useDynamicForm(props) {
281
282
  }
282
283
  if (itemWithJson.attrtype === 0) {
283
284
  const initialValue = handleSetFormItemInitialValue(itemWithJson);
284
- const message2 = (_b = itemWithJson.json) == null ? void 0 : _b["default-prompt"];
285
+ const message2 = (_c = itemWithJson.json) == null ? void 0 : _c["default-prompt"];
285
286
  const placeholder = handleGetPlaceholder(itemWithJson, langId);
286
287
  const { combinations = [] } = itemWithJson.json || {};
287
288
  if (combinations == null ? void 0 : combinations.length) {
288
289
  return /* @__PURE__ */ jsx(Flex, { children: combinations.map((item, index) => {
289
- var _a2, _b2, _c2, _d2, _e2, _f, _g;
290
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g;
290
291
  let initValue = handleSetFormItemInitialValue(item);
291
292
  let width = defaultWidth;
292
293
  const mode = item.json.input || "text";
@@ -301,7 +302,11 @@ function useDynamicForm(props) {
301
302
  return /* @__PURE__ */ jsx(
302
303
  Form.Item,
303
304
  {
304
- style: { flex: width },
305
+ style: {
306
+ flex: width,
307
+ pointerEvents: readonly ? "none" : "auto",
308
+ opacity: readonly ? 0.5 : 1
309
+ },
305
310
  label: index === 0 ? (_b2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b2["combination-name"] : /* @__PURE__ */ jsx("div", { style: { visibility: "hidden" }, children: (_c2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c2["combination-name"] }),
306
311
  required: index === 0 ? (_d2 = item.json) == null ? void 0 : _d2.must : false,
307
312
  name: formListField ? Array.isArray(formListField.name) ? [...formListField.name, item.attrid] : [formListField.name, item.attrid] : item.attrid,
@@ -313,7 +318,7 @@ function useDynamicForm(props) {
313
318
  message: message2 || `${placeholder}${item.attrname}`
314
319
  }
315
320
  ] : [],
316
- ...((_f = itemWithJson.json) == null ? void 0 : _f.regexp) ? [
321
+ ...((_f2 = itemWithJson.json) == null ? void 0 : _f2.regexp) ? [
317
322
  {
318
323
  pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
319
324
  message: ((_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
@@ -344,17 +349,21 @@ function useDynamicForm(props) {
344
349
  name: formItemName,
345
350
  label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
346
351
  initialValue,
352
+ style: {
353
+ pointerEvents: readonly ? "none" : "auto",
354
+ opacity: readonly ? 0.5 : 1
355
+ },
347
356
  rules: [
348
- ...((_c = itemWithJson.json) == null ? void 0 : _c.must) ? [
357
+ ...((_d = itemWithJson.json) == null ? void 0 : _d.must) ? [
349
358
  {
350
359
  required: true,
351
360
  message: `${placeholder}${itemWithJson.attrname}`
352
361
  }
353
362
  ] : [],
354
- ...((_d = itemWithJson.json) == null ? void 0 : _d.regexp) ? [
363
+ ...((_e = itemWithJson.json) == null ? void 0 : _e.regexp) ? [
355
364
  {
356
365
  pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
357
- message: ((_e = itemWithJson.json) == null ? void 0 : _e["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
366
+ message: ((_f = itemWithJson.json) == null ? void 0 : _f["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
358
367
  }
359
368
  ] : []
360
369
  ],
@@ -598,7 +607,7 @@ function useDynamicForm(props) {
598
607
  );
599
608
  }
600
609
  case "range-picker":
601
- return /* @__PURE__ */ jsx(Calendar, { type: "range", children: (val, actions) => {
610
+ return /* @__PURE__ */ jsx(Calendar, { type: "range", readOnly: readonly, children: (val, actions) => {
602
611
  return /* @__PURE__ */ jsx(
603
612
  Cell,
604
613
  {
@@ -606,10 +615,8 @@ function useDynamicForm(props) {
606
615
  value: val ? val.map(
607
616
  (el) => dayjs(el).format("YYYY-MM-DD")
608
617
  ).join("~") : langId === "10001" ? "请选择日期" : "Please select a date",
609
- onClick: () => {
610
- if (!readonly) {
611
- actions.open();
612
- }
618
+ onClick: (e) => {
619
+ actions.open();
613
620
  }
614
621
  }
615
622
  );
package/es/mock/index.js CHANGED
@@ -8,7 +8,7 @@ const attrList = [
8
8
  attrid: "30BDE6E7977E40069B55DDE61C8795AE",
9
9
  attrname: "Dates",
10
10
  attrtype: 0,
11
- info: '{"input":"range-picker","range-picker-save":"single","dataType":"string","length":1000,"input-width":240,"must":true}',
11
+ info: '{"readonly":true,"input":"range-picker","range-picker-save":"single","dataType":"string","length":1000,"input-width":240,"must":true}',
12
12
  info_base64: 0,
13
13
  createtime: "2026-02-11 15:12:26",
14
14
  attrvalue: "",
@@ -258,10 +258,11 @@ function useDynamicForm(props) {
258
258
  formListField,
259
259
  isShowLabel = true
260
260
  }) => {
261
- var _a, _b, _c, _d, _e;
261
+ var _a, _b, _c, _d, _e, _f;
262
262
  if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true || (hideAttrList == null ? void 0 : hideAttrList.includes(itemWithJson.attrid))) {
263
263
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
264
264
  }
265
+ readonly = ((_b = itemWithJson.json) == null ? void 0 : _b.readonly) || readonly || false;
265
266
  if (itemWithJson.attrtype === 1) {
266
267
  return renderNestedFormList({
267
268
  itemWithJson,
@@ -282,12 +283,12 @@ function useDynamicForm(props) {
282
283
  }
283
284
  if (itemWithJson.attrtype === 0) {
284
285
  const initialValue = func.handleSetFormItemInitialValue(itemWithJson);
285
- const message2 = (_b = itemWithJson.json) == null ? void 0 : _b["default-prompt"];
286
+ const message2 = (_c = itemWithJson.json) == null ? void 0 : _c["default-prompt"];
286
287
  const placeholder = func.handleGetPlaceholder(itemWithJson, langId);
287
288
  const { combinations = [] } = itemWithJson.json || {};
288
289
  if (combinations == null ? void 0 : combinations.length) {
289
290
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { children: combinations.map((item, index) => {
290
- var _a2, _b2, _c2, _d2, _e2, _f, _g;
291
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g;
291
292
  let initValue = func.handleSetFormItemInitialValue(item);
292
293
  let width = defaultWidth;
293
294
  const mode = item.json.input || "text";
@@ -302,7 +303,11 @@ function useDynamicForm(props) {
302
303
  return /* @__PURE__ */ jsxRuntime.jsx(
303
304
  reactVant.Form.Item,
304
305
  {
305
- style: { flex: width },
306
+ style: {
307
+ flex: width,
308
+ pointerEvents: readonly ? "none" : "auto",
309
+ opacity: readonly ? 0.5 : 1
310
+ },
306
311
  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"] }),
307
312
  required: index === 0 ? (_d2 = item.json) == null ? void 0 : _d2.must : false,
308
313
  name: formListField ? Array.isArray(formListField.name) ? [...formListField.name, item.attrid] : [formListField.name, item.attrid] : item.attrid,
@@ -314,7 +319,7 @@ function useDynamicForm(props) {
314
319
  message: message2 || `${placeholder}${item.attrname}`
315
320
  }
316
321
  ] : [],
317
- ...((_f = itemWithJson.json) == null ? void 0 : _f.regexp) ? [
322
+ ...((_f2 = itemWithJson.json) == null ? void 0 : _f2.regexp) ? [
318
323
  {
319
324
  pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
320
325
  message: ((_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
@@ -345,17 +350,21 @@ function useDynamicForm(props) {
345
350
  name: formItemName,
346
351
  label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
347
352
  initialValue,
353
+ style: {
354
+ pointerEvents: readonly ? "none" : "auto",
355
+ opacity: readonly ? 0.5 : 1
356
+ },
348
357
  rules: [
349
- ...((_c = itemWithJson.json) == null ? void 0 : _c.must) ? [
358
+ ...((_d = itemWithJson.json) == null ? void 0 : _d.must) ? [
350
359
  {
351
360
  required: true,
352
361
  message: `${placeholder}${itemWithJson.attrname}`
353
362
  }
354
363
  ] : [],
355
- ...((_d = itemWithJson.json) == null ? void 0 : _d.regexp) ? [
364
+ ...((_e = itemWithJson.json) == null ? void 0 : _e.regexp) ? [
356
365
  {
357
366
  pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
358
- message: ((_e = itemWithJson.json) == null ? void 0 : _e["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
367
+ message: ((_f = itemWithJson.json) == null ? void 0 : _f["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
359
368
  }
360
369
  ] : []
361
370
  ],
@@ -599,7 +608,7 @@ function useDynamicForm(props) {
599
608
  );
600
609
  }
601
610
  case "range-picker":
602
- return /* @__PURE__ */ jsxRuntime.jsx(reactVant.Calendar, { type: "range", children: (val, actions) => {
611
+ return /* @__PURE__ */ jsxRuntime.jsx(reactVant.Calendar, { type: "range", readOnly: readonly, children: (val, actions) => {
603
612
  return /* @__PURE__ */ jsxRuntime.jsx(
604
613
  reactVant.Cell,
605
614
  {
@@ -607,10 +616,8 @@ function useDynamicForm(props) {
607
616
  value: val ? val.map(
608
617
  (el) => dayjs(el).format("YYYY-MM-DD")
609
618
  ).join("~") : langId === "10001" ? "请选择日期" : "Please select a date",
610
- onClick: () => {
611
- if (!readonly) {
612
- actions.open();
613
- }
619
+ onClick: (e) => {
620
+ actions.open();
614
621
  }
615
622
  }
616
623
  );
package/lib/mock/index.js CHANGED
@@ -10,7 +10,7 @@ const attrList = [
10
10
  attrid: "30BDE6E7977E40069B55DDE61C8795AE",
11
11
  attrname: "Dates",
12
12
  attrtype: 0,
13
- info: '{"input":"range-picker","range-picker-save":"single","dataType":"string","length":1000,"input-width":240,"must":true}',
13
+ info: '{"readonly":true,"input":"range-picker","range-picker-save":"single","dataType":"string","length":1000,"input-width":240,"must":true}',
14
14
  info_base64: 0,
15
15
  createtime: "2026-02-11 15:12:26",
16
16
  attrvalue: "",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.4.9",
4
+ "version": "0.4.11",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",