@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.
@@ -4149,28 +4149,49 @@ const buildFormConfigFromDataUnit = (dataUnit) => {
4149
4149
  .filter(descriptor => descriptor.visible !== false)
4150
4150
  .map(descriptor => { return { name: descriptor.name, defaultValue: descriptor.defaultValue }; });
4151
4151
  }
4152
- const config = { emptyConfig: false, fields };
4153
- return config;
4152
+ return { emptyConfig: false, fields };
4154
4153
  };
4155
- const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
4156
- var _a, _b;
4157
- if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
4158
- config = buildFormConfigFromDataUnit(dataUnit);
4159
- }
4160
- const sheets = new Map();
4161
- const hiddenTabs = new Map();
4162
- const requiredFields = [];
4163
- const cleanOnCopyFields = [];
4164
- const defaultValues = {};
4165
- (_a = config === null || config === void 0 ? void 0 : config.tabs) === null || _a === void 0 ? void 0 : _a.forEach((tab) => {
4166
- if (!hiddenTabs.has(tab.label) && tab.visible === false) {
4167
- hiddenTabs.set(tab.label, tab);
4154
+ function handleDetailTabs(dataUnit, config, sheets) {
4155
+ const unitMD = dataUnit.metadata;
4156
+ if (unitMD === undefined || unitMD.children === undefined)
4157
+ return;
4158
+ unitMD.children.forEach((child) => {
4159
+ const tabConfig = getTabFromConfig(child.label, config);
4160
+ if (tabConfig) {
4161
+ sheets.set(Object.assign(tabConfig, { name: buildChildName(child), isDetail: true }), []);
4162
+ return;
4168
4163
  }
4164
+ const { label, name, fields } = buildDetailSheet(child);
4165
+ sheets.set({ name, label, isDetail: true }, fields);
4169
4166
  });
4170
- (_b = config === null || config === void 0 ? void 0 : config.fields) === null || _b === void 0 ? void 0 : _b.forEach((field) => {
4167
+ }
4168
+ function handleCustomTabs(customGuides, config, sheets) {
4169
+ customGuides.forEach((guide) => {
4170
+ const tabConfig = getTabFromConfig(guide.label, config);
4171
+ if (tabConfig) {
4172
+ sheets.set(Object.assign(tabConfig, { name: guide.id, isCustom: true }), []);
4173
+ return;
4174
+ }
4175
+ const sheet = { label: guide.label, name: guide.id, isCustom: true, visible: true };
4176
+ sheets.set(sheet, []);
4177
+ });
4178
+ }
4179
+ function parseTabToFormSheet(key, fields) {
4180
+ const i18n = getI18n();
4181
+ return {
4182
+ label: (key.label === "__main") ? i18n("ez-form.mainTab") : key.label,
4183
+ name: key.name || key.label,
4184
+ isCustom: key.isCustom,
4185
+ isDetail: key.isDetail,
4186
+ fields
4187
+ };
4188
+ }
4189
+ function handleFields(config, sheets, hiddenTabs, dataUnit, requiredFields, cleanOnCopyFields, defaultValues) {
4190
+ var _a;
4191
+ (_a = config === null || config === void 0 ? void 0 : config.fields) === null || _a === void 0 ? void 0 : _a.forEach((field) => {
4171
4192
  var _a, _b, _c;
4172
4193
  if (field.visible !== false) {
4173
- const tabConfig = getTabConfig(field.tab || "__main", sheets);
4194
+ const tabConfig = getTabConfig(field.tab || "__main", sheets, config);
4174
4195
  if (hiddenTabs.has(tabConfig.label)) {
4175
4196
  return;
4176
4197
  }
@@ -4206,7 +4227,8 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
4206
4227
  defaultValue = value;
4207
4228
  }
4208
4229
  }
4209
- catch (_d) { }
4230
+ catch (_d) {
4231
+ }
4210
4232
  }
4211
4233
  }
4212
4234
  defaultValues[field.name] = defaultValue;
@@ -4214,42 +4236,82 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
4214
4236
  }
4215
4237
  }
4216
4238
  });
4239
+ }
4240
+ const buildFormMetadata = (config, dataUnit, includeDetails = false, customGuides) => {
4241
+ var _a;
4242
+ if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
4243
+ config = buildFormConfigFromDataUnit(dataUnit);
4244
+ }
4245
+ const sheets = new Map();
4246
+ const hiddenTabs = new Map();
4247
+ const requiredFields = [];
4248
+ const cleanOnCopyFields = [];
4249
+ const defaultValues = {};
4250
+ const tabs = (_a = config === null || config === void 0 ? void 0 : config.tabs) !== null && _a !== void 0 ? _a : [];
4251
+ tabs.forEach((tab) => {
4252
+ if (!hiddenTabs.has(tab.label) && tab.visible === false) {
4253
+ hiddenTabs.set(tab.label, tab);
4254
+ }
4255
+ });
4256
+ handleFields(config, sheets, hiddenTabs, dataUnit, requiredFields, cleanOnCopyFields, defaultValues);
4217
4257
  const metadata = new FormMetadata();
4218
4258
  metadata.setDefaultVars(config.defaultVars);
4219
4259
  if (includeDetails) {
4220
- const unitMD = dataUnit.metadata;
4221
- if (unitMD != undefined && unitMD.children != undefined) {
4222
- unitMD.children.forEach(child => {
4223
- const { label, name, fields } = buildDetailSheet(child);
4224
- sheets.set({ name, label }, fields);
4225
- });
4226
- }
4260
+ handleDetailTabs(dataUnit, config, sheets);
4261
+ }
4262
+ if (customGuides) {
4263
+ handleCustomTabs(customGuides, config, sheets);
4227
4264
  }
4228
- const i18n = getI18n();
4229
4265
  Array.from(sheets.entries())
4230
4266
  .sort(sortTabs)
4231
- .forEach(([key, fields]) => {
4232
- metadata.addSheet({
4233
- label: (key.label === "__main") ? i18n("ez-form.mainTab") : key.label,
4234
- name: key.name || key.label,
4235
- fields
4236
- });
4267
+ .forEach(([tab, fields]) => {
4268
+ if (!hiddenTabs.has(tab.label)) {
4269
+ metadata.addSheet(parseTabToFormSheet(tab, fields));
4270
+ }
4237
4271
  });
4238
4272
  metadata.addRequiredFields(requiredFields);
4239
4273
  metadata.addCleanOnCopyFields(cleanOnCopyFields);
4240
4274
  metadata.addDefaultValues(defaultValues);
4241
4275
  return metadata;
4242
4276
  };
4243
- const getTabConfig = (tab, sheets) => {
4244
- const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
4277
+ const getTabFromConfig = (tab, config) => {
4278
+ var _a;
4279
+ if (!config) {
4280
+ return;
4281
+ }
4282
+ return (_a = config.tabs) === null || _a === void 0 ? void 0 : _a.find(t => t.label === tab);
4283
+ };
4284
+ const getTabConfig = (tab, sheets, config) => {
4285
+ if (typeof tab !== "string") {
4286
+ return tab;
4287
+ }
4288
+ if (config) {
4289
+ const tabConfig = getTabFromConfig(tab, config);
4290
+ if (tabConfig) {
4291
+ return tabConfig;
4292
+ }
4293
+ }
4294
+ const tabConfig = Array.from(sheets.keys()).find(t => t.label === tab);
4245
4295
  return tabConfig || { label: tab, visible: true };
4246
4296
  };
4247
- const sortTabs = (a, b) => {
4248
- return a[0].label == '__main' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
4297
+ function sortTabs(a, b) {
4298
+ var _a, _b;
4299
+ if (a[0].label === '__main' && b[0].label !== '__main') {
4300
+ return -1;
4301
+ }
4302
+ if (a[0].label !== '__main' && b[0].label === '__main') {
4303
+ return 1;
4304
+ }
4305
+ const aOrder = (_a = a[0].order) !== null && _a !== void 0 ? _a : Number.MAX_VALUE;
4306
+ const bOrder = (_b = b[0].order) !== null && _b !== void 0 ? _b : Number.MAX_VALUE;
4307
+ return aOrder - bOrder;
4308
+ }
4309
+ const buildChildName = (child) => {
4310
+ return `child[${child.name}]`;
4249
4311
  };
4250
4312
  const buildDetailSheet = (child) => {
4251
4313
  return {
4252
- name: `child[${child.name}]`,
4314
+ name: buildChildName(child),
4253
4315
  label: child.label,
4254
4316
  fields: []
4255
4317
  };
@@ -4460,7 +4522,7 @@ class DataBinder {
4460
4522
  clearFieldError(fieldName) {
4461
4523
  var _a;
4462
4524
  const field = (_a = this._fields.get(fieldName)) === null || _a === void 0 ? void 0 : _a.field;
4463
- if (field["errorMessage"]) {
4525
+ if (field && field["errorMessage"]) {
4464
4526
  field["errorMessage"] = "";
4465
4527
  this._dataUnit.clearInvalid(this.getCurrentRecordId(), fieldName);
4466
4528
  }
@@ -75810,7 +75872,7 @@ var MenuModule = {
75810
75872
  };
75811
75873
 
75812
75874
  var purify = createCommonjsModule(function (module, exports) {
75813
- /*! @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 */
75875
+ /*! @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 */
75814
75876
 
75815
75877
  (function (global, factory) {
75816
75878
  module.exports = factory() ;
@@ -75999,7 +76061,7 @@ var purify = createCommonjsModule(function (module, exports) {
75999
76061
  }
76000
76062
 
76001
76063
  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']);
76002
- 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']);
76064
+ 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']);
76003
76065
  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']);
76004
76066
  // List of SVG elements that are disallowed by default.
76005
76067
  // We still need to know them so that we can do namespace
@@ -76013,7 +76075,7 @@ var purify = createCommonjsModule(function (module, exports) {
76013
76075
  const text = freeze(['#text']);
76014
76076
 
76015
76077
  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']);
76016
- 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']);
76078
+ 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']);
76017
76079
  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']);
76018
76080
  const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
76019
76081
 
@@ -76120,7 +76182,7 @@ var purify = createCommonjsModule(function (module, exports) {
76120
76182
  function createDOMPurify() {
76121
76183
  let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
76122
76184
  const DOMPurify = root => createDOMPurify(root);
76123
- DOMPurify.version = '3.2.7';
76185
+ DOMPurify.version = '3.3.0';
76124
76186
  DOMPurify.removed = [];
76125
76187
  if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
76126
76188
  // Not running in a browser, provide a factory function
@@ -76231,6 +76293,21 @@ var purify = createCommonjsModule(function (module, exports) {
76231
76293
  let FORBID_TAGS = null;
76232
76294
  /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
76233
76295
  let FORBID_ATTR = null;
76296
+ /* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */
76297
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
76298
+ tagCheck: {
76299
+ writable: true,
76300
+ configurable: false,
76301
+ enumerable: true,
76302
+ value: null
76303
+ },
76304
+ attributeCheck: {
76305
+ writable: true,
76306
+ configurable: false,
76307
+ enumerable: true,
76308
+ value: null
76309
+ }
76310
+ }));
76234
76311
  /* Decide if ARIA attributes are okay */
76235
76312
  let ALLOW_ARIA_ATTR = true;
76236
76313
  /* Decide if custom data attributes are okay */
@@ -76423,16 +76500,24 @@ var purify = createCommonjsModule(function (module, exports) {
76423
76500
  }
76424
76501
  /* Merge configuration parameters */
76425
76502
  if (cfg.ADD_TAGS) {
76426
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
76427
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
76503
+ if (typeof cfg.ADD_TAGS === 'function') {
76504
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
76505
+ } else {
76506
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
76507
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
76508
+ }
76509
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
76428
76510
  }
76429
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
76430
76511
  }
76431
76512
  if (cfg.ADD_ATTR) {
76432
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
76433
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
76513
+ if (typeof cfg.ADD_ATTR === 'function') {
76514
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
76515
+ } else {
76516
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
76517
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
76518
+ }
76519
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
76434
76520
  }
76435
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
76436
76521
  }
76437
76522
  if (cfg.ADD_URI_SAFE_ATTR) {
76438
76523
  addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
@@ -76740,7 +76825,7 @@ var purify = createCommonjsModule(function (module, exports) {
76740
76825
  return true;
76741
76826
  }
76742
76827
  /* Remove element if anything forbids its presence */
76743
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
76828
+ if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
76744
76829
  /* Check if we have a custom element to handle */
76745
76830
  if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
76746
76831
  if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
@@ -76812,7 +76897,7 @@ var purify = createCommonjsModule(function (module, exports) {
76812
76897
  (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
76813
76898
  XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
76814
76899
  We don't need to check the value; it's always URI safe. */
76815
- 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]) {
76900
+ 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]) {
76816
76901
  if (
76817
76902
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
76818
76903
  // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
@@ -78008,7 +78093,7 @@ class AgGridController {
78008
78093
  const colDefsWithConfigs = this.getColsDefWithConfigApplied(colDefs, this._lastColsConfig);
78009
78094
  this._gridOptions.api.setColumnDefs(colDefsWithConfigs);
78010
78095
  }
78011
- getColsDefWithConfigApplied(colDefs, colsConfig) {
78096
+ getColsDefWithConfigApplied(colDefs, colsConfig = []) {
78012
78097
  //Cria map de colunas existentes na config e seu índice
78013
78098
  const orderMap = colsConfig.reduce((map, col, index) => {
78014
78099
  map[col.name] = index;
@@ -3,7 +3,7 @@ import { ElementIDUtils, ObjectUtils, HTMLBuilder, StringUtils, KeyboardManager
3
3
  import { i as initI18n } from './index-62fc771e.js';
4
4
  import { C as CustomEditorSource } from './FormLayout-071d324c.js';
5
5
  import { R as RICH_TOOLBAR_FORMAT_TAGS, a as RICH_TOOLBAR_COMMANDS } from './RichToolbarHelper-f3a149c4.js';
6
- import { p as purify } from './purify-dc6814bf.js';
6
+ import { p as purify } from './purify-003c47e2.js';
7
7
  import { A as ApplicationUtils } from './ApplicationUtils-12768f5a.js';
8
8
  import './DialogType-54a62731.js';
9
9
  import './CheckMode-bdb2ec19.js';
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, f as forceUpdate, H as Host, g as getElement } from './index-baa5e267.js';
2
2
  import { DateUtils, ApplicationContext, Action, StringUtils, KeyboardManager, DataUnit, ElementIDUtils } from '@sankhyalabs/core';
3
- import { b as buildFieldMetadata, a as buildFieldSearch, S as SHORTCUT_SEARCH_FIELD, f as focusOnFieldSerch, c as SEARCH_FIELD_FULL_WIDTH, D as DataBinder } from './search-column-83562552.js';
3
+ import { b as buildFieldMetadata, a as buildFieldSearch, S as SHORTCUT_SEARCH_FIELD, f as focusOnFieldSerch, c as SEARCH_FIELD_FULL_WIDTH, D as DataBinder } from './search-column-c00119ae.js';
4
4
  import { g as getI18n, i as initI18n } from './index-62fc771e.js';
5
5
  import { F as FormLayout } from './FormLayout-071d324c.js';
6
6
  import './ApplicationUtils-12768f5a.js';
@@ -78,28 +78,49 @@ const buildFormConfigFromDataUnit = (dataUnit) => {
78
78
  .filter(descriptor => descriptor.visible !== false)
79
79
  .map(descriptor => { return { name: descriptor.name, defaultValue: descriptor.defaultValue }; });
80
80
  }
81
- const config = { emptyConfig: false, fields };
82
- return config;
81
+ return { emptyConfig: false, fields };
83
82
  };
84
- const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
85
- var _a, _b;
86
- if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
87
- config = buildFormConfigFromDataUnit(dataUnit);
88
- }
89
- const sheets = new Map();
90
- const hiddenTabs = new Map();
91
- const requiredFields = [];
92
- const cleanOnCopyFields = [];
93
- const defaultValues = {};
94
- (_a = config === null || config === void 0 ? void 0 : config.tabs) === null || _a === void 0 ? void 0 : _a.forEach((tab) => {
95
- if (!hiddenTabs.has(tab.label) && tab.visible === false) {
96
- hiddenTabs.set(tab.label, tab);
83
+ function handleDetailTabs(dataUnit, config, sheets) {
84
+ const unitMD = dataUnit.metadata;
85
+ if (unitMD === undefined || unitMD.children === undefined)
86
+ return;
87
+ unitMD.children.forEach((child) => {
88
+ const tabConfig = getTabFromConfig(child.label, config);
89
+ if (tabConfig) {
90
+ sheets.set(Object.assign(tabConfig, { name: buildChildName(child), isDetail: true }), []);
91
+ return;
97
92
  }
93
+ const { label, name, fields } = buildDetailSheet(child);
94
+ sheets.set({ name, label, isDetail: true }, fields);
98
95
  });
99
- (_b = config === null || config === void 0 ? void 0 : config.fields) === null || _b === void 0 ? void 0 : _b.forEach((field) => {
96
+ }
97
+ function handleCustomTabs(customGuides, config, sheets) {
98
+ customGuides.forEach((guide) => {
99
+ const tabConfig = getTabFromConfig(guide.label, config);
100
+ if (tabConfig) {
101
+ sheets.set(Object.assign(tabConfig, { name: guide.id, isCustom: true }), []);
102
+ return;
103
+ }
104
+ const sheet = { label: guide.label, name: guide.id, isCustom: true, visible: true };
105
+ sheets.set(sheet, []);
106
+ });
107
+ }
108
+ function parseTabToFormSheet(key, fields) {
109
+ const i18n = getI18n();
110
+ return {
111
+ label: (key.label === "__main") ? i18n("ez-form.mainTab") : key.label,
112
+ name: key.name || key.label,
113
+ isCustom: key.isCustom,
114
+ isDetail: key.isDetail,
115
+ fields
116
+ };
117
+ }
118
+ function handleFields(config, sheets, hiddenTabs, dataUnit, requiredFields, cleanOnCopyFields, defaultValues) {
119
+ var _a;
120
+ (_a = config === null || config === void 0 ? void 0 : config.fields) === null || _a === void 0 ? void 0 : _a.forEach((field) => {
100
121
  var _a, _b, _c;
101
122
  if (field.visible !== false) {
102
- const tabConfig = getTabConfig(field.tab || "__main", sheets);
123
+ const tabConfig = getTabConfig(field.tab || "__main", sheets, config);
103
124
  if (hiddenTabs.has(tabConfig.label)) {
104
125
  return;
105
126
  }
@@ -135,7 +156,8 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
135
156
  defaultValue = value;
136
157
  }
137
158
  }
138
- catch (_d) { }
159
+ catch (_d) {
160
+ }
139
161
  }
140
162
  }
141
163
  defaultValues[field.name] = defaultValue;
@@ -143,42 +165,82 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
143
165
  }
144
166
  }
145
167
  });
168
+ }
169
+ const buildFormMetadata = (config, dataUnit, includeDetails = false, customGuides) => {
170
+ var _a;
171
+ if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
172
+ config = buildFormConfigFromDataUnit(dataUnit);
173
+ }
174
+ const sheets = new Map();
175
+ const hiddenTabs = new Map();
176
+ const requiredFields = [];
177
+ const cleanOnCopyFields = [];
178
+ const defaultValues = {};
179
+ const tabs = (_a = config === null || config === void 0 ? void 0 : config.tabs) !== null && _a !== void 0 ? _a : [];
180
+ tabs.forEach((tab) => {
181
+ if (!hiddenTabs.has(tab.label) && tab.visible === false) {
182
+ hiddenTabs.set(tab.label, tab);
183
+ }
184
+ });
185
+ handleFields(config, sheets, hiddenTabs, dataUnit, requiredFields, cleanOnCopyFields, defaultValues);
146
186
  const metadata = new FormMetadata();
147
187
  metadata.setDefaultVars(config.defaultVars);
148
188
  if (includeDetails) {
149
- const unitMD = dataUnit.metadata;
150
- if (unitMD != undefined && unitMD.children != undefined) {
151
- unitMD.children.forEach(child => {
152
- const { label, name, fields } = buildDetailSheet(child);
153
- sheets.set({ name, label }, fields);
154
- });
155
- }
189
+ handleDetailTabs(dataUnit, config, sheets);
190
+ }
191
+ if (customGuides) {
192
+ handleCustomTabs(customGuides, config, sheets);
156
193
  }
157
- const i18n = getI18n();
158
194
  Array.from(sheets.entries())
159
195
  .sort(sortTabs)
160
- .forEach(([key, fields]) => {
161
- metadata.addSheet({
162
- label: (key.label === "__main") ? i18n("ez-form.mainTab") : key.label,
163
- name: key.name || key.label,
164
- fields
165
- });
196
+ .forEach(([tab, fields]) => {
197
+ if (!hiddenTabs.has(tab.label)) {
198
+ metadata.addSheet(parseTabToFormSheet(tab, fields));
199
+ }
166
200
  });
167
201
  metadata.addRequiredFields(requiredFields);
168
202
  metadata.addCleanOnCopyFields(cleanOnCopyFields);
169
203
  metadata.addDefaultValues(defaultValues);
170
204
  return metadata;
171
205
  };
172
- const getTabConfig = (tab, sheets) => {
173
- const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
206
+ const getTabFromConfig = (tab, config) => {
207
+ var _a;
208
+ if (!config) {
209
+ return;
210
+ }
211
+ return (_a = config.tabs) === null || _a === void 0 ? void 0 : _a.find(t => t.label === tab);
212
+ };
213
+ const getTabConfig = (tab, sheets, config) => {
214
+ if (typeof tab !== "string") {
215
+ return tab;
216
+ }
217
+ if (config) {
218
+ const tabConfig = getTabFromConfig(tab, config);
219
+ if (tabConfig) {
220
+ return tabConfig;
221
+ }
222
+ }
223
+ const tabConfig = Array.from(sheets.keys()).find(t => t.label === tab);
174
224
  return tabConfig || { label: tab, visible: true };
175
225
  };
176
- const sortTabs = (a, b) => {
177
- return a[0].label == '__main' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
226
+ function sortTabs(a, b) {
227
+ var _a, _b;
228
+ if (a[0].label === '__main' && b[0].label !== '__main') {
229
+ return -1;
230
+ }
231
+ if (a[0].label !== '__main' && b[0].label === '__main') {
232
+ return 1;
233
+ }
234
+ const aOrder = (_a = a[0].order) !== null && _a !== void 0 ? _a : Number.MAX_VALUE;
235
+ const bOrder = (_b = b[0].order) !== null && _b !== void 0 ? _b : Number.MAX_VALUE;
236
+ return aOrder - bOrder;
237
+ }
238
+ const buildChildName = (child) => {
239
+ return `child[${child.name}]`;
178
240
  };
179
241
  const buildDetailSheet = (child) => {
180
242
  return {
181
- name: `child[${child.name}]`,
243
+ name: buildChildName(child),
182
244
  label: child.label,
183
245
  fields: []
184
246
  };
@@ -6,10 +6,10 @@ import './DialogType-54a62731.js';
6
6
  import './CheckMode-bdb2ec19.js';
7
7
  import { g as getI18n, i as initI18n } from './index-62fc771e.js';
8
8
  import { C as CustomEditorSource, a as CustomRenderSource } from './FormLayout-071d324c.js';
9
- import { b as buildFieldMetadata, R as RecordValidationProcessor, D as DataBinder, S as SHORTCUT_SEARCH_FIELD, f as focusOnFieldSerch, c as SEARCH_FIELD_FULL_WIDTH, a as buildFieldSearch } from './search-column-83562552.js';
9
+ import { b as buildFieldMetadata, R as RecordValidationProcessor, D as DataBinder, S as SHORTCUT_SEARCH_FIELD, f as focusOnFieldSerch, c as SEARCH_FIELD_FULL_WIDTH, a as buildFieldSearch } from './search-column-c00119ae.js';
10
10
  import { D as DISTINCT_FILTER_NAME_PREFIX, E as EZ_GRID_LOADING_SOURCE, P as PRESENTATION_COL_ID_PROP_NAME, a as PRESENTATION_FROM_COL_PROP_NAME } from './constants-3fabe81e.js';
11
11
  import { F as FocusResolver } from './FocusResolver-1ccbf850.js';
12
- import { p as purify } from './purify-dc6814bf.js';
12
+ import { p as purify } from './purify-003c47e2.js';
13
13
  import './_commonjsHelpers-9943807e.js';
14
14
 
15
15
  /**
@@ -65574,7 +65574,7 @@ class AgGridController {
65574
65574
  const colDefsWithConfigs = this.getColsDefWithConfigApplied(colDefs, this._lastColsConfig);
65575
65575
  this._gridOptions.api.setColumnDefs(colDefsWithConfigs);
65576
65576
  }
65577
- getColsDefWithConfigApplied(colDefs, colsConfig) {
65577
+ getColsDefWithConfigApplied(colDefs, colsConfig = []) {
65578
65578
  //Cria map de colunas existentes na config e seu índice
65579
65579
  const orderMap = colsConfig.reduce((map, col, index) => {
65580
65580
  map[col.name] = index;