@daracl/form 0.0.18 → 0.0.19

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.
@@ -1383,7 +1383,7 @@
1383
1383
  fileList.forEach((file) => {
1384
1384
  fileTemplateHtml.push(`
1385
1385
  <div class="df-file-item" data-seq="${file.$seq}">
1386
- ${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>
1386
+ ${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>
1387
1387
  <span class="df-file-name">${file.fileName}</span >
1388
1388
  </div>`);
1389
1389
  });
@@ -3373,12 +3373,11 @@
3373
3373
  * @param evt event
3374
3374
  */
3375
3375
  removeRow(evt) {
3376
- var _a, _b;
3376
+ var _a;
3377
3377
  const target = evt.target;
3378
3378
  const rowElement = target.closest("tr");
3379
3379
  if (rowElement) {
3380
- if (((_a = rowElement.parentElement) == null ? void 0 : _a.childElementCount) == 1) return;
3381
- let rowIdx = ((_b = evt.currentTarget) == null ? void 0 : _b.getAttribute("data-row-idx")) || "-1";
3380
+ let rowIdx = ((_a = evt.currentTarget) == null ? void 0 : _a.getAttribute("data-row-idx")) || "-1";
3382
3381
  this.removeFieldInfo(rowIdx);
3383
3382
  rowElement.remove();
3384
3383
  }
@@ -3389,6 +3388,7 @@
3389
3388
  */
3390
3389
  removeFieldInfo(rowIdx) {
3391
3390
  let removeFieldArrs = [];
3391
+ console.log("rowIdx : ", rowIdx);
3392
3392
  if (isEmpty(rowIdx)) {
3393
3393
  for (let key in this.allAddRowInfo) {
3394
3394
  removeFieldArrs = removeFieldArrs.concat(this.allAddRowInfo[key]);
@@ -4053,7 +4053,7 @@
4053
4053
  getLabelTemplate(field) {
4054
4054
  const requiredTemplate = field.required ? `<span class="required"></span>` : "";
4055
4055
  const tooltipTemplate = isBlank(field.tooltip) ? "" : `<span class="df-tooltip">?<span class="df-tooltip-text">${field.tooltip}</span></span>`;
4056
- return `${field.label ?? ""} ${tooltipTemplate} ${requiredTemplate}`;
4056
+ return `<span class="df-label-text">${field.label ?? ""}</span> ${tooltipTemplate} ${requiredTemplate}`;
4057
4057
  }
4058
4058
  /**
4059
4059
  * label 숨김 여부
@@ -4116,6 +4116,26 @@
4116
4116
  this.changeMode = (mode) => {
4117
4117
  this.options.mode = mode;
4118
4118
  this.formElement.setAttribute("data-df-mode", mode);
4119
+ const fields = this.formElement.querySelectorAll(".df-field input, .df-field textarea, .df-field select");
4120
+ if (mode == "view") {
4121
+ fields.forEach((field) => {
4122
+ if (field instanceof HTMLInputElement) {
4123
+ field.readOnly = true;
4124
+ }
4125
+ if (field instanceof HTMLTextAreaElement) {
4126
+ field.readOnly = true;
4127
+ }
4128
+ });
4129
+ } else {
4130
+ fields.forEach((field) => {
4131
+ if (field instanceof HTMLInputElement) {
4132
+ field.readOnly = false;
4133
+ }
4134
+ if (field instanceof HTMLTextAreaElement) {
4135
+ field.readOnly = false;
4136
+ }
4137
+ });
4138
+ }
4119
4139
  };
4120
4140
  this.resetForm = () => {
4121
4141
  const fieldMap = this.fieldInfoMap.getAllFieldInfo();
@@ -4455,7 +4475,7 @@
4455
4475
  return this.fieldInfoMap;
4456
4476
  }
4457
4477
  };
4458
- _DaraForm.VERSION = `${"0.0.18"}`;
4478
+ _DaraForm.VERSION = `${"0.0.19"}`;
4459
4479
  _DaraForm.validator = {
4460
4480
  string: (value, field) => {
4461
4481
  return stringValidator(value, field);