data-restructor 3.4.2 → 3.4.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.
Files changed (43) hide show
  1. package/.github/workflows/codeql-analysis.yml +4 -4
  2. package/.github/workflows/continuous-integration.yaml +15 -11
  3. package/CHANGELOG.md +3 -1
  4. package/coverage/coverage-summary.json +4 -4
  5. package/coverage/datarestructor.js.html +137 -137
  6. package/coverage/describedfield.js.html +45 -45
  7. package/coverage/index.html +6 -6
  8. package/coverage/templateResolver.js.html +26 -26
  9. package/devdist/datarestructor-ie.js +10 -10
  10. package/devdist/datarestructor.js +5 -5
  11. package/devdist/describedfield-ie.js +3 -3
  12. package/devdist/describedfield.js +2 -2
  13. package/devdist/templateResolver-ie.js +6 -6
  14. package/devdist/templateResolver.js +3 -3
  15. package/dist/datarestructor-ie.js +1 -693
  16. package/dist/datarestructor-ie.js.map +1 -1
  17. package/dist/datarestructor.js +1 -687
  18. package/dist/datarestructor.js.map +1 -1
  19. package/dist/describedfield-ie.js +1 -142
  20. package/dist/describedfield-ie.js.map +1 -1
  21. package/dist/describedfield.js +1 -142
  22. package/dist/describedfield.js.map +1 -1
  23. package/dist/templateResolver-ie.js +1 -82
  24. package/dist/templateResolver-ie.js.map +1 -1
  25. package/dist/templateResolver.js +1 -76
  26. package/dist/templateResolver.js.map +1 -1
  27. package/docs/datarestructor.js.html +1 -1
  28. package/docs/describedfield.js.html +1 -1
  29. package/docs/index.html +1 -1
  30. package/docs/module-datarestructor.DescribedEntryCreator.html +1 -1
  31. package/docs/module-datarestructor.PropertyStructureDescriptionBuilder.html +1 -1
  32. package/docs/module-datarestructor.Restructor.html +1 -1
  33. package/docs/module-datarestructor.Transform.html +1 -1
  34. package/docs/module-datarestructor.html +1 -1
  35. package/docs/module-described_field.DescribedDataFieldBuilder.html +1 -1
  36. package/docs/module-described_field.DescribedDataFieldGroup.html +1 -1
  37. package/docs/module-described_field.html +1 -1
  38. package/docs/module-template_resolver.Resolver.html +1 -1
  39. package/docs/module-template_resolver.html +1 -1
  40. package/docs/templateResolver.js.html +1 -1
  41. package/eslint.config.js +15 -0
  42. package/package.json +11 -10
  43. package/.eslintrc.json +0 -13
@@ -1,143 +1,2 @@
1
- var i=globalThis,e={},t={},r=i.parcelRequirec1f2;null==r&&((r=function(i){if(i in e)return e[i].exports;if(i in t){var r=t[i];delete t[i];var s={id:i,exports:{}};return e[i]=s,r.call(s.exports,s,s.exports),s.exports}var n=Error("Cannot find module '"+i+"'");throw n.code="MODULE_NOT_FOUND",n}).register=function(i,e){t[i]=e},i.parcelRequirec1f2=r),(0,r.register)("d63jw",function(i,e){var t=r(t);// Fallback for vanilla js without modules
2
- function r(i){return i||{}}/**
3
- * Describes a data field of the restructured data.
4
- * @module described_field
5
- */var s=t.exports={};// Export module for npm...
6
- s.internalCreateIfNotExists=r,/**
7
- * Describes a field of the restructured data.
8
- * Dynamically added properties represent custom named groups containing DescribedDataField-Arrays.
9
- *
10
- * @typedef {Object} module:described_field.DescribedDataField
11
- * @property {string} [category=""] - name of the category. Could contain a short domain name like "product" or "vendor".
12
- * @property {string} [type=""] - type of the data element. Examples: "summary" for e.g. a list overview. "detail" e.g. when a summary is selected. "filter" e.g. for field/value pair results that can be selected as data filters.
13
- * @property {string} [abbreviation=""] - one optional character, a symbol character or a short abbreviation of the category
14
- * @property {string} [image=""] - one optional path to an image resource
15
- * @property {string} index - array of numbers containing the splitted index. Example: "responses[2].hits.hits[4]._source.name" will have an index of [2,4]
16
- * @property {string[]} groupNames - array of names of all dynamically added properties representing groups
17
- * @property {string} displayName - display name of the field
18
- * @property {string} fieldName - field name
19
- * @property {{*}} value - content of the field
20
- * @property {module:described_field.DescribedDataField[]} [couldBeAnyCustomGroupName] any number of groups attached to the field each containing multiple fields
21
- */s.DescribedDataFieldBuilder=function(){function i(i,e){return"string"==typeof i&&null!==i&&""!==i?i:e}return(/**
22
- * Builds a {@link module:described_field.DescribedDataField}.
23
- * DescribedDataField is the main element of the restructured data and therefore considered "public".
24
- * @constructs DescribedDataFieldBuilder
25
- * @alias module:described_field.DescribedDataFieldBuilder
26
- */function(){/**
27
- * @type {module:described_field.DescribedDataField}
28
- */this.describedField={category:"",type:"",abbreviation:"",image:"",index:[],groupNames:[],displayName:"",fieldName:"",value:""},/**
29
- * Takes over all values of the template {@link module:described_field.DescribedDataField}.
30
- * @function
31
- * @param {module:described_field.DescribedDataField} template
32
- * @returns {DescribedDataFieldBuilder}
33
- * @example fromDescribedDataField(sourceField)
34
- */this.fromDescribedDataField=function(i){return this.category(i.category),this.type(i.type),this.abbreviation(i.abbreviation),this.image(i.image),this.index(i.index),this.groupNames(i.groupNames),this.displayName(i.displayName),this.fieldName(i.fieldName),this.value(i.value),this},/**
35
- * Sets the category.
36
- *
37
- * Contains a short domain nam, for example:
38
- * - "product" for products
39
- * - "vendor" for vendors
40
- *
41
- * @function
42
- * @param {String} [value=""]
43
- * @returns {DescribedDataFieldBuilder}
44
- * @example category("Product")
45
- */this.category=function(e){return this.describedField.category=i(e,""),this},/**
46
- * Sets the type.
47
- *
48
- * Contains the type of the entry, for example:
49
- * - "summary" for e.g. a list overview.
50
- * - "detail" e.g. when a summary is selected.
51
- * - "filter" e.g. for field/value pair results that can be selected as search parameters.
52
- *
53
- * @function
54
- * @param {String} [value=""]
55
- * @returns {DescribedDataFieldBuilder}
56
- * @example type("summary")
57
- */this.type=function(e){return this.describedField.type=i(e,""),this},/**
58
- * Sets the optional abbreviation.
59
- *
60
- * Contains a symbol character or a very short abbreviation of the category.
61
- * - "P" for products
62
- * - "V" for vendors
63
- *
64
- * @function
65
- * @param {String} [value=""]
66
- * @returns {DescribedDataFieldBuilder}
67
- * @example abbreviation("P")
68
- */this.abbreviation=function(e){return this.describedField.abbreviation=i(e,""),this},/**
69
- * Sets the optional path to an image resource.
70
- *
71
- * @function
72
- * @param {String} [value=""]
73
- * @returns {DescribedDataFieldBuilder}
74
- * @example image("img/product.png")
75
- */this.image=function(e){return this.describedField.image=i(e,""),this},/**
76
- * Sets the index as an array of numbers containing the splitted array indexes of the source field.
77
- * Example: "responses[2].hits.hits[4]._source.name" will have an index of [2,4].
78
- *
79
- * @function
80
- * @param {number[]} [value=[]]
81
- * @returns {DescribedDataFieldBuilder}
82
- * @example index([2,4])
83
- */this.index=function(i){return this.describedField.index=null==i?[]:i,this},/**
84
- * Sets the group names as an array of strings containing the names of the dynamically added properties,
85
- * that contain an array of {@link module:described_field.DescribedDataField}-Objects.
86
- *
87
- * @function
88
- * @param {string[]} [value=[]]
89
- * @returns {DescribedDataFieldBuilder}
90
- * @example groupNames(["summaries","details","options"])
91
- */this.groupNames=function(i){return this.describedField.groupNames=null==i?[]:i,this},/**
92
- * Sets the display name.
93
- *
94
- * @function
95
- * @param {String} [value=""]
96
- * @returns {DescribedDataFieldBuilder}
97
- * @example displayName("Color")
98
- */this.displayName=function(e){return this.describedField.displayName=i(e,""),this},/**
99
- * Sets the (technical) field name.
100
- *
101
- * @function
102
- * @param {String} [value=""]
103
- * @returns {DescribedDataFieldBuilder}
104
- * @example fieldName("color")
105
- */this.fieldName=function(e){return this.describedField.fieldName=i(e,""),this},/**
106
- * Sets the value/content of the field.
107
- *
108
- * @function
109
- * @param {*} value
110
- * @returns {DescribedDataFieldBuilder}
111
- * @example value("darkblue")
112
- */this.value=function(i){return this.describedField.value=i,this},/**
113
- * Finalizes the settings and builds the {@link module:described_field.DescribedDataField}.
114
- * @function
115
- * @returns {module:described_field.DescribedDataField}
116
- */this.build=function(){return this.describedField}})}(),/**
117
- * Creates a new described data field with all properties of the original one except for dynamically added groups.
118
- * @param {module:described_field.DescribedDataField} describedDataField
119
- * @returns {module:described_field.DescribedDataField}
120
- * @memberof module:described_field
121
- */s.copyWithoutGroups=function(i){return new s.DescribedDataFieldBuilder().fromDescribedDataField(i).groupNames([]).build()},s.DescribedDataFieldGroup=/**
122
- * Adds groups to {@link module:described_field.DescribedDataField}s. These groups are dynamically added properties
123
- * that contain an array of sub fields of the same type {@link module:described_field.DescribedDataField}s.
124
- *
125
- * @param {module:described_field.DescribedDataField} dataField
126
- * @constructs DescribedDataFieldGroup
127
- * @alias module:described_field.DescribedDataFieldGroup
128
- * @example new described_field.DescribedDataFieldGroup(field).addGroupEntry("details", detailField);
129
- */function(i){this.dataField=i,/**
130
- * Adds an entry to the given group. If the group does not exist, it will be created.
131
- * @function
132
- * @param {String} groupName name of the group to which the entry will be added
133
- * @param {module:described_field.DescribedDataField} describedField sub field that is added to the group
134
- * @returns {DescribedDataFieldGroup}
135
- */this.addGroupEntry=function(i,e){return this.addGroupEntries(i,[e]),this},/**
136
- * Adds entries to the given group. If the group does not exist, it will be created.
137
- * @function
138
- * @param {String} groupName name of the group to which the entries will be added
139
- * @param {module:described_field.DescribedDataField[]} describedFields sub fields that are added to the group
140
- * @returns {DescribedDataFieldGroup}
141
- */this.addGroupEntries=function(i,e){var t,r;if(!i||0===i.length||!e||0===e.length)return this;for(void 0===this.dataField[i]&&(this.dataField.groupNames.push(i),this.dataField[i]=[]),t=0;t<e.length;t+=1)r=e[t],this.dataField[i].push(r);return this}}});var s=r("d63jw");module.exports={described_field:s};//# sourceMappingURL=describedfield-ie.js.map
142
-
1
+ var i=globalThis,e={},t={},r=i.parcelRequirec1f2;null==r&&((r=function(i){if(i in e)return e[i].exports;if(i in t){var r=t[i];delete t[i];var s={id:i,exports:{}};return e[i]=s,r.call(s.exports,s,s.exports),s.exports}var n=Error("Cannot find module '"+i+"'");throw n.code="MODULE_NOT_FOUND",n}).register=function(i,e){t[i]=e},i.parcelRequirec1f2=r),(0,r.register)("aJuQy",function(i,e){var t=r(t);function r(i){return i||{}}var s=t.exports={};s.internalCreateIfNotExists=r,s.DescribedDataFieldBuilder=function(){function i(i,e){return"string"==typeof i&&null!==i&&""!==i?i:e}return function(){this.describedField={category:"",type:"",abbreviation:"",image:"",index:[],groupNames:[],displayName:"",fieldName:"",value:""},this.fromDescribedDataField=function(i){return this.category(i.category),this.type(i.type),this.abbreviation(i.abbreviation),this.image(i.image),this.index(i.index),this.groupNames(i.groupNames),this.displayName(i.displayName),this.fieldName(i.fieldName),this.value(i.value),this},this.category=function(e){return this.describedField.category=i(e,""),this},this.type=function(e){return this.describedField.type=i(e,""),this},this.abbreviation=function(e){return this.describedField.abbreviation=i(e,""),this},this.image=function(e){return this.describedField.image=i(e,""),this},this.index=function(i){var e;return this.describedField.index=(e=[],null==i?e:i),this},this.groupNames=function(i){var e;return this.describedField.groupNames=(e=[],null==i?e:i),this},this.displayName=function(e){return this.describedField.displayName=i(e,""),this},this.fieldName=function(e){return this.describedField.fieldName=i(e,""),this},this.value=function(i){return this.describedField.value=i,this},this.build=function(){return this.describedField}}}(),s.copyWithoutGroups=function(i){return new s.DescribedDataFieldBuilder().fromDescribedDataField(i).groupNames([]).build()},s.DescribedDataFieldGroup=function(i){this.dataField=i,this.addGroupEntry=function(i,e){return this.addGroupEntries(i,[e]),this},this.addGroupEntries=function(i,e){var t,r;if(!i||0===i.length||!e||0===e.length)return this;for(void 0===this.dataField[i]&&(this.dataField.groupNames.push(i),this.dataField[i]=[]),t=0;t<e.length;t+=1)r=e[t],this.dataField[i].push(r);return this}}});var s=r("aJuQy");module.exports={described_field:s};
143
2
  //# sourceMappingURL=describedfield-ie.js.map
@@ -1 +1 @@
1
- {"mappings":"A,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,A,C,E,E,Q,A,E,Q,S,C,C,C,ECOA,IAAI,EAAS,EAAwC,EAAS,2CAA0C;AAExG,SAAS,EAAwC,CAAa,EAC5D,OAAO,GAAiB,CAAC,CAC3B,CAEA;;;CAGC,EACD,IAAI,EAAmB,EAA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;;;;;;;GAQC,EACD,SAAiC,CAAS,EACxC,IAAI,CAAC,SAAS,CAAG,EAEjB;;;;;;KAMC,EACD,IAAI,CAAC,aAAa,CAAG,SAAU,CAAS,CAAE,CAAc,EAEtD,OADA,IAAI,CAAC,eAAe,CAAC,EAAW,CAAC,EAAe,EACzC,IAAI,AACb,EAEA;;;;;;KAMC,EACD,IAAI,CAAC,eAAe,CAAG,SAAU,CAAS,CAAE,CAAe,MAWrD,EACA,EAXJ,GAAI,CAAC,GAAa,AAAqB,IAArB,EAAU,MAAM,EAG9B,CAAC,GAAmB,AAA2B,IAA3B,EAAgB,MAAM,CAF5C,OAAO,IAAI,CAWb,IANkC,KAAA,IAA9B,IAAI,CAAC,SAAS,CAAC,EAAU,GAC3B,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,GAC/B,IAAI,CAAC,SAAS,CAAC,EAAU,CAAG,EAAE,EAI3B,EAAQ,EAAG,EAAQ,EAAgB,MAAM,CAAE,GAAS,EACvD,EAAiB,CAAe,CAAC,EAAM,CACvC,IAAI,CAAC,SAAS,CAAC,EAAU,CAAC,IAAI,CAAC,GAEjC,OAAO,IAAI,AACb,CACF,C,G,I,E,E,QC9RF,CAAA,OAAA,OAAA,CAAiB,CAAC,gBAAkB,CAAe,C,8C","sources":["<anon>","src/js/describedfield.js","src/js/describedfield-ie.js"],"sourcesContent":["\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirec1f2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirec1f2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nparcelRegister(\"d63jw\", function(module, exports) {\n/**\n * @file Describes a data field of the restructured data.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */ \"use strict\";\nvar $988e67f614ef1b49$var$module = $988e67f614ef1b49$var$describedFieldInternalCreateIfNotExists($988e67f614ef1b49$var$module); // Fallback for vanilla js without modules\nfunction $988e67f614ef1b49$var$describedFieldInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n/**\n * Describes a data field of the restructured data.\n * @module described_field\n */ var $988e67f614ef1b49$var$described_field = $988e67f614ef1b49$var$module.exports = {}; // Export module for npm...\n$988e67f614ef1b49$var$described_field.internalCreateIfNotExists = $988e67f614ef1b49$var$describedFieldInternalCreateIfNotExists;\n/**\n * Describes a field of the restructured data.\n * Dynamically added properties represent custom named groups containing DescribedDataField-Arrays.\n *\n * @typedef {Object} module:described_field.DescribedDataField\n * @property {string} [category=\"\"] - name of the category. Could contain a short domain name like \"product\" or \"vendor\".\n * @property {string} [type=\"\"] - type of the data element. Examples: \"summary\" for e.g. a list overview. \"detail\" e.g. when a summary is selected. \"filter\" e.g. for field/value pair results that can be selected as data filters.\n * @property {string} [abbreviation=\"\"] - one optional character, a symbol character or a short abbreviation of the category\n * @property {string} [image=\"\"] - one optional path to an image resource\n * @property {string} index - array of numbers containing the splitted index. Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4]\n * @property {string[]} groupNames - array of names of all dynamically added properties representing groups\n * @property {string} displayName - display name of the field\n * @property {string} fieldName - field name\n * @property {{*}} value - content of the field\n * @property {module:described_field.DescribedDataField[]} [couldBeAnyCustomGroupName] any number of groups attached to the field each containing multiple fields\n */ $988e67f614ef1b49$var$described_field.DescribedDataFieldBuilder = function() {\n /**\n * Builds a {@link module:described_field.DescribedDataField}.\n * DescribedDataField is the main element of the restructured data and therefore considered \"public\".\n * @constructs DescribedDataFieldBuilder\n * @alias module:described_field.DescribedDataFieldBuilder\n */ function DescribedDataFieldBuilder() {\n /**\n * @type {module:described_field.DescribedDataField}\n */ this.describedField = {\n category: \"\",\n type: \"\",\n abbreviation: \"\",\n image: \"\",\n index: [],\n groupNames: [],\n displayName: \"\",\n fieldName: \"\",\n value: \"\"\n };\n /**\n * Takes over all values of the template {@link module:described_field.DescribedDataField}.\n * @function\n * @param {module:described_field.DescribedDataField} template\n * @returns {DescribedDataFieldBuilder}\n * @example fromDescribedDataField(sourceField)\n */ this.fromDescribedDataField = function(template) {\n this.category(template.category);\n this.type(template.type);\n this.abbreviation(template.abbreviation);\n this.image(template.image);\n this.index(template.index);\n this.groupNames(template.groupNames);\n this.displayName(template.displayName);\n this.fieldName(template.fieldName);\n this.value(template.value);\n return this;\n };\n /**\n * Sets the category.\n *\n * Contains a short domain nam, for example:\n * - \"product\" for products\n * - \"vendor\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example category(\"Product\")\n */ this.category = function(value) {\n this.describedField.category = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the type.\n *\n * Contains the type of the entry, for example:\n * - \"summary\" for e.g. a list overview.\n * - \"detail\" e.g. when a summary is selected.\n * - \"filter\" e.g. for field/value pair results that can be selected as search parameters.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example type(\"summary\")\n */ this.type = function(value) {\n this.describedField.type = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional abbreviation.\n *\n * Contains a symbol character or a very short abbreviation of the category.\n * - \"P\" for products\n * - \"V\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example abbreviation(\"P\")\n */ this.abbreviation = function(value) {\n this.describedField.abbreviation = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional path to an image resource.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example image(\"img/product.png\")\n */ this.image = function(value) {\n this.describedField.image = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the index as an array of numbers containing the splitted array indexes of the source field.\n * Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4].\n *\n * @function\n * @param {number[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example index([2,4])\n */ this.index = function(value) {\n this.describedField.index = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the group names as an array of strings containing the names of the dynamically added properties,\n * that contain an array of {@link module:described_field.DescribedDataField}-Objects.\n *\n * @function\n * @param {string[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example groupNames([\"summaries\",\"details\",\"options\"])\n */ this.groupNames = function(value) {\n this.describedField.groupNames = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the display name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example displayName(\"Color\")\n */ this.displayName = function(value) {\n this.describedField.displayName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the (technical) field name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example fieldName(\"color\")\n */ this.fieldName = function(value) {\n this.describedField.fieldName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the value/content of the field.\n *\n * @function\n * @param {*} value\n * @returns {DescribedDataFieldBuilder}\n * @example value(\"darkblue\")\n */ this.value = function(value) {\n this.describedField.value = value;\n return this;\n };\n /**\n * Finalizes the settings and builds the {@link module:described_field.DescribedDataField}.\n * @function\n * @returns {module:described_field.DescribedDataField}\n */ this.build = function() {\n return this.describedField;\n };\n }\n function isSpecifiedString(value) {\n return typeof value === \"string\" && value !== null && value !== \"\";\n }\n function withDefaultString(value, defaultValue) {\n return isSpecifiedString(value) ? value : defaultValue;\n }\n function withDefaultArray(value, defaultValue) {\n return value === undefined || value === null ? defaultValue : value;\n }\n return DescribedDataFieldBuilder;\n}();\n/**\n * Creates a new described data field with all properties of the original one except for dynamically added groups.\n * @param {module:described_field.DescribedDataField} describedDataField\n * @returns {module:described_field.DescribedDataField}\n * @memberof module:described_field\n */ $988e67f614ef1b49$var$described_field.copyWithoutGroups = function(describedDataField) {\n return new $988e67f614ef1b49$var$described_field.DescribedDataFieldBuilder().fromDescribedDataField(describedDataField).groupNames([]).build();\n};\n$988e67f614ef1b49$var$described_field.DescribedDataFieldGroup = function() {\n /**\n * Adds groups to {@link module:described_field.DescribedDataField}s. These groups are dynamically added properties\n * that contain an array of sub fields of the same type {@link module:described_field.DescribedDataField}s.\n *\n * @param {module:described_field.DescribedDataField} dataField\n * @constructs DescribedDataFieldGroup\n * @alias module:described_field.DescribedDataFieldGroup\n * @example new described_field.DescribedDataFieldGroup(field).addGroupEntry(\"details\", detailField);\n */ function DescribedDataFieldGroup(dataField) {\n this.dataField = dataField;\n /**\n * Adds an entry to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entry will be added\n * @param {module:described_field.DescribedDataField} describedField sub field that is added to the group\n * @returns {DescribedDataFieldGroup}\n */ this.addGroupEntry = function(groupName, describedField) {\n this.addGroupEntries(groupName, [\n describedField\n ]);\n return this;\n };\n /**\n * Adds entries to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entries will be added\n * @param {module:described_field.DescribedDataField[]} describedFields sub fields that are added to the group\n * @returns {DescribedDataFieldGroup}\n */ this.addGroupEntries = function(groupName, describedFields) {\n if (!groupName || groupName.length === 0) return this;\n if (!describedFields || describedFields.length === 0) return this;\n if (this.dataField[groupName] === undefined) {\n this.dataField.groupNames.push(groupName);\n this.dataField[groupName] = [];\n }\n var index;\n var describedField;\n for(index = 0; index < describedFields.length; index += 1){\n describedField = describedFields[index];\n this.dataField[groupName].push(describedField);\n }\n return this;\n };\n }\n return DescribedDataFieldGroup;\n}();\n\n});\n\n\"use strict\";\n\nvar $d63jw = parcelRequire(\"d63jw\");\nmodule.exports = {\n described_field: $d63jw\n};\n\n\n//# sourceMappingURL=describedfield-ie.js.map\n","/**\n * @file Describes a data field of the restructured data.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */\n\"use strict\";\nvar module = describedFieldInternalCreateIfNotExists(module); // Fallback for vanilla js without modules\n\nfunction describedFieldInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n\n/**\n * Describes a data field of the restructured data.\n * @module described_field\n */\nvar described_field = (module.exports = {}); // Export module for npm...\ndescribed_field.internalCreateIfNotExists = describedFieldInternalCreateIfNotExists;\n\n/**\n * Describes a field of the restructured data.\n * Dynamically added properties represent custom named groups containing DescribedDataField-Arrays.\n *\n * @typedef {Object} module:described_field.DescribedDataField\n * @property {string} [category=\"\"] - name of the category. Could contain a short domain name like \"product\" or \"vendor\".\n * @property {string} [type=\"\"] - type of the data element. Examples: \"summary\" for e.g. a list overview. \"detail\" e.g. when a summary is selected. \"filter\" e.g. for field/value pair results that can be selected as data filters.\n * @property {string} [abbreviation=\"\"] - one optional character, a symbol character or a short abbreviation of the category\n * @property {string} [image=\"\"] - one optional path to an image resource\n * @property {string} index - array of numbers containing the splitted index. Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4]\n * @property {string[]} groupNames - array of names of all dynamically added properties representing groups\n * @property {string} displayName - display name of the field\n * @property {string} fieldName - field name\n * @property {{*}} value - content of the field\n * @property {module:described_field.DescribedDataField[]} [couldBeAnyCustomGroupName] any number of groups attached to the field each containing multiple fields\n */\n\ndescribed_field.DescribedDataFieldBuilder = (function () {\n /**\n * Builds a {@link module:described_field.DescribedDataField}.\n * DescribedDataField is the main element of the restructured data and therefore considered \"public\".\n * @constructs DescribedDataFieldBuilder\n * @alias module:described_field.DescribedDataFieldBuilder\n */\n function DescribedDataFieldBuilder() {\n /**\n * @type {module:described_field.DescribedDataField}\n */\n this.describedField = {\n category: \"\",\n type: \"\",\n abbreviation: \"\",\n image: \"\",\n index: [],\n groupNames: [],\n displayName: \"\",\n fieldName: \"\",\n value: \"\"\n };\n /**\n * Takes over all values of the template {@link module:described_field.DescribedDataField}.\n * @function\n * @param {module:described_field.DescribedDataField} template\n * @returns {DescribedDataFieldBuilder}\n * @example fromDescribedDataField(sourceField)\n */\n this.fromDescribedDataField = function (template) {\n this.category(template.category);\n this.type(template.type);\n this.abbreviation(template.abbreviation);\n this.image(template.image);\n this.index(template.index);\n this.groupNames(template.groupNames);\n this.displayName(template.displayName);\n this.fieldName(template.fieldName);\n this.value(template.value);\n return this;\n };\n /**\n * Sets the category.\n *\n * Contains a short domain nam, for example:\n * - \"product\" for products\n * - \"vendor\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example category(\"Product\")\n */\n this.category = function (value) {\n this.describedField.category = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the type.\n *\n * Contains the type of the entry, for example:\n * - \"summary\" for e.g. a list overview.\n * - \"detail\" e.g. when a summary is selected.\n * - \"filter\" e.g. for field/value pair results that can be selected as search parameters.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example type(\"summary\")\n */\n this.type = function (value) {\n this.describedField.type = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional abbreviation.\n *\n * Contains a symbol character or a very short abbreviation of the category.\n * - \"P\" for products\n * - \"V\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example abbreviation(\"P\")\n */\n this.abbreviation = function (value) {\n this.describedField.abbreviation = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional path to an image resource.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example image(\"img/product.png\")\n */\n this.image = function (value) {\n this.describedField.image = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the index as an array of numbers containing the splitted array indexes of the source field.\n * Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4].\n *\n * @function\n * @param {number[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example index([2,4])\n */\n this.index = function (value) {\n this.describedField.index = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the group names as an array of strings containing the names of the dynamically added properties,\n * that contain an array of {@link module:described_field.DescribedDataField}-Objects.\n *\n * @function\n * @param {string[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example groupNames([\"summaries\",\"details\",\"options\"])\n */\n this.groupNames = function (value) {\n this.describedField.groupNames = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the display name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example displayName(\"Color\")\n */\n this.displayName = function (value) {\n this.describedField.displayName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the (technical) field name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example fieldName(\"color\")\n */\n this.fieldName = function (value) {\n this.describedField.fieldName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the value/content of the field.\n *\n * @function\n * @param {*} value\n * @returns {DescribedDataFieldBuilder}\n * @example value(\"darkblue\")\n */\n this.value = function (value) {\n this.describedField.value = value;\n return this;\n };\n\n /**\n * Finalizes the settings and builds the {@link module:described_field.DescribedDataField}.\n * @function\n * @returns {module:described_field.DescribedDataField}\n */\n this.build = function () {\n return this.describedField;\n };\n }\n\n function isSpecifiedString(value) {\n return typeof value === \"string\" && value !== null && value !== \"\";\n }\n\n function withDefaultString(value, defaultValue) {\n return isSpecifiedString(value) ? value : defaultValue;\n }\n\n function withDefaultArray(value, defaultValue) {\n return value === undefined || value === null ? defaultValue : value;\n }\n\n return DescribedDataFieldBuilder;\n}());\n\n/**\n * Creates a new described data field with all properties of the original one except for dynamically added groups.\n * @param {module:described_field.DescribedDataField} describedDataField\n * @returns {module:described_field.DescribedDataField}\n * @memberof module:described_field\n */\ndescribed_field.copyWithoutGroups = function (describedDataField) {\n return new described_field.DescribedDataFieldBuilder().fromDescribedDataField(describedDataField).groupNames([]).build();\n};\n\ndescribed_field.DescribedDataFieldGroup = (function () {\n /**\n * Adds groups to {@link module:described_field.DescribedDataField}s. These groups are dynamically added properties\n * that contain an array of sub fields of the same type {@link module:described_field.DescribedDataField}s.\n *\n * @param {module:described_field.DescribedDataField} dataField\n * @constructs DescribedDataFieldGroup\n * @alias module:described_field.DescribedDataFieldGroup\n * @example new described_field.DescribedDataFieldGroup(field).addGroupEntry(\"details\", detailField);\n */\n function DescribedDataFieldGroup(dataField) {\n this.dataField = dataField;\n\n /**\n * Adds an entry to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entry will be added\n * @param {module:described_field.DescribedDataField} describedField sub field that is added to the group\n * @returns {DescribedDataFieldGroup}\n */\n this.addGroupEntry = function (groupName, describedField) {\n this.addGroupEntries(groupName, [describedField]);\n return this;\n };\n\n /**\n * Adds entries to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entries will be added\n * @param {module:described_field.DescribedDataField[]} describedFields sub fields that are added to the group\n * @returns {DescribedDataFieldGroup}\n */\n this.addGroupEntries = function (groupName, describedFields) {\n if (!groupName || groupName.length === 0) {\n return this;\n }\n if (!describedFields || describedFields.length === 0) {\n return this;\n }\n if (this.dataField[groupName] === undefined) {\n this.dataField.groupNames.push(groupName);\n this.dataField[groupName] = [];\n }\n var index;\n var describedField;\n for (index = 0; index < describedFields.length; index += 1) {\n describedField = describedFields[index];\n this.dataField[groupName].push(describedField);\n }\n return this;\n };\n }\n\n return DescribedDataFieldGroup;\n}());\n","\"use strict\";\nvar described_field = require(\"../../src/js/describedfield.js\");\nmodule.exports = {described_field : described_field};\n"],"names":["$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","parcelRegister","$988e67f614ef1b49$var$module","$988e67f614ef1b49$var$describedFieldInternalCreateIfNotExists","objectToCheck","$988e67f614ef1b49$var$described_field","internalCreateIfNotExists","DescribedDataFieldBuilder","withDefaultString","value","defaultValue","isSpecifiedString","describedField","category","type","abbreviation","image","index","groupNames","displayName","fieldName","fromDescribedDataField","template","build","copyWithoutGroups","describedDataField","DescribedDataFieldGroup","dataField","addGroupEntry","groupName","addGroupEntries","describedFields","length","undefined","push","$d63jw","described_field"],"version":3,"file":"describedfield-ie.js.map","sourceRoot":"../"}
1
+ {"mappings":"A,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,A,C,E,E,Q,A,E,Q,S,C,C,C,ECOA,IAAI,EAAS,EAAwC,GAErD,SAAS,EAAwC,CAAa,EAC5D,OAAO,GAAiB,CAAC,CAC3B,CAMA,IAAI,EAAmB,EAAO,OAAO,CAAG,CAAC,CACzC,CAAA,EAAgB,yBAAyB,CAAG,EAmB5C,EAAgB,yBAAyB,CAAI,WAmL3C,SAAS,EAAkB,CAAK,CAAE,CAAY,EAC5C,MAAO,AAJA,AAAiB,UAAjB,OAIkB,GAJW,AAAU,OAIrB,GAJ6B,AAAU,KAIvC,EAAS,EAAQ,CAC5C,CAMA,OApLA,WAIE,IAAI,CAAC,cAAc,CAAG,CACpB,SAAU,GACV,KAAM,GACN,aAAc,GACd,MAAO,GACP,MAAO,EAAE,CACT,WAAY,EAAE,CACd,YAAa,GACb,UAAW,GACX,MAAO,EACT,EAQA,IAAI,CAAC,sBAAsB,CAAG,SAAU,CAAQ,EAU9C,OATA,IAAI,CAAC,QAAQ,CAAC,EAAS,QAAQ,EAC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AA,CAAiB,CAAC,gBAAkB,CAAe","sources":["<anon>","src/js/describedfield.js","src/js/describedfield-ie.js"],"sourcesContent":["\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirec1f2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirec1f2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nparcelRegister(\"aJuQy\", function(module, exports) {\n/**\n * @file Describes a data field of the restructured data.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */ \"use strict\";\nvar $7d0608def849b52f$var$module = $7d0608def849b52f$var$describedFieldInternalCreateIfNotExists($7d0608def849b52f$var$module); // Fallback for vanilla js without modules\nfunction $7d0608def849b52f$var$describedFieldInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n/**\n * Describes a data field of the restructured data.\n * @module described_field\n */ var $7d0608def849b52f$var$described_field = $7d0608def849b52f$var$module.exports = {}; // Export module for npm...\n$7d0608def849b52f$var$described_field.internalCreateIfNotExists = $7d0608def849b52f$var$describedFieldInternalCreateIfNotExists;\n/**\n * Describes a field of the restructured data.\n * Dynamically added properties represent custom named groups containing DescribedDataField-Arrays.\n *\n * @typedef {Object} module:described_field.DescribedDataField\n * @property {string} [category=\"\"] - name of the category. Could contain a short domain name like \"product\" or \"vendor\".\n * @property {string} [type=\"\"] - type of the data element. Examples: \"summary\" for e.g. a list overview. \"detail\" e.g. when a summary is selected. \"filter\" e.g. for field/value pair results that can be selected as data filters.\n * @property {string} [abbreviation=\"\"] - one optional character, a symbol character or a short abbreviation of the category\n * @property {string} [image=\"\"] - one optional path to an image resource\n * @property {string} index - array of numbers containing the splitted index. Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4]\n * @property {string[]} groupNames - array of names of all dynamically added properties representing groups\n * @property {string} displayName - display name of the field\n * @property {string} fieldName - field name\n * @property {{*}} value - content of the field\n * @property {module:described_field.DescribedDataField[]} [couldBeAnyCustomGroupName] any number of groups attached to the field each containing multiple fields\n */ $7d0608def849b52f$var$described_field.DescribedDataFieldBuilder = function() {\n /**\n * Builds a {@link module:described_field.DescribedDataField}.\n * DescribedDataField is the main element of the restructured data and therefore considered \"public\".\n * @constructs DescribedDataFieldBuilder\n * @alias module:described_field.DescribedDataFieldBuilder\n */ function DescribedDataFieldBuilder() {\n /**\n * @type {module:described_field.DescribedDataField}\n */ this.describedField = {\n category: \"\",\n type: \"\",\n abbreviation: \"\",\n image: \"\",\n index: [],\n groupNames: [],\n displayName: \"\",\n fieldName: \"\",\n value: \"\"\n };\n /**\n * Takes over all values of the template {@link module:described_field.DescribedDataField}.\n * @function\n * @param {module:described_field.DescribedDataField} template\n * @returns {DescribedDataFieldBuilder}\n * @example fromDescribedDataField(sourceField)\n */ this.fromDescribedDataField = function(template) {\n this.category(template.category);\n this.type(template.type);\n this.abbreviation(template.abbreviation);\n this.image(template.image);\n this.index(template.index);\n this.groupNames(template.groupNames);\n this.displayName(template.displayName);\n this.fieldName(template.fieldName);\n this.value(template.value);\n return this;\n };\n /**\n * Sets the category.\n *\n * Contains a short domain nam, for example:\n * - \"product\" for products\n * - \"vendor\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example category(\"Product\")\n */ this.category = function(value) {\n this.describedField.category = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the type.\n *\n * Contains the type of the entry, for example:\n * - \"summary\" for e.g. a list overview.\n * - \"detail\" e.g. when a summary is selected.\n * - \"filter\" e.g. for field/value pair results that can be selected as search parameters.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example type(\"summary\")\n */ this.type = function(value) {\n this.describedField.type = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional abbreviation.\n *\n * Contains a symbol character or a very short abbreviation of the category.\n * - \"P\" for products\n * - \"V\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example abbreviation(\"P\")\n */ this.abbreviation = function(value) {\n this.describedField.abbreviation = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional path to an image resource.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example image(\"img/product.png\")\n */ this.image = function(value) {\n this.describedField.image = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the index as an array of numbers containing the splitted array indexes of the source field.\n * Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4].\n *\n * @function\n * @param {number[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example index([2,4])\n */ this.index = function(value) {\n this.describedField.index = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the group names as an array of strings containing the names of the dynamically added properties,\n * that contain an array of {@link module:described_field.DescribedDataField}-Objects.\n *\n * @function\n * @param {string[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example groupNames([\"summaries\",\"details\",\"options\"])\n */ this.groupNames = function(value) {\n this.describedField.groupNames = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the display name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example displayName(\"Color\")\n */ this.displayName = function(value) {\n this.describedField.displayName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the (technical) field name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example fieldName(\"color\")\n */ this.fieldName = function(value) {\n this.describedField.fieldName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the value/content of the field.\n *\n * @function\n * @param {*} value\n * @returns {DescribedDataFieldBuilder}\n * @example value(\"darkblue\")\n */ this.value = function(value) {\n this.describedField.value = value;\n return this;\n };\n /**\n * Finalizes the settings and builds the {@link module:described_field.DescribedDataField}.\n * @function\n * @returns {module:described_field.DescribedDataField}\n */ this.build = function() {\n return this.describedField;\n };\n }\n function isSpecifiedString(value) {\n return typeof value === \"string\" && value !== null && value !== \"\";\n }\n function withDefaultString(value, defaultValue) {\n return isSpecifiedString(value) ? value : defaultValue;\n }\n function withDefaultArray(value, defaultValue) {\n return value === undefined || value === null ? defaultValue : value;\n }\n return DescribedDataFieldBuilder;\n}();\n/**\n * Creates a new described data field with all properties of the original one except for dynamically added groups.\n * @param {module:described_field.DescribedDataField} describedDataField\n * @returns {module:described_field.DescribedDataField}\n * @memberof module:described_field\n */ $7d0608def849b52f$var$described_field.copyWithoutGroups = function(describedDataField) {\n return new $7d0608def849b52f$var$described_field.DescribedDataFieldBuilder().fromDescribedDataField(describedDataField).groupNames([]).build();\n};\n$7d0608def849b52f$var$described_field.DescribedDataFieldGroup = function() {\n /**\n * Adds groups to {@link module:described_field.DescribedDataField}s. These groups are dynamically added properties\n * that contain an array of sub fields of the same type {@link module:described_field.DescribedDataField}s.\n *\n * @param {module:described_field.DescribedDataField} dataField\n * @constructs DescribedDataFieldGroup\n * @alias module:described_field.DescribedDataFieldGroup\n * @example new described_field.DescribedDataFieldGroup(field).addGroupEntry(\"details\", detailField);\n */ function DescribedDataFieldGroup(dataField) {\n this.dataField = dataField;\n /**\n * Adds an entry to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entry will be added\n * @param {module:described_field.DescribedDataField} describedField sub field that is added to the group\n * @returns {DescribedDataFieldGroup}\n */ this.addGroupEntry = function(groupName, describedField) {\n this.addGroupEntries(groupName, [\n describedField\n ]);\n return this;\n };\n /**\n * Adds entries to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entries will be added\n * @param {module:described_field.DescribedDataField[]} describedFields sub fields that are added to the group\n * @returns {DescribedDataFieldGroup}\n */ this.addGroupEntries = function(groupName, describedFields) {\n if (!groupName || groupName.length === 0) return this;\n if (!describedFields || describedFields.length === 0) return this;\n if (this.dataField[groupName] === undefined) {\n this.dataField.groupNames.push(groupName);\n this.dataField[groupName] = [];\n }\n var index;\n var describedField;\n for(index = 0; index < describedFields.length; index += 1){\n describedField = describedFields[index];\n this.dataField[groupName].push(describedField);\n }\n return this;\n };\n }\n return DescribedDataFieldGroup;\n}();\n\n});\n\n\"use strict\";\n\nvar $aJuQy = parcelRequire(\"aJuQy\");\nmodule.exports = {\n described_field: $aJuQy\n};\n\n\n//# sourceMappingURL=describedfield-ie.js.map\n","/**\n * @file Describes a data field of the restructured data.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */\n\"use strict\";\nvar module = describedFieldInternalCreateIfNotExists(module); // Fallback for vanilla js without modules\n\nfunction describedFieldInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n\n/**\n * Describes a data field of the restructured data.\n * @module described_field\n */\nvar described_field = (module.exports = {}); // Export module for npm...\ndescribed_field.internalCreateIfNotExists = describedFieldInternalCreateIfNotExists;\n\n/**\n * Describes a field of the restructured data.\n * Dynamically added properties represent custom named groups containing DescribedDataField-Arrays.\n *\n * @typedef {Object} module:described_field.DescribedDataField\n * @property {string} [category=\"\"] - name of the category. Could contain a short domain name like \"product\" or \"vendor\".\n * @property {string} [type=\"\"] - type of the data element. Examples: \"summary\" for e.g. a list overview. \"detail\" e.g. when a summary is selected. \"filter\" e.g. for field/value pair results that can be selected as data filters.\n * @property {string} [abbreviation=\"\"] - one optional character, a symbol character or a short abbreviation of the category\n * @property {string} [image=\"\"] - one optional path to an image resource\n * @property {string} index - array of numbers containing the splitted index. Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4]\n * @property {string[]} groupNames - array of names of all dynamically added properties representing groups\n * @property {string} displayName - display name of the field\n * @property {string} fieldName - field name\n * @property {{*}} value - content of the field\n * @property {module:described_field.DescribedDataField[]} [couldBeAnyCustomGroupName] any number of groups attached to the field each containing multiple fields\n */\n\ndescribed_field.DescribedDataFieldBuilder = (function () {\n /**\n * Builds a {@link module:described_field.DescribedDataField}.\n * DescribedDataField is the main element of the restructured data and therefore considered \"public\".\n * @constructs DescribedDataFieldBuilder\n * @alias module:described_field.DescribedDataFieldBuilder\n */\n function DescribedDataFieldBuilder() {\n /**\n * @type {module:described_field.DescribedDataField}\n */\n this.describedField = {\n category: \"\",\n type: \"\",\n abbreviation: \"\",\n image: \"\",\n index: [],\n groupNames: [],\n displayName: \"\",\n fieldName: \"\",\n value: \"\"\n };\n /**\n * Takes over all values of the template {@link module:described_field.DescribedDataField}.\n * @function\n * @param {module:described_field.DescribedDataField} template\n * @returns {DescribedDataFieldBuilder}\n * @example fromDescribedDataField(sourceField)\n */\n this.fromDescribedDataField = function (template) {\n this.category(template.category);\n this.type(template.type);\n this.abbreviation(template.abbreviation);\n this.image(template.image);\n this.index(template.index);\n this.groupNames(template.groupNames);\n this.displayName(template.displayName);\n this.fieldName(template.fieldName);\n this.value(template.value);\n return this;\n };\n /**\n * Sets the category.\n *\n * Contains a short domain nam, for example:\n * - \"product\" for products\n * - \"vendor\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example category(\"Product\")\n */\n this.category = function (value) {\n this.describedField.category = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the type.\n *\n * Contains the type of the entry, for example:\n * - \"summary\" for e.g. a list overview.\n * - \"detail\" e.g. when a summary is selected.\n * - \"filter\" e.g. for field/value pair results that can be selected as search parameters.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example type(\"summary\")\n */\n this.type = function (value) {\n this.describedField.type = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional abbreviation.\n *\n * Contains a symbol character or a very short abbreviation of the category.\n * - \"P\" for products\n * - \"V\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example abbreviation(\"P\")\n */\n this.abbreviation = function (value) {\n this.describedField.abbreviation = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional path to an image resource.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example image(\"img/product.png\")\n */\n this.image = function (value) {\n this.describedField.image = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the index as an array of numbers containing the splitted array indexes of the source field.\n * Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4].\n *\n * @function\n * @param {number[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example index([2,4])\n */\n this.index = function (value) {\n this.describedField.index = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the group names as an array of strings containing the names of the dynamically added properties,\n * that contain an array of {@link module:described_field.DescribedDataField}-Objects.\n *\n * @function\n * @param {string[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example groupNames([\"summaries\",\"details\",\"options\"])\n */\n this.groupNames = function (value) {\n this.describedField.groupNames = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the display name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example displayName(\"Color\")\n */\n this.displayName = function (value) {\n this.describedField.displayName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the (technical) field name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example fieldName(\"color\")\n */\n this.fieldName = function (value) {\n this.describedField.fieldName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the value/content of the field.\n *\n * @function\n * @param {*} value\n * @returns {DescribedDataFieldBuilder}\n * @example value(\"darkblue\")\n */\n this.value = function (value) {\n this.describedField.value = value;\n return this;\n };\n\n /**\n * Finalizes the settings and builds the {@link module:described_field.DescribedDataField}.\n * @function\n * @returns {module:described_field.DescribedDataField}\n */\n this.build = function () {\n return this.describedField;\n };\n }\n\n function isSpecifiedString(value) {\n return typeof value === \"string\" && value !== null && value !== \"\";\n }\n\n function withDefaultString(value, defaultValue) {\n return isSpecifiedString(value) ? value : defaultValue;\n }\n\n function withDefaultArray(value, defaultValue) {\n return value === undefined || value === null ? defaultValue : value;\n }\n\n return DescribedDataFieldBuilder;\n}());\n\n/**\n * Creates a new described data field with all properties of the original one except for dynamically added groups.\n * @param {module:described_field.DescribedDataField} describedDataField\n * @returns {module:described_field.DescribedDataField}\n * @memberof module:described_field\n */\ndescribed_field.copyWithoutGroups = function (describedDataField) {\n return new described_field.DescribedDataFieldBuilder().fromDescribedDataField(describedDataField).groupNames([]).build();\n};\n\ndescribed_field.DescribedDataFieldGroup = (function () {\n /**\n * Adds groups to {@link module:described_field.DescribedDataField}s. These groups are dynamically added properties\n * that contain an array of sub fields of the same type {@link module:described_field.DescribedDataField}s.\n *\n * @param {module:described_field.DescribedDataField} dataField\n * @constructs DescribedDataFieldGroup\n * @alias module:described_field.DescribedDataFieldGroup\n * @example new described_field.DescribedDataFieldGroup(field).addGroupEntry(\"details\", detailField);\n */\n function DescribedDataFieldGroup(dataField) {\n this.dataField = dataField;\n\n /**\n * Adds an entry to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entry will be added\n * @param {module:described_field.DescribedDataField} describedField sub field that is added to the group\n * @returns {DescribedDataFieldGroup}\n */\n this.addGroupEntry = function (groupName, describedField) {\n this.addGroupEntries(groupName, [describedField]);\n return this;\n };\n\n /**\n * Adds entries to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entries will be added\n * @param {module:described_field.DescribedDataField[]} describedFields sub fields that are added to the group\n * @returns {DescribedDataFieldGroup}\n */\n this.addGroupEntries = function (groupName, describedFields) {\n if (!groupName || groupName.length === 0) {\n return this;\n }\n if (!describedFields || describedFields.length === 0) {\n return this;\n }\n if (this.dataField[groupName] === undefined) {\n this.dataField.groupNames.push(groupName);\n this.dataField[groupName] = [];\n }\n var index;\n var describedField;\n for (index = 0; index < describedFields.length; index += 1) {\n describedField = describedFields[index];\n this.dataField[groupName].push(describedField);\n }\n return this;\n };\n }\n\n return DescribedDataFieldGroup;\n}());\n","\"use strict\";\nvar described_field = require(\"../../src/js/describedfield.js\");\nmodule.exports = {described_field : described_field};\n"],"names":["$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","parcelRegister","$7d0608def849b52f$var$module","$7d0608def849b52f$var$describedFieldInternalCreateIfNotExists","objectToCheck","$7d0608def849b52f$var$described_field","internalCreateIfNotExists","DescribedDataFieldBuilder","withDefaultString","value","defaultValue","isSpecifiedString","describedField","category","type","abbreviation","image","index","groupNames","displayName","fieldName","fromDescribedDataField","template","build","copyWithoutGroups","describedDataField","DescribedDataFieldGroup","dataField","addGroupEntry","groupName","addGroupEntries","describedFields","length","undefined","push","$aJuQy","described_field"],"version":3,"file":"describedfield-ie.js.map","sourceRoot":"../"}
@@ -1,143 +1,2 @@
1
- var i=globalThis,e={},t={},r=i.parcelRequirec1f2;null==r&&((r=function(i){if(i in e)return e[i].exports;if(i in t){var r=t[i];delete t[i];var s={id:i,exports:{}};return e[i]=s,r.call(s.exports,s,s.exports),s.exports}var n=Error("Cannot find module '"+i+"'");throw n.code="MODULE_NOT_FOUND",n}).register=function(i,e){t[i]=e},i.parcelRequirec1f2=r),(0,r.register)("d63jw",function(i,e){var t=r(t);// Fallback for vanilla js without modules
2
- function r(i){return i||{}}/**
3
- * Describes a data field of the restructured data.
4
- * @module described_field
5
- */var s=t.exports={};// Export module for npm...
6
- s.internalCreateIfNotExists=r,/**
7
- * Describes a field of the restructured data.
8
- * Dynamically added properties represent custom named groups containing DescribedDataField-Arrays.
9
- *
10
- * @typedef {Object} module:described_field.DescribedDataField
11
- * @property {string} [category=""] - name of the category. Could contain a short domain name like "product" or "vendor".
12
- * @property {string} [type=""] - type of the data element. Examples: "summary" for e.g. a list overview. "detail" e.g. when a summary is selected. "filter" e.g. for field/value pair results that can be selected as data filters.
13
- * @property {string} [abbreviation=""] - one optional character, a symbol character or a short abbreviation of the category
14
- * @property {string} [image=""] - one optional path to an image resource
15
- * @property {string} index - array of numbers containing the splitted index. Example: "responses[2].hits.hits[4]._source.name" will have an index of [2,4]
16
- * @property {string[]} groupNames - array of names of all dynamically added properties representing groups
17
- * @property {string} displayName - display name of the field
18
- * @property {string} fieldName - field name
19
- * @property {{*}} value - content of the field
20
- * @property {module:described_field.DescribedDataField[]} [couldBeAnyCustomGroupName] any number of groups attached to the field each containing multiple fields
21
- */s.DescribedDataFieldBuilder=function(){function i(i,e){return"string"==typeof i&&null!==i&&""!==i?i:e}return(/**
22
- * Builds a {@link module:described_field.DescribedDataField}.
23
- * DescribedDataField is the main element of the restructured data and therefore considered "public".
24
- * @constructs DescribedDataFieldBuilder
25
- * @alias module:described_field.DescribedDataFieldBuilder
26
- */function(){/**
27
- * @type {module:described_field.DescribedDataField}
28
- */this.describedField={category:"",type:"",abbreviation:"",image:"",index:[],groupNames:[],displayName:"",fieldName:"",value:""},/**
29
- * Takes over all values of the template {@link module:described_field.DescribedDataField}.
30
- * @function
31
- * @param {module:described_field.DescribedDataField} template
32
- * @returns {DescribedDataFieldBuilder}
33
- * @example fromDescribedDataField(sourceField)
34
- */this.fromDescribedDataField=function(i){return this.category(i.category),this.type(i.type),this.abbreviation(i.abbreviation),this.image(i.image),this.index(i.index),this.groupNames(i.groupNames),this.displayName(i.displayName),this.fieldName(i.fieldName),this.value(i.value),this},/**
35
- * Sets the category.
36
- *
37
- * Contains a short domain nam, for example:
38
- * - "product" for products
39
- * - "vendor" for vendors
40
- *
41
- * @function
42
- * @param {String} [value=""]
43
- * @returns {DescribedDataFieldBuilder}
44
- * @example category("Product")
45
- */this.category=function(e){return this.describedField.category=i(e,""),this},/**
46
- * Sets the type.
47
- *
48
- * Contains the type of the entry, for example:
49
- * - "summary" for e.g. a list overview.
50
- * - "detail" e.g. when a summary is selected.
51
- * - "filter" e.g. for field/value pair results that can be selected as search parameters.
52
- *
53
- * @function
54
- * @param {String} [value=""]
55
- * @returns {DescribedDataFieldBuilder}
56
- * @example type("summary")
57
- */this.type=function(e){return this.describedField.type=i(e,""),this},/**
58
- * Sets the optional abbreviation.
59
- *
60
- * Contains a symbol character or a very short abbreviation of the category.
61
- * - "P" for products
62
- * - "V" for vendors
63
- *
64
- * @function
65
- * @param {String} [value=""]
66
- * @returns {DescribedDataFieldBuilder}
67
- * @example abbreviation("P")
68
- */this.abbreviation=function(e){return this.describedField.abbreviation=i(e,""),this},/**
69
- * Sets the optional path to an image resource.
70
- *
71
- * @function
72
- * @param {String} [value=""]
73
- * @returns {DescribedDataFieldBuilder}
74
- * @example image("img/product.png")
75
- */this.image=function(e){return this.describedField.image=i(e,""),this},/**
76
- * Sets the index as an array of numbers containing the splitted array indexes of the source field.
77
- * Example: "responses[2].hits.hits[4]._source.name" will have an index of [2,4].
78
- *
79
- * @function
80
- * @param {number[]} [value=[]]
81
- * @returns {DescribedDataFieldBuilder}
82
- * @example index([2,4])
83
- */this.index=function(i){return this.describedField.index=null==i?[]:i,this},/**
84
- * Sets the group names as an array of strings containing the names of the dynamically added properties,
85
- * that contain an array of {@link module:described_field.DescribedDataField}-Objects.
86
- *
87
- * @function
88
- * @param {string[]} [value=[]]
89
- * @returns {DescribedDataFieldBuilder}
90
- * @example groupNames(["summaries","details","options"])
91
- */this.groupNames=function(i){return this.describedField.groupNames=null==i?[]:i,this},/**
92
- * Sets the display name.
93
- *
94
- * @function
95
- * @param {String} [value=""]
96
- * @returns {DescribedDataFieldBuilder}
97
- * @example displayName("Color")
98
- */this.displayName=function(e){return this.describedField.displayName=i(e,""),this},/**
99
- * Sets the (technical) field name.
100
- *
101
- * @function
102
- * @param {String} [value=""]
103
- * @returns {DescribedDataFieldBuilder}
104
- * @example fieldName("color")
105
- */this.fieldName=function(e){return this.describedField.fieldName=i(e,""),this},/**
106
- * Sets the value/content of the field.
107
- *
108
- * @function
109
- * @param {*} value
110
- * @returns {DescribedDataFieldBuilder}
111
- * @example value("darkblue")
112
- */this.value=function(i){return this.describedField.value=i,this},/**
113
- * Finalizes the settings and builds the {@link module:described_field.DescribedDataField}.
114
- * @function
115
- * @returns {module:described_field.DescribedDataField}
116
- */this.build=function(){return this.describedField}})}(),/**
117
- * Creates a new described data field with all properties of the original one except for dynamically added groups.
118
- * @param {module:described_field.DescribedDataField} describedDataField
119
- * @returns {module:described_field.DescribedDataField}
120
- * @memberof module:described_field
121
- */s.copyWithoutGroups=function(i){return new s.DescribedDataFieldBuilder().fromDescribedDataField(i).groupNames([]).build()},s.DescribedDataFieldGroup=/**
122
- * Adds groups to {@link module:described_field.DescribedDataField}s. These groups are dynamically added properties
123
- * that contain an array of sub fields of the same type {@link module:described_field.DescribedDataField}s.
124
- *
125
- * @param {module:described_field.DescribedDataField} dataField
126
- * @constructs DescribedDataFieldGroup
127
- * @alias module:described_field.DescribedDataFieldGroup
128
- * @example new described_field.DescribedDataFieldGroup(field).addGroupEntry("details", detailField);
129
- */function(i){this.dataField=i,/**
130
- * Adds an entry to the given group. If the group does not exist, it will be created.
131
- * @function
132
- * @param {String} groupName name of the group to which the entry will be added
133
- * @param {module:described_field.DescribedDataField} describedField sub field that is added to the group
134
- * @returns {DescribedDataFieldGroup}
135
- */this.addGroupEntry=function(i,e){return this.addGroupEntries(i,[e]),this},/**
136
- * Adds entries to the given group. If the group does not exist, it will be created.
137
- * @function
138
- * @param {String} groupName name of the group to which the entries will be added
139
- * @param {module:described_field.DescribedDataField[]} describedFields sub fields that are added to the group
140
- * @returns {DescribedDataFieldGroup}
141
- */this.addGroupEntries=function(i,e){var t,r;if(!i||0===i.length||!e||0===e.length)return this;for(void 0===this.dataField[i]&&(this.dataField.groupNames.push(i),this.dataField[i]=[]),t=0;t<e.length;t+=1)r=e[t],this.dataField[i].push(r);return this}}}),r("d63jw");//# sourceMappingURL=describedfield.js.map
142
-
1
+ var i=globalThis,e={},t={},r=i.parcelRequirec1f2;null==r&&((r=function(i){if(i in e)return e[i].exports;if(i in t){var r=t[i];delete t[i];var s={id:i,exports:{}};return e[i]=s,r.call(s.exports,s,s.exports),s.exports}var n=Error("Cannot find module '"+i+"'");throw n.code="MODULE_NOT_FOUND",n}).register=function(i,e){t[i]=e},i.parcelRequirec1f2=r),(0,r.register)("aJuQy",function(i,e){var t=r(t);function r(i){return i||{}}var s=t.exports={};s.internalCreateIfNotExists=r,s.DescribedDataFieldBuilder=function(){function i(i,e){return"string"==typeof i&&null!==i&&""!==i?i:e}return function(){this.describedField={category:"",type:"",abbreviation:"",image:"",index:[],groupNames:[],displayName:"",fieldName:"",value:""},this.fromDescribedDataField=function(i){return this.category(i.category),this.type(i.type),this.abbreviation(i.abbreviation),this.image(i.image),this.index(i.index),this.groupNames(i.groupNames),this.displayName(i.displayName),this.fieldName(i.fieldName),this.value(i.value),this},this.category=function(e){return this.describedField.category=i(e,""),this},this.type=function(e){return this.describedField.type=i(e,""),this},this.abbreviation=function(e){return this.describedField.abbreviation=i(e,""),this},this.image=function(e){return this.describedField.image=i(e,""),this},this.index=function(i){var e;return this.describedField.index=(e=[],null==i?e:i),this},this.groupNames=function(i){var e;return this.describedField.groupNames=(e=[],null==i?e:i),this},this.displayName=function(e){return this.describedField.displayName=i(e,""),this},this.fieldName=function(e){return this.describedField.fieldName=i(e,""),this},this.value=function(i){return this.describedField.value=i,this},this.build=function(){return this.describedField}}}(),s.copyWithoutGroups=function(i){return new s.DescribedDataFieldBuilder().fromDescribedDataField(i).groupNames([]).build()},s.DescribedDataFieldGroup=function(i){this.dataField=i,this.addGroupEntry=function(i,e){return this.addGroupEntries(i,[e]),this},this.addGroupEntries=function(i,e){var t,r;if(!i||0===i.length||!e||0===e.length)return this;for(void 0===this.dataField[i]&&(this.dataField.groupNames.push(i),this.dataField[i]=[]),t=0;t<e.length;t+=1)r=e[t],this.dataField[i].push(r);return this}}}),r("aJuQy");
143
2
  //# sourceMappingURL=describedfield.js.map
@@ -1 +1 @@
1
- {"mappings":"A,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,A,C,E,E,Q,A,E,Q,S,C,C,C,ECOA,IAAI,EAAS,EAAwC,EAAS,2CAA0C;AAExG,SAAS,EAAwC,CAAa,EAC5D,OAAO,GAAiB,CAAC,CAC3B,CAEA;;;CAGC,EACD,IAAI,EAAmB,EAAO,OAAO,CAAG,CAAC,CAAI,4BAA2B;AACxE,EAAgB,yBAAyB,CAAG,EAE5C;;;;;;;;;;;;;;;CAeC,EAED,EAAgB,yBAAyB,CAAI,WAmL3C,SAAS,EAAkB,CAAK,CAAE,CAAY,EAC5C,MAAO,AAJA,AAAiB,UAAjB,OAIkB,GAJW,AAAU,OAIrB,GAJ6B,AAAU,KAIvC,EAAS,EAAQ,CAC5C,CAMA,OA1LA;;;;;GAKC,EACD,WACE;;KAEC,EACD,IAAI,CAAC,cAAc,CAAG,CACpB,SAAU,GACV,KAAM,GACN,aAAc,GACd,MAAO,GACP,MAAO,EAAE,CACT,WAAY,EAAE,CACd,YAAa,GACb,UAAW,GACX,MAAO,EACT,EACA;;;;;;KAMC,EACD,IAAI,CAAC,sBAAsB,CAAG,SAAU,CAAQ,EAU9C,OATA,IAAI,CAAC,QAAQ,CAAC,EAAS,QAAQ,EAC/B,IAAI,CAAC,IAAI,CAAC,EAAS,IAAI,EACvB,IAAI,CAAC,YAAY,CA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AiB,CAAe,CAAC,EAAM,CACvC,IAAI,CAAC,SAAS,CAAC,EAAU,CAAC,IAAI,CAAC,GAEjC,OAAO,IAAI,AACb,CACF,C,G,E,Q,2C","sources":["<anon>","src/js/describedfield.js"],"sourcesContent":["\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirec1f2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirec1f2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nparcelRegister(\"d63jw\", function(module, exports) {\n/**\n * @file Describes a data field of the restructured data.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */ \"use strict\";\nvar $988e67f614ef1b49$var$module = $988e67f614ef1b49$var$describedFieldInternalCreateIfNotExists($988e67f614ef1b49$var$module); // Fallback for vanilla js without modules\nfunction $988e67f614ef1b49$var$describedFieldInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n/**\n * Describes a data field of the restructured data.\n * @module described_field\n */ var $988e67f614ef1b49$var$described_field = $988e67f614ef1b49$var$module.exports = {}; // Export module for npm...\n$988e67f614ef1b49$var$described_field.internalCreateIfNotExists = $988e67f614ef1b49$var$describedFieldInternalCreateIfNotExists;\n/**\n * Describes a field of the restructured data.\n * Dynamically added properties represent custom named groups containing DescribedDataField-Arrays.\n *\n * @typedef {Object} module:described_field.DescribedDataField\n * @property {string} [category=\"\"] - name of the category. Could contain a short domain name like \"product\" or \"vendor\".\n * @property {string} [type=\"\"] - type of the data element. Examples: \"summary\" for e.g. a list overview. \"detail\" e.g. when a summary is selected. \"filter\" e.g. for field/value pair results that can be selected as data filters.\n * @property {string} [abbreviation=\"\"] - one optional character, a symbol character or a short abbreviation of the category\n * @property {string} [image=\"\"] - one optional path to an image resource\n * @property {string} index - array of numbers containing the splitted index. Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4]\n * @property {string[]} groupNames - array of names of all dynamically added properties representing groups\n * @property {string} displayName - display name of the field\n * @property {string} fieldName - field name\n * @property {{*}} value - content of the field\n * @property {module:described_field.DescribedDataField[]} [couldBeAnyCustomGroupName] any number of groups attached to the field each containing multiple fields\n */ $988e67f614ef1b49$var$described_field.DescribedDataFieldBuilder = function() {\n /**\n * Builds a {@link module:described_field.DescribedDataField}.\n * DescribedDataField is the main element of the restructured data and therefore considered \"public\".\n * @constructs DescribedDataFieldBuilder\n * @alias module:described_field.DescribedDataFieldBuilder\n */ function DescribedDataFieldBuilder() {\n /**\n * @type {module:described_field.DescribedDataField}\n */ this.describedField = {\n category: \"\",\n type: \"\",\n abbreviation: \"\",\n image: \"\",\n index: [],\n groupNames: [],\n displayName: \"\",\n fieldName: \"\",\n value: \"\"\n };\n /**\n * Takes over all values of the template {@link module:described_field.DescribedDataField}.\n * @function\n * @param {module:described_field.DescribedDataField} template\n * @returns {DescribedDataFieldBuilder}\n * @example fromDescribedDataField(sourceField)\n */ this.fromDescribedDataField = function(template) {\n this.category(template.category);\n this.type(template.type);\n this.abbreviation(template.abbreviation);\n this.image(template.image);\n this.index(template.index);\n this.groupNames(template.groupNames);\n this.displayName(template.displayName);\n this.fieldName(template.fieldName);\n this.value(template.value);\n return this;\n };\n /**\n * Sets the category.\n *\n * Contains a short domain nam, for example:\n * - \"product\" for products\n * - \"vendor\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example category(\"Product\")\n */ this.category = function(value) {\n this.describedField.category = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the type.\n *\n * Contains the type of the entry, for example:\n * - \"summary\" for e.g. a list overview.\n * - \"detail\" e.g. when a summary is selected.\n * - \"filter\" e.g. for field/value pair results that can be selected as search parameters.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example type(\"summary\")\n */ this.type = function(value) {\n this.describedField.type = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional abbreviation.\n *\n * Contains a symbol character or a very short abbreviation of the category.\n * - \"P\" for products\n * - \"V\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example abbreviation(\"P\")\n */ this.abbreviation = function(value) {\n this.describedField.abbreviation = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional path to an image resource.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example image(\"img/product.png\")\n */ this.image = function(value) {\n this.describedField.image = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the index as an array of numbers containing the splitted array indexes of the source field.\n * Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4].\n *\n * @function\n * @param {number[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example index([2,4])\n */ this.index = function(value) {\n this.describedField.index = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the group names as an array of strings containing the names of the dynamically added properties,\n * that contain an array of {@link module:described_field.DescribedDataField}-Objects.\n *\n * @function\n * @param {string[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example groupNames([\"summaries\",\"details\",\"options\"])\n */ this.groupNames = function(value) {\n this.describedField.groupNames = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the display name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example displayName(\"Color\")\n */ this.displayName = function(value) {\n this.describedField.displayName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the (technical) field name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example fieldName(\"color\")\n */ this.fieldName = function(value) {\n this.describedField.fieldName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the value/content of the field.\n *\n * @function\n * @param {*} value\n * @returns {DescribedDataFieldBuilder}\n * @example value(\"darkblue\")\n */ this.value = function(value) {\n this.describedField.value = value;\n return this;\n };\n /**\n * Finalizes the settings and builds the {@link module:described_field.DescribedDataField}.\n * @function\n * @returns {module:described_field.DescribedDataField}\n */ this.build = function() {\n return this.describedField;\n };\n }\n function isSpecifiedString(value) {\n return typeof value === \"string\" && value !== null && value !== \"\";\n }\n function withDefaultString(value, defaultValue) {\n return isSpecifiedString(value) ? value : defaultValue;\n }\n function withDefaultArray(value, defaultValue) {\n return value === undefined || value === null ? defaultValue : value;\n }\n return DescribedDataFieldBuilder;\n}();\n/**\n * Creates a new described data field with all properties of the original one except for dynamically added groups.\n * @param {module:described_field.DescribedDataField} describedDataField\n * @returns {module:described_field.DescribedDataField}\n * @memberof module:described_field\n */ $988e67f614ef1b49$var$described_field.copyWithoutGroups = function(describedDataField) {\n return new $988e67f614ef1b49$var$described_field.DescribedDataFieldBuilder().fromDescribedDataField(describedDataField).groupNames([]).build();\n};\n$988e67f614ef1b49$var$described_field.DescribedDataFieldGroup = function() {\n /**\n * Adds groups to {@link module:described_field.DescribedDataField}s. These groups are dynamically added properties\n * that contain an array of sub fields of the same type {@link module:described_field.DescribedDataField}s.\n *\n * @param {module:described_field.DescribedDataField} dataField\n * @constructs DescribedDataFieldGroup\n * @alias module:described_field.DescribedDataFieldGroup\n * @example new described_field.DescribedDataFieldGroup(field).addGroupEntry(\"details\", detailField);\n */ function DescribedDataFieldGroup(dataField) {\n this.dataField = dataField;\n /**\n * Adds an entry to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entry will be added\n * @param {module:described_field.DescribedDataField} describedField sub field that is added to the group\n * @returns {DescribedDataFieldGroup}\n */ this.addGroupEntry = function(groupName, describedField) {\n this.addGroupEntries(groupName, [\n describedField\n ]);\n return this;\n };\n /**\n * Adds entries to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entries will be added\n * @param {module:described_field.DescribedDataField[]} describedFields sub fields that are added to the group\n * @returns {DescribedDataFieldGroup}\n */ this.addGroupEntries = function(groupName, describedFields) {\n if (!groupName || groupName.length === 0) return this;\n if (!describedFields || describedFields.length === 0) return this;\n if (this.dataField[groupName] === undefined) {\n this.dataField.groupNames.push(groupName);\n this.dataField[groupName] = [];\n }\n var index;\n var describedField;\n for(index = 0; index < describedFields.length; index += 1){\n describedField = describedFields[index];\n this.dataField[groupName].push(describedField);\n }\n return this;\n };\n }\n return DescribedDataFieldGroup;\n}();\n\n});\n\n\nparcelRequire(\"d63jw\");\n\n//# sourceMappingURL=describedfield.js.map\n","/**\n * @file Describes a data field of the restructured data.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */\n\"use strict\";\nvar module = describedFieldInternalCreateIfNotExists(module); // Fallback for vanilla js without modules\n\nfunction describedFieldInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n\n/**\n * Describes a data field of the restructured data.\n * @module described_field\n */\nvar described_field = (module.exports = {}); // Export module for npm...\ndescribed_field.internalCreateIfNotExists = describedFieldInternalCreateIfNotExists;\n\n/**\n * Describes a field of the restructured data.\n * Dynamically added properties represent custom named groups containing DescribedDataField-Arrays.\n *\n * @typedef {Object} module:described_field.DescribedDataField\n * @property {string} [category=\"\"] - name of the category. Could contain a short domain name like \"product\" or \"vendor\".\n * @property {string} [type=\"\"] - type of the data element. Examples: \"summary\" for e.g. a list overview. \"detail\" e.g. when a summary is selected. \"filter\" e.g. for field/value pair results that can be selected as data filters.\n * @property {string} [abbreviation=\"\"] - one optional character, a symbol character or a short abbreviation of the category\n * @property {string} [image=\"\"] - one optional path to an image resource\n * @property {string} index - array of numbers containing the splitted index. Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4]\n * @property {string[]} groupNames - array of names of all dynamically added properties representing groups\n * @property {string} displayName - display name of the field\n * @property {string} fieldName - field name\n * @property {{*}} value - content of the field\n * @property {module:described_field.DescribedDataField[]} [couldBeAnyCustomGroupName] any number of groups attached to the field each containing multiple fields\n */\n\ndescribed_field.DescribedDataFieldBuilder = (function () {\n /**\n * Builds a {@link module:described_field.DescribedDataField}.\n * DescribedDataField is the main element of the restructured data and therefore considered \"public\".\n * @constructs DescribedDataFieldBuilder\n * @alias module:described_field.DescribedDataFieldBuilder\n */\n function DescribedDataFieldBuilder() {\n /**\n * @type {module:described_field.DescribedDataField}\n */\n this.describedField = {\n category: \"\",\n type: \"\",\n abbreviation: \"\",\n image: \"\",\n index: [],\n groupNames: [],\n displayName: \"\",\n fieldName: \"\",\n value: \"\"\n };\n /**\n * Takes over all values of the template {@link module:described_field.DescribedDataField}.\n * @function\n * @param {module:described_field.DescribedDataField} template\n * @returns {DescribedDataFieldBuilder}\n * @example fromDescribedDataField(sourceField)\n */\n this.fromDescribedDataField = function (template) {\n this.category(template.category);\n this.type(template.type);\n this.abbreviation(template.abbreviation);\n this.image(template.image);\n this.index(template.index);\n this.groupNames(template.groupNames);\n this.displayName(template.displayName);\n this.fieldName(template.fieldName);\n this.value(template.value);\n return this;\n };\n /**\n * Sets the category.\n *\n * Contains a short domain nam, for example:\n * - \"product\" for products\n * - \"vendor\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example category(\"Product\")\n */\n this.category = function (value) {\n this.describedField.category = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the type.\n *\n * Contains the type of the entry, for example:\n * - \"summary\" for e.g. a list overview.\n * - \"detail\" e.g. when a summary is selected.\n * - \"filter\" e.g. for field/value pair results that can be selected as search parameters.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example type(\"summary\")\n */\n this.type = function (value) {\n this.describedField.type = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional abbreviation.\n *\n * Contains a symbol character or a very short abbreviation of the category.\n * - \"P\" for products\n * - \"V\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example abbreviation(\"P\")\n */\n this.abbreviation = function (value) {\n this.describedField.abbreviation = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional path to an image resource.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example image(\"img/product.png\")\n */\n this.image = function (value) {\n this.describedField.image = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the index as an array of numbers containing the splitted array indexes of the source field.\n * Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4].\n *\n * @function\n * @param {number[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example index([2,4])\n */\n this.index = function (value) {\n this.describedField.index = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the group names as an array of strings containing the names of the dynamically added properties,\n * that contain an array of {@link module:described_field.DescribedDataField}-Objects.\n *\n * @function\n * @param {string[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example groupNames([\"summaries\",\"details\",\"options\"])\n */\n this.groupNames = function (value) {\n this.describedField.groupNames = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the display name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example displayName(\"Color\")\n */\n this.displayName = function (value) {\n this.describedField.displayName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the (technical) field name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example fieldName(\"color\")\n */\n this.fieldName = function (value) {\n this.describedField.fieldName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the value/content of the field.\n *\n * @function\n * @param {*} value\n * @returns {DescribedDataFieldBuilder}\n * @example value(\"darkblue\")\n */\n this.value = function (value) {\n this.describedField.value = value;\n return this;\n };\n\n /**\n * Finalizes the settings and builds the {@link module:described_field.DescribedDataField}.\n * @function\n * @returns {module:described_field.DescribedDataField}\n */\n this.build = function () {\n return this.describedField;\n };\n }\n\n function isSpecifiedString(value) {\n return typeof value === \"string\" && value !== null && value !== \"\";\n }\n\n function withDefaultString(value, defaultValue) {\n return isSpecifiedString(value) ? value : defaultValue;\n }\n\n function withDefaultArray(value, defaultValue) {\n return value === undefined || value === null ? defaultValue : value;\n }\n\n return DescribedDataFieldBuilder;\n}());\n\n/**\n * Creates a new described data field with all properties of the original one except for dynamically added groups.\n * @param {module:described_field.DescribedDataField} describedDataField\n * @returns {module:described_field.DescribedDataField}\n * @memberof module:described_field\n */\ndescribed_field.copyWithoutGroups = function (describedDataField) {\n return new described_field.DescribedDataFieldBuilder().fromDescribedDataField(describedDataField).groupNames([]).build();\n};\n\ndescribed_field.DescribedDataFieldGroup = (function () {\n /**\n * Adds groups to {@link module:described_field.DescribedDataField}s. These groups are dynamically added properties\n * that contain an array of sub fields of the same type {@link module:described_field.DescribedDataField}s.\n *\n * @param {module:described_field.DescribedDataField} dataField\n * @constructs DescribedDataFieldGroup\n * @alias module:described_field.DescribedDataFieldGroup\n * @example new described_field.DescribedDataFieldGroup(field).addGroupEntry(\"details\", detailField);\n */\n function DescribedDataFieldGroup(dataField) {\n this.dataField = dataField;\n\n /**\n * Adds an entry to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entry will be added\n * @param {module:described_field.DescribedDataField} describedField sub field that is added to the group\n * @returns {DescribedDataFieldGroup}\n */\n this.addGroupEntry = function (groupName, describedField) {\n this.addGroupEntries(groupName, [describedField]);\n return this;\n };\n\n /**\n * Adds entries to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entries will be added\n * @param {module:described_field.DescribedDataField[]} describedFields sub fields that are added to the group\n * @returns {DescribedDataFieldGroup}\n */\n this.addGroupEntries = function (groupName, describedFields) {\n if (!groupName || groupName.length === 0) {\n return this;\n }\n if (!describedFields || describedFields.length === 0) {\n return this;\n }\n if (this.dataField[groupName] === undefined) {\n this.dataField.groupNames.push(groupName);\n this.dataField[groupName] = [];\n }\n var index;\n var describedField;\n for (index = 0; index < describedFields.length; index += 1) {\n describedField = describedFields[index];\n this.dataField[groupName].push(describedField);\n }\n return this;\n };\n }\n\n return DescribedDataFieldGroup;\n}());\n"],"names":["$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","parcelRegister","$988e67f614ef1b49$var$module","$988e67f614ef1b49$var$describedFieldInternalCreateIfNotExists","objectToCheck","$988e67f614ef1b49$var$described_field","internalCreateIfNotExists","DescribedDataFieldBuilder","withDefaultString","value","defaultValue","isSpecifiedString","describedField","category","type","abbreviation","image","index","groupNames","displayName","fieldName","fromDescribedDataField","template","build","copyWithoutGroups","describedDataField","DescribedDataFieldGroup","dataField","addGroupEntry","groupName","addGroupEntries","describedFields","length","undefined","push"],"version":3,"file":"describedfield.js.map","sourceRoot":"../"}
1
+ {"mappings":"A,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,A,C,E,E,Q,A,E,Q,S,C,C,C,ECOA,IAAI,EAAS,EAAwC,GAErD,SAAS,EAAwC,CAAa,EAC5D,OAAO,GAAiB,CAAC,CAC3B,CAMA,IAAI,EAAmB,EAAO,OAAO,CAAG,CAAC,CACzC,CAAA,EAAgB,yBAAyB,CAAG,EAmB5C,EAAgB,yBAAyB,CAAI,WAmL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,EAAgB,MAAM,CAF5C,OAAO,IAAI,CAWb,IANkC,KAAA,IAA9B,IAAI,CAAC,SAAS,CAAC,EAAU,GAC3B,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,GAC/B,IAAI,CAAC,SAAS,CAAC,EAAU,CAAG,EAAE,EAI3B,EAAQ,EAAG,EAAQ,EAAgB,MAAM,CAAE,GAAS,EACvD,EAAiB,CAAe,CAAC,EAAM,CACvC,IAAI,CAAC,SAAS,CAAC,EAAU,CAAC,IAAI,CAAC,GAEjC,OAAO,IAAI,AACb,CACF,C,G,E","sources":["<anon>","src/js/describedfield.js"],"sourcesContent":["\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirec1f2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirec1f2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nparcelRegister(\"aJuQy\", function(module, exports) {\n/**\n * @file Describes a data field of the restructured data.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */ \"use strict\";\nvar $7d0608def849b52f$var$module = $7d0608def849b52f$var$describedFieldInternalCreateIfNotExists($7d0608def849b52f$var$module); // Fallback for vanilla js without modules\nfunction $7d0608def849b52f$var$describedFieldInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n/**\n * Describes a data field of the restructured data.\n * @module described_field\n */ var $7d0608def849b52f$var$described_field = $7d0608def849b52f$var$module.exports = {}; // Export module for npm...\n$7d0608def849b52f$var$described_field.internalCreateIfNotExists = $7d0608def849b52f$var$describedFieldInternalCreateIfNotExists;\n/**\n * Describes a field of the restructured data.\n * Dynamically added properties represent custom named groups containing DescribedDataField-Arrays.\n *\n * @typedef {Object} module:described_field.DescribedDataField\n * @property {string} [category=\"\"] - name of the category. Could contain a short domain name like \"product\" or \"vendor\".\n * @property {string} [type=\"\"] - type of the data element. Examples: \"summary\" for e.g. a list overview. \"detail\" e.g. when a summary is selected. \"filter\" e.g. for field/value pair results that can be selected as data filters.\n * @property {string} [abbreviation=\"\"] - one optional character, a symbol character or a short abbreviation of the category\n * @property {string} [image=\"\"] - one optional path to an image resource\n * @property {string} index - array of numbers containing the splitted index. Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4]\n * @property {string[]} groupNames - array of names of all dynamically added properties representing groups\n * @property {string} displayName - display name of the field\n * @property {string} fieldName - field name\n * @property {{*}} value - content of the field\n * @property {module:described_field.DescribedDataField[]} [couldBeAnyCustomGroupName] any number of groups attached to the field each containing multiple fields\n */ $7d0608def849b52f$var$described_field.DescribedDataFieldBuilder = function() {\n /**\n * Builds a {@link module:described_field.DescribedDataField}.\n * DescribedDataField is the main element of the restructured data and therefore considered \"public\".\n * @constructs DescribedDataFieldBuilder\n * @alias module:described_field.DescribedDataFieldBuilder\n */ function DescribedDataFieldBuilder() {\n /**\n * @type {module:described_field.DescribedDataField}\n */ this.describedField = {\n category: \"\",\n type: \"\",\n abbreviation: \"\",\n image: \"\",\n index: [],\n groupNames: [],\n displayName: \"\",\n fieldName: \"\",\n value: \"\"\n };\n /**\n * Takes over all values of the template {@link module:described_field.DescribedDataField}.\n * @function\n * @param {module:described_field.DescribedDataField} template\n * @returns {DescribedDataFieldBuilder}\n * @example fromDescribedDataField(sourceField)\n */ this.fromDescribedDataField = function(template) {\n this.category(template.category);\n this.type(template.type);\n this.abbreviation(template.abbreviation);\n this.image(template.image);\n this.index(template.index);\n this.groupNames(template.groupNames);\n this.displayName(template.displayName);\n this.fieldName(template.fieldName);\n this.value(template.value);\n return this;\n };\n /**\n * Sets the category.\n *\n * Contains a short domain nam, for example:\n * - \"product\" for products\n * - \"vendor\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example category(\"Product\")\n */ this.category = function(value) {\n this.describedField.category = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the type.\n *\n * Contains the type of the entry, for example:\n * - \"summary\" for e.g. a list overview.\n * - \"detail\" e.g. when a summary is selected.\n * - \"filter\" e.g. for field/value pair results that can be selected as search parameters.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example type(\"summary\")\n */ this.type = function(value) {\n this.describedField.type = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional abbreviation.\n *\n * Contains a symbol character or a very short abbreviation of the category.\n * - \"P\" for products\n * - \"V\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example abbreviation(\"P\")\n */ this.abbreviation = function(value) {\n this.describedField.abbreviation = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional path to an image resource.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example image(\"img/product.png\")\n */ this.image = function(value) {\n this.describedField.image = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the index as an array of numbers containing the splitted array indexes of the source field.\n * Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4].\n *\n * @function\n * @param {number[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example index([2,4])\n */ this.index = function(value) {\n this.describedField.index = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the group names as an array of strings containing the names of the dynamically added properties,\n * that contain an array of {@link module:described_field.DescribedDataField}-Objects.\n *\n * @function\n * @param {string[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example groupNames([\"summaries\",\"details\",\"options\"])\n */ this.groupNames = function(value) {\n this.describedField.groupNames = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the display name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example displayName(\"Color\")\n */ this.displayName = function(value) {\n this.describedField.displayName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the (technical) field name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example fieldName(\"color\")\n */ this.fieldName = function(value) {\n this.describedField.fieldName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the value/content of the field.\n *\n * @function\n * @param {*} value\n * @returns {DescribedDataFieldBuilder}\n * @example value(\"darkblue\")\n */ this.value = function(value) {\n this.describedField.value = value;\n return this;\n };\n /**\n * Finalizes the settings and builds the {@link module:described_field.DescribedDataField}.\n * @function\n * @returns {module:described_field.DescribedDataField}\n */ this.build = function() {\n return this.describedField;\n };\n }\n function isSpecifiedString(value) {\n return typeof value === \"string\" && value !== null && value !== \"\";\n }\n function withDefaultString(value, defaultValue) {\n return isSpecifiedString(value) ? value : defaultValue;\n }\n function withDefaultArray(value, defaultValue) {\n return value === undefined || value === null ? defaultValue : value;\n }\n return DescribedDataFieldBuilder;\n}();\n/**\n * Creates a new described data field with all properties of the original one except for dynamically added groups.\n * @param {module:described_field.DescribedDataField} describedDataField\n * @returns {module:described_field.DescribedDataField}\n * @memberof module:described_field\n */ $7d0608def849b52f$var$described_field.copyWithoutGroups = function(describedDataField) {\n return new $7d0608def849b52f$var$described_field.DescribedDataFieldBuilder().fromDescribedDataField(describedDataField).groupNames([]).build();\n};\n$7d0608def849b52f$var$described_field.DescribedDataFieldGroup = function() {\n /**\n * Adds groups to {@link module:described_field.DescribedDataField}s. These groups are dynamically added properties\n * that contain an array of sub fields of the same type {@link module:described_field.DescribedDataField}s.\n *\n * @param {module:described_field.DescribedDataField} dataField\n * @constructs DescribedDataFieldGroup\n * @alias module:described_field.DescribedDataFieldGroup\n * @example new described_field.DescribedDataFieldGroup(field).addGroupEntry(\"details\", detailField);\n */ function DescribedDataFieldGroup(dataField) {\n this.dataField = dataField;\n /**\n * Adds an entry to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entry will be added\n * @param {module:described_field.DescribedDataField} describedField sub field that is added to the group\n * @returns {DescribedDataFieldGroup}\n */ this.addGroupEntry = function(groupName, describedField) {\n this.addGroupEntries(groupName, [\n describedField\n ]);\n return this;\n };\n /**\n * Adds entries to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entries will be added\n * @param {module:described_field.DescribedDataField[]} describedFields sub fields that are added to the group\n * @returns {DescribedDataFieldGroup}\n */ this.addGroupEntries = function(groupName, describedFields) {\n if (!groupName || groupName.length === 0) return this;\n if (!describedFields || describedFields.length === 0) return this;\n if (this.dataField[groupName] === undefined) {\n this.dataField.groupNames.push(groupName);\n this.dataField[groupName] = [];\n }\n var index;\n var describedField;\n for(index = 0; index < describedFields.length; index += 1){\n describedField = describedFields[index];\n this.dataField[groupName].push(describedField);\n }\n return this;\n };\n }\n return DescribedDataFieldGroup;\n}();\n\n});\n\n\nparcelRequire(\"aJuQy\");\n\n//# sourceMappingURL=describedfield.js.map\n","/**\n * @file Describes a data field of the restructured data.\n * @version {@link https://github.com/JohT/data-restructor-js/releases/latest latest version}\n * @author JohT\n * @version ${project.version}\n */\n\"use strict\";\nvar module = describedFieldInternalCreateIfNotExists(module); // Fallback for vanilla js without modules\n\nfunction describedFieldInternalCreateIfNotExists(objectToCheck) {\n return objectToCheck || {};\n}\n\n/**\n * Describes a data field of the restructured data.\n * @module described_field\n */\nvar described_field = (module.exports = {}); // Export module for npm...\ndescribed_field.internalCreateIfNotExists = describedFieldInternalCreateIfNotExists;\n\n/**\n * Describes a field of the restructured data.\n * Dynamically added properties represent custom named groups containing DescribedDataField-Arrays.\n *\n * @typedef {Object} module:described_field.DescribedDataField\n * @property {string} [category=\"\"] - name of the category. Could contain a short domain name like \"product\" or \"vendor\".\n * @property {string} [type=\"\"] - type of the data element. Examples: \"summary\" for e.g. a list overview. \"detail\" e.g. when a summary is selected. \"filter\" e.g. for field/value pair results that can be selected as data filters.\n * @property {string} [abbreviation=\"\"] - one optional character, a symbol character or a short abbreviation of the category\n * @property {string} [image=\"\"] - one optional path to an image resource\n * @property {string} index - array of numbers containing the splitted index. Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4]\n * @property {string[]} groupNames - array of names of all dynamically added properties representing groups\n * @property {string} displayName - display name of the field\n * @property {string} fieldName - field name\n * @property {{*}} value - content of the field\n * @property {module:described_field.DescribedDataField[]} [couldBeAnyCustomGroupName] any number of groups attached to the field each containing multiple fields\n */\n\ndescribed_field.DescribedDataFieldBuilder = (function () {\n /**\n * Builds a {@link module:described_field.DescribedDataField}.\n * DescribedDataField is the main element of the restructured data and therefore considered \"public\".\n * @constructs DescribedDataFieldBuilder\n * @alias module:described_field.DescribedDataFieldBuilder\n */\n function DescribedDataFieldBuilder() {\n /**\n * @type {module:described_field.DescribedDataField}\n */\n this.describedField = {\n category: \"\",\n type: \"\",\n abbreviation: \"\",\n image: \"\",\n index: [],\n groupNames: [],\n displayName: \"\",\n fieldName: \"\",\n value: \"\"\n };\n /**\n * Takes over all values of the template {@link module:described_field.DescribedDataField}.\n * @function\n * @param {module:described_field.DescribedDataField} template\n * @returns {DescribedDataFieldBuilder}\n * @example fromDescribedDataField(sourceField)\n */\n this.fromDescribedDataField = function (template) {\n this.category(template.category);\n this.type(template.type);\n this.abbreviation(template.abbreviation);\n this.image(template.image);\n this.index(template.index);\n this.groupNames(template.groupNames);\n this.displayName(template.displayName);\n this.fieldName(template.fieldName);\n this.value(template.value);\n return this;\n };\n /**\n * Sets the category.\n *\n * Contains a short domain nam, for example:\n * - \"product\" for products\n * - \"vendor\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example category(\"Product\")\n */\n this.category = function (value) {\n this.describedField.category = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the type.\n *\n * Contains the type of the entry, for example:\n * - \"summary\" for e.g. a list overview.\n * - \"detail\" e.g. when a summary is selected.\n * - \"filter\" e.g. for field/value pair results that can be selected as search parameters.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example type(\"summary\")\n */\n this.type = function (value) {\n this.describedField.type = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional abbreviation.\n *\n * Contains a symbol character or a very short abbreviation of the category.\n * - \"P\" for products\n * - \"V\" for vendors\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example abbreviation(\"P\")\n */\n this.abbreviation = function (value) {\n this.describedField.abbreviation = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the optional path to an image resource.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example image(\"img/product.png\")\n */\n this.image = function (value) {\n this.describedField.image = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the index as an array of numbers containing the splitted array indexes of the source field.\n * Example: \"responses[2].hits.hits[4]._source.name\" will have an index of [2,4].\n *\n * @function\n * @param {number[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example index([2,4])\n */\n this.index = function (value) {\n this.describedField.index = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the group names as an array of strings containing the names of the dynamically added properties,\n * that contain an array of {@link module:described_field.DescribedDataField}-Objects.\n *\n * @function\n * @param {string[]} [value=[]]\n * @returns {DescribedDataFieldBuilder}\n * @example groupNames([\"summaries\",\"details\",\"options\"])\n */\n this.groupNames = function (value) {\n this.describedField.groupNames = withDefaultArray(value, []);\n return this;\n };\n /**\n * Sets the display name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example displayName(\"Color\")\n */\n this.displayName = function (value) {\n this.describedField.displayName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the (technical) field name.\n *\n * @function\n * @param {String} [value=\"\"]\n * @returns {DescribedDataFieldBuilder}\n * @example fieldName(\"color\")\n */\n this.fieldName = function (value) {\n this.describedField.fieldName = withDefaultString(value, \"\");\n return this;\n };\n /**\n * Sets the value/content of the field.\n *\n * @function\n * @param {*} value\n * @returns {DescribedDataFieldBuilder}\n * @example value(\"darkblue\")\n */\n this.value = function (value) {\n this.describedField.value = value;\n return this;\n };\n\n /**\n * Finalizes the settings and builds the {@link module:described_field.DescribedDataField}.\n * @function\n * @returns {module:described_field.DescribedDataField}\n */\n this.build = function () {\n return this.describedField;\n };\n }\n\n function isSpecifiedString(value) {\n return typeof value === \"string\" && value !== null && value !== \"\";\n }\n\n function withDefaultString(value, defaultValue) {\n return isSpecifiedString(value) ? value : defaultValue;\n }\n\n function withDefaultArray(value, defaultValue) {\n return value === undefined || value === null ? defaultValue : value;\n }\n\n return DescribedDataFieldBuilder;\n}());\n\n/**\n * Creates a new described data field with all properties of the original one except for dynamically added groups.\n * @param {module:described_field.DescribedDataField} describedDataField\n * @returns {module:described_field.DescribedDataField}\n * @memberof module:described_field\n */\ndescribed_field.copyWithoutGroups = function (describedDataField) {\n return new described_field.DescribedDataFieldBuilder().fromDescribedDataField(describedDataField).groupNames([]).build();\n};\n\ndescribed_field.DescribedDataFieldGroup = (function () {\n /**\n * Adds groups to {@link module:described_field.DescribedDataField}s. These groups are dynamically added properties\n * that contain an array of sub fields of the same type {@link module:described_field.DescribedDataField}s.\n *\n * @param {module:described_field.DescribedDataField} dataField\n * @constructs DescribedDataFieldGroup\n * @alias module:described_field.DescribedDataFieldGroup\n * @example new described_field.DescribedDataFieldGroup(field).addGroupEntry(\"details\", detailField);\n */\n function DescribedDataFieldGroup(dataField) {\n this.dataField = dataField;\n\n /**\n * Adds an entry to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entry will be added\n * @param {module:described_field.DescribedDataField} describedField sub field that is added to the group\n * @returns {DescribedDataFieldGroup}\n */\n this.addGroupEntry = function (groupName, describedField) {\n this.addGroupEntries(groupName, [describedField]);\n return this;\n };\n\n /**\n * Adds entries to the given group. If the group does not exist, it will be created.\n * @function\n * @param {String} groupName name of the group to which the entries will be added\n * @param {module:described_field.DescribedDataField[]} describedFields sub fields that are added to the group\n * @returns {DescribedDataFieldGroup}\n */\n this.addGroupEntries = function (groupName, describedFields) {\n if (!groupName || groupName.length === 0) {\n return this;\n }\n if (!describedFields || describedFields.length === 0) {\n return this;\n }\n if (this.dataField[groupName] === undefined) {\n this.dataField.groupNames.push(groupName);\n this.dataField[groupName] = [];\n }\n var index;\n var describedField;\n for (index = 0; index < describedFields.length; index += 1) {\n describedField = describedFields[index];\n this.dataField[groupName].push(describedField);\n }\n return this;\n };\n }\n\n return DescribedDataFieldGroup;\n}());\n"],"names":["$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","parcelRegister","$7d0608def849b52f$var$module","$7d0608def849b52f$var$describedFieldInternalCreateIfNotExists","objectToCheck","$7d0608def849b52f$var$described_field","internalCreateIfNotExists","DescribedDataFieldBuilder","withDefaultString","value","defaultValue","isSpecifiedString","describedField","category","type","abbreviation","image","index","groupNames","displayName","fieldName","fromDescribedDataField","template","build","copyWithoutGroups","describedDataField","DescribedDataFieldGroup","dataField","addGroupEntry","groupName","addGroupEntries","describedFields","length","undefined","push"],"version":3,"file":"describedfield.js.map","sourceRoot":"../"}