@daracl/form 0.0.18 → 0.0.20

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/index.cjs CHANGED
@@ -1329,7 +1329,7 @@ class FileRender extends Render {
1329
1329
  fileList.forEach((file) => {
1330
1330
  fileTemplateHtml.push(`
1331
1331
  <div class="df-file-item" data-seq="${file.$seq}">
1332
- ${file.fileId ? '<span class="df-file-icon df-file-download"></span>' : '<span class="df-file-icon"></span>'} <span class="df-file-icon df-file-remove"></span>
1332
+ ${file.fileId ? '<span class="df-file-icon df-file-download"></span>' : '<span class="df-file-icon df-empty-icon"></span>'} <span class="df-file-icon df-file-remove"></span>
1333
1333
  <span class="df-file-name">${file.fileName}</span >
1334
1334
  </div>`);
1335
1335
  });
@@ -3319,12 +3319,11 @@ class GridRender extends Render {
3319
3319
  * @param evt event
3320
3320
  */
3321
3321
  removeRow(evt) {
3322
- var _a, _b;
3322
+ var _a;
3323
3323
  const target = evt.target;
3324
3324
  const rowElement = target.closest("tr");
3325
3325
  if (rowElement) {
3326
- if (((_a = rowElement.parentElement) == null ? void 0 : _a.childElementCount) == 1) return;
3327
- let rowIdx = ((_b = evt.currentTarget) == null ? void 0 : _b.getAttribute("data-row-idx")) || "-1";
3326
+ let rowIdx = ((_a = evt.currentTarget) == null ? void 0 : _a.getAttribute("data-row-idx")) || "-1";
3328
3327
  this.removeFieldInfo(rowIdx);
3329
3328
  rowElement.remove();
3330
3329
  }
@@ -3335,6 +3334,7 @@ class GridRender extends Render {
3335
3334
  */
3336
3335
  removeFieldInfo(rowIdx) {
3337
3336
  let removeFieldArrs = [];
3337
+ console.log("rowIdx : ", rowIdx);
3338
3338
  if (isEmpty(rowIdx)) {
3339
3339
  for (let key in this.allAddRowInfo) {
3340
3340
  removeFieldArrs = removeFieldArrs.concat(this.allAddRowInfo[key]);
@@ -3999,7 +3999,7 @@ class FormTemplate {
3999
3999
  getLabelTemplate(field) {
4000
4000
  const requiredTemplate = field.required ? `<span class="required"></span>` : "";
4001
4001
  const tooltipTemplate = isBlank(field.tooltip) ? "" : `<span class="df-tooltip">?<span class="df-tooltip-text">${field.tooltip}</span></span>`;
4002
- return `${field.label ?? ""} ${tooltipTemplate} ${requiredTemplate}`;
4002
+ return `<span class="df-label-text">${field.label ?? ""}</span> ${tooltipTemplate} ${requiredTemplate}`;
4003
4003
  }
4004
4004
  /**
4005
4005
  * label 숨김 여부
@@ -4062,6 +4062,26 @@ const _DaraForm = class _DaraForm {
4062
4062
  this.changeMode = (mode) => {
4063
4063
  this.options.mode = mode;
4064
4064
  this.formElement.setAttribute("data-df-mode", mode);
4065
+ const fields = this.formElement.querySelectorAll(".df-field input, .df-field textarea, .df-field select");
4066
+ if (mode == "view") {
4067
+ fields.forEach((field) => {
4068
+ if (field instanceof HTMLInputElement) {
4069
+ field.readOnly = true;
4070
+ }
4071
+ if (field instanceof HTMLTextAreaElement) {
4072
+ field.readOnly = true;
4073
+ }
4074
+ });
4075
+ } else {
4076
+ fields.forEach((field) => {
4077
+ if (field instanceof HTMLInputElement) {
4078
+ field.readOnly = false;
4079
+ }
4080
+ if (field instanceof HTMLTextAreaElement) {
4081
+ field.readOnly = false;
4082
+ }
4083
+ });
4084
+ }
4065
4085
  };
4066
4086
  this.resetForm = () => {
4067
4087
  const fieldMap = this.fieldInfoMap.getAllFieldInfo();
@@ -4401,7 +4421,7 @@ const _DaraForm = class _DaraForm {
4401
4421
  return this.fieldInfoMap;
4402
4422
  }
4403
4423
  };
4404
- _DaraForm.VERSION = `${"0.0.18"}`;
4424
+ _DaraForm.VERSION = `${"0.0.20"}`;
4405
4425
  _DaraForm.validator = {
4406
4426
  string: (value, field) => {
4407
4427
  return stringValidator(value, field);