@sankhyalabs/ezui 7.1.0-dev.1 → 7.1.0-dev.3

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.
@@ -7,7 +7,7 @@ const core = require('@sankhyalabs/core');
7
7
  const index$1 = require('./index-00d0166b.js');
8
8
  const FormLayout = require('./FormLayout-18853e70.js');
9
9
  const RichToolbarHelper = require('./RichToolbarHelper-ea12328f.js');
10
- const purify = require('./purify-47a2f27b.js');
10
+ const purify = require('./purify-453a8028.js');
11
11
  const ApplicationUtils = require('./ApplicationUtils-d04f5c94.js');
12
12
  require('./DialogType-2114c337.js');
13
13
  require('./CheckMode-ecb90b87.js');
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index$1 = require('./index-a7b0c73d.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const searchColumn = require('./search-column-9aa090ec.js');
7
+ const searchColumn = require('./search-column-8bfee733.js');
8
8
  const index = require('./index-00d0166b.js');
9
9
  const FormLayout = require('./FormLayout-18853e70.js');
10
10
  require('./ApplicationUtils-d04f5c94.js');
@@ -82,28 +82,49 @@ const buildFormConfigFromDataUnit = (dataUnit) => {
82
82
  .filter(descriptor => descriptor.visible !== false)
83
83
  .map(descriptor => { return { name: descriptor.name, defaultValue: descriptor.defaultValue }; });
84
84
  }
85
- const config = { emptyConfig: false, fields };
86
- return config;
85
+ return { emptyConfig: false, fields };
87
86
  };
88
- const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
89
- var _a, _b;
90
- if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
91
- config = buildFormConfigFromDataUnit(dataUnit);
92
- }
93
- const sheets = new Map();
94
- const hiddenTabs = new Map();
95
- const requiredFields = [];
96
- const cleanOnCopyFields = [];
97
- const defaultValues = {};
98
- (_a = config === null || config === void 0 ? void 0 : config.tabs) === null || _a === void 0 ? void 0 : _a.forEach((tab) => {
99
- if (!hiddenTabs.has(tab.label) && tab.visible === false) {
100
- hiddenTabs.set(tab.label, tab);
87
+ function handleDetailTabs(dataUnit, config, sheets) {
88
+ const unitMD = dataUnit.metadata;
89
+ if (unitMD === undefined || unitMD.children === undefined)
90
+ return;
91
+ unitMD.children.forEach((child) => {
92
+ const tabConfig = getTabFromConfig(child.label, config);
93
+ if (tabConfig) {
94
+ sheets.set(Object.assign(tabConfig, { name: buildChildName(child), isDetail: true }), []);
95
+ return;
101
96
  }
97
+ const { label, name, fields } = buildDetailSheet(child);
98
+ sheets.set({ name, label, isDetail: true }, fields);
102
99
  });
103
- (_b = config === null || config === void 0 ? void 0 : config.fields) === null || _b === void 0 ? void 0 : _b.forEach((field) => {
100
+ }
101
+ function handleCustomTabs(customGuides, config, sheets) {
102
+ customGuides.forEach((guide) => {
103
+ const tabConfig = getTabFromConfig(guide.label, config);
104
+ if (tabConfig) {
105
+ sheets.set(Object.assign(tabConfig, { name: guide.id, isCustom: true }), []);
106
+ return;
107
+ }
108
+ const sheet = { label: guide.label, name: guide.id, isCustom: true, visible: true };
109
+ sheets.set(sheet, []);
110
+ });
111
+ }
112
+ function parseTabToFormSheet(key, fields) {
113
+ const i18n = index.getI18n();
114
+ return {
115
+ label: (key.label === "__main") ? i18n("ez-form.mainTab") : key.label,
116
+ name: key.name || key.label,
117
+ isCustom: key.isCustom,
118
+ isDetail: key.isDetail,
119
+ fields
120
+ };
121
+ }
122
+ function handleFields(config, sheets, hiddenTabs, dataUnit, requiredFields, cleanOnCopyFields, defaultValues) {
123
+ var _a;
124
+ (_a = config === null || config === void 0 ? void 0 : config.fields) === null || _a === void 0 ? void 0 : _a.forEach((field) => {
104
125
  var _a, _b, _c;
105
126
  if (field.visible !== false) {
106
- const tabConfig = getTabConfig(field.tab || "__main", sheets);
127
+ const tabConfig = getTabConfig(field.tab || "__main", sheets, config);
107
128
  if (hiddenTabs.has(tabConfig.label)) {
108
129
  return;
109
130
  }
@@ -139,7 +160,8 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
139
160
  defaultValue = value;
140
161
  }
141
162
  }
142
- catch (_d) { }
163
+ catch (_d) {
164
+ }
143
165
  }
144
166
  }
145
167
  defaultValues[field.name] = defaultValue;
@@ -147,42 +169,82 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
147
169
  }
148
170
  }
149
171
  });
172
+ }
173
+ const buildFormMetadata = (config, dataUnit, includeDetails = false, customGuides) => {
174
+ var _a;
175
+ if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
176
+ config = buildFormConfigFromDataUnit(dataUnit);
177
+ }
178
+ const sheets = new Map();
179
+ const hiddenTabs = new Map();
180
+ const requiredFields = [];
181
+ const cleanOnCopyFields = [];
182
+ const defaultValues = {};
183
+ const tabs = (_a = config === null || config === void 0 ? void 0 : config.tabs) !== null && _a !== void 0 ? _a : [];
184
+ tabs.forEach((tab) => {
185
+ if (!hiddenTabs.has(tab.label) && tab.visible === false) {
186
+ hiddenTabs.set(tab.label, tab);
187
+ }
188
+ });
189
+ handleFields(config, sheets, hiddenTabs, dataUnit, requiredFields, cleanOnCopyFields, defaultValues);
150
190
  const metadata = new FormMetadata();
151
191
  metadata.setDefaultVars(config.defaultVars);
152
192
  if (includeDetails) {
153
- const unitMD = dataUnit.metadata;
154
- if (unitMD != undefined && unitMD.children != undefined) {
155
- unitMD.children.forEach(child => {
156
- const { label, name, fields } = buildDetailSheet(child);
157
- sheets.set({ name, label }, fields);
158
- });
159
- }
193
+ handleDetailTabs(dataUnit, config, sheets);
194
+ }
195
+ if (customGuides) {
196
+ handleCustomTabs(customGuides, config, sheets);
160
197
  }
161
- const i18n = index.getI18n();
162
198
  Array.from(sheets.entries())
163
199
  .sort(sortTabs)
164
- .forEach(([key, fields]) => {
165
- metadata.addSheet({
166
- label: (key.label === "__main") ? i18n("ez-form.mainTab") : key.label,
167
- name: key.name || key.label,
168
- fields
169
- });
200
+ .forEach(([tab, fields]) => {
201
+ if (!hiddenTabs.has(tab.label)) {
202
+ metadata.addSheet(parseTabToFormSheet(tab, fields));
203
+ }
170
204
  });
171
205
  metadata.addRequiredFields(requiredFields);
172
206
  metadata.addCleanOnCopyFields(cleanOnCopyFields);
173
207
  metadata.addDefaultValues(defaultValues);
174
208
  return metadata;
175
209
  };
176
- const getTabConfig = (tab, sheets) => {
177
- const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
210
+ const getTabFromConfig = (tab, config) => {
211
+ var _a;
212
+ if (!config) {
213
+ return;
214
+ }
215
+ return (_a = config.tabs) === null || _a === void 0 ? void 0 : _a.find(t => t.label === tab);
216
+ };
217
+ const getTabConfig = (tab, sheets, config) => {
218
+ if (typeof tab !== "string") {
219
+ return tab;
220
+ }
221
+ if (config) {
222
+ const tabConfig = getTabFromConfig(tab, config);
223
+ if (tabConfig) {
224
+ return tabConfig;
225
+ }
226
+ }
227
+ const tabConfig = Array.from(sheets.keys()).find(t => t.label === tab);
178
228
  return tabConfig || { label: tab, visible: true };
179
229
  };
180
- const sortTabs = (a, b) => {
181
- return a[0].label == '__main' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
230
+ function sortTabs(a, b) {
231
+ var _a, _b;
232
+ if (a[0].label === '__main' && b[0].label !== '__main') {
233
+ return -1;
234
+ }
235
+ if (a[0].label !== '__main' && b[0].label === '__main') {
236
+ return 1;
237
+ }
238
+ const aOrder = (_a = a[0].order) !== null && _a !== void 0 ? _a : Number.MAX_VALUE;
239
+ const bOrder = (_b = b[0].order) !== null && _b !== void 0 ? _b : Number.MAX_VALUE;
240
+ return aOrder - bOrder;
241
+ }
242
+ const buildChildName = (child) => {
243
+ return `child[${child.name}]`;
182
244
  };
183
245
  const buildDetailSheet = (child) => {
184
246
  return {
185
- name: `child[${child.name}]`,
247
+ name: buildChildName(child),
186
248
  label: child.label,
187
249
  fields: []
188
250
  };
@@ -10,10 +10,10 @@ require('./DialogType-2114c337.js');
10
10
  require('./CheckMode-ecb90b87.js');
11
11
  const index = require('./index-00d0166b.js');
12
12
  const FormLayout = require('./FormLayout-18853e70.js');
13
- const searchColumn = require('./search-column-9aa090ec.js');
13
+ const searchColumn = require('./search-column-8bfee733.js');
14
14
  const constants = require('./constants-72b7e05e.js');
15
15
  const FocusResolver = require('./FocusResolver-885f2173.js');
16
- const purify = require('./purify-47a2f27b.js');
16
+ const purify = require('./purify-453a8028.js');
17
17
  require('./_commonjsHelpers-537d719a.js');
18
18
 
19
19
  /**
@@ -65578,7 +65578,7 @@ class AgGridController {
65578
65578
  const colDefsWithConfigs = this.getColsDefWithConfigApplied(colDefs, this._lastColsConfig);
65579
65579
  this._gridOptions.api.setColumnDefs(colDefsWithConfigs);
65580
65580
  }
65581
- getColsDefWithConfigApplied(colDefs, colsConfig) {
65581
+ getColsDefWithConfigApplied(colDefs, colsConfig = []) {
65582
65582
  //Cria map de colunas existentes na config e seu índice
65583
65583
  const orderMap = colsConfig.reduce((map, col, index) => {
65584
65584
  map[col.name] = index;
@@ -3,7 +3,7 @@
3
3
  const _commonjsHelpers = require('./_commonjsHelpers-537d719a.js');
4
4
 
5
5
  var purify = _commonjsHelpers.createCommonjsModule(function (module, exports) {
6
- /*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */
6
+ /*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
7
7
 
8
8
  (function (global, factory) {
9
9
  module.exports = factory() ;
@@ -192,7 +192,7 @@ var purify = _commonjsHelpers.createCommonjsModule(function (module, exports) {
192
192
  }
193
193
 
194
194
  const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'search', 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
195
- const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'slot', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
195
+ const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
196
196
  const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
197
197
  // List of SVG elements that are disallowed by default.
198
198
  // We still need to know them so that we can do namespace
@@ -206,7 +206,7 @@ var purify = _commonjsHelpers.createCommonjsModule(function (module, exports) {
206
206
  const text = freeze(['#text']);
207
207
 
208
208
  const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
209
- const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
209
+ const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
210
210
  const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
211
211
  const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
212
212
 
@@ -313,7 +313,7 @@ var purify = _commonjsHelpers.createCommonjsModule(function (module, exports) {
313
313
  function createDOMPurify() {
314
314
  let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
315
315
  const DOMPurify = root => createDOMPurify(root);
316
- DOMPurify.version = '3.2.7';
316
+ DOMPurify.version = '3.3.0';
317
317
  DOMPurify.removed = [];
318
318
  if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
319
319
  // Not running in a browser, provide a factory function
@@ -424,6 +424,21 @@ var purify = _commonjsHelpers.createCommonjsModule(function (module, exports) {
424
424
  let FORBID_TAGS = null;
425
425
  /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
426
426
  let FORBID_ATTR = null;
427
+ /* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */
428
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
429
+ tagCheck: {
430
+ writable: true,
431
+ configurable: false,
432
+ enumerable: true,
433
+ value: null
434
+ },
435
+ attributeCheck: {
436
+ writable: true,
437
+ configurable: false,
438
+ enumerable: true,
439
+ value: null
440
+ }
441
+ }));
427
442
  /* Decide if ARIA attributes are okay */
428
443
  let ALLOW_ARIA_ATTR = true;
429
444
  /* Decide if custom data attributes are okay */
@@ -616,16 +631,24 @@ var purify = _commonjsHelpers.createCommonjsModule(function (module, exports) {
616
631
  }
617
632
  /* Merge configuration parameters */
618
633
  if (cfg.ADD_TAGS) {
619
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
620
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
634
+ if (typeof cfg.ADD_TAGS === 'function') {
635
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
636
+ } else {
637
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
638
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
639
+ }
640
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
621
641
  }
622
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
623
642
  }
624
643
  if (cfg.ADD_ATTR) {
625
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
626
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
644
+ if (typeof cfg.ADD_ATTR === 'function') {
645
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
646
+ } else {
647
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
648
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
649
+ }
650
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
627
651
  }
628
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
629
652
  }
630
653
  if (cfg.ADD_URI_SAFE_ATTR) {
631
654
  addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
@@ -933,7 +956,7 @@ var purify = _commonjsHelpers.createCommonjsModule(function (module, exports) {
933
956
  return true;
934
957
  }
935
958
  /* Remove element if anything forbids its presence */
936
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
959
+ if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
937
960
  /* Check if we have a custom element to handle */
938
961
  if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
939
962
  if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
@@ -1005,7 +1028,7 @@ var purify = _commonjsHelpers.createCommonjsModule(function (module, exports) {
1005
1028
  (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1006
1029
  XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1007
1030
  We don't need to check the value; it's always URI safe. */
1008
- if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1031
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1009
1032
  if (
1010
1033
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1011
1034
  // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
@@ -232,7 +232,7 @@ class DataBinder {
232
232
  clearFieldError(fieldName) {
233
233
  var _a;
234
234
  const field = (_a = this._fields.get(fieldName)) === null || _a === void 0 ? void 0 : _a.field;
235
- if (field["errorMessage"]) {
235
+ if (field && field["errorMessage"]) {
236
236
  field["errorMessage"] = "";
237
237
  this._dataUnit.clearInvalid(this.getCurrentRecordId(), fieldName);
238
238
  }
@@ -763,7 +763,7 @@ export default class AgGridController {
763
763
  const colDefsWithConfigs = this.getColsDefWithConfigApplied(colDefs, this._lastColsConfig);
764
764
  this._gridOptions.api.setColumnDefs(colDefsWithConfigs);
765
765
  }
766
- getColsDefWithConfigApplied(colDefs, colsConfig) {
766
+ getColsDefWithConfigApplied(colDefs, colsConfig = []) {
767
767
  //Cria map de colunas existentes na config e seu índice
768
768
  const orderMap = colsConfig.reduce((map, col, index) => {
769
769
  map[col.name] = index;
@@ -120,7 +120,7 @@ export default class DataBinder {
120
120
  clearFieldError(fieldName) {
121
121
  var _a;
122
122
  const field = (_a = this._fields.get(fieldName)) === null || _a === void 0 ? void 0 : _a.field;
123
- if (field["errorMessage"]) {
123
+ if (field && field["errorMessage"]) {
124
124
  field["errorMessage"] = "";
125
125
  this._dataUnit.clearInvalid(this.getCurrentRecordId(), fieldName);
126
126
  }
@@ -72,28 +72,49 @@ export const buildFormConfigFromDataUnit = (dataUnit) => {
72
72
  .filter(descriptor => descriptor.visible !== false)
73
73
  .map(descriptor => { return { name: descriptor.name, defaultValue: descriptor.defaultValue }; });
74
74
  }
75
- const config = { emptyConfig: false, fields };
76
- return config;
75
+ return { emptyConfig: false, fields };
77
76
  };
78
- export const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
79
- var _a, _b;
80
- if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
81
- config = buildFormConfigFromDataUnit(dataUnit);
82
- }
83
- const sheets = new Map();
84
- const hiddenTabs = new Map();
85
- const requiredFields = [];
86
- const cleanOnCopyFields = [];
87
- const defaultValues = {};
88
- (_a = config === null || config === void 0 ? void 0 : config.tabs) === null || _a === void 0 ? void 0 : _a.forEach((tab) => {
89
- if (!hiddenTabs.has(tab.label) && tab.visible === false) {
90
- hiddenTabs.set(tab.label, tab);
77
+ function handleDetailTabs(dataUnit, config, sheets) {
78
+ const unitMD = dataUnit.metadata;
79
+ if (unitMD === undefined || unitMD.children === undefined)
80
+ return;
81
+ unitMD.children.forEach((child) => {
82
+ const tabConfig = getTabFromConfig(child.label, config);
83
+ if (tabConfig) {
84
+ sheets.set(Object.assign(tabConfig, { name: buildChildName(child), isDetail: true }), []);
85
+ return;
91
86
  }
87
+ const { label, name, fields } = buildDetailSheet(child);
88
+ sheets.set({ name, label, isDetail: true }, fields);
92
89
  });
93
- (_b = config === null || config === void 0 ? void 0 : config.fields) === null || _b === void 0 ? void 0 : _b.forEach((field) => {
90
+ }
91
+ function handleCustomTabs(customGuides, config, sheets) {
92
+ customGuides.forEach((guide) => {
93
+ const tabConfig = getTabFromConfig(guide.label, config);
94
+ if (tabConfig) {
95
+ sheets.set(Object.assign(tabConfig, { name: guide.id, isCustom: true }), []);
96
+ return;
97
+ }
98
+ const sheet = { label: guide.label, name: guide.id, isCustom: true, visible: true };
99
+ sheets.set(sheet, []);
100
+ });
101
+ }
102
+ function parseTabToFormSheet(key, fields) {
103
+ const i18n = getI18n();
104
+ return {
105
+ label: (key.label === "__main") ? i18n("ez-form.mainTab") : key.label,
106
+ name: key.name || key.label,
107
+ isCustom: key.isCustom,
108
+ isDetail: key.isDetail,
109
+ fields
110
+ };
111
+ }
112
+ function handleFields(config, sheets, hiddenTabs, dataUnit, requiredFields, cleanOnCopyFields, defaultValues) {
113
+ var _a;
114
+ (_a = config === null || config === void 0 ? void 0 : config.fields) === null || _a === void 0 ? void 0 : _a.forEach((field) => {
94
115
  var _a, _b, _c;
95
116
  if (field.visible !== false) {
96
- const tabConfig = getTabConfig(field.tab || "__main", sheets);
117
+ const tabConfig = getTabConfig(field.tab || "__main", sheets, config);
97
118
  if (hiddenTabs.has(tabConfig.label)) {
98
119
  return;
99
120
  }
@@ -129,7 +150,8 @@ export const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
129
150
  defaultValue = value;
130
151
  }
131
152
  }
132
- catch (_d) { }
153
+ catch (_d) {
154
+ }
133
155
  }
134
156
  }
135
157
  defaultValues[field.name] = defaultValue;
@@ -137,42 +159,82 @@ export const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
137
159
  }
138
160
  }
139
161
  });
162
+ }
163
+ export const buildFormMetadata = (config, dataUnit, includeDetails = false, customGuides) => {
164
+ var _a;
165
+ if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
166
+ config = buildFormConfigFromDataUnit(dataUnit);
167
+ }
168
+ const sheets = new Map();
169
+ const hiddenTabs = new Map();
170
+ const requiredFields = [];
171
+ const cleanOnCopyFields = [];
172
+ const defaultValues = {};
173
+ const tabs = (_a = config === null || config === void 0 ? void 0 : config.tabs) !== null && _a !== void 0 ? _a : [];
174
+ tabs.forEach((tab) => {
175
+ if (!hiddenTabs.has(tab.label) && tab.visible === false) {
176
+ hiddenTabs.set(tab.label, tab);
177
+ }
178
+ });
179
+ handleFields(config, sheets, hiddenTabs, dataUnit, requiredFields, cleanOnCopyFields, defaultValues);
140
180
  const metadata = new FormMetadata();
141
181
  metadata.setDefaultVars(config.defaultVars);
142
182
  if (includeDetails) {
143
- const unitMD = dataUnit.metadata;
144
- if (unitMD != undefined && unitMD.children != undefined) {
145
- unitMD.children.forEach(child => {
146
- const { label, name, fields } = buildDetailSheet(child);
147
- sheets.set({ name, label }, fields);
148
- });
149
- }
183
+ handleDetailTabs(dataUnit, config, sheets);
184
+ }
185
+ if (customGuides) {
186
+ handleCustomTabs(customGuides, config, sheets);
150
187
  }
151
- const i18n = getI18n();
152
188
  Array.from(sheets.entries())
153
189
  .sort(sortTabs)
154
- .forEach(([key, fields]) => {
155
- metadata.addSheet({
156
- label: (key.label === "__main") ? i18n("ez-form.mainTab") : key.label,
157
- name: key.name || key.label,
158
- fields
159
- });
190
+ .forEach(([tab, fields]) => {
191
+ if (!hiddenTabs.has(tab.label)) {
192
+ metadata.addSheet(parseTabToFormSheet(tab, fields));
193
+ }
160
194
  });
161
195
  metadata.addRequiredFields(requiredFields);
162
196
  metadata.addCleanOnCopyFields(cleanOnCopyFields);
163
197
  metadata.addDefaultValues(defaultValues);
164
198
  return metadata;
165
199
  };
166
- const getTabConfig = (tab, sheets) => {
167
- const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
200
+ const getTabFromConfig = (tab, config) => {
201
+ var _a;
202
+ if (!config) {
203
+ return;
204
+ }
205
+ return (_a = config.tabs) === null || _a === void 0 ? void 0 : _a.find(t => t.label === tab);
206
+ };
207
+ const getTabConfig = (tab, sheets, config) => {
208
+ if (typeof tab !== "string") {
209
+ return tab;
210
+ }
211
+ if (config) {
212
+ const tabConfig = getTabFromConfig(tab, config);
213
+ if (tabConfig) {
214
+ return tabConfig;
215
+ }
216
+ }
217
+ const tabConfig = Array.from(sheets.keys()).find(t => t.label === tab);
168
218
  return tabConfig || { label: tab, visible: true };
169
219
  };
170
- const sortTabs = (a, b) => {
171
- return a[0].label == '__main' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
220
+ function sortTabs(a, b) {
221
+ var _a, _b;
222
+ if (a[0].label === '__main' && b[0].label !== '__main') {
223
+ return -1;
224
+ }
225
+ if (a[0].label !== '__main' && b[0].label === '__main') {
226
+ return 1;
227
+ }
228
+ const aOrder = (_a = a[0].order) !== null && _a !== void 0 ? _a : Number.MAX_VALUE;
229
+ const bOrder = (_b = b[0].order) !== null && _b !== void 0 ? _b : Number.MAX_VALUE;
230
+ return aOrder - bOrder;
231
+ }
232
+ const buildChildName = (child) => {
233
+ return `child[${child.name}]`;
172
234
  };
173
235
  const buildDetailSheet = (child) => {
174
236
  return {
175
- name: `child[${child.name}]`,
237
+ name: buildChildName(child),
176
238
  label: child.label,
177
239
  fields: []
178
240
  };