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AAgB2R,CAAEyF,CAAAA,OAAF,CAAUS,CAAV,CAA2BlG,CAAEyE,CAAAA,KAAF,CAAQ,CACxD1U,OAAQA,CADgD,CAExD0B,OAAQA,CAFgD,CAGxDW,IAAKV,CAHmD,CAAR,CAI/C,CAAA,CAJ+C,CAA3B,CAIbO,CAAAA,IAJa,CAIRgT,CAJQ,CAAhB,CAF4C,CAwB9C,CA9IO,CAuJT,CA1JiE,CAA1E,C,CCIAtY,MAAA,CAAO,0BAAP,CAAmC,QAAS,EAAG,EAA/C;", "sources":["Logic.js","displayerXObjectPropertyHelper.js","editBus.js","jsonMerge.js","liveDataSource.js","polyfills.js"], "sourcesContent":["/*\n * See the NOTICE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\n\ndefine('xwiki-livedata', [\n \"vue\",\n \"vue-i18n\",\n \"xwiki-livedata-vue\",\n \"xwiki-livedata-source\",\n \"xwiki-json-merge\",\n \"edit-bus\",\n \"xwiki-livedata-polyfills\"\n], function(\n Vue,\n VueI18n,\n xwikiLivedataVue,\n liveDataSourceModule,\n jsonMerge,\n editBus\n) {\n const XWikiLivedata = xwikiLivedataVue.XWikiLivedata;\n /**\n * Make vue use the i18n plugin\n */\n Vue.use(VueI18n);\n\n\n /**\n * Map the element to its data object\n * So that each instance of the livedata on the page handle there own data\n */\n const instancesMap = new WeakMap();\n\n\n\n /**\n * The init function of the logic script\n * For each livedata element on the page, returns its corresponding data / API\n * If the data does not exist yet, create it from the element\n * @param {HTMLElement} element The HTML Element corresponding to the Livedata component\n */\n const init = function (element) {\n\n if (!instancesMap.has(element)) {\n // create a new logic object associated to the element\n const logic = new Logic(element);\n instancesMap.set(element, logic);\n }\n\n return instancesMap.get(element);\n };\n\n /**\n * A service providing footnotes related operations. \n */\n class FootnotesService {\n constructor() {\n this._footnotes = [];\n }\n\n /**\n * Register a new footnote. If a footnote with the same translationKey is already registered this method has no\n * effect on the list of registered footnotes.\n * @param symbol the symbol to identify the entries related to the footnote \n * @param translationKey the translation key of the footnote text \n */\n put(symbol, translationKey) {\n if (!this._footnotes.some(footnote => footnote.translationKey === translationKey)) {\n this._footnotes.push({symbol, translationKey});\n }\n }\n \n reset() {\n this._footnotes.splice(0);\n }\n \n list() {\n return this._footnotes;\n }\n }\n\n // Initializes a promise to be resolved once the translations loading is done.\n var translationsLoadedResolve;\n const translationsLoaded = new Promise((resolve) => {\n translationsLoadedResolve = resolve;\n });\n\n /**\n * Class for a logic element\n * Contains the Livedata data object and methods to mutate it\n * Can be used in the layouts to display the data, and call its API\n * @param {HTMLElement} element The HTML Element corresponding to the Livedata\n */\n const Logic = function (element) {\n // Make sure to have one Live Data source instance per Live Data instance. \n this.liveDataSource = liveDataSourceModule.init();\n this.element = element;\n this.data = JSON.parse(element.getAttribute(\"data-config\") || \"{}\");\n this.contentTrusted = element.getAttribute(\"data-config-content-trusted\") === \"true\"; \n this.data.entries = Object.freeze(this.data.entries);\n\n // Reactive properties must be initialized before Vue is instantiated.\n this.firstEntriesLoading = true;\n this.currentLayoutId = \"\";\n this.changeLayout(this.data.meta.defaultLayout);\n this.entrySelection = {\n selected: [],\n deselected: [],\n isGlobal: false,\n };\n this.openedPanels = [];\n this.footnotes = new FootnotesService();\n this.panels = [];\n\n element.removeAttribute(\"data-config\");\n\n const locale = document.documentElement.getAttribute('lang');\n\n const i18n = new VueI18n({\n locale: locale,\n messages: {},\n silentFallbackWarn: true,\n });\n\n // Vue.js replaces the container - prevent this by creating a placeholder for Vue.js to replace.\n const placeholderElement = document.createElement('div');\n this.element.appendChild(placeholderElement);\n\n // create Vuejs instance\n const vue = new Vue({\n el: placeholderElement,\n components: {\n \"XWikiLivedata\": XWikiLivedata,\n },\n template: \"\",\n i18n: i18n,\n data: {\n logic: this\n },\n mounted()\n {\n element.classList.remove('loading');\n // Trigger the \"instanceCreated\" event on the next tick to ensure that the constructor has returned and thus\n // all references to the logic instance have been initialized.\n this.$nextTick(function () {\n this.logic.triggerEvent('instanceCreated', {});\n });\n }\n });\n\n // Fetch the data if we don't have any. This call must be made just after the main Vue component is initialized as \n // LivedataPersistentConfiguration must be mounted for the persisted filters to be loaded and applied when fetching \n // the entries.\n // We use a dedicated field (firstEntriesLoading) for the first load as the fetch start/end events can be triggered \n // before the loader components is loaded (and in this case the loader is never hidden even once the entries are\n // displayed).\n if (!this.data.data.entries.length) {\n this.updateEntries()\n // Mark the loader as finished, even if it fails as the loader should stop and a message be displayed to the \n // user in this case.\n .finally(() => this.firstEntriesLoading = false);\n } else {\n this.firstEntriesLoading = false;\n }\n\n this.setEditBus(editBus.init(this));\n\n /**\n * Load given translations from the server\n *\n * @param {object} parameters\n * @param {string} componentName The name component who needs the translations\n * Used to avoid loading the same translations several times\n * @param {string} prefix The translation keys prefix\n * @param {string[]} keys\n */\n this.loadTranslations = async function ({ componentName, prefix, keys }) {\n // If translations were already loaded, return.\n if (this.loadTranslations[componentName]) return;\n this.loadTranslations[componentName] = true;\n // Fetch translation and load them.\n try {\n const translations = await this.liveDataSource.getTranslations(locale, prefix, keys);\n i18n.mergeLocaleMessage(locale, translations)\n } catch (error) {\n console.error(error);\n }\n }\n\n // Load needed translations for the Livedata\n const translationsPromise = this.loadTranslations({\n prefix: \"livedata.\",\n keys: [\n \"dropdownMenu.title\",\n \"dropdownMenu.actions\",\n \"dropdownMenu.layouts\",\n \"dropdownMenu.panels\",\n \"dropdownMenu.panels.properties\",\n \"dropdownMenu.panels.sort\",\n \"dropdownMenu.panels.filter\",\n \"selection.selectInAllPages\",\n \"selection.infoBar.selectedCount\",\n \"selection.infoBar.allSelected\",\n \"selection.infoBar.allSelectedBut\",\n \"pagination.label\",\n \"pagination.label.empty\",\n \"pagination.currentEntries\",\n \"pagination.pageSize\",\n \"pagination.selectPageSize\",\n \"pagination.page\",\n \"pagination.first\",\n \"pagination.previous\",\n \"pagination.next\",\n \"pagination.last\",\n \"action.refresh\",\n \"action.addEntry\",\n \"action.columnName.sortable.hint\",\n \"action.columnName.default.hint\",\n \"action.resizeColumn.hint\",\n \"panel.filter.title\",\n \"panel.filter.noneFilterable\",\n \"panel.filter.addConstraint\",\n \"panel.filter.addProperty\",\n \"panel.filter.delete\",\n \"panel.filter.deleteAll\",\n \"panel.properties.title\",\n \"panel.sort.title\",\n \"panel.sort.noneSortable\",\n \"panel.sort.direction.ascending\",\n \"panel.sort.direction.descending\",\n \"panel.sort.add\",\n \"panel.sort.delete\",\n \"displayer.emptyValue\",\n \"displayer.link.noValue\",\n \"displayer.boolean.true\",\n \"displayer.boolean.false\",\n \"displayer.xObjectProperty.missingDocumentName.errorMessage\",\n \"displayer.xObjectProperty.failedToRetrieveField.errorMessage\",\n \"displayer.actions.edit\",\n \"displayer.actions.followLink\",\n \"filter.boolean.label\",\n \"filter.date.label\",\n \"filter.list.label\",\n \"filter.list.emptyLabel\",\n \"filter.number.label\",\n \"filter.text.label\",\n \"footnotes.computedTitle\",\n \"footnotes.propertyNotViewable\",\n \"bottombar.noEntries\",\n \"error.updateEntriesFailed\"\n ],\n }).then(() => {\n translationsLoadedResolve(true);\n });\n\n // Return a translation only once the translations have been loaded from the server.\n this.translate = async (key, ...args) => {\n // Make sure that the translations are loaded from the server before translating.\n await translationsPromise;\n return vue.$t(key, args);\n }\n \n // Waits for the translations to be loaded before continuing.\n this.translationsLoaded = async() => {\n await translationsPromise;\n }\n\n // Registers panels once the translations have been loadded as they are otherwise hard to update.\n this.translationsLoaded().finally(() => {\n this.registerPanel({\n id: 'propertiesPanel',\n title: vue.$t('livedata.panel.properties.title'),\n name: vue.$t('livedata.dropdownMenu.panels.properties'),\n icon: 'list-bullets',\n component: 'LivedataAdvancedPanelProperties',\n order: 1000\n });\n this.registerPanel({\n id: 'sortPanel',\n title: vue.$t('livedata.panel.sort.title'),\n name: vue.$t('livedata.dropdownMenu.panels.sort'),\n icon: 'table_sort',\n component: 'LivedataAdvancedPanelSort',\n order: 2000\n });\n this.registerPanel({\n id: 'filterPanel',\n title: vue.$t('livedata.panel.filter.title'),\n name: vue.$t('livedata.dropdownMenu.panels.filter'),\n icon: 'filter',\n component: 'LivedataAdvancedPanelFilter',\n order: 3000\n });\n });\n };\n\n\n\n\n /**\n * THE LOGIC API\n */\n Logic.prototype = {\n\n\n /**\n * ---------------------------------------------------------------\n * EVENTS\n */\n\n\n /**\n * Send custom events\n * @param {String} eventName The name of the event, without the prefix \"xwiki:livedata\"\n * @param {Object} eventData The data associated with the event.\n * The livedata object reference is automatically added\n */\n triggerEvent (eventName, eventData) {\n // configure event\n const defaultData = {\n livedata: this,\n };\n eventName = \"xwiki:livedata:\" + eventName;\n eventData = {\n bubbles: true,\n detail: Object.assign(defaultData, eventData),\n };\n const event = new CustomEvent(eventName, eventData);\n // dispatch event\n this.element.dispatchEvent(event);\n },\n\n /**\n * Listen for custom events\n * @param {String} eventName The name of the event, without the prefix \"xwiki:livedata\"\n * @param {Function} callback Function to call we the event is triggered: e => { ... }\n */\n onEvent (eventName, callback) {\n eventName = \"xwiki:livedata:\" + eventName;\n this.element.addEventListener(eventName, function (e) {\n callback(e);\n });\n },\n\n\n /**\n * Listen for custom events, mathching certain conditions\n * @param {String} eventName The name of the event, without the prefix \"xwiki:livedata\"\n * @param {Object|Function} condition The condition to execute the callback\n * if Object, values of object properties must match e.detail properties values\n * if Function, the function must return true. e.detail is passed as argument\n * @param {Function} callback Function to call we the event is triggered: e => { ... }\n */\n onEventWhere (eventName, condition, callback) {\n eventName = \"xwiki:livedata:\" + eventName;\n this.element.addEventListener(eventName, function (e) {\n // Object check\n if (typeof condition === \"object\") {\n const isDetailMatching = (data, detail) => Object.keys(data).every(key => {\n return typeof data[key] === \"object\"\n ? isDetailMatching(data[key], detail?.[key])\n : Object.is(data[key], detail?.[key]);\n });\n if (!isDetailMatching(condition, e.detail)) { return; }\n }\n // Function check\n if (typeof condition === \"function\") {\n if (!condition(e.detail)) { return; }\n }\n // call callback\n callback(e);\n });\n },\n\n\n\n\n /**\n * ---------------------------------------------------------------\n * UTILS\n */\n\n\n /**\n * Return the list of layout ids\n * @returns {Array}\n */\n getLayoutIds () {\n return this.data.meta.layouts.map(layoutDescriptor => layoutDescriptor.id);\n },\n\n\n /**\n * Return the id of the given entry\n * @param {Object} entry\n * @returns {String}\n */\n getEntryId (entry) {\n const idProperty = this.data.meta.entryDescriptor.idProperty || \"id\";\n if (entry[idProperty] === undefined) {\n console.warn(\"Entry has no id (at property [\" + idProperty + \"]\", entry);\n return;\n }\n return entry[idProperty];\n },\n\n /*\n As Sets are not reactive in Vue 2.x, if we want to create\n a reactive collection of unique objects, we have to use arrays.\n So here are some handy functions to do what Sets do, but with arrays\n */\n\n /**\n * Return whether the array has the given item\n * @param {Array} uniqueArray An array of unique items\n * @param {Any} item\n */\n uniqueArrayHas (uniqueArray, item) {\n return uniqueArray.includes(item);\n },\n\n\n /**\n * Add the given item if not present in the array, or does nothing\n * @param {Array} uniqueArray An array of unique items\n * @param {Any} item\n */\n uniqueArrayAdd (uniqueArray, item) {\n if (this.uniqueArrayHas(uniqueArray, item)) { return; }\n uniqueArray.push(item);\n },\n\n\n /**\n * Remove the given item from the array if present, or does nothing\n * @param {Array} uniqueArray An array of unique items\n * @param {Any} item\n */\n uniqueArrayRemove (uniqueArray, item) {\n const index = uniqueArray.indexOf(item);\n if (index === -1) { return; }\n uniqueArray.splice(index, 1);\n },\n\n\n /**\n * Toggle the given item from the array, ensuring its uniqueness\n * @param {Array} uniqueArray An array of unique items\n * @param {Any} item\n * @param {Boolean} force Optional: true force add / false force remove\n */\n uniqueArrayToggle (uniqueArray, item, force) {\n if (force === undefined) {\n force = !this.uniqueArrayHas(uniqueArray, item);\n }\n if (force) {\n this.uniqueArrayAdd(uniqueArray, item);\n } else {\n this.uniqueArrayRemove(uniqueArray, item);\n }\n },\n\n\n\n\n /**\n * ---------------------------------------------------------------\n * DESCRIPTORS\n */\n\n\n /**\n * Returns the property descriptors of displayable properties\n * @returns {Array}\n */\n getPropertyDescriptors () {\n return this.data.query.properties.map(propertyId => this.getPropertyDescriptor(propertyId));\n },\n\n\n /**\n * Return the property descriptor corresponding to a property id\n * @param {String} propertyId\n * @returns {Object}\n */\n getPropertyDescriptor (propertyId) {\n const propertyDescriptor = this.data.meta.propertyDescriptors\n .find(propertyDescriptor => propertyDescriptor.id === propertyId);\n if (!propertyDescriptor) {\n console.error(\"Property descriptor of property `\" + propertyId + \"` does not exist\");\n }\n return propertyDescriptor;\n },\n\n\n /**\n * Return the property type descriptor corresponding to a property id\n * @param {String} propertyId\n * @returns {Object}\n */\n getPropertyTypeDescriptor (propertyId) {\n const propertyDescriptor = this.getPropertyDescriptor(propertyId);\n if (!propertyDescriptor) { return; }\n return this.data.meta.propertyTypes\n .find(typeDescriptor => typeDescriptor.id === propertyDescriptor.type);\n },\n\n\n /**\n * Return the layout descriptor corresponding to a layout id\n * @param {String} propertyId\n * @returns {Object}\n */\n getLayoutDescriptor (layoutId) {\n return this.data.meta.layouts\n .find(layoutDescriptor => layoutDescriptor.id === layoutId);\n },\n\n\n /**\n * Get the displayer descriptor associated to a property id\n * @param {String} propertyId\n * @returns {Object}\n */\n getDisplayerDescriptor (propertyId) {\n // Property descriptor config\n const propertyDescriptor = this.getPropertyDescriptor(propertyId);\n // Property type descriptor config\n const typeDescriptor = this.getPropertyTypeDescriptor(propertyId);\n // Merge the property and type displayer descriptors.\n const customDisplayerDescriptor = jsonMerge({}, typeDescriptor?.displayer, propertyDescriptor?.displayer);\n // Get the default displayer descriptor.\n const displayerId = customDisplayerDescriptor.id || this.data.meta.defaultDisplayer;\n const defaultDisplayerDescriptor = this.data.meta.displayers.find(displayer => displayer.id === displayerId);\n // Merge displayer descriptors.\n return jsonMerge({}, defaultDisplayerDescriptor, customDisplayerDescriptor);\n },\n\n\n /**\n * Get the filter descriptor associated to a property id\n * @param {String} propertyId\n * @returns {Object}\n */\n getFilterDescriptor(propertyId) {\n // Property descriptor config\n const propertyDescriptor = this.getPropertyDescriptor(propertyId);\n // Property type descriptor config\n const typeDescriptor = this.getPropertyTypeDescriptor(propertyId);\n // Merge the property and type filter descriptors.\n const customFilterDescriptor = jsonMerge({}, typeDescriptor?.filter, propertyDescriptor?.filter);\n // Get the default filter descriptor.\n const filterId = customFilterDescriptor.id || this.data.meta.defaultFilter;\n const defaultFilterDescriptor = this.data.meta.filters.find(filter => filter.id === filterId);\n // Merge filter descriptors.\n return jsonMerge({}, defaultFilterDescriptor, customFilterDescriptor);\n },\n\n\n\n\n /**\n * ---------------------------------------------------------------\n * LAYOUT\n */\n\n\n /**\n * Fetch the entries of the current page according to the query configuration.\n * @returns the fetched entries\n */\n fetchEntries() {\n // Before fetch event\n this.triggerEvent(\"beforeEntryFetch\");\n // Fetch entries from data source\n return this.liveDataSource.getEntries(this.data.query)\n .then(data => {\n // After fetch event\n return data\n })\n .finally(() => this.triggerEvent(\"afterEntryFetch\"));\n },\n\n\n updateEntries () {\n return this.fetchEntries()\n .then(data => {\n this.data.data = Object.freeze(data);\n Vue.nextTick(() => this.triggerEvent('entriesUpdated', {}));\n // Remove the outdated footnotes, they will be recomputed by the new entries.\n this.footnotes.reset()\n })\n .catch(err => {\n // Prevent undesired notifications of the end user for non business related errors (for instance, the user\n // left the page before the request was completed).\n // See https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState\n if (err.readyState === 4) {\n this.translate('livedata.error.updateEntriesFailed')\n .then(value => new XWiki.widgets.Notification(value, 'error'));\n }\n \n // Do not log if the request has been aborted (e.g., because a second request was started for the same LD with\n // new criteria).\n if(err.statusText !== 'abort') {\n console.error('Failed to fetch the entries', err);\n }\n });\n },\n\n\n /**\n * Return whether the Livedata is editable or not\n * if entry given, return whether it is editable\n * if property given, return whether it is editable (for any entries)\n * If entry and property given, return whether specific value is editable\n * @param {Object} [parameters]\n * @param {Object} [parameters.entry] The entry object\n * @param {Number} [parameters.propertyId] The property id of the entry\n */\n isEditable ({ entry, propertyId } = {}) {\n // TODO: Ensure entry is valid (need other current PR)\n // TODO: Ensure property is valid (need other current PR)\n\n // Check if the edit entry action is available.\n if (!this.data.meta.actions.find(action => action.id === \"edit\")) {\n return false;\n }\n\n // Check if we are allowed to edit the given entry.\n if (entry && !this.isEntryEditable(entry)) {\n return false;\n }\n\n // Check if the specified property is editable.\n return !propertyId || this.isPropertyEditable(propertyId);\n },\n\n /**\n * Returns whether the given entry is editable or not.\n *\n * @param {Object} entry\n * @returns {Boolean}\n */\n isEntryEditable (entry) {\n return this.isActionAllowed('edit', entry);\n },\n\n /**\n * Returns whether a certain property is editable or not.\n *\n * @param {String} propertyId\n * @returns {Boolean}\n */\n isPropertyEditable (propertyId) {\n const propertyDescriptor = this.getPropertyDescriptor(propertyId);\n const propertyTypeDescriptor = this.getPropertyTypeDescriptor(propertyId);\n return propertyDescriptor && (propertyDescriptor.editable !== undefined ? propertyDescriptor.editable :\n (propertyTypeDescriptor && propertyTypeDescriptor.editable));\n },\n\n /**\n * Set the value of the given entry property\n * @param {Object} parameters\n * @param {Object} parameters.entry The entry we want to modify\n * @param {number} parameters.propertyId The property id we want to modify in the entry\n * @param {string} parameters.value The new value of entry property\n */\n setValue({entry, propertyId, value}) {\n // TODO: Ensure entry is valid (need other current PR)\n // TODO: Ensure property is valid (need other current PR)\n if (!this.isEditable({entry, propertyId})) {\n return;\n }\n entry[propertyId] = value;\n const source = this.data.query.source;\n const entryId = this.getEntryId(entry);\n // Once the entry updated, reload the whole livedata because changing a single entry can have an impact on other \n // properties of the entry, but also possibly on other entriers, or in the way they are sorted.\n this.liveDataSource.updateEntryProperty(source, entryId, propertyId, entry[propertyId])\n .then(() => this.updateEntries());\n },\n\n /**\n * Update the entry with the values object passed in parameter and s\n * @param {Object} entry the current entry\n * @param {Object} values the entry's values to update\n */\n setValues({entryId, values}) {\n const source = this.data.query.source;\n return this.liveDataSource.updateEntry(source, entryId, values)\n .then(() => this.updateEntries());\n\n },\n\n\n /**\n * Return whether adding new entries is enabled.\n */\n canAddEntry () {\n // Check if the add entry action is available.\n return this.data.meta.actions.find(action => action.id === \"addEntry\");\n },\n\n addEntry () {\n if (!this.canAddEntry()) { return; }\n const mockNewUrl = () => this.getEntryId(this.data.data.entries.slice(-1)[0]) + \"0\";\n // TODO: CALL FUNCTION TO CREATE NEW DATA HERE\n Promise.resolve({ /* MOCK DATA */\n \"doc_url\": mockNewUrl(),\n \"doc_name\": undefined,\n \"doc_date\": \"1585311660000\",\n \"doc_title\": undefined,\n \"doc_author\": \"Author 1\",\n \"doc_creationDate\": \"1585311660000\",\n \"doc_creator\": \"Creator 1\",\n \"age\": undefined,\n \"tags\": undefined,\n \"country\": undefined,\n \"other\": undefined,\n })\n .then(newEntry => {\n this.data.data.entries.push(newEntry);\n this.data.data.count++; // TODO: remove when merging with backend\n });\n },\n\n\n\n\n /**\n * ---------------------------------------------------------------\n * LAYOUT\n */\n\n\n /**\n * Load a layout, or default layout if none specified\n * @param {String} layoutId The id of the layout to load with requireJS\n * @returns {Promise}\n */\n changeLayout (layoutId) {\n // bad layout\n if (!this.getLayoutDescriptor(layoutId)) {\n console.error(\"Layout of id `\" + layoutId + \"` does not have a descriptor\");\n return;\n }\n // set layout\n const previousLayoutId = this.currentLayoutId;\n this.currentLayoutId = layoutId;\n // dispatch events\n this.triggerEvent(\"layoutChange\", {\n layoutId: layoutId,\n previousLayoutId: previousLayoutId,\n });\n },\n\n\n\n\n /**\n * ---------------------------------------------------------------\n * PAGINATION\n */\n\n\n /**\n * Get total number of pages\n * @returns {Number}\n */\n getPageCount () {\n return Math.ceil(this.data.data.count / this.data.query.limit);\n },\n\n\n /**\n * Get the page corresponding to the specified entry (0-based index)\n * @param {Number} entryIndex The index of the entry. Uses current entry if undefined.\n * @returns {Number}\n */\n getPageIndex (entryIndex) {\n if (entryIndex === undefined) {\n entryIndex = this.data.query.offset;\n }\n return Math.floor(entryIndex / this.data.query.limit);\n },\n\n\n /**\n * Set page index (0-based index), then fetch new data\n * @param {Number} pageIndex\n * @returns {Promise}\n */\n setPageIndex (pageIndex) {\n return new Promise ((resolve, reject) => {\n if (pageIndex < 0 || pageIndex >= this.getPageCount()) { return void reject(); }\n const previousPageIndex = this.getPageIndex();\n this.data.query.offset = this.getFirstIndexOfPage(pageIndex);\n this.triggerEvent(\"pageChange\", {\n pageIndex: pageIndex,\n previousPageIndex: previousPageIndex,\n });\n this.updateEntries().then(resolve, reject);\n });\n },\n\n\n /**\n * Get the first entry index of the given page index\n * @param {Number} pageIndex The page index. Uses current page if undefined.\n * @returns {Number}\n */\n getFirstIndexOfPage (pageIndex) {\n if (pageIndex === undefined) {\n pageIndex = this.getPageIndex();\n }\n if (0 <= pageIndex && pageIndex < this.getPageCount()) {\n return pageIndex * this.data.query.limit;\n } else {\n return -1;\n }\n },\n\n\n /**\n * Get the last entry index of the given page index\n * @param {Number} pageIndex The page index. Uses current page if undefined.\n * @returns {Number}\n */\n getLastIndexOfPage (pageIndex) {\n if (pageIndex === undefined) {\n pageIndex = this.getPageIndex();\n }\n if (0 <= pageIndex && pageIndex < this.getPageCount()) {\n return Math.min(this.getFirstIndexOfPage(pageIndex) + this.data.query.limit, this.data.data.count) - 1;\n } else {\n return -1;\n }\n },\n\n\n /**\n * Set the pagination page size, then fetch new data\n * @param {Number} pageSize\n * @returns {Promise}\n */\n setPageSize (pageSize) {\n return new Promise ((resolve, reject) => {\n if (pageSize < 0) { return void reject(); }\n const previousPageSize = this.data.query.limit;\n if (pageSize === previousPageSize) { return void resolve(); }\n this.data.query.limit = pageSize;\n // Reset the offset whenever the page size changes.\n this.data.query.offset = 0;\n this.triggerEvent(\"pageSizeChange\", {\n pageSize: pageSize,\n previousPageSize: previousPageSize,\n });\n this.updateEntries().then(resolve, reject);\n });\n },\n\n\n\n\n /**\n * ---------------------------------------------------------------\n * DISPLAY\n */\n\n\n /**\n * Returns whether a certain property is visible\n * @param {String} propertyId\n * @returns {Boolean}\n */\n isPropertyVisible (propertyId) {\n const propertyDescriptor = this.getPropertyDescriptor(propertyId);\n return propertyDescriptor.visible;\n },\n\n\n /**\n * Set whether the given property should be visible\n * @param {String} propertyId\n * @param {Boolean} visible\n */\n setPropertyVisible (propertyId, visible) {\n const propertyDescriptor = this.getPropertyDescriptor(propertyId);\n propertyDescriptor.visible = visible;\n },\n\n\n /**\n * Move a property to a certain index in the property order list\n * @param {String|Number} from The id or index of the property to move\n * @param {Number} toIndex\n */\n reorderProperty (from, toIndex) {\n let fromIndex;\n if (typeof from === \"number\") {\n fromIndex = from;\n } else if (typeof from === \"string\") {\n fromIndex = this.data.query.properties.indexOf(from);\n } else {\n return;\n }\n if (fromIndex < 0 || toIndex < 0) { return; }\n this.data.query.properties.splice(toIndex, 0, this.data.query.properties.splice(fromIndex, 1)[0]);\n },\n\n\n\n\n /**\n * ---------------------------------------------------------------\n * SELECTION\n */\n\n\n /**\n * Return whether selecting entries is enabled. If an entry is given, return whether that entry can be selected.\n *\n * @param {Object} [parameters]\n * @param {Object} [parameters.entry]\n */\n isSelectionEnabled ({ entry } = {}) {\n // An entry is selectable if it has an id specified.\n return this.data.meta.selection.enabled && (!entry || this.getEntryId(entry));\n },\n\n\n /**\n * Return whether the entry is currently selected\n * @param {Object} entry\n * @returns {Boolean}\n */\n isEntrySelected (entry) {\n const entryId = this.getEntryId(entry);\n if (this.entrySelection.isGlobal) {\n return !this.uniqueArrayHas(this.entrySelection.deselected, entryId);\n } else {\n return this.uniqueArrayHas(this.entrySelection.selected, entryId);\n }\n },\n\n\n /**\n * Select the specified entries\n * @param {Object|Array} entries\n */\n selectEntries (entries) {\n if (!this.isSelectionEnabled()) { return; }\n const entryArray = (entries instanceof Array) ? entries : [entries];\n entryArray.forEach(entry => {\n if (!this.isSelectionEnabled({ entry })) { return; }\n const entryId = this.getEntryId(entry);\n if (this.entrySelection.isGlobal) {\n this.uniqueArrayRemove(this.entrySelection.deselected, entryId);\n }\n else {\n this.uniqueArrayAdd(this.entrySelection.selected, entryId);\n }\n this.triggerEvent(\"select\", {\n entry: entry,\n });\n });\n },\n\n\n /**\n * Deselect the specified entries\n * @param {Object|Array} entries\n */\n deselectEntries (entries) {\n if (!this.isSelectionEnabled()) { return; }\n const entryArray = (entries instanceof Array) ? entries : [entries];\n entryArray.forEach(entry => {\n if (!this.isSelectionEnabled({ entry })) { return; }\n const entryId = this.getEntryId(entry);\n if (this.entrySelection.isGlobal) {\n this.uniqueArrayAdd(this.entrySelection.deselected, entryId);\n }\n else {\n this.uniqueArrayRemove(this.entrySelection.selected, entryId);\n }\n this.triggerEvent(\"deselect\", {\n entry: entry,\n });\n });\n },\n\n\n /**\n * Toggle the selection of the specified entries\n * @param {Object|Array} entries\n * @param {Boolean} select Whether to select or not the entries. Undefined toggle current state\n */\n toggleSelectEntries (entries, select) {\n if (!this.isSelectionEnabled()) { return; }\n const entryArray = (entries instanceof Array) ? entries : [entries];\n entryArray.forEach(entry => {\n if (!this.isSelectionEnabled({ entry })) { return; }\n if (select === undefined) {\n select = !this.isEntrySelected(entry);\n }\n if (select) {\n this.selectEntries(entry);\n } else {\n this.deselectEntries(entry);\n }\n });\n },\n\n\n /**\n * Get number of selectable entries in page\n * @returns {Number}\n */\n selectableCountInPage () {\n if (!this.isSelectionEnabled()) { return 0; }\n return this.data.data.entries\n .filter(entry => this.isSelectionEnabled({ entry }))\n .length;\n },\n\n\n /**\n * Set the entry selection globally accross pages\n * @param {Boolean} global\n */\n setEntrySelectGlobal (global) {\n if (!this.isSelectionEnabled()) { return; }\n this.entrySelection.isGlobal = global;\n this.entrySelection.selected.splice(0);\n this.entrySelection.deselected.splice(0);\n this.triggerEvent(\"selectGlobal\", {\n state: global,\n });\n },\n\n\n\n /**\n * ---------------------------------------------------------------\n * ACTIONS\n */\n\n\n /**\n * @param {String|Object} specifies the action\n * @returns {Object} the descriptor of the specified live data action\n */\n getActionDescriptor(action) {\n const descriptor = typeof action === 'string' ? {id: action} : action;\n const baseDescriptor = this.data.meta.actions.find(baseDescriptor => baseDescriptor.id === descriptor.id);\n return jsonMerge({}, baseDescriptor, descriptor);\n },\n\n\n /**\n * @param {String|Object} specifies the action\n * @param {Object} the live data entry that is the target of the action\n * @returns {Boolean} whether the specified action is allowed to target the specified live data entry\n */\n isActionAllowed(action, entry) {\n const actionDescriptor = this.getActionDescriptor(action);\n return !actionDescriptor.allowProperty || entry[actionDescriptor.allowProperty];\n },\n\n\n /**\n * ---------------------------------------------------------------\n * SORT\n */\n\n\n /**\n * Returns whether a certain property is sortable or not\n * @param {String} propertyId\n * @returns {Boolean}\n */\n isPropertySortable (propertyId) {\n const propertyDescriptor = this.getPropertyDescriptor(propertyId);\n const propertyTypeDescriptor = this.getPropertyTypeDescriptor(propertyId);\n return propertyDescriptor && (propertyDescriptor.sortable !== undefined ? propertyDescriptor.sortable :\n (propertyTypeDescriptor && propertyTypeDescriptor.sortable));\n },\n\n\n /**\n * Returns the sortable properties from the live data query.\n *\n * @returns {Array}\n */\n getSortableProperties () {\n return this.data.query.properties.filter(property => this.isPropertySortable(property));\n },\n\n\n /**\n * Returns the sortable properties that don't have a sort entry in the live data query.\n *\n * @returns {Array}\n */\n getUnsortedProperties () {\n return this.getSortableProperties().filter(property => !this.getQuerySort(property));\n },\n\n\n /**\n * Get the sort query associated to a property id\n * @param {String} propertyId\n */\n getQuerySort (propertyId) {\n return this.data.query.sort.find(sort => sort.property === propertyId);\n },\n\n\n /**\n * Update sort configuration based on parameters, then fetch new data\n * @param {String} property The property to sort according to\n * @param {String} level The sort level for the property (0 is the highest).\n * Undefined means keep current. Negative value removes property sort.\n * @param {String} descending Specify whether the sort should be descending or not.\n * Undefined means toggle current direction\n * @returns {Promise}\n */\n sort (property, level, descending) {\n const err = new Error(\"Property `\" + property + \"` is not sortable\");\n return new Promise ((resolve, reject) => {\n // Allow the user to remove a sort entry (level < 0) even if the property is not sortable.\n if (!(level < 0 || this.isPropertySortable(property))) {\n return void reject(err);\n }\n // find property current sort level\n const currentLevel = this.data.query.sort.findIndex(sortObject => sortObject.property === property);\n // default level\n if (level === undefined) {\n level = (currentLevel !== -1) ? currentLevel : 0;\n } else if (level < 0) {\n level = -1;\n }\n // default descending\n if (descending === undefined) {\n descending = (currentLevel !== -1) ? !this.data.query.sort[currentLevel].descending : false;\n }\n // create sort object\n const sortObject = {\n property: property,\n descending: descending,\n };\n // apply sort\n if (level !== -1) {\n this.data.query.sort.splice(level, 1, sortObject);\n }\n if (currentLevel !== -1 && currentLevel !== level) {\n this.data.query.sort.splice(currentLevel, 1);\n }\n // dispatch events\n this.triggerEvent(\"sort\", {\n property: property,\n level: level,\n descending: descending,\n });\n\n this.updateEntries().then(resolve, reject);\n });\n },\n\n\n /**\n * Add new sort entry, shorthand of sort:\n * If the property is already sorting, does nothing\n * @param {String} property The property to add to the sort\n * @param {String} descending Specify whether the sort should be descending or not.\n * Undefined means toggle current direction\n * @returns {Promise}\n */\n addSort (property, descending) {\n const err = new Error(\"Property `\" + property + \"` is already sorting\");\n const propertyQuerySort = this.data.query.sort.find(sortObject => sortObject.property === property);\n if (propertyQuerySort) { return Promise.reject(err); }\n return this.sort(property, this.data.query.sort.length, descending);\n },\n\n\n /**\n * Remove a sort entry, shorthand of sort:\n * @param {String} property The property to remove to the sort\n * @returns {Promise}\n */\n removeSort (property) {\n return this.sort(property, -1);\n },\n\n\n /**\n * Move a sort entry to a certain index in the query sort list\n * @param {String} property The property to reorder the sort\n * @param {Number} toIndex\n */\n reorderSort (propertyId, toIndex) {\n const err = new Error(\"Property `\" + propertyId + \"` is not sortable\");\n return new Promise ((resolve, reject) => {\n const fromIndex = this.data.query.sort.findIndex(querySort => querySort.property === propertyId);\n if (fromIndex < 0 || toIndex < 0) { return void reject(err); }\n this.data.query.sort.splice(toIndex, 0, this.data.query.sort.splice(fromIndex, 1)[0]);\n\n // dispatch events\n this.triggerEvent(\"sort\", {\n type: \"move\",\n property: propertyId,\n level: toIndex,\n });\n\n this.updateEntries().then(resolve, reject);\n });\n },\n\n\n\n\n /**\n * ---------------------------------------------------------------\n * FILTER\n */\n\n\n /**\n * Returns whether a certain property is filterable or not\n * @param {String} propertyId\n * @returns {Boolean}\n */\n isPropertyFilterable (propertyId) {\n const propertyDescriptor = this.getPropertyDescriptor(propertyId);\n const propertyTypeDescriptor = this.getPropertyTypeDescriptor(propertyId);\n return propertyDescriptor && (propertyDescriptor.filterable !== undefined ? propertyDescriptor.filterable :\n (propertyTypeDescriptor && propertyTypeDescriptor.filterable));\n },\n\n\n /**\n * Returns the filterable properties from the live data query.\n *\n * @returns {Array}\n */\n getFilterableProperties () {\n return this.data.query.properties.filter(property => this.isPropertyFilterable(property));\n },\n\n\n /**\n * Returns the filterable properties that don't have constraints in the live data query.\n *\n * @returns {Array}\n */\n getUnfilteredProperties () {\n return this.getFilterableProperties().filter(property => {\n const filter = this.getQueryFilterGroup(property);\n return !filter || filter.constraints.length === 0;\n });\n },\n\n\n /**\n * Get the filter in the query data object associated to a property id\n * @param {String} propertyId\n * @returns {Object}\n */\n getQueryFilterGroup (propertyId) {\n return this.data.query.filters.find(filter => filter.property === propertyId);\n },\n\n\n /**\n * Get the filters in the query data object associated to a property id\n * @param {String} propertyId\n * @returns {Array} The constraints array of the filter group, or empty array if it does not exist\n */\n getQueryFilters (propertyId) {\n const queryFilterGroup = this.getQueryFilterGroup(propertyId);\n return queryFilterGroup && queryFilterGroup.constraints || [];\n },\n\n\n /**\n * Get the default filter operator associated to a property id\n * @param {String} propertyId\n * @returns {String}\n */\n getFilterDefaultOperator (propertyId) {\n // get valid operator descriptor\n const filterDescriptor = this.getFilterDescriptor(propertyId);\n if (!filterDescriptor) { return; }\n const filterOperators = filterDescriptor.operators;\n if (!(filterOperators instanceof Array)) { return; }\n if (filterOperators.length === 0) { return; }\n // get default operator\n const defaultOperator = filterDescriptor.defaultOperator;\n const isDefaultOperatorValid = !!filterOperators.find(operator => operator.id === defaultOperator);\n if (defaultOperator && isDefaultOperatorValid) {\n return defaultOperator;\n } else {\n return filterOperators[0].id;\n }\n },\n\n\n /**\n * Return an object containing the new and old filter entries corresponding to parameters\n * oldEntry: the filter entry to be modified\n * newEntry: what this entry should be modified to\n * @param {String} property The property to filter according to\n * @param {String} index The index of the filter entry\n * @param {String} filterEntry The filter data used to update the filter configuration\n * (see Logic.prototype.filter for more)\n * @returns {Object} {oldEntry, newEntry}\n * with oldEntry / newEntry being {property, index, operator, value}\n */\n _computeFilterEntries (property, index, filterEntry, {filterOperator} = {}) {\n if (!this.isPropertyFilterable(property)) { return; }\n // default indexes\n index = index || 0;\n if (index < 0) { index = -1; }\n if (filterEntry.index < 0) { filterEntry.index = -1; }\n // old entry\n let oldEntry = {\n property: property,\n index: index,\n };\n const queryFilters = this.getQueryFilters(property);\n const currentEntry = queryFilters[index] || {};\n oldEntry = Object.assign({}, currentEntry, oldEntry);\n // new entry (copy properties that are not undefined from filterEntry)\n let newEntry = Object.fromEntries(Object.entries(filterEntry || {})\n .filter(entry => entry[1] !== undefined));\n const self = this;\n const defaultEntry = {\n property: property,\n value: \"\",\n operator: self.getFilterDefaultOperator(property),\n index: 0,\n };\n newEntry = Object.assign({}, defaultEntry, oldEntry, newEntry);\n if (filterOperator) {\n newEntry.operator = filterOperator;\n }\n // check newEntry operator\n const newEntryValidOperator = this.getFilterDescriptor(newEntry.property).operators\n .some(operator => operator.id === newEntry.operator);\n if (!newEntryValidOperator) {\n newEntry.operator = self.getFilterDefaultOperator(newEntry.property);\n }\n return {\n oldEntry: oldEntry,\n newEntry: newEntry,\n };\n },\n\n\n /**\n * Return the filtering type, based on oldEntry and newEntry\n * @param {Object} oldEntry\n * @param {Oject} newEntry\n * @returns {String} \"add\" | \"remove\" | \"move\" | \"modify\"\n */\n _getFilteringType (oldEntry, newEntry) {\n const queryFilter = this.getQueryFilterGroup(oldEntry.property);\n if (queryFilter && oldEntry.index === -1) {\n return \"add\";\n }\n if (newEntry.index === -1) {\n return \"remove\";\n }\n if (oldEntry.index !== newEntry.index) {\n return \"move\";\n }\n return \"modify\";\n },\n\n\n /**\n * Update filter configuration based on parameters, then fetch new data\n * @param {String} property The property to filter according to\n * @param {String} index The index of the filter entry\n * @param {String} filterEntry The filter data used to update the filter configuration\n * filterEntry = {property, operator, value}\n * undefined values are defaulted to current values, then to default values.\n * @param {String} filterEntry.property The new property to filter according to\n * @param {String} filterEntry.index The new index the filter should go. -1 delete filter\n * @param {String} filterEntry.operator The operator of the filter.\n * Should match the filter descriptor of the filter property\n * @param {String} filterEntry.value Value for the new filter entry\n * @returns {Promise}\n */\n filter(property, index, filterEntry, {filterOperator} = {}) {\n const err = new Error(\"Property `\" + property + \"` is not filterable\");\n return new Promise ((resolve, reject) => {\n const filterEntries = this._computeFilterEntries(property, index, filterEntry, {filterOperator});\n if (!filterEntries) { return void reject(err); }\n const oldEntry = filterEntries.oldEntry;\n const newEntry = filterEntries.newEntry;\n const filteringType = this._getFilteringType(oldEntry, newEntry);\n // remove filter at current property and index\n if (oldEntry.index !== -1) {\n this.getQueryFilters(oldEntry.property).splice(index, 1);\n }\n // add filter at new property and index\n if (newEntry.index !== -1) {\n // create filterGroup if not exists\n if (!this.getQueryFilterGroup(newEntry.property)) {\n this.data.query.filters.push({\n property: newEntry.property,\n // We use by default AND between filter groups (different properties) and OR inside a filter group (same\n // property)\n matchAll: false,\n constraints: [],\n });\n }\n // add entry\n this.getQueryFilterGroup(newEntry.property).constraints.splice(newEntry.index, 0, {\n operator: newEntry.operator,\n value: newEntry.value,\n });\n }\n // remove filter group if empty\n if (this.getQueryFilters(oldEntry.property).length === 0) {\n this.removeAllFilters(oldEntry.property);\n }\n // Reset the offset whenever the filters are updated.\n this.data.query.offset = 0;\n // dispatch events\n this.triggerEvent(\"filter\", {\n type: filteringType,\n oldEntry: oldEntry,\n newEntry: newEntry,\n });\n\n this.updateEntries().then(resolve, reject);\n });\n },\n\n\n /**\n * Add new filter entry, shorthand of filter:\n * @param {String} property Which property to add the filter to\n * @param {String} operator The operator of the filter. Should match the filter descriptor of the property\n * @param {String} value Default value for the new filter entry\n * @param {Number} index Index of new filter entry. Undefined means last\n * @returns {Promise}\n */\n addFilter (property, operator, value, index) {\n if (index === undefined) {\n index = ((this.getQueryFilterGroup(property) || {}).constraints || []).length;\n }\n return this.filter(property, -1, {\n property: property,\n operator: operator,\n value: value,\n index: index,\n });\n },\n\n\n /**\n * Remove a filter entry in the configuration, then fetch new data\n * @param {String} property Property to remove the filter to\n * @param {String} index The index of the filter to remove. Undefined means last.\n * @returns {Promise}\n */\n removeFilter (property, index) {\n return this.filter(property, index, {index: -1});\n },\n\n\n /**\n * Remove all the filters associated to a property\n * @param {String} property Property to remove the filters to\n * @returns {Promise}\n */\n removeAllFilters (property) {\n return new Promise ((resolve, reject) => {\n const filterIndex = this.data.query.filters\n .findIndex(filterGroup => filterGroup.property === property);\n if (filterIndex < 0) { return void reject(); }\n const removedFilterGroups = this.data.query.filters.splice(filterIndex, 1);\n // Reset the offset whenever the filters are updated.\n this.data.query.offset = 0;\n // dispatch events\n this.triggerEvent(\"filter\", {\n type: \"removeAll\",\n property: property,\n removedFilters: removedFilterGroups[0].constraints,\n });\n this.updateEntries().then(resolve, reject);\n });\n },\n \n //\n // Translations\n //\n\n /**\n * @returns {Promise} the promise is resolved to true once the translations are loaded\n */\n translationsLoaded() {\n return translationsLoaded;\n },\n \n //\n // Edit Bus\n //\n\n setEditBus(editBusInstance) {\n this.editBusInstance = editBusInstance;\n },\n\n getEditBus() {\n return this.editBusInstance;\n },\n\n /**\n * Registers a panel.\n *\n * The panel must have the following attributes:\n * * id: the id of the panel, must be unique among all panels, also used as suffix of the class on the panel\n * * name: the name that shall be shown in the menu\n * * title: the title that shall be displayed in the title bar of the panel\n * * icon: the name of the icon for the menu and the title of the panel\n * * container: the Element that shall be attached to the extension panel's body, this should contain the main UI\n * * component: the component of the panel, should be \"LiveDataAdvancedPanelExtension\" for extension panels\n * * order: the ordering number, panels are sorted by this number in ascending order\n *\n * @param {Object} panel the panel to add\n */\n registerPanel(panel)\n {\n // Basic insertion sorting to avoid shuffling the (reactive) array.\n const index = this.panels.findIndex(p => p.order > panel.order);\n if (index === -1) {\n this.panels.push(panel);\n } else {\n this.panels.splice(index, 0, panel);\n }\n },\n\n //\n // Content status\n //\n\n /**\n * @returns {boolean} when false, the content is not trusted will be sanitized whenever Vue integrated escaping\n * is not enough. When true, the content is never sanitized\n */\n isContentTrusted() {\n return this.contentTrusted;\n }\n };\n\n\n\n\n\n // return the init function to be used in the layouts\n return init;\n\n});\n\n\n\n","/*\n * See the NOTICE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\ndefine('xwiki-livedata-xObjectPropertyHelper', ['jquery', 'xwiki-meta', 'xwiki-entityReference'], function($, xcontext, XWiki) {\n 'use strict';\n\n /**\n * Pass the vue-i18n helper to the module to allow error messages to be localized.\n * @param $t the vue-i18n localization helper\n */\n function setLocalization($t) {\n this.$t = $t;\n }\n\n /**\n * Resolve the url of the document reference in the given mode.\n * @param documentReference the document reference\n * @param mode the mode\n * @returns {*} the computed relative url\n */\n function computeTargetURL(documentReference, mode) {\n return new XWiki.Document(XWiki.Model.resolve(documentReference, XWiki.EntityType.DOCUMENT)).getURL(mode);\n }\n\n function getPropertyReference(propertyName, className) {\n if (propertyName.startsWith('doc.')) {\n return propertyName.substring('doc.'.length);\n } else {\n // We target the first object of the specified type (class name).\n return className + '[0].' + propertyName;\n }\n }\n\n function load(mode, documentReference, property, className) {\n const targetUrl = computeTargetURL(documentReference, 'get');\n return Promise.resolve($.get(targetUrl, {\n xpage: 'display',\n mode: mode,\n // TODO: handle the object index when provided\n property: getPropertyReference(property, className),\n type: property.startsWith('doc.') ? 'document' : 'object',\n language: xcontext.locale\n })).catch(() => {\n new XWiki.widgets.Notification(\n this.$t('livedata.displayer.xObjectProperty.failedToRetrieveField.errorMessage', [mode]), 'error');\n return Promise.reject();\n });\n }\n\n /**\n * Load an XObject property field in edit mode.\n * @param documentReference the reference of the document containing the XObject\n * @param className the class name of the XObject\n * @param property the XObject property to display\n * @returns {*} the XObject property field html content in edit mode\n */\n function edit(documentReference, className, property) {\n return load('edit', documentReference, property, className);\n }\n\n /**\n * Load an XObject property field in view mode.\n * @param documentReference the reference of the document containing the XObject\n * @param className the class name of the XObject\n * @param property the XObject property to display\n * @returns {*} the XObject property field html content in view mode\n */\n function view(documentReference, className, property) {\n return load('view', documentReference, property, className);\n }\n\n return {edit, view, setLocalization};\n});\n","/*\n * See the NOTICE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\n\n/**\n * Vue event bus for the edit action states.\n * Sent events:\n * - start-editing-entry({entryId, propertyId}): when an entry passes in edit mode\n * - cancel-editing-entry({entryId, propertyId}): when an entry goes out of edit mode without saving its edits\n * - save-editing-entry({entryId, propertyId, content}): when an entry goes out of edit model and wants to save its\n * edits. The content is an object mapping the keys and values of the cell form attributes.\n */\ndefine('edit-bus', ['vue'], (Vue) => {\n\n /**\n * Initialize the edit bus view and services.\n * @param logic the live data logic instance\n */\n function init(logic) {\n\n /**\n * Centralizes the edition event listeners and maintain a centralized state of the edition states and results for\n * the live data. This is useful to know when to save the table, and to know which cells can be edited according to\n * the current edit state\n */\n class EditBusService {\n\n /**\n * Default constructor.\n * @param editBus an edit bus Vue object\n * @param logic the live data logic instance\n */\n constructor(editBus, logic) {\n this.editBus = editBus;\n this.editStates = {};\n this.logic = logic;\n }\n\n /**\n * Initializes the Vue events listeners.\n */\n init() {\n this.editBus.$on('start-editing-entry', ({entryId, propertyId}) => {\n const entryState = this.editStates[entryId] || {};\n const propertyState = entryState[propertyId] || {};\n propertyState.editing = true;\n entryState[propertyId] = propertyState;\n this.editStates[entryId] = entryState;\n })\n\n this.editBus.$on('cancel-editing-entry', ({entryId, propertyId}) => {\n const entryState = this.editStates[entryId];\n const propertyState = entryState[propertyId];\n\n // The entry is not edited anymore.\n // The content is not edited, and should be `undefined` if the property was edited for the first time.\n // If the property was edited and saved a first time, then edited and cancelled, the content must stay to one\n // from the first edit.\n propertyState.editing = false;\n\n })\n\n this.editBus.$on('save-editing-entry', ({entryId, propertyId, content}) => {\n const entryState = this.editStates[entryId];\n const propertyState = entryState[propertyId];\n // The entry is not edited anymore but its content will need to be saved once the rest of the properties of\n // the entry are not in edit mode. \n propertyState.editing = false;\n propertyState.tosave = true;\n propertyState.content = content;\n this.save(entryId);\n })\n }\n\n /**\n * Save the changed values of an entry server side.\n * @param entryId the entry id of the entry to save\n */\n save(entryId) {\n const values = this.editStates[entryId];\n var canBeSaved = false;\n var keyEntry = undefined;\n\n\n // Look for the single cell to save.\n for (keyEntry in values) {\n const entryValue = values[keyEntry];\n\n const editing = entryValue.editing;\n const tosave = entryValue.tosave;\n canBeSaved = !editing && tosave;\n\n if (canBeSaved) {\n break;\n }\n }\n\n // If a cell to save is found, we get its content and save it. \n if (canBeSaved && keyEntry) {\n const vals = values[keyEntry].content;\n\n this.logic.setValues({entryId, values: vals})\n .then(() => {\n this.editStates[entryId] = {};\n })\n .catch(() => {\n new XWiki.widgets.Notification(`The row save action failed.`, 'error');\n });\n }\n }\n\n isEditable() {\n for (const editStatesKey in this.editStates) {\n const editStates = this.editStates[editStatesKey];\n for (const editStateKey in editStates) {\n const editState = editStates[editStateKey];\n if (editState.editing) {\n return false;\n }\n }\n }\n return true;\n }\n\n onAnyEvent(callback) {\n this.editBus.$on(['save-editing-entry', 'start-editing-entry', 'cancel-editing-entry'], () => callback())\n }\n }\n\n /**\n * Notifies the start of a cell modification. After this event, the cell is considered as edited unless it is\n * canceled.\n * @param entry the entry of the edited row\n * @param propertyId the property id of the edited cell.\n */\n function start(entry, propertyId) {\n _editBus.$emit('start-editing-entry', {\n entryId: _logic.getEntryId(entry),\n propertyId\n });\n\n }\n\n /**\n * Notifies the cancellation of the edition of a cell. The cell rollback to a non modified state.\n * @param entry the entry of the edited row\n * @param propertyId the property id of the edited cell\n */\n function cancel(entry, propertyId) {\n _editBus.$emit('cancel-editing-entry', {\n entryId: _logic.getEntryId(entry),\n propertyId\n })\n\n }\n\n /**\n * Notifies the save of the a cell. With the current save strategy, the cell is directly save and the table is\n * reload after this notification.\n * @param entry the entry of the edit row\n * @param propertyId the property id of the edited cell\n * @param content the attributes of the edit cell form, in the form of an object\n `\n */\n function save(entry, propertyId, content) {\n _editBus.$emit('save-editing-entry', {\n entryId: _logic.getEntryId(entry),\n propertyId: propertyId,\n content: content\n });\n }\n\n /**\n * Indicated if cells are allowed to switch to edit mode. For instance, a cell is not allowed to be edited if\n * another cell is already in edit mode. In this case the currently edited cell must be saved or cancelled before\n * another one can be edited.\n * @returns {*} true if the cells are allowed to switch to edit mode, false otherwise\n */\n function isEditable() {\n return _editBusService.isEditable();\n }\n\n function onAnyEvent(callback) {\n _editBusService.onAnyEvent(callback);\n }\n\n const _editBus = new Vue();\n const _logic = logic\n const _editBusService = new EditBusService(_editBus, logic);\n _editBusService.init()\n return {start, cancel, save, isEditable, onAnyEvent};\n }\n\n return {init};\n})\n","/*\n * See the NOTICE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\ndefine('xwiki-json-merge', function() {\n let merge = function(left, right) {\n if (left?.constructor === Object && right?.constructor === Object) {\n return mergeObject(left, right);\n } else if (Array.isArray(left) && Array.isArray(right)) {\n return mergeArray(left, right);\n } else if (right == null) {\n // Keep the left value.\n return left;\n } else {\n // Overwrite the left value because either it's null or we cannot merge.\n return deepCopy(right);\n }\n };\n\n let mergeArray = function(left, right) {\n // Take the items from the right, merging them with the corresponding item from the left.\n const fromRight = right.map(rightItem => merge(findById(rightItem.id, left), rightItem));\n // Take the items from the left that are identifiable and that are not present on the right.\n const fromLeft = deepCopy(left.filter(leftItem => leftItem.id != null && findById(leftItem.id, right) == null));\n return fromRight.concat(fromLeft);\n };\n\n let mergeObject = function(left, right) {\n // Don't merge if the right object has an identifier different than the one of the left object.\n if (right.hasOwnProperty('id') && left.id !== right.id) {\n return deepCopy(right);\n }\n Object.keys(right).forEach(key => {\n left[key] = merge(left[key], right[key]);\n });\n return left;\n };\n\n let deepCopy = function(value) {\n return JSON.parse(JSON.stringify(value));\n };\n\n let findById = function(id, array) {\n if (id != null) {\n return array.find(item => item.id === id);\n }\n };\n\n return function(...objects) {\n return objects?.reduce(merge, null);\n };\n});\n","/*\n * See the NOTICE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\ndefine('xwiki-livedata-source', ['module', 'jquery'], function(module, $) {\n 'use strict';\n\n function init() {\n var baseURL = module.config().contextPath + '/rest/liveData/sources/';\n\n // Hold the most recent request to update the Live Data entries. It can be aborted. For instance, if some criteria \n // (e.g., filtering or sorting) are changed before the previous request is completed. \n let entriesRequest;\n\n var getEntries = function(liveDataQuery) {\n var entriesURL = getEntriesURL(liveDataQuery.source);\n\n var parameters = {\n properties: liveDataQuery.properties,\n offset: liveDataQuery.offset,\n limit: liveDataQuery.limit\n };\n // Add filters.\n parameters.matchAll = [];\n liveDataQuery.filters.forEach(filter => {\n if (filter.matchAll) {\n parameters.matchAll.push(filter.property);\n }\n parameters['filters.' + filter.property] = filter.constraints\n .filter(constraint => constraint.value !== undefined)\n .map(constraint => {\n if (constraint.operator === undefined) {\n constraint.operator = \"\";\n }\n return constraint;\n })\n .map(constraint => constraint.operator + ':' + constraint.value);\n });\n // Add sort.\n parameters.sort = liveDataQuery.sort.map(sort => sort.property);\n parameters.descending = liveDataQuery.sort.map(sort => sort.descending);\n\n // We abort previous requests to avoid a race condition. It can happen that getEntries is called twice in a short\n // time (when the user is typing in a filter field for instance, quickly changing sorting, or just if the network \n // is slow) and that the first request succeeds after the second request, and its results would replace the\n // \"fresher\" state.\n entriesRequest?.abort();\n entriesRequest = $.getJSON(entriesURL, $.param(parameters, true));\n\n return Promise.resolve(entriesRequest.then(toLiveData))\n .finally(cleanupRequest.bind(null, entriesRequest));\n };\n\n function cleanupRequest(requestToClean) {\n // We reset the request object to null for two reasons:\n // - avoid keeping an object we don't need anymore in memory, preventing it from being GC'd\n // - make sure we don't attempt to abort a request that already terminated.\n //\n // We only nullify the request if it is the request we just handled.\n // Otherwise, this means that a fresher request is in flight. In which case\n // we need to be able to abort this fresher one if yet another request is\n // fired before it succeeds.\n if (requestToClean === entriesRequest) {\n entriesRequest = null;\n }\n }\n\n var getEntriesURL = function(source) {\n var entriesURL = baseURL + encodeURIComponent(source.id) + '/entries';\n return addSourcePathParameters(source, entriesURL);\n };\n\n function addSourcePathParameters(source, url) {\n var parameters = {\n // Make sure the response is not retrieved from cache (IE11 doesn't obey the caching HTTP headers).\n timestamp: new Date().getTime(),\n namespace: `wiki:${encodeURIComponent(XWiki.currentWiki)}`\n };\n addSourceParameters(parameters, source);\n return `${url}?${$.param(parameters, true)}`;\n }\n\n function getEntryPropertyURL(source, entryId, propertyId) {\n const encodedSourceId = encodeURIComponent(source.id);\n const encodedEntryId = encodeURIComponent(entryId);\n const encodedPropertyId = encodeURIComponent(propertyId);\n const url = `${baseURL}${encodedSourceId}/entries/${encodedEntryId}/properties/${encodedPropertyId}`\n return addSourcePathParameters(source, url);\n }\n\n function getEntryURL(source, entryId) {\n const encodedSourceId = encodeURIComponent(source.id);\n const encodedEntryId = encodeURIComponent(entryId);\n const url = `${baseURL}${encodedSourceId}/entries/${encodedEntryId}`\n return addSourcePathParameters(source, url);\n }\n\n var addSourceParameters = function(parameters, source) {\n $.each(source, (key, value) => {\n if (key !== 'id') {\n parameters['sourceParams.' + key] = value;\n }\n });\n };\n\n var toLiveData = function(data) {\n return {\n count: data.count,\n entries: data.entries.map(entry => entry.values)\n };\n };\n\n var addEntry = function(source, entry) {\n return Promise.resolve($.post(getEntriesURL(source), entry).then(e => e.values));\n };\n\n function updateEntry(source, entryId, values) {\n return Promise.resolve($.ajax({\n type: 'PUT',\n url: getEntryURL(source, entryId),\n contentType: 'application/json',\n data: JSON.stringify({values})\n }));\n }\n\n var getTranslations = function(locale, prefix, keys) {\n const translationsURL = `${module.config().contextPath}/rest/wikis/${encodeURIComponent(XWiki.currentWiki)}/localization/translations`;\n return Promise.resolve($.getJSON(translationsURL, $.param({\n locale: locale,\n prefix: prefix,\n key: keys\n }, true)).then(toTranslationsMap));\n };\n\n var toTranslationsMap = function(responseJSON) {\n var translationsMap = {};\n responseJSON.translations?.forEach(translation => translationsMap[translation.key] = translation.rawSource);\n return translationsMap;\n };\n\n function updateEntryProperty(source, entryId, propertyId, propertyValue) {\n return Promise.resolve($.ajax({\n type: 'PUT',\n url: getEntryPropertyURL(source, entryId, propertyId),\n contentType: 'text/plain',\n data: `${propertyValue}`\n }))\n }\n\n return {\n getEntries,\n addEntry,\n updateEntry,\n updateEntryProperty,\n getTranslations\n };\n }\n\n return {init};\n});\n","/*\n * See the NOTICE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\n/**\n * Polyfills that are not yet provided by Closure Compiler.\n * See https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/js/polyfills.txt\n */\ndefine('xwiki-livedata-polyfills', function () {\n});\n"], "names":["define","Vue","VueI18n","xwikiLivedataVue","liveDataSourceModule","jsonMerge","editBus","XWikiLivedata","use","instancesMap","WeakMap","FootnotesService","constructor","_footnotes","put","symbol","translationKey","some","footnote","push","reset","splice","list","translationsLoadedResolve","translationsLoaded","Promise","resolve","Logic","element","liveDataSource","init","data","JSON","parse","getAttribute","contentTrusted","entries","Object","freeze","firstEntriesLoading","currentLayoutId","changeLayout","meta","defaultLayout","entrySelection","selected","deselected","isGlobal","openedPanels","footnotes","panels","removeAttribute","locale","document","documentElement","i18n","messages","silentFallbackWarn","placeholderElement","createElement","appendChild","vue","el","components","template","logic","mounted","classList","remove","$nextTick","triggerEvent","length","updateEntries","finally","setEditBus","loadTranslations","this.loadTranslations","componentName","prefix","keys","translations","getTranslations","mergeLocaleMessage","error","console","translationsPromise","then","translate","this.translate","key","args","$t","this.translationsLoaded","registerPanel","id","title","name","icon","component","order","prototype","eventName","eventData","defaultData","livedata","bubbles","detail","assign","event","CustomEvent","dispatchEvent","onEvent","callback","addEventListener","e","onEventWhere","condition","isDetailMatching","every","is","getLayoutIds","layouts","map","layoutDescriptor","getEntryId","entry","idProperty","entryDescriptor","undefined","warn","uniqueArrayHas","uniqueArray","item","includes","uniqueArrayAdd","uniqueArrayRemove","index","indexOf","uniqueArrayToggle","force","getPropertyDescriptors","query","properties","propertyId","getPropertyDescriptor","propertyDescriptor","propertyDescriptors","find","getPropertyTypeDescriptor","propertyTypes","typeDescriptor","type","getLayoutDescriptor","layoutId","getDisplayerDescriptor","customDisplayerDescriptor","displayer","displayerId","defaultDisplayer","defaultDisplayerDescriptor","displayers","getFilterDescriptor","customFilterDescriptor","filter","filterId","defaultFilter","defaultFilterDescriptor","filters","fetchEntries","getEntries","nextTick","catch","err","readyState","value","XWiki","widgets","Notification","statusText","isEditable","actions","action","isEntryEditable","isPropertyEditable","isActionAllowed","propertyTypeDescriptor","editable","setValue","source","entryId","updateEntryProperty","setValues","values","updateEntry","canAddEntry","addEntry","mockNewUrl","slice","newEntry","count","previousLayoutId","getPageCount","Math","ceil","limit","getPageIndex","entryIndex","offset","floor","setPageIndex","pageIndex","reject","previousPageIndex","getFirstIndexOfPage","getLastIndexOfPage","min","setPageSize","pageSize","previousPageSize","isPropertyVisible","visible","setPropertyVisible","reorderProperty","from","toIndex","fromIndex","isSelectionEnabled","selection","enabled","isEntrySelected","selectEntries","forEach","entryArray","Array","deselectEntries","toggleSelectEntries","select","selectableCountInPage","setEntrySelectGlobal","global","state","getActionDescriptor","descriptor","baseDescriptor","actionDescriptor","allowProperty","isPropertySortable","sortable","getSortableProperties","property","getUnsortedProperties","getQuerySort","sort","level","descending","Error","currentLevel","findIndex","sortObject","addSort","propertyQuerySort","removeSort","reorderSort","querySort","isPropertyFilterable","filterable","getFilterableProperties","getUnfilteredProperties","getQueryFilterGroup","constraints","getQueryFilters","queryFilterGroup","getFilterDefaultOperator","filterDescriptor","filterOperators","operators","defaultOperator","isDefaultOperatorValid","operator","_computeFilterEntries","filterEntry","filterOperator","oldEntry","currentEntry","queryFilters","fromEntries","defaultEntry","self","newEntryValidOperator","_getFilteringType","queryFilter","filterEntries","filteringType","matchAll","removeAllFilters","addFilter","removeFilter","filterIndex","filterGroup","removedFilterGroups","removedFilters","editBusInstance","getEditBus","panel","p","isContentTrusted","has","set","get","$","xcontext","getPropertyReference","propertyName","className","startsWith","substring","load","mode","documentReference","targetUrl","getURL","Document","Model","EntityType","DOCUMENT","xpage","language","edit","view","setLocalization","EditBusService","editStates","$on","entryState","propertyState","editing","content","tosave","save","canBeSaved","keyEntry","entryValue","editStatesKey","editStateKey","editState","onAnyEvent","_editBus","_editBusService","start","$emit","cancel","merge","left","right","mergeObject","isArray","mergeArray","stringify","fromRight","rightItem","findById","fromLeft","leftItem","concat","hasOwnProperty","array","objects","reduce","module","cleanupRequest","requestToClean","entriesRequest","addSourcePathParameters","url","parameters","timestamp","getTime","Date","namespace","encodeURIComponent","currentWiki","addSourceParameters","param","baseURL","config","contextPath","getEntriesURL","entriesURL","each","toLiveData","toTranslationsMap","responseJSON","translationsMap","translation","rawSource","liveDataQuery","constraint","abort","getJSON","bind","post","ajax","encodedSourceId","encodedEntryId","contentType","propertyValue","encodedPropertyId","translationsURL"] }