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