refine-rails 2.9.5 → 2.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -62
- data/app/assets/javascripts/refine-stimulus.esm.js +1 -1
- data/app/assets/javascripts/refine-stimulus.esm.js.map +1 -1
- data/app/assets/javascripts/refine-stimulus.js +1 -1
- data/app/assets/javascripts/refine-stimulus.js.map +1 -1
- data/app/assets/javascripts/refine-stimulus.modern.js +1 -1
- data/app/assets/javascripts/refine-stimulus.modern.js.map +1 -1
- data/app/assets/javascripts/refine-stimulus.umd.js +1 -1
- data/app/assets/javascripts/refine-stimulus.umd.js.map +1 -1
- data/app/assets/stylesheets/index.css +6 -3
- data/app/assets/stylesheets/index.tailwind.css +2 -0
- data/app/controllers/refine/inline/criteria_controller.rb +1 -1
- data/app/javascript/controllers/refine/state-controller.js +1 -0
- data/app/views/refine/inline/filters/_show.html.erb +5 -5
- data/app/views/refine/inline/inputs/_date_condition.html.erb +1 -1
- data/config/locales/en/refine.en.yml +1 -0
- data/lib/refine/rails/version.rb +1 -1
- metadata +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"refine-stimulus.modern.js","sources":["../../../node_modules/@hotwired/stimulus-webpack-helpers/dist/stimulus-webpack-helpers.js","../../javascript/controllers/refine/server-refresh-controller.js","../../javascript/controllers/refine/add-controller.js","../../javascript/controllers/refine/criterion-form-controller.js","../../javascript/controllers/refine/defaults-controller.js","../../javascript/controllers/refine/delete-controller.js","../../javascript/controllers/refine/filter-pills-controller.js","../../javascript/controllers/refine/popup-controller.js","../../javascript/controllers/refine/search-filter-controller.js","../../javascript/refine/helpers/index.js","../../javascript/controllers/refine/state-controller.js","../../javascript/controllers/refine/stored-filter-controller.js","../../javascript/controllers/refine/submit-form-controller.js","../../javascript/controllers/refine/toggle-controller.js","../../javascript/controllers/refine/turbo-stream-form-controller.js","../../javascript/controllers/refine/turbo-stream-link-controller.js","../../javascript/controllers/refine/typeahead-list-controller.js","../../javascript/controllers/refine/update-controller.js","../../javascript/controllers/refine/date-controller.js","../../javascript/controllers/index.js"],"sourcesContent":["/*\nStimulus Webpack Helpers 1.0.0\nCopyright © 2021 Basecamp, LLC\n */\nfunction definitionsFromContext(context) {\n return context.keys()\n .map((key) => definitionForModuleWithContextAndKey(context, key))\n .filter((value) => value);\n}\nfunction definitionForModuleWithContextAndKey(context, key) {\n const identifier = identifierForContextKey(key);\n if (identifier) {\n return definitionForModuleAndIdentifier(context(key), identifier);\n }\n}\nfunction definitionForModuleAndIdentifier(module, identifier) {\n const controllerConstructor = module.default;\n if (typeof controllerConstructor == \"function\") {\n return { identifier, controllerConstructor };\n }\n}\nfunction identifierForContextKey(key) {\n const logicalName = (key.match(/^(?:\\.\\/)?(.+)(?:[_-]controller\\..+?)$/) || [])[1];\n if (logicalName) {\n return logicalName.replace(/_/g, \"-\").replace(/\\//g, \"--\");\n }\n}\n\nexport { definitionForModuleAndIdentifier, definitionForModuleWithContextAndKey, definitionsFromContext, identifierForContextKey };\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\n\n// Base class for controllers that reload form content from the server\nexport default class extends Controller {\n connect() {\n this.state.finishUpdate()\n }\n\n get state() {\n let currentElement = this.element\n\n while(currentElement !== document.body) {\n if (currentElement.matches('[data-controller~=\"refine--state\"]'))\n return this.application.getControllerForElementAndIdentifier(currentElement, 'refine--state')\n else {\n currentElement = currentElement.parentNode\n }\n }\n\n return null\n }\n\n async refreshFromServer(options = {}) {\n const { includeErrors } = options\n this.state.startUpdate()\n const request = new FetchRequest(\n \"GET\",\n this.state.refreshUrlValue,\n {\n responseKind: \"turbo-stream\",\n query: {\n \"refine_filters_builder[filter_class]\": this.state.filterName,\n \"refine_filters_builder[blueprint_json]\": JSON.stringify(this.state.blueprint),\n \"refine_filters_builder[client_id]\": this.state.clientIdValue,\n include_errors: !!includeErrors\n }\n }\n )\n await request.perform()\n }\n}\n","import ServerRefreshController from './server-refresh-controller'\nimport { FetchRequest } from '@rails/request.js'\n\nexport default class extends ServerRefreshController {\n static values = {\n previousCriterionId: Number,\n }\n\n async criterion() {\n const isValid = await this.validateBlueprint()\n if (isValid) {\n this.state.addCriterion(this.previousCriterionIdValue)\n }\n this.refreshFromServer({includeErrors: !isValid})\n }\n\n async group() {\n const isValid = await this.validateBlueprint()\n if (isValid) {\n this.state.addGroup()\n }\n this.refreshFromServer({includeErrors: !isValid})\n }\n\n async validateBlueprint(blueprint) {\n const { state } = this\n\n const request = new FetchRequest(\n \"GET\",\n this.state.validateBlueprintUrlValue,\n {\n query: {\n \"refine_filters_builder[filter_class]\": this.state.filterName,\n \"refine_filters_builder[blueprint_json]\": JSON.stringify(this.state.blueprint),\n \"refine_filters_builder[client_id]\": this.state.clientIdValue\n }\n }\n )\n const response = await request.perform()\n return response.ok\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\n/*\n This controller handles criteria forms\n (refine/inline/criteria/new|edit)\n*/\nexport default class extends Controller {\n static values = {\n url: String,\n formId: String\n }\n\n async refresh(_event) {\n // update the url with params from the form\n const formElement = document.getElementById(this.formIdValue)\n const formData = new FormData(formElement)\n\n const request = new FetchRequest(\n \"GET\",\n this.urlValue,\n {\n query: formData,\n responseKind: \"turbo-stream\"\n }\n )\n const response = await request.perform()\n }\n\n\n\n}\n","import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n static values = {\n criterionId: Number,\n input: Object,\n };\n\n connect() {\n this.state = this.getStateController()\n\n this.state.updateInput(\n this.criterionIdValue,\n this.inputValue,\n );\n }\n\n getStateController() {\n let currentElement = this.element\n\n while(currentElement !== document.body) {\n const controller = this.application.getControllerForElementAndIdentifier(currentElement, 'refine--state')\n if (controller) {\n return controller\n } else {\n currentElement = currentElement.parentNode\n }\n }\n\n return null\n }\n}\n","import ServerRefreshController from './server-refresh-controller';\n\nexport default class extends ServerRefreshController {\n static values = {\n criterionId: Number,\n }\n\n criterion() {\n const { state, criterionIdValue } = this;\n state.deleteCriterion(criterionIdValue);\n this.refreshFromServer()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\nexport default class extends Controller {\n static values = {\n submitUrl: String\n }\n\n connect() {\n const urlParams = new URLSearchParams(window.location.search)\n this.existingParams = urlParams\n this.existingParams.delete('stable_id')\n }\n\n delete(event) {\n const { criterionId } = event.currentTarget.dataset\n var index = parseInt(criterionId)\n this.stateController.deleteCriterion(index)\n this.reloadPage()\n }\n\n async reloadPage() {\n const {blueprint} = this.stateController\n const request = new FetchRequest(\n \"POST\",\n this.submitUrlValue,\n {\n responseKind: \"turbo-stream\",\n body: JSON.stringify({\n refine_filters_builder: {\n filter_class: this.stateController.filterName,\n blueprint_json: JSON.stringify(blueprint),\n client_id: this.stateController.clientIdValue\n }\n })\n }\n )\n await request.perform()\n }\n\n redirectToStableId(stableId) {\n const params = new URLSearchParams()\n if (stableId) {\n params.append('stable_id', stableId)\n }\n const allParams = new URLSearchParams({\n ...Object.fromEntries(this.existingParams),\n ...Object.fromEntries(params),\n }).toString()\n const url = `${window.location.pathname}?${allParams}`\n\n history.pushState({}, document.title, url)\n window.location.reload()\n }\n\n get stateController() {\n return this.element.refineStateController\n }\n\n get stabilizeFilterController() {\n return this.element.stabilizeFilterController\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { useClickOutside } from 'stimulus-use'\n\n// simple controller to hide/show the filter modal\nexport default class extends Controller {\n static targets = [\"frame\"]\n\n static values = {\n src: String,\n isOpen: {type: Boolean, default: false}\n }\n\n connect() {\n useClickOutside(this)\n this.boundHandleKeyUp = this.handleKeyUp.bind(this)\n document.addEventListener(\"keyup\", this.boundHandleKeyUp)\n }\n\n disconnect() {\n document.removeEventListener(\"keyup\", this.boundHandleKeyUp)\n }\n\n show(event) {\n event.preventDefault()\n this.frameTarget.src = this.srcValue;\n this.isOpenValue = true\n }\n\n hide(event) {\n if (this.isOpenValue) {\n event?.preventDefault()\n this.frameTarget.innerHTML = \"\";\n this.isOpenValue = false\n }\n }\n\n clickOutside(event) {\n this.hide(event)\n }\n\n handleKeyUp(event) {\n if (event.key === \"Escape\" || event.key === \"Esc\") {\n this.hide(event)\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\nexport default class extends Controller {\n static values = {\n submitUrl: String\n }\n\n\n search(event) {\n event.preventDefault()\n this.submitFilter()\n document.activeElement.blur()\n }\n\n async submitFilter() {\n const {blueprint} = this.stateController\n const request = new FetchRequest(\n \"POST\",\n this.submitUrlValue,\n {\n responseKind: \"turbo-stream\",\n body: JSON.stringify({\n refine_filters_builder: {\n filter_class: this.stateController.filterName,\n blueprint_json: JSON.stringify(blueprint),\n client_id: this.stateController.clientIdValue\n }\n })\n }\n )\n await request.perform()\n }\n\n get stateController() {\n return this\n .element\n .querySelector('[data-controller~=\"refine--state\"]')\n .refineStateController\n }\n\n loadResults({detail: {url}}) {\n console.log(\"filter submit success\")\n if (window.Turbo) {\n window.Turbo.visit(url)\n } else {\n window.location.href = url\n }\n }\n}\n","// Polyfill for custom events in IE9-11\n// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#polyfill\n;(function () {\n if (typeof window.CustomEvent === 'function') return false\n\n function CustomEvent(event, params) {\n params = params || { bubbles: false, cancelable: false, detail: undefined }\n var evt = document.createEvent('CustomEvent')\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail)\n return evt\n }\n\n CustomEvent.prototype = window.Event.prototype\n\n window.CustomEvent = CustomEvent\n\n // eslint expects a return here\n return true\n})()\n\nexport const filterStabilizedEvent = (element, stableId, filterName) => {\n const event = new CustomEvent('filter-stabilized', {\n bubbles: true,\n cancelable: true,\n detail: {\n stableId,\n filterName,\n },\n })\n element.dispatchEvent(event)\n}\n\nexport const filterUnstableEvent = (blueprint) => {\n const event = new CustomEvent('filter-unstable', {\n bubbles: true,\n cancelable: true,\n detail: {\n blueprint,\n },\n })\n window.dispatchEvent(event)\n}\n\nexport const filterInvalidEvent = ({blueprint, errors}) => {\n const event = new CustomEvent('filter-invalid', {\n bubbles: true,\n cancelable: true,\n detail: {\n blueprint,\n errors,\n },\n })\n window.dispatchEvent(event)\n}\n\nexport const filterStoredEvent = (storedFilterId) => {\n const event = new CustomEvent('filter-stored', {\n bubbles: true,\n cancelable: true,\n detail: {\n storedFilterId,\n },\n })\n window.dispatchEvent(event)\n}\n\nexport const blueprintUpdatedEvent = (element, {blueprint, formId}) => {\n const event = new CustomEvent('blueprint-updated', {\n bubbles: true,\n cancelable: true,\n detail: {\n blueprint,\n formId\n },\n })\n element.dispatchEvent(event)\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { delegate, abnegate } from 'jquery-events-to-dom-events'\nimport { blueprintUpdatedEvent } from '../../refine/helpers'\nimport { isEqual } from 'lodash'\n\nconst criterion = (id, depth, condition) => {\n const component = condition?.component\n const meta = condition?.meta || { clauses: [], options: {}}\n const refinements = condition?.refinements || []\n const { clauses, options } = meta\n let selected\n if (component === 'option-condition') {\n selected = options[0] ? [options[0].id] : []\n } else {\n selected = undefined\n }\n // Set newInput based on component\n\n let newInput = {\n clause: clauses[0]?.id,\n selected: selected,\n }\n\n // If refinements are present, add to input array\n refinements.forEach((refinement) => {\n const { meta, component } = refinement\n const { clauses, options } = meta\n let selected\n if (component === 'option-condition') {\n selected = options[0] ? [options[0].id] : []\n } else {\n selected = undefined\n }\n newInput[refinement.id] = {\n clause: clauses[0].id,\n selected: selected,\n }\n })\n\n return {\n depth,\n type: 'criterion',\n condition_id: id,\n input: newInput,\n }\n}\n\nconst or = function (depth) {\n depth = depth === undefined ? 0 : depth\n return {\n depth,\n type: 'conjunction',\n word: 'or',\n }\n}\n\nconst and = function (depth) {\n depth = depth === undefined ? 1 : depth\n return {\n depth,\n type: 'conjunction',\n word: 'and',\n }\n}\nexport default class extends Controller {\n static values = {\n blueprint: Array,\n conditions: Array,\n className: String,\n refreshUrl: String,\n clientId: String,\n validateBlueprintUrl: String,\n defaultConditionId: String\n }\n static targets = ['loading']\n\n\n connect() {\n // for select2 jquery events and datepicker\n this.element.refineStateController = this\n this.changeDelegate = delegate('change', ['event', 'picker'])\n this.blueprint = this.blueprintValue\n this.conditions = this.conditionsValue\n this.filterName = this.classNameValue\n this.conditionsLookup = this.conditions.reduce((lookup, condition) => {\n lookup[condition.id] = condition\n return lookup\n }, {})\n this.loadingTimeout = null\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n disconnect() {\n abnegate('change', this.changeDelegate)\n }\n\n startUpdate() {\n if (this.loadingTimeout) {\n window.clearTimeout(this.loadingTimeout)\n }\n // only show the loading overlay if it's taking a long time\n // to render the updates\n this.loadingTimeout = window.setTimeout(() => {\n this.loadingTarget.classList.remove('hidden')\n }, 1000)\n }\n\n finishUpdate() {\n if (this.loadingTimeout) {\n window.clearTimeout(this.loadingTimeout)\n }\n this.loadingTarget.classList.add('hidden')\n }\n\n conditionConfigFor(conditionId) {\n return this.conditionsLookup[conditionId]\n }\n\n addGroup() {\n const { blueprint, conditions } = this\n const condition = ( conditions.find(c => c.id == this.defaultConditionIdValue) || conditions[0] )\n const { meta } = condition\n\n if (this.blueprint.length > 0) {\n this.blueprint.push(or())\n }\n this.blueprint.push(criterion(condition.id, 1, condition))\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n addCriterion(previousCriterionId) {\n const { blueprint, conditions } = this\n const condition = ( conditions.find(c => c.id == this.defaultConditionIdValue) || conditions[0] )\n const { meta } = condition\n blueprint.splice(previousCriterionId + 1, 0, and(), criterion(condition.id, 1, condition))\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n deleteCriterion(criterionId) {\n /**\n To support 'groups' there is some complicated logic for deleting criterion.\n\n Imagine this simplified blueprint: [eq, and, sw, or, eq]\n\n User clicks to delete the last eq. We also have to delete the preceding or\n otherwise we're left with a hanging empty group\n\n What if the user deletes the sw? We have to clean up the preceding and.\n\n Imagine another scenario: [eq or sw and ew]\n Now we delete the first eq but this time we need to clean up the or.\n\n These conditionals cover these cases.\n **/\n const { blueprint } = this\n const previous = blueprint[criterionId - 1]\n const next = blueprint[criterionId + 1]\n\n const nextIsOr = next && next.word === 'or'\n const previousIsOr = previous && previous.word === 'or'\n\n const nextIsRightParen = nextIsOr || !next\n const previousIsLeftParen = previousIsOr || !previous\n\n const isFirstInGroup = previousIsLeftParen && !nextIsRightParen\n const isLastInGroup = previousIsLeftParen && nextIsRightParen\n const isLastCriterion = !previous && !next\n\n if (isLastCriterion) {\n this.blueprint = []\n } else if (isLastInGroup && previousIsOr) {\n blueprint.splice(criterionId - 1, 2)\n } else if (isLastInGroup && !previous) {\n blueprint.splice(criterionId, 2)\n } else if (isFirstInGroup) {\n blueprint.splice(criterionId, 2)\n } else {\n blueprint.splice(criterionId - 1, 2)\n }\n\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n /*\n Updates a criterion in the blueprint\n Returns true if an update was actually performed, or false if no-op\n */\n replaceCriterion(criterionId, conditionId, condition) {\n const criterionRow = this.blueprint[criterionId]\n if (criterionRow.type !== 'criterion') {\n throw new Error(\n `You can't call updateConditionId on a non-criterion type. Trying to update ${JSON.stringify(criterion)}`\n )\n }\n const existingCriterion = this.blueprint[criterionId]\n const newCriterion = criterion(conditionId, criterionRow.depth, condition)\n if (isEqual(existingCriterion, newCriterion)) {\n return false\n } else {\n this.blueprint[criterionId] = newCriterion\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n return true\n }\n }\n\n updateInput(criterionId, input, inputId) {\n // Input id is an array of hash keys that define the path for this input such as [\"input\", \"date_refinement\"]\n const { blueprint } = this\n const criterion = blueprint[criterionId]\n inputId = inputId || 'input'\n const blueprintPath = inputId.split(', ')\n // If the inputId contains more than one element, add input at appropriate depth\n if (blueprintPath.length > 1) {\n criterion[blueprintPath[0]][blueprintPath[1]] = { ...criterion[blueprintPath[0]][blueprintPath[1]], ...input }\n } else {\n criterion[inputId] = { ...criterion[inputId], ...input }\n }\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { filterStoredEvent } from '../../refine/helpers'\n\nexport default class extends Controller {\n static targets = ['blueprintField']\n static values = { formId: String, stateDomId: String }\n\n connect() {\n const stateController = document\n .getElementById(this.stateDomIdValue)\n .refineStateController\n this.blueprintFieldTarget.value = JSON.stringify(stateController.blueprint)\n console.log(\"connect\", this.blueprintFieldTarget.value)\n }\n\n updateBlueprintField(event) {\n if (event.detail.formId != this.formIdValue) { return null }\n const { detail } = event\n const { blueprint } = detail\n this.blueprintFieldTarget.value = JSON.stringify(blueprint)\n console.log(\"update blueprint\", this.blueprintFieldTarget.value)\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n submit(event) {\n event.preventDefault()\n this.element.submit()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\n\n// simple controller to hide/show the filter modal\nexport default class extends Controller {\n static targets = [\"content\"]\n\n toggle(_event) {\n this.contentTargets.forEach(node => {\n node.toggleAttribute(\"hidden\")\n })\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\n/*\n attach to a form element to have it submit to a turbo-stream endpoint\n\n <form action=\"/contacts\" data-controller=\"refine--turbo-stream-form\" data-action=\"submit->refine--turbo-stream-form#submit\">\n\n Turbo is supposed to handle this natively but we're seeing issues when the form is inside an iframe\n*/\nexport default class extends Controller {\n async submit(event) {\n event.preventDefault()\n const request = new FetchRequest(\n (this.element.method || \"POST\"),\n this.element.action,\n {\n responseKind: \"turbo-stream\",\n body: new FormData(this.element)\n }\n )\n await request.perform()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\n/*\n attach to a link element to have it request turbo stream responses\n\n <a href=\"/contacts\" data-controller=\"refine--turbo-stream-link\" data-action=\"refine--turbo-stream-link#get\">Click me</a>\n\n Turbo is supposed to handle this natively with data-turbo-stream but we're\n seeing issues using that attribute inside iframes\n*/\nexport default class extends Controller {\n async visit(event) {\n event.preventDefault()\n const request = new FetchRequest(\n (this.element.dataset.turboMethod || \"GET\"),\n this.element.href,\n {\n responseKind: \"turbo-stream\",\n }\n )\n await request.perform()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n\n static targets = ['listItem', 'category']\n\n filter(event) {\n const query = event.currentTarget.value.toLowerCase()\n const visibleCategories = new Set()\n\n // hide / show listItem links that match the query and note which\n // categories should be visible\n this.listItemTargets.forEach(listItemNode => {\n const listItemName = listItemNode.dataset.listItemValue.toLowerCase()\n if (listItemName.includes(query)) {\n listItemNode.hidden = false\n visibleCategories.add(listItemNode.dataset.category)\n } else {\n listItemNode.hidden = true\n }\n })\n\n // hide / show category headers that have\n this.categoryTargets.forEach(categoryNode => {\n const categoryName = categoryNode.innerHTML\n if (visibleCategories.has(categoryName)) {\n categoryNode.hidden = false\n } else {\n categoryNode.hidden = true\n }\n })\n }\n}\n","import ServerRefreshController from './server-refresh-controller'\nimport { debounce } from 'lodash'\n\nexport default class extends ServerRefreshController {\n static values = {\n criterionId: Number,\n }\n\n initialize() {\n this.updateBlueprint = debounce((event, value, inputKey) => {\n this.value(event, value, inputKey)\n }, 500)\n }\n\n refinedFilter(event) {\n const { criterionIdValue, state } = this\n const dataset = event.target.dataset\n const inputId = dataset.inputId\n\n state.updateInput(\n criterionIdValue,\n {\n id: event.target.value,\n },\n inputId\n )\n this.refreshFromServer()\n }\n\n clause(event) {\n const { criterionIdValue, state } = this\n const dataset = event.target.dataset\n const inputId = dataset.inputId\n state.updateInput(\n criterionIdValue,\n {\n clause: event.target.value,\n },\n inputId\n )\n this.refreshFromServer()\n }\n\n selected(event) {\n const { target: select } = event\n const options = Array.prototype.slice.call(select.options)\n const selectedOptions = options.filter((option) => option.selected)\n const selected = selectedOptions.map((option) => option.value)\n this.value(event, selected, 'selected')\n }\n\n value(event, value, inputKey) {\n const { criterionIdValue, state } = this\n const dataset = event.target.dataset\n const inputId = dataset.inputId\n inputKey = inputKey || dataset.inputKey || 'value'\n value = value || event.target.value\n state.updateInput(\n criterionIdValue,\n {\n [inputKey]: value,\n },\n inputId\n )\n }\n\n condition(event) {\n const { criterionIdValue, state } = this\n const element = event.target\n let newConditionId = element.value\n if (!newConditionId) newConditionId = element.querySelector('select').value \n const config = this.state.conditionConfigFor(newConditionId)\n const updatePerformed = state.replaceCriterion(criterionIdValue, newConditionId, config)\n if (updatePerformed) {\n this.refreshFromServer()\n }\n }\n\n // Prevent form submission when hitting enter in a text box\n cancelEnter(event) {\n if (event.code === \"Enter\") {\n event.preventDefault()\n event.stopPropagation()\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport moment from 'moment'\nrequire('daterangepicker/daterangepicker.css')\n\n// requires jQuery, moment, might want to consider a vanilla JS alternative\nimport $ from 'jquery' // ensure jquery is loaded before daterangepicker\nimport 'daterangepicker'\n\nexport default class extends Controller {\n static targets = [\n 'field',\n 'hiddenField',\n 'clearButton',\n ]\n\n static values = {\n includeTime: Boolean,\n futureOnly: Boolean,\n drops: String,\n inline: Boolean,\n dateFormat: String,\n timeFormat: String,\n isAmPm: Boolean,\n locale: { type: String, default: 'en' },\n datetimeFormat: { type: String, default: 'MM/DD/YYYY h:mm A' },\n pickerLocale: { type: Object, default: {} },\n }\n\n connect() {\n this.initPluginInstance()\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n clearDate(event) {\n // don't submit the form, unless it originated from the cancel/clear button\n event.preventDefault()\n\n window.$(this.fieldTarget).val('')\n\n this.dispatch('value-cleared')\n }\n\n applyDateToField(event, picker) {\n const format = this.includeTimeValue ? this.timeFormatValue : this.dateFormatValue\n\n const momentVal = picker\n ? moment(picker.startDate.toISOString())\n : moment(this.fieldTarget.value, 'YYYY-MM-DDTHH:mm').format('YYYY-MM-DDTHH:mm')\n const displayVal = momentVal.format(format)\n const dataVal = this.includeTimeValue ? momentVal.toISOString(true) : momentVal.format('YYYY-MM-DD')\n\n this.fieldTarget.value = displayVal\n this.hiddenFieldTarget.value = dataVal\n // bubble up a change event when the input is updated for other listeners\n window.$(this.fieldTarget).trigger('change', picker)\n\n // emit native change event\n this.hiddenFieldTarget.dispatchEvent(new Event('change', { detail: picker, bubbles: true }))\n }\n\n initPluginInstance() {\n const localeValues = this.pickerLocaleValue\n const isAmPm = this.isAmPmValue\n localeValues['format'] = this.includeTimeValue ? this.timeFormatValue : this.dateFormatValue\n\n window.$(this.fieldTarget).daterangepicker({\n singleDatePicker: true,\n timePicker: this.includeTimeValue,\n timePickerIncrement: 5,\n autoUpdateInput: false,\n autoApply: true,\n minDate: this.futureOnlyValue ? new Date() : false,\n locale: localeValues,\n parentEl: $(this.element),\n drops: this.dropsValue ? this.dropsValue : 'down',\n timePicker24Hour: !isAmPm,\n })\n\n window.$(this.fieldTarget).on('apply.daterangepicker', this.applyDateToField.bind(this))\n window.$(this.fieldTarget).on('cancel.daterangepicker', this.clearDate.bind(this))\n window.$(this.fieldTarget).on('showCalendar.daterangepicker', this.showCalendar.bind(this))\n\n this.pluginMainEl = this.fieldTarget\n this.plugin = $(this.pluginMainEl).data('daterangepicker') // weird\n\n if (this.inlineValue) {\n this.element.classList.add('date-input--inline')\n }\n\n }\n \n teardownPluginInstance() {\n if (this.plugin === undefined) {\n return\n }\n\n $(this.pluginMainEl).off('apply.daterangepicker')\n $(this.pluginMainEl).off('cancel.daterangepicker')\n $(this.pluginMainEl).off('showCalendar.daterangepicker')\n\n // revert to original markup, remove any event listeners\n this.plugin.remove()\n\n }\n\n showCalendar() {\n this.dispatch('show-calendar')\n }\n\n}\n","import { identifierForContextKey } from \"@hotwired/stimulus-webpack-helpers\"\n\nimport AddController from './refine/add-controller'\nimport CriterionFormController from './refine/criterion-form-controller'\nimport DefaultsController from './refine/defaults-controller'\nimport DeleteController from './refine/delete-controller'\nimport FilterPillsController from './refine/filter-pills-controller'\nimport PopupController from './refine/popup-controller'\nimport SearchFilterController from './refine/search-filter-controller'\nimport ServerRefreshController from './refine/server-refresh-controller'\nimport StateController from './refine/state-controller'\nimport StoredFilterController from './refine/stored-filter-controller'\nimport SubmitForm from './refine/submit-form-controller'\nimport ToggleController from './refine/toggle-controller'\nimport TurboStreamFormController from './refine/turbo-stream-form-controller'\nimport TurboStreamLinkController from './refine/turbo-stream-link-controller'\nimport TypeaheadListController from './refine/typeahead-list-controller'\nimport UpdateController from './refine/update-controller'\nimport DateController from './refine/date-controller'\n\nexport const controllerDefinitions = [\n [AddController, 'refine/add-controller.js'],\n [CriterionFormController, 'refine/criterion-form-controller.js'],\n [DefaultsController, 'refine/defaults-controller.js'],\n [DeleteController, 'refine/delete-controller.js'],\n [FilterPillsController, 'refine/filter-pills-controller.js'],\n [PopupController, 'refine/popup-controller.js'],\n [SearchFilterController, 'refine/search-filter-controller.js'],\n [ServerRefreshController, 'refine/server-refresh-controller.js'],\n [StateController, 'refine/state-controller.js'],\n [StoredFilterController, 'refine/stored-filter-controller.js'],\n [SubmitForm, 'refine/submit-form-controller.js'],\n [ToggleController, 'refine/toggle-controller.js'],\n [TurboStreamFormController, 'refine/turbo-stream-form-controller.js'],\n [TurboStreamLinkController, 'refine/turbo-stream-link-controller.js'],\n [TypeaheadListController, './refine/typeahead-list-controller.js'],\n [UpdateController, 'refine/update-controller.js'],\n [DateController, 'refine/date-controller.js']\n].map(function(d) {\n const key = d[1]\n const controller = d[0]\n return {\n identifier: identifierForContextKey(key),\n controllerConstructor: controller\n }\n})\n\nexport {\n AddController,\n CriterionFormController,\n DefaultsController,\n DeleteController,\n FilterPillsController,\n PopupController,\n SearchFilterController,\n ServerRefreshController,\n StateController,\n StoredFilterController,\n SubmitForm,\n ToggleController,\n TurboStreamFormController,\n TurboStreamLinkController,\n TypeaheadListController,\n UpdateController,\n DateController\n}\n"],"names":["identifierForContextKey","key","logicalName","match","replace","Controller","connect","this","state","finishUpdate","currentElement","element","document","body","matches","application","getControllerForElementAndIdentifier","parentNode","async","options","includeErrors","startUpdate","request","FetchRequest","refreshUrlValue","responseKind","query","filterName","JSON","stringify","blueprint","clientIdValue","include_errors","perform","ServerRefreshController","isValid","validateBlueprint","addCriterion","previousCriterionIdValue","refreshFromServer","addGroup","validateBlueprintUrlValue","ok","values","previousCriterionId","Number","_event","formElement","getElementById","formIdValue","formData","FormData","urlValue","url","String","formId","getStateController","updateInput","criterionIdValue","inputValue","controller","criterionId","input","Object","criterion","deleteCriterion","urlParams","URLSearchParams","window","location","search","existingParams","delete","event","currentTarget","dataset","index","parseInt","stateController","reloadPage","submitUrlValue","refine_filters_builder","filter_class","blueprint_json","client_id","redirectToStableId","stableId","params","append","allParams","fromEntries","toString","pathname","history","pushState","title","reload","refineStateController","stabilizeFilterController","submitUrl","useClickOutside","boundHandleKeyUp","handleKeyUp","bind","addEventListener","disconnect","removeEventListener","show","preventDefault","frameTarget","src","srcValue","isOpenValue","hide","innerHTML","clickOutside","targets","isOpen","type","Boolean","default","_class","submitFilter","activeElement","blur","querySelector","loadResults","detail","console","log","Turbo","visit","href","CustomEvent","bubbles","cancelable","undefined","evt","createEvent","initCustomEvent","prototype","Event","blueprintUpdatedEvent","dispatchEvent","id","depth","condition","_clauses$","component","meta","clauses","refinements","selected","newInput","clause","forEach","refinement","condition_id","changeDelegate","delegate","blueprintValue","conditions","conditionsValue","classNameValue","conditionsLookup","reduce","lookup","loadingTimeout","abnegate","clearTimeout","setTimeout","loadingTarget","classList","remove","add","conditionConfigFor","conditionId","find","c","defaultConditionIdValue","length","push","word","splice","previous","next","previousIsOr","nextIsRightParen","previousIsLeftParen","isLastInGroup","replaceCriterion","criterionRow","Error","existingCriterion","newCriterion","isEqual","inputId","blueprintPath","split","Array","className","refreshUrl","clientId","validateBlueprintUrl","defaultConditionId","stateDomIdValue","blueprintFieldTarget","value","updateBlueprintField","stateDomId","submit","toggle","contentTargets","node","toggleAttribute","TurboStreamFormController","method","action","turboMethod","filter","toLowerCase","visibleCategories","Set","listItemTargets","listItemNode","listItemValue","includes","hidden","category","categoryTargets","categoryNode","has","initialize","updateBlueprint","debounce","inputKey","refinedFilter","target","select","slice","call","option","map","newConditionId","config","cancelEnter","code","stopPropagation","require","initPluginInstance","teardownPluginInstance","clearDate","$","fieldTarget","val","dispatch","applyDateToField","picker","format","includeTimeValue","timeFormatValue","dateFormatValue","momentVal","moment","startDate","toISOString","displayVal","dataVal","hiddenFieldTarget","trigger","localeValues","pickerLocaleValue","isAmPm","isAmPmValue","daterangepicker","singleDatePicker","timePicker","timePickerIncrement","autoUpdateInput","autoApply","minDate","futureOnlyValue","Date","locale","parentEl","drops","dropsValue","timePicker24Hour","on","showCalendar","pluginMainEl","plugin","data","inlineValue","off","includeTime","futureOnly","inline","dateFormat","timeFormat","datetimeFormat","pickerLocale","controllerDefinitions","AddController","CriterionFormController","DefaultsController","DeleteController","FilterPillsController","PopupController","SearchFilterController","StateController","StoredFilterController","SubmitForm","ToggleController","TurboStreamLinkController","TypeaheadListController","UpdateController","DateController","d","identifier","controllerConstructor"],"mappings":"wUAqBA,SAASA,EAAwBC,GAC7B,MAAMC,GAAeD,EAAIE,MAAM,2CAA6C,IAAI,GAChF,GAAID,EACA,OAAOA,EAAYE,QAAQ,KAAM,KAAKA,QAAQ,MAAO,MCnBhCC,MAAAA,UAAAA,EAC3BC,UACEC,KAAKC,MAAMC,eAGTD,YACF,IAAIE,EAAiBH,KAAKI,QAE1B,KAAMD,IAAmBE,SAASC,MAAM,CACtC,GAAIH,EAAeI,QAAQ,sCACzB,OAAYC,KAAAA,YAAYC,qCAAqCN,EAAgB,iBAE7EA,EAAiBA,EAAeO,WAIpC,OACD,KAEsBC,wBAACC,EAAU,IAChC,MAAMC,cAAEA,GAAkBD,EAC1BZ,KAAKC,MAAMa,cACX,MAAMC,EAAU,IAAIC,EAClB,MACAhB,KAAKC,MAAMgB,gBACX,CACEC,aAAc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,EAAErP,KAAK2R,cAAcI,IAAI,gCAGzB/R,KAAK4R,OAAOtH,UAIdoH,eACE1R,KAAKwP,SAAS,oBApGT3I,QAAU,CACf,QACA,cACA,eAGKzE,EAAAA,OAAS,CACd4P,YAAahL,QACbiL,WAAYjL,QACZsK,MAAOvO,OACPmP,OAAQlL,QACRmL,WAAYpP,OACZqP,WAAYrP,OACZ0N,OAAQzJ,QACRoK,OAAQ,CAAErK,KAAMhE,OAAQkE,QAAS,MACjCoL,eAAgB,CAAEtL,KAAMhE,OAAQkE,QAAU,qBAC1CqL,aAAc,CAAEvL,KAAMvD,OAAQyD,QAAS,KCL9BsL,MAAAA,EAAwB,CACnC,CAACC,EAAe,4BAChB,CAACC,EAAyB,uCAC1B,CAACC,EAAoB,iCACrB,CAACC,EAAkB,+BACnB,CAACC,EAAuB,qCACxB,CAACC,EAAiB,8BAClB,CAACC,EAAwB,sCACzB,CAACnR,EAAyB,uCAC1B,CAACoR,EAAiB,8BAClB,CAACC,EAAwB,sCACzB,CAACC,EAAY,oCACb,CAACC,EAAkB,+BACnB,CAAClG,EAA2B,0CAC5B,CAACmG,EAA2B,0CAC5B,CAACC,EAAyB,yCAC1B,CAACC,EAAkB,+BACnB,CAACC,EAAgB,8BACjB3E,IAAI,SAAS4E,GACb,MACMlQ,EAAakQ,EAAE,GACrB,MAAO,CACLC,WAAY/T,EAHF8T,EAAE,IAIZE,sBAAuBpQ"}
|
1
|
+
{"version":3,"file":"refine-stimulus.modern.js","sources":["../../../node_modules/@hotwired/stimulus-webpack-helpers/dist/stimulus-webpack-helpers.js","../../javascript/controllers/refine/server-refresh-controller.js","../../javascript/controllers/refine/add-controller.js","../../javascript/controllers/refine/criterion-form-controller.js","../../javascript/controllers/refine/defaults-controller.js","../../javascript/controllers/refine/delete-controller.js","../../javascript/controllers/refine/filter-pills-controller.js","../../javascript/controllers/refine/popup-controller.js","../../javascript/controllers/refine/search-filter-controller.js","../../javascript/refine/helpers/index.js","../../javascript/controllers/refine/state-controller.js","../../javascript/controllers/refine/stored-filter-controller.js","../../javascript/controllers/refine/submit-form-controller.js","../../javascript/controllers/refine/toggle-controller.js","../../javascript/controllers/refine/turbo-stream-form-controller.js","../../javascript/controllers/refine/turbo-stream-link-controller.js","../../javascript/controllers/refine/typeahead-list-controller.js","../../javascript/controllers/refine/update-controller.js","../../javascript/controllers/refine/date-controller.js","../../javascript/controllers/refine/clear-criteria-controller.js","../../javascript/controllers/index.js"],"sourcesContent":["/*\nStimulus Webpack Helpers 1.0.0\nCopyright © 2021 Basecamp, LLC\n */\nfunction definitionsFromContext(context) {\n return context.keys()\n .map((key) => definitionForModuleWithContextAndKey(context, key))\n .filter((value) => value);\n}\nfunction definitionForModuleWithContextAndKey(context, key) {\n const identifier = identifierForContextKey(key);\n if (identifier) {\n return definitionForModuleAndIdentifier(context(key), identifier);\n }\n}\nfunction definitionForModuleAndIdentifier(module, identifier) {\n const controllerConstructor = module.default;\n if (typeof controllerConstructor == \"function\") {\n return { identifier, controllerConstructor };\n }\n}\nfunction identifierForContextKey(key) {\n const logicalName = (key.match(/^(?:\\.\\/)?(.+)(?:[_-]controller\\..+?)$/) || [])[1];\n if (logicalName) {\n return logicalName.replace(/_/g, \"-\").replace(/\\//g, \"--\");\n }\n}\n\nexport { definitionForModuleAndIdentifier, definitionForModuleWithContextAndKey, definitionsFromContext, identifierForContextKey };\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\n\n// Base class for controllers that reload form content from the server\nexport default class extends Controller {\n connect() {\n this.state.finishUpdate()\n }\n\n get state() {\n let currentElement = this.element\n\n while(currentElement !== document.body) {\n if (currentElement.matches('[data-controller~=\"refine--state\"]'))\n return this.application.getControllerForElementAndIdentifier(currentElement, 'refine--state')\n else {\n currentElement = currentElement.parentNode\n }\n }\n\n return null\n }\n\n async refreshFromServer(options = {}) {\n const { includeErrors } = options\n this.state.startUpdate()\n const request = new FetchRequest(\n \"GET\",\n this.state.refreshUrlValue,\n {\n responseKind: \"turbo-stream\",\n query: {\n \"refine_filters_builder[filter_class]\": this.state.filterName,\n \"refine_filters_builder[blueprint_json]\": JSON.stringify(this.state.blueprint),\n \"refine_filters_builder[client_id]\": this.state.clientIdValue,\n include_errors: !!includeErrors\n }\n }\n )\n await request.perform()\n }\n}\n","import ServerRefreshController from './server-refresh-controller'\nimport { FetchRequest } from '@rails/request.js'\n\nexport default class extends ServerRefreshController {\n static values = {\n previousCriterionId: Number,\n }\n\n async criterion() {\n const isValid = await this.validateBlueprint()\n if (isValid) {\n this.state.addCriterion(this.previousCriterionIdValue)\n }\n this.refreshFromServer({includeErrors: !isValid})\n }\n\n async group() {\n const isValid = await this.validateBlueprint()\n if (isValid) {\n this.state.addGroup()\n }\n this.refreshFromServer({includeErrors: !isValid})\n }\n\n async validateBlueprint(blueprint) {\n const { state } = this\n\n const request = new FetchRequest(\n \"GET\",\n this.state.validateBlueprintUrlValue,\n {\n query: {\n \"refine_filters_builder[filter_class]\": this.state.filterName,\n \"refine_filters_builder[blueprint_json]\": JSON.stringify(this.state.blueprint),\n \"refine_filters_builder[client_id]\": this.state.clientIdValue\n }\n }\n )\n const response = await request.perform()\n return response.ok\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\n/*\n This controller handles criteria forms\n (refine/inline/criteria/new|edit)\n*/\nexport default class extends Controller {\n static values = {\n url: String,\n formId: String\n }\n\n async refresh(_event) {\n // update the url with params from the form\n const formElement = document.getElementById(this.formIdValue)\n const formData = new FormData(formElement)\n console.log(\"in criterion-form refresh event\")\n console.log(this)\n console.log(formData)\n\n const request = new FetchRequest(\n \"GET\",\n this.urlValue,\n {\n query: formData,\n responseKind: \"turbo-stream\"\n }\n )\n const response = await request.perform()\n }\n\n\n\n}\n","import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n static values = {\n criterionId: Number,\n input: Object,\n };\n\n connect() {\n this.state = this.getStateController()\n\n this.state.updateInput(\n this.criterionIdValue,\n this.inputValue,\n );\n }\n\n getStateController() {\n let currentElement = this.element\n\n while(currentElement !== document.body) {\n const controller = this.application.getControllerForElementAndIdentifier(currentElement, 'refine--state')\n if (controller) {\n return controller\n } else {\n currentElement = currentElement.parentNode\n }\n }\n\n return null\n }\n}\n","import ServerRefreshController from './server-refresh-controller';\n\nexport default class extends ServerRefreshController {\n static values = {\n criterionId: Number,\n }\n\n criterion() {\n const { state, criterionIdValue } = this;\n state.deleteCriterion(criterionIdValue);\n this.refreshFromServer()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\nexport default class extends Controller {\n static values = {\n submitUrl: String\n }\n\n connect() {\n const urlParams = new URLSearchParams(window.location.search)\n this.existingParams = urlParams\n this.existingParams.delete('stable_id')\n }\n\n delete(event) {\n const { criterionId } = event.currentTarget.dataset\n var index = parseInt(criterionId)\n this.stateController.deleteCriterion(index)\n this.reloadPage()\n }\n\n async reloadPage() {\n const {blueprint} = this.stateController\n const request = new FetchRequest(\n \"POST\",\n this.submitUrlValue,\n {\n responseKind: \"turbo-stream\",\n body: JSON.stringify({\n refine_filters_builder: {\n filter_class: this.stateController.filterName,\n blueprint_json: JSON.stringify(blueprint),\n client_id: this.stateController.clientIdValue\n }\n })\n }\n )\n await request.perform()\n }\n\n redirectToStableId(stableId) {\n const params = new URLSearchParams()\n if (stableId) {\n params.append('stable_id', stableId)\n }\n const allParams = new URLSearchParams({\n ...Object.fromEntries(this.existingParams),\n ...Object.fromEntries(params),\n }).toString()\n const url = `${window.location.pathname}?${allParams}`\n\n history.pushState({}, document.title, url)\n window.location.reload()\n }\n\n get stateController() {\n return this.element.refineStateController\n }\n\n get stabilizeFilterController() {\n return this.element.stabilizeFilterController\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { useClickOutside } from 'stimulus-use'\n\n// simple controller to hide/show the filter modal\nexport default class extends Controller {\n static targets = [\"frame\"]\n\n static values = {\n src: String,\n isOpen: {type: Boolean, default: false}\n }\n\n connect() {\n useClickOutside(this)\n this.boundHandleKeyUp = this.handleKeyUp.bind(this)\n document.addEventListener(\"keyup\", this.boundHandleKeyUp)\n }\n\n disconnect() {\n document.removeEventListener(\"keyup\", this.boundHandleKeyUp)\n }\n\n show(event) {\n console.log(\"In Popup Show\")\n event.preventDefault()\n this.frameTarget.src = this.srcValue;\n this.isOpenValue = true\n }\n\n hide(event) {\n if (this.isOpenValue) {\n event?.preventDefault()\n this.frameTarget.innerHTML = \"\";\n this.isOpenValue = false\n }\n }\n\n clickOutside(event) {\n this.hide(event)\n }\n\n handleKeyUp(event) {\n if (event.key === \"Escape\" || event.key === \"Esc\") {\n this.hide(event)\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\nexport default class extends Controller {\n static values = {\n submitUrl: String\n }\n\n\n search(event) {\n event.preventDefault()\n this.submitFilter()\n document.activeElement.blur()\n }\n\n async submitFilter() {\n const {blueprint} = this.stateController\n const request = new FetchRequest(\n \"POST\",\n this.submitUrlValue,\n {\n responseKind: \"turbo-stream\",\n body: JSON.stringify({\n refine_filters_builder: {\n filter_class: this.stateController.filterName,\n blueprint_json: JSON.stringify(blueprint),\n client_id: this.stateController.clientIdValue\n }\n })\n }\n )\n await request.perform()\n }\n\n get stateController() {\n return this\n .element\n .querySelector('[data-controller~=\"refine--state\"]')\n .refineStateController\n }\n\n loadResults({detail: {url}}) {\n console.log(\"filter submit success\")\n if (window.Turbo) {\n window.Turbo.visit(url)\n } else {\n window.location.href = url\n }\n }\n}\n","// Polyfill for custom events in IE9-11\n// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#polyfill\n;(function () {\n if (typeof window.CustomEvent === 'function') return false\n\n function CustomEvent(event, params) {\n params = params || { bubbles: false, cancelable: false, detail: undefined }\n var evt = document.createEvent('CustomEvent')\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail)\n return evt\n }\n\n CustomEvent.prototype = window.Event.prototype\n\n window.CustomEvent = CustomEvent\n\n // eslint expects a return here\n return true\n})()\n\nexport const filterStabilizedEvent = (element, stableId, filterName) => {\n const event = new CustomEvent('filter-stabilized', {\n bubbles: true,\n cancelable: true,\n detail: {\n stableId,\n filterName,\n },\n })\n element.dispatchEvent(event)\n}\n\nexport const filterUnstableEvent = (blueprint) => {\n const event = new CustomEvent('filter-unstable', {\n bubbles: true,\n cancelable: true,\n detail: {\n blueprint,\n },\n })\n window.dispatchEvent(event)\n}\n\nexport const filterInvalidEvent = ({blueprint, errors}) => {\n const event = new CustomEvent('filter-invalid', {\n bubbles: true,\n cancelable: true,\n detail: {\n blueprint,\n errors,\n },\n })\n window.dispatchEvent(event)\n}\n\nexport const filterStoredEvent = (storedFilterId) => {\n const event = new CustomEvent('filter-stored', {\n bubbles: true,\n cancelable: true,\n detail: {\n storedFilterId,\n },\n })\n window.dispatchEvent(event)\n}\n\nexport const blueprintUpdatedEvent = (element, {blueprint, formId}) => {\n const event = new CustomEvent('blueprint-updated', {\n bubbles: true,\n cancelable: true,\n detail: {\n blueprint,\n formId\n },\n })\n element.dispatchEvent(event)\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { delegate, abnegate } from 'jquery-events-to-dom-events'\nimport { blueprintUpdatedEvent } from '../../refine/helpers'\nimport { isEqual } from 'lodash'\n\nconst criterion = (id, depth, condition) => {\n const component = condition?.component\n const meta = condition?.meta || { clauses: [], options: {}}\n const refinements = condition?.refinements || []\n const { clauses, options } = meta\n let selected\n if (component === 'option-condition') {\n selected = options[0] ? [options[0].id] : []\n } else {\n selected = undefined\n }\n // Set newInput based on component\n\n let newInput = {\n clause: clauses[0]?.id,\n selected: selected,\n }\n\n // If refinements are present, add to input array\n refinements.forEach((refinement) => {\n const { meta, component } = refinement\n const { clauses, options } = meta\n let selected\n if (component === 'option-condition') {\n selected = options[0] ? [options[0].id] : []\n } else {\n selected = undefined\n }\n newInput[refinement.id] = {\n clause: clauses[0].id,\n selected: selected,\n }\n })\n\n return {\n depth,\n type: 'criterion',\n condition_id: id,\n input: newInput,\n }\n}\n\nconst or = function (depth) {\n depth = depth === undefined ? 0 : depth\n return {\n depth,\n type: 'conjunction',\n word: 'or',\n }\n}\n\nconst and = function (depth) {\n depth = depth === undefined ? 1 : depth\n return {\n depth,\n type: 'conjunction',\n word: 'and',\n }\n}\nexport default class extends Controller {\n static values = {\n blueprint: Array,\n conditions: Array,\n className: String,\n refreshUrl: String,\n clientId: String,\n validateBlueprintUrl: String,\n defaultConditionId: String\n }\n static targets = ['loading']\n\n\n connect() {\n // for select2 jquery events and datepicker\n this.element.refineStateController = this\n this.changeDelegate = delegate('change', ['event', 'picker'])\n this.blueprint = this.blueprintValue\n this.conditions = this.conditionsValue\n this.filterName = this.classNameValue\n this.conditionsLookup = this.conditions.reduce((lookup, condition) => {\n lookup[condition.id] = condition\n return lookup\n }, {})\n this.loadingTimeout = null\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n disconnect() {\n abnegate('change', this.changeDelegate)\n }\n\n startUpdate() {\n if (this.loadingTimeout) {\n window.clearTimeout(this.loadingTimeout)\n }\n // only show the loading overlay if it's taking a long time\n // to render the updates\n this.loadingTimeout = window.setTimeout(() => {\n this.loadingTarget.classList.remove('hidden')\n }, 1000)\n }\n\n finishUpdate() {\n if (this.loadingTimeout) {\n window.clearTimeout(this.loadingTimeout)\n }\n this.loadingTarget.classList.add('hidden')\n }\n\n conditionConfigFor(conditionId) {\n return this.conditionsLookup[conditionId]\n }\n\n addGroup() {\n const { blueprint, conditions } = this\n const condition = ( conditions.find(c => c.id == this.defaultConditionIdValue) || conditions[0] )\n const { meta } = condition\n\n if (this.blueprint.length > 0) {\n this.blueprint.push(or())\n }\n this.blueprint.push(criterion(condition.id, 1, condition))\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n addCriterion(previousCriterionId) {\n console.log(\"Add criteria\")\n const { blueprint, conditions } = this\n const condition = ( conditions.find(c => c.id == this.defaultConditionIdValue) || conditions[0] )\n const { meta } = condition\n blueprint.splice(previousCriterionId + 1, 0, and(), criterion(condition.id, 1, condition))\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n deleteCriterion(criterionId) {\n /**\n To support 'groups' there is some complicated logic for deleting criterion.\n\n Imagine this simplified blueprint: [eq, and, sw, or, eq]\n\n User clicks to delete the last eq. We also have to delete the preceding or\n otherwise we're left with a hanging empty group\n\n What if the user deletes the sw? We have to clean up the preceding and.\n\n Imagine another scenario: [eq or sw and ew]\n Now we delete the first eq but this time we need to clean up the or.\n\n These conditionals cover these cases.\n **/\n const { blueprint } = this\n const previous = blueprint[criterionId - 1]\n const next = blueprint[criterionId + 1]\n\n const nextIsOr = next && next.word === 'or'\n const previousIsOr = previous && previous.word === 'or'\n\n const nextIsRightParen = nextIsOr || !next\n const previousIsLeftParen = previousIsOr || !previous\n\n const isFirstInGroup = previousIsLeftParen && !nextIsRightParen\n const isLastInGroup = previousIsLeftParen && nextIsRightParen\n const isLastCriterion = !previous && !next\n\n if (isLastCriterion) {\n this.blueprint = []\n } else if (isLastInGroup && previousIsOr) {\n blueprint.splice(criterionId - 1, 2)\n } else if (isLastInGroup && !previous) {\n blueprint.splice(criterionId, 2)\n } else if (isFirstInGroup) {\n blueprint.splice(criterionId, 2)\n } else {\n blueprint.splice(criterionId - 1, 2)\n }\n\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n /*\n Updates a criterion in the blueprint\n Returns true if an update was actually performed, or false if no-op\n */\n replaceCriterion(criterionId, conditionId, condition) {\n const criterionRow = this.blueprint[criterionId]\n if (criterionRow.type !== 'criterion') {\n throw new Error(\n `You can't call updateConditionId on a non-criterion type. Trying to update ${JSON.stringify(criterion)}`\n )\n }\n const existingCriterion = this.blueprint[criterionId]\n const newCriterion = criterion(conditionId, criterionRow.depth, condition)\n if (isEqual(existingCriterion, newCriterion)) {\n return false\n } else {\n this.blueprint[criterionId] = newCriterion\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n return true\n }\n }\n\n updateInput(criterionId, input, inputId) {\n // Input id is an array of hash keys that define the path for this input such as [\"input\", \"date_refinement\"]\n const { blueprint } = this\n const criterion = blueprint[criterionId]\n inputId = inputId || 'input'\n const blueprintPath = inputId.split(', ')\n // If the inputId contains more than one element, add input at appropriate depth\n if (blueprintPath.length > 1) {\n criterion[blueprintPath[0]][blueprintPath[1]] = { ...criterion[blueprintPath[0]][blueprintPath[1]], ...input }\n } else {\n criterion[inputId] = { ...criterion[inputId], ...input }\n }\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n clearCriteria() {\n console.log(\"In clearCriteria\")\n blueprintUpdatedEvent(this.element, {blueprint: [], formId: this.formIdValue})\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { filterStoredEvent } from '../../refine/helpers'\n\nexport default class extends Controller {\n static targets = ['blueprintField']\n static values = { formId: String, stateDomId: String }\n\n connect() {\n const stateController = document\n .getElementById(this.stateDomIdValue)\n .refineStateController\n this.blueprintFieldTarget.value = JSON.stringify(stateController.blueprint)\n console.log(\"connect\", this.blueprintFieldTarget.value)\n }\n\n updateBlueprintField(event) {\n if (event.detail.formId != this.formIdValue) { return null }\n const { detail } = event\n const { blueprint } = detail\n this.blueprintFieldTarget.value = JSON.stringify(blueprint)\n console.log(\"update blueprint\", this.blueprintFieldTarget.value)\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n submit(event) {\n event.preventDefault()\n this.element.submit()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\n\n// simple controller to hide/show the filter modal\nexport default class extends Controller {\n static targets = [\"content\"]\n\n toggle(_event) {\n this.contentTargets.forEach(node => {\n node.toggleAttribute(\"hidden\")\n })\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\n/*\n attach to a form element to have it submit to a turbo-stream endpoint\n\n <form action=\"/contacts\" data-controller=\"refine--turbo-stream-form\" data-action=\"submit->refine--turbo-stream-form#submit\">\n\n Turbo is supposed to handle this natively but we're seeing issues when the form is inside an iframe\n*/\nexport default class extends Controller {\n async submit(event) {\n event.preventDefault()\n const request = new FetchRequest(\n (this.element.method || \"POST\"),\n this.element.action,\n {\n responseKind: \"turbo-stream\",\n body: new FormData(this.element)\n }\n )\n await request.perform()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\n/*\n attach to a link element to have it request turbo stream responses\n\n <a href=\"/contacts\" data-controller=\"refine--turbo-stream-link\" data-action=\"refine--turbo-stream-link#get\">Click me</a>\n\n Turbo is supposed to handle this natively with data-turbo-stream but we're\n seeing issues using that attribute inside iframes\n*/\nexport default class extends Controller {\n async visit(event) {\n event.preventDefault()\n const request = new FetchRequest(\n (this.element.dataset.turboMethod || \"GET\"),\n this.element.href,\n {\n responseKind: \"turbo-stream\",\n }\n )\n await request.perform()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n\n static targets = ['listItem', 'category']\n\n filter(event) {\n const query = event.currentTarget.value.toLowerCase()\n const visibleCategories = new Set()\n\n // hide / show listItem links that match the query and note which\n // categories should be visible\n this.listItemTargets.forEach(listItemNode => {\n const listItemName = listItemNode.dataset.listItemValue.toLowerCase()\n if (listItemName.includes(query)) {\n listItemNode.hidden = false\n visibleCategories.add(listItemNode.dataset.category)\n } else {\n listItemNode.hidden = true\n }\n })\n\n // hide / show category headers that have\n this.categoryTargets.forEach(categoryNode => {\n const categoryName = categoryNode.innerHTML\n if (visibleCategories.has(categoryName)) {\n categoryNode.hidden = false\n } else {\n categoryNode.hidden = true\n }\n })\n }\n}\n","import ServerRefreshController from './server-refresh-controller'\nimport { debounce } from 'lodash'\n\nexport default class extends ServerRefreshController {\n static values = {\n criterionId: Number,\n }\n\n initialize() {\n this.updateBlueprint = debounce((event, value, inputKey) => {\n this.value(event, value, inputKey)\n }, 500)\n }\n\n refinedFilter(event) {\n const { criterionIdValue, state } = this\n const dataset = event.target.dataset\n const inputId = dataset.inputId\n\n state.updateInput(\n criterionIdValue,\n {\n id: event.target.value,\n },\n inputId\n )\n this.refreshFromServer()\n }\n\n clause(event) {\n const { criterionIdValue, state } = this\n const dataset = event.target.dataset\n const inputId = dataset.inputId\n state.updateInput(\n criterionIdValue,\n {\n clause: event.target.value,\n },\n inputId\n )\n this.refreshFromServer()\n }\n\n selected(event) {\n const { target: select } = event\n const options = Array.prototype.slice.call(select.options)\n const selectedOptions = options.filter((option) => option.selected)\n const selected = selectedOptions.map((option) => option.value)\n this.value(event, selected, 'selected')\n }\n\n value(event, value, inputKey) {\n const { criterionIdValue, state } = this\n const dataset = event.target.dataset\n const inputId = dataset.inputId\n inputKey = inputKey || dataset.inputKey || 'value'\n value = value || event.target.value\n state.updateInput(\n criterionIdValue,\n {\n [inputKey]: value,\n },\n inputId\n )\n }\n\n condition(event) {\n const { criterionIdValue, state } = this\n const element = event.target\n let newConditionId = element.value\n if (!newConditionId) newConditionId = element.querySelector('select').value \n const config = this.state.conditionConfigFor(newConditionId)\n const updatePerformed = state.replaceCriterion(criterionIdValue, newConditionId, config)\n if (updatePerformed) {\n this.refreshFromServer()\n }\n }\n\n // Prevent form submission when hitting enter in a text box\n cancelEnter(event) {\n if (event.code === \"Enter\") {\n event.preventDefault()\n event.stopPropagation()\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport moment from 'moment'\nrequire('daterangepicker/daterangepicker.css')\n\n// requires jQuery, moment, might want to consider a vanilla JS alternative\nimport $ from 'jquery' // ensure jquery is loaded before daterangepicker\nimport 'daterangepicker'\n\nexport default class extends Controller {\n static targets = [\n 'field',\n 'hiddenField',\n 'clearButton',\n ]\n\n static values = {\n includeTime: Boolean,\n futureOnly: Boolean,\n drops: String,\n inline: Boolean,\n dateFormat: String,\n timeFormat: String,\n isAmPm: Boolean,\n locale: { type: String, default: 'en' },\n datetimeFormat: { type: String, default: 'MM/DD/YYYY h:mm A' },\n pickerLocale: { type: Object, default: {} },\n }\n\n connect() {\n this.initPluginInstance()\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n clearDate(event) {\n // don't submit the form, unless it originated from the cancel/clear button\n event.preventDefault()\n\n window.$(this.fieldTarget).val('')\n\n this.dispatch('value-cleared')\n }\n\n applyDateToField(event, picker) {\n const format = this.includeTimeValue ? this.timeFormatValue : this.dateFormatValue\n\n const momentVal = picker\n ? moment(picker.startDate.toISOString())\n : moment(this.fieldTarget.value, 'YYYY-MM-DDTHH:mm').format('YYYY-MM-DDTHH:mm')\n const displayVal = momentVal.format(format)\n const dataVal = this.includeTimeValue ? momentVal.toISOString(true) : momentVal.format('YYYY-MM-DD')\n\n this.fieldTarget.value = displayVal\n this.hiddenFieldTarget.value = dataVal\n // bubble up a change event when the input is updated for other listeners\n window.$(this.fieldTarget).trigger('change', picker)\n\n // emit native change event\n this.hiddenFieldTarget.dispatchEvent(new Event('change', { detail: picker, bubbles: true }))\n }\n\n initPluginInstance() {\n const localeValues = this.pickerLocaleValue\n const isAmPm = this.isAmPmValue\n localeValues['format'] = this.includeTimeValue ? this.timeFormatValue : this.dateFormatValue\n\n window.$(this.fieldTarget).daterangepicker({\n singleDatePicker: true,\n timePicker: this.includeTimeValue,\n timePickerIncrement: 5,\n autoUpdateInput: false,\n autoApply: true,\n minDate: this.futureOnlyValue ? new Date() : false,\n locale: localeValues,\n parentEl: $(this.element),\n drops: this.dropsValue ? this.dropsValue : 'down',\n timePicker24Hour: !isAmPm,\n })\n\n window.$(this.fieldTarget).on('apply.daterangepicker', this.applyDateToField.bind(this))\n window.$(this.fieldTarget).on('cancel.daterangepicker', this.clearDate.bind(this))\n window.$(this.fieldTarget).on('showCalendar.daterangepicker', this.showCalendar.bind(this))\n\n this.pluginMainEl = this.fieldTarget\n this.plugin = $(this.pluginMainEl).data('daterangepicker') // weird\n\n if (this.inlineValue) {\n this.element.classList.add('date-input--inline')\n }\n\n }\n \n teardownPluginInstance() {\n if (this.plugin === undefined) {\n return\n }\n\n $(this.pluginMainEl).off('apply.daterangepicker')\n $(this.pluginMainEl).off('cancel.daterangepicker')\n $(this.pluginMainEl).off('showCalendar.daterangepicker')\n\n // revert to original markup, remove any event listeners\n this.plugin.remove()\n\n }\n\n showCalendar() {\n this.dispatch('show-calendar')\n }\n\n}\n","// import ServerRefreshController from './server-refresh-controller';\nimport { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n clear() {\n console.log(\"Clearing criteria\")\n const { state } = this;\n state.clearCriteria();\n this.refreshFromServer()\n }\n}\n","import { identifierForContextKey } from \"@hotwired/stimulus-webpack-helpers\"\n\nimport AddController from './refine/add-controller'\nimport CriterionFormController from './refine/criterion-form-controller'\nimport DefaultsController from './refine/defaults-controller'\nimport DeleteController from './refine/delete-controller'\nimport FilterPillsController from './refine/filter-pills-controller'\nimport PopupController from './refine/popup-controller'\nimport SearchFilterController from './refine/search-filter-controller'\nimport ServerRefreshController from './refine/server-refresh-controller'\nimport StateController from './refine/state-controller'\nimport StoredFilterController from './refine/stored-filter-controller'\nimport SubmitForm from './refine/submit-form-controller'\nimport ToggleController from './refine/toggle-controller'\nimport TurboStreamFormController from './refine/turbo-stream-form-controller'\nimport TurboStreamLinkController from './refine/turbo-stream-link-controller'\nimport TypeaheadListController from './refine/typeahead-list-controller'\nimport UpdateController from './refine/update-controller'\nimport DateController from './refine/date-controller'\nimport ClearCriteriaController from \"./refine/clear-criteria-controller\"\n\nexport const controllerDefinitions = [\n [AddController, 'refine/add-controller.js'],\n [CriterionFormController, 'refine/criterion-form-controller.js'],\n [DefaultsController, 'refine/defaults-controller.js'],\n [DeleteController, 'refine/delete-controller.js'],\n [FilterPillsController, 'refine/filter-pills-controller.js'],\n [PopupController, 'refine/popup-controller.js'],\n [SearchFilterController, 'refine/search-filter-controller.js'],\n [ServerRefreshController, 'refine/server-refresh-controller.js'],\n [StateController, 'refine/state-controller.js'],\n [StoredFilterController, 'refine/stored-filter-controller.js'],\n [SubmitForm, 'refine/submit-form-controller.js'],\n [ToggleController, 'refine/toggle-controller.js'],\n [TurboStreamFormController, 'refine/turbo-stream-form-controller.js'],\n [TurboStreamLinkController, 'refine/turbo-stream-link-controller.js'],\n [TypeaheadListController, './refine/typeahead-list-controller.js'],\n [UpdateController, 'refine/update-controller.js'],\n [DateController, 'refine/date-controller.js'],\n [ClearCriteriaController, 'refine/clear-criteria-controller.js']\n].map(function(d) {\n const key = d[1]\n const controller = d[0]\n return {\n identifier: identifierForContextKey(key),\n controllerConstructor: controller\n }\n})\n\nexport {\n AddController,\n CriterionFormController,\n DefaultsController,\n DeleteController,\n FilterPillsController,\n PopupController,\n SearchFilterController,\n ServerRefreshController,\n StateController,\n StoredFilterController,\n SubmitForm,\n ToggleController,\n TurboStreamFormController,\n TurboStreamLinkController,\n TypeaheadListController,\n UpdateController,\n DateController,\n ClearCriteriaController\n}\n"],"names":["identifierForContextKey","key","logicalName","match","replace","Controller","connect","this","state","finishUpdate","currentElement","element","document","body","matches","application","getControllerForElementAndIdentifier","parentNode","async","options","includeErrors","startUpdate","request","FetchRequest","refreshUrlValue","responseKind","query","filterName","JSON","stringify","blueprint","clientIdValue","include_errors","perform","ServerRefreshController","isValid","validateBlueprint","addCriterion","previousCriterionIdValue","refreshFromServer","addGroup","validateBlueprintUrlValue","ok","values","previousCriterionId","Number","_event","formElement","getElementById","formIdValue","formData","FormData","console","log","urlValue","url","String","formId","getStateController","updateInput","criterionIdValue","inputValue","controller","criterionId","input","Object","criterion","deleteCriterion","urlParams","URLSearchParams","window","location","search","existingParams","delete","event","currentTarget","dataset","index","parseInt","stateController","reloadPage","submitUrlValue","refine_filters_builder","filter_class","blueprint_json","client_id","redirectToStableId","stableId","params","append","allParams","fromEntries","toString","pathname","history","pushState","title","reload","refineStateController","stabilizeFilterController","submitUrl","_class","useClickOutside","boundHandleKeyUp","handleKeyUp","bind","addEventListener","disconnect","removeEventListener","show","preventDefault","frameTarget","src","srcValue","isOpenValue","hide","innerHTML","clickOutside","targets","isOpen","type","Boolean","default","submitFilter","activeElement","blur","querySelector","loadResults","detail","Turbo","visit","href","CustomEvent","bubbles","cancelable","undefined","evt","createEvent","initCustomEvent","prototype","Event","blueprintUpdatedEvent","dispatchEvent","id","depth","condition","_clauses$","component","meta","clauses","refinements","selected","newInput","clause","forEach","refinement","condition_id","changeDelegate","delegate","blueprintValue","conditions","conditionsValue","classNameValue","conditionsLookup","reduce","lookup","loadingTimeout","abnegate","clearTimeout","setTimeout","loadingTarget","classList","remove","add","conditionConfigFor","conditionId","find","c","defaultConditionIdValue","length","push","word","splice","previous","next","previousIsOr","nextIsRightParen","previousIsLeftParen","isLastInGroup","replaceCriterion","criterionRow","Error","existingCriterion","newCriterion","isEqual","inputId","blueprintPath","split","_extends","clearCriteria","Array","className","refreshUrl","clientId","validateBlueprintUrl","defaultConditionId","stateDomIdValue","blueprintFieldTarget","value","updateBlueprintField","stateDomId","submit","toggle","contentTargets","node","toggleAttribute","TurboStreamFormController","method","action","turboMethod","filter","toLowerCase","visibleCategories","Set","listItemTargets","listItemNode","listItemValue","includes","hidden","category","categoryTargets","categoryNode","has","initialize","updateBlueprint","debounce","inputKey","refinedFilter","target","select","slice","call","option","map","newConditionId","config","cancelEnter","code","stopPropagation","require","initPluginInstance","teardownPluginInstance","clearDate","$","fieldTarget","val","dispatch","applyDateToField","picker","format","includeTimeValue","timeFormatValue","dateFormatValue","momentVal","moment","startDate","toISOString","displayVal","dataVal","hiddenFieldTarget","trigger","localeValues","pickerLocaleValue","isAmPm","isAmPmValue","daterangepicker","singleDatePicker","timePicker","timePickerIncrement","autoUpdateInput","autoApply","minDate","futureOnlyValue","Date","locale","parentEl","drops","dropsValue","timePicker24Hour","on","showCalendar","pluginMainEl","plugin","data","inlineValue","off","includeTime","futureOnly","inline","dateFormat","timeFormat","datetimeFormat","pickerLocale","ClearCriteriaController","clear","controllerDefinitions","AddController","CriterionFormController","DefaultsController","DeleteController","FilterPillsController","PopupController","SearchFilterController","StateController","StoredFilterController","SubmitForm","ToggleController","TurboStreamLinkController","TypeaheadListController","UpdateController","DateController","d","identifier","controllerConstructor"],"mappings":"wUAqBA,SAASA,EAAwBC,GAC7B,MAAMC,GAAeD,EAAIE,MAAM,2CAA6C,IAAI,GAChF,GAAID,EACA,OAAOA,EAAYE,QAAQ,KAAM,KAAKA,QAAQ,MAAO,MCnBhCC,MAAAA,UAAAA,EAC3BC,UACEC,KAAKC,MAAMC,eAGTD,YACF,IAAIE,EAAiBH,KAAKI,QAE1B,KAAMD,IAAmBE,SAASC,MAAM,CACtC,GAAIH,EAAeI,QAAQ,sCACzB,OAAYC,KAAAA,YAAYC,qCAAqCN,EAAgB,iBAE7EA,EAAiBA,EAAeO,WAIpC,OACD,KAEsBC,wBAACC,EAAU,IAChC,MAAMC,cAAEA,GAAkBD,EAC1BZ,KAAKC,MAAMa,cACX,MAAMC,EAAU,IAAIC,EAClB,MACAhB,KAAKC,MAAMgB,gBACX,CACEC,aAAc,eACdC,MAAO,CACL,uCAAwCnB,KAAKC,MAAMmB,WACnD,yCAA0CC,KAAKC,UAAUtB,KAAKC,MAAMsB,WACpE,oCAAqCvB,KAAKC,MAAMuB,cAChDC,iBAAkBZ,WAIlBE,EAAQW,WCrCWC,MAAAA,UAAAA,EAKZhB,kBACb,MAAMiB,QAAqBC,KAAAA,oBACvBD,GACF5B,KAAKC,MAAM6B,aAAa9B,KAAK+B,0BAE/B/B,KAAKgC,kBAAkB,CAACnB,eAAgBe,IAG/BjB,cACT,MAAMiB,QAAqBC,KAAAA,oBACvBD,GACF5B,KAAKC,MAAMgC,WAEbjC,KAAKgC,kBAAkB,CAACnB,eAAgBe,IAGnBjB,wBAACY,GAGtB,MAAMR,EAAU,IAAIC,EAClB,MACAhB,KAAKC,MAAMiC,0BACX,CACEf,MAAO,CACL,uCAAwCnB,KAAKC,MAAMmB,WACnD,yCAA0CC,K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AAErL,KAAMjE,OAAQmE,QAAU,qBAC1CoL,aAAc,CAAEtL,KAAMxD,OAAQ0D,QAAS,KCtB5B,MAAAqL,UAAc3S,EAC3B4S,QACE7P,QAAQC,IAAI,qBACZ,MAAM7C,MAAEA,GAAUD,KAClBC,EAAMgM,gBACNjM,KAAKgC,qBCaI2Q,MAAAA,EAAwB,CACnC,CAACC,EAAe,4BAChB,CAACC,EAAyB,uCAC1B,CAACC,EAAoB,iCACrB,CAACC,EAAkB,+BACnB,CAACC,EAAuB,qCACxB,CAACC,EAAiB,8BAClB,CAACC,EAAwB,sCACzB,CAACvR,EAAyB,uCAC1B,CAACwR,EAAiB,8BAClB,CAACC,EAAwB,sCACzB,CAACC,EAAY,oCACb,CAACC,EAAkB,+BACnB,CAACpG,EAA2B,0CAC5B,CAACqG,EAA2B,0CAC5B,CAACC,EAAyB,yCAC1B,CAACC,EAAkB,+BACnB,CAACC,EAAgB,6BACjB,CAACjB,EAAyB,wCAC1B5D,IAAI,SAAS8E,GACb,MACMpQ,EAAaoQ,EAAE,GACrB,MAAO,CACLC,WAAYnU,EAHFkU,EAAE,IAIZE,sBAAuBtQ"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@hotwired/stimulus"),require("@rails/request.js"),require("stimulus-use"),require("jquery-events-to-dom-events"),require("lodash"),require("moment"),require("jquery"),require("daterangepicker")):"function"==typeof define&&define.amd?define(["exports","@hotwired/stimulus","@rails/request.js","stimulus-use","jquery-events-to-dom-events","lodash","moment","jquery","daterangepicker"],t):t((e||self).refineStimulus={},e.Stimulus,e.request_js,e.stimulusUse,e.jqueryEventsToDomEvents,e.lodash,e.moment,e.jquery)}(this,function(e,t,r,i,n,l,o,s){function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(o),d=a(s);function c(e){const t=(e.match(/^(?:\.\/)?(.+)(?:[_-]controller\..+?)$/)||[])[1];if(t)return t.replace(/_/g,"-").replace(/\//g,"--")}class h extends t.Controller{connect(){this.state.finishUpdate()}get state(){let e=this.element;for(;e!==document.body;){if(e.matches('[data-controller~="refine--state"]'))return this.application.getControllerForElementAndIdentifier(e,"refine--state");e=e.parentNode}return null}refreshFromServer(e){void 0===e&&(e={});try{const t=this,{includeErrors:i}=e;t.state.startUpdate();const n=new r.FetchRequest("GET",t.state.refreshUrlValue,{responseKind:"turbo-stream",query:{"refine_filters_builder[filter_class]":t.state.filterName,"refine_filters_builder[blueprint_json]":JSON.stringify(t.state.blueprint),"refine_filters_builder[client_id]":t.state.clientIdValue,include_errors:!!i}});return Promise.resolve(n.perform()).then(function(){})}catch(e){return Promise.reject(e)}}}class p extends h{criterion(){try{const e=this;return Promise.resolve(e.validateBlueprint()).then(function(t){t&&e.state.addCriterion(e.previousCriterionIdValue),e.refreshFromServer({includeErrors:!t})})}catch(e){return Promise.reject(e)}}group(){try{const e=this;return Promise.resolve(e.validateBlueprint()).then(function(t){t&&e.state.addGroup(),e.refreshFromServer({includeErrors:!t})})}catch(e){return Promise.reject(e)}}validateBlueprint(e){try{const e=this,t=new r.FetchRequest("GET",e.state.validateBlueprintUrlValue,{query:{"refine_filters_builder[filter_class]":e.state.filterName,"refine_filters_builder[blueprint_json]":JSON.stringify(e.state.blueprint),"refine_filters_builder[client_id]":e.state.clientIdValue}});return Promise.resolve(t.perform()).then(function(e){return e.ok})}catch(e){return Promise.reject(e)}}}p.values={previousCriterionId:Number};class m extends t.Controller{refresh(e){try{const e=this,t=document.getElementById(e.formIdValue),i=new FormData(t),n=new r.FetchRequest("GET",e.urlValue,{query:i,responseKind:"turbo-stream"});return Promise.resolve(n.perform()).then(function(){})}catch(e){return Promise.reject(e)}}}m.values={url:String,formId:String};class f extends t.Controller{connect(){this.state=this.getStateController(),this.state.updateInput(this.criterionIdValue,this.inputValue)}getStateController(){let e=this.element;for(;e!==document.body;){const t=this.application.getControllerForElementAndIdentifier(e,"refine--state");if(t)return t;e=e.parentNode}return null}}f.values={criterionId:Number,input:Object};class g extends h{criterion(){const{state:e,criterionIdValue:t}=this;e.deleteCriterion(t),this.refreshFromServer()}}g.values={criterionId:Number};class b extends t.Controller{connect(){const e=new URLSearchParams(window.location.search);this.existingParams=e,this.existingParams.delete("stable_id")}delete(e){const{criterionId:t}=e.currentTarget.dataset;var r=parseInt(t);this.stateController.deleteCriterion(r),this.reloadPage()}reloadPage(){try{const e=this,{blueprint:t}=e.stateController,i=new r.FetchRequest("POST",e.submitUrlValue,{responseKind:"turbo-stream",body:JSON.stringify({refine_filters_builder:{filter_class:e.stateController.filterName,blueprint_json:JSON.stringify(t),client_id:e.stateController.clientIdValue}})});return Promise.resolve(i.perform()).then(function(){})}catch(e){return Promise.reject(e)}}redirectToStableId(e){const t=new URLSearchParams;e&&t.append("stable_id",e);const r=new URLSearchParams({...Object.fromEntries(this.existingParams),...Object.fromEntries(t)}).toString(),i=window.location.pathname+"?"+r;history.pushState({},document.title,i),window.location.reload()}get stateController(){return this.element.refineStateController}get stabilizeFilterController(){return this.element.stabilizeFilterController}}b.values={submitUrl:String};class v extends t.Controller{connect(){i.useClickOutside(this),this.boundHandleKeyUp=this.handleKeyUp.bind(this),document.addEventListener("keyup",this.boundHandleKeyUp)}disconnect(){document.removeEventListener("keyup",this.boundHandleKeyUp)}show(e){e.preventDefault(),this.frameTarget.src=this.srcValue,this.isOpenValue=!0}hide(e){this.isOpenValue&&(null==e||e.preventDefault(),this.frameTarget.innerHTML="",this.isOpenValue=!1)}clickOutside(e){this.hide(e)}handleKeyUp(e){"Escape"!==e.key&&"Esc"!==e.key||this.hide(e)}}v.targets=["frame"],v.values={src:String,isOpen:{type:Boolean,default:!1}};class y extends t.Controller{search(e){e.preventDefault(),this.submitFilter(),document.activeElement.blur()}submitFilter(){try{const e=this,{blueprint:t}=e.stateController,i=new r.FetchRequest("POST",e.submitUrlValue,{responseKind:"turbo-stream",body:JSON.stringify({refine_filters_builder:{filter_class:e.stateController.filterName,blueprint_json:JSON.stringify(t),client_id:e.stateController.clientIdValue}})});return Promise.resolve(i.perform()).then(function(){})}catch(e){return Promise.reject(e)}}get stateController(){return this.element.querySelector('[data-controller~="refine--state"]').refineStateController}loadResults(e){let{detail:{url:t}}=e;console.log("filter submit success"),window.Turbo?window.Turbo.visit(t):window.location.href=t}}y.values={submitUrl:String},function(){if("function"==typeof window.CustomEvent)return!1;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r}e.prototype=window.Event.prototype,window.CustomEvent=e}();const C=(e,t)=>{let{blueprint:r,formId:i}=t;const n=new CustomEvent("blueprint-updated",{bubbles:!0,cancelable:!0,detail:{blueprint:r,formId:i}});e.dispatchEvent(n)},w=(e,t,r)=>{var i;const n=null==r?void 0:r.component,l=(null==r?void 0:r.meta)||{clauses:[],options:{}},o=(null==r?void 0:r.refinements)||[],{clauses:s,options:a}=l;let u;u="option-condition"===n?a[0]?[a[0].id]:[]:void 0;let d={clause:null==(i=s[0])?void 0:i.id,selected:u};return o.forEach(e=>{const{meta:t,component:r}=e,{clauses:i,options:n}=t;let l;l="option-condition"===r?n[0]?[n[0].id]:[]:void 0,d[e.id]={clause:i[0].id,selected:l}}),{depth:t,type:"criterion",condition_id:e,input:d}};class I extends t.Controller{connect(){this.element.refineStateController=this,this.changeDelegate=n.delegate("change",["event","picker"]),this.blueprint=this.blueprintValue,this.conditions=this.conditionsValue,this.filterName=this.classNameValue,this.conditionsLookup=this.conditions.reduce((e,t)=>(e[t.id]=t,e),{}),this.loadingTimeout=null,C(this.element,{blueprint:this.blueprint,formId:this.formIdValue})}disconnect(){n.abnegate("change",this.changeDelegate)}startUpdate(){this.loadingTimeout&&window.clearTimeout(this.loadingTimeout),this.loadingTimeout=window.setTimeout(()=>{this.loadingTarget.classList.remove("hidden")},1e3)}finishUpdate(){this.loadingTimeout&&window.clearTimeout(this.loadingTimeout),this.loadingTarget.classList.add("hidden")}conditionConfigFor(e){return this.conditionsLookup[e]}addGroup(){const{conditions:e}=this,t=e.find(e=>e.id==this.defaultConditionIdValue)||e[0];var r;this.blueprint.length>0&&this.blueprint.push({depth:r=void 0===r?0:r,type:"conjunction",word:"or"}),this.blueprint.push(w(t.id,1,t)),C(this.element,{blueprint:this.blueprint,formId:this.formIdValue})}addCriterion(e){const{blueprint:t,conditions:r}=this,i=r.find(e=>e.id==this.defaultConditionIdValue)||r[0];var n;t.splice(e+1,0,{depth:n=void 0===n?1:n,type:"conjunction",word:"and"},w(i.id,1,i)),C(this.element,{blueprint:this.blueprint,formId:this.formIdValue})}deleteCriterion(e){const{blueprint:t}=this,r=t[e-1],i=t[e+1],n=r&&"or"===r.word,l=i&&"or"===i.word||!i,o=n||!r,s=o&&l;r||i?t.splice(s&&n?e-1:s&&!r||o&&!l?e:e-1,2):this.blueprint=[],C(this.element,{blueprint:this.blueprint,formId:this.formIdValue})}replaceCriterion(e,t,r){const i=this.blueprint[e];if("criterion"!==i.type)throw new Error("You can't call updateConditionId on a non-criterion type. Trying to update "+JSON.stringify(w));const n=this.blueprint[e],o=w(t,i.depth,r);return!l.isEqual(n,o)&&(this.blueprint[e]=o,C(this.element,{blueprint:this.blueprint,formId:this.formIdValue}),!0)}updateInput(e,t,r){const{blueprint:i}=this,n=i[e],l=(r=r||"input").split(", ");l.length>1?n[l[0]][l[1]]={...n[l[0]][l[1]],...t}:n[r]={...n[r],...t},C(this.element,{blueprint:this.blueprint,formId:this.formIdValue})}}I.values={blueprint:Array,conditions:Array,className:String,refreshUrl:String,clientId:String,validateBlueprintUrl:String,defaultConditionId:String},I.targets=["loading"];class S extends t.Controller{connect(){const e=document.getElementById(this.stateDomIdValue).refineStateController;this.blueprintFieldTarget.value=JSON.stringify(e.blueprint),console.log("connect",this.blueprintFieldTarget.value)}updateBlueprintField(e){if(e.detail.formId!=this.formIdValue)return null;const{detail:t}=e,{blueprint:r}=t;this.blueprintFieldTarget.value=JSON.stringify(r),console.log("update blueprint",this.blueprintFieldTarget.value)}}S.targets=["blueprintField"],S.values={formId:String,stateDomId:String};class T extends t.Controller{submit(e){e.preventDefault(),this.element.submit()}}class V extends t.Controller{toggle(e){this.contentTargets.forEach(e=>{e.toggleAttribute("hidden")})}}V.targets=["content"];class F extends t.Controller{submit(e){try{const t=this;e.preventDefault();const i=new r.FetchRequest(t.element.method||"POST",t.element.action,{responseKind:"turbo-stream",body:new FormData(t.element)});return Promise.resolve(i.perform()).then(function(){})}catch(e){return Promise.reject(e)}}}class j extends t.Controller{visit(e){try{const t=this;e.preventDefault();const i=new r.FetchRequest(t.element.dataset.turboMethod||"GET",t.element.href,{responseKind:"turbo-stream"});return Promise.resolve(i.perform()).then(function(){})}catch(e){return Promise.reject(e)}}}class E extends t.Controller{filter(e){const t=e.currentTarget.value.toLowerCase(),r=new Set;this.listItemTargets.forEach(e=>{e.dataset.listItemValue.toLowerCase().includes(t)?(e.hidden=!1,r.add(e.dataset.category)):e.hidden=!0}),this.categoryTargets.forEach(e=>{e.hidden=!r.has(e.innerHTML)})}}E.targets=["listItem","category"];class P extends h{initialize(){this.updateBlueprint=l.debounce((e,t,r)=>{this.value(e,t,r)},500)}refinedFilter(e){const{criterionIdValue:t,state:r}=this;r.updateInput(t,{id:e.target.value},e.target.dataset.inputId),this.refreshFromServer()}clause(e){const{criterionIdValue:t,state:r}=this;r.updateInput(t,{clause:e.target.value},e.target.dataset.inputId),this.refreshFromServer()}selected(e){const{target:t}=e,r=Array.prototype.slice.call(t.options).filter(e=>e.selected).map(e=>e.value);this.value(e,r,"selected")}value(e,t,r){const{criterionIdValue:i,state:n}=this,l=e.target.dataset;n.updateInput(i,{[r=r||l.inputKey||"value"]:t=t||e.target.value},l.inputId)}condition(e){const{criterionIdValue:t,state:r}=this,i=e.target;let n=i.value;n||(n=i.querySelector("select").value);const l=this.state.conditionConfigFor(n);r.replaceCriterion(t,n,l)&&this.refreshFromServer()}cancelEnter(e){"Enter"===e.code&&(e.preventDefault(),e.stopPropagation())}}P.values={criterionId:Number},require("daterangepicker/daterangepicker.css");class D extends t.Controller{connect(){this.initPluginInstance()}disconnect(){this.teardownPluginInstance()}clearDate(e){e.preventDefault(),window.$(this.fieldTarget).val(""),this.dispatch("value-cleared")}applyDateToField(e,t){const r=this.includeTimeValue?this.timeFormatValue:this.dateFormatValue,i=t?u.default(t.startDate.toISOString()):u.default(this.fieldTarget.value,"YYYY-MM-DDTHH:mm").format("YYYY-MM-DDTHH:mm"),n=i.format(r),l=this.includeTimeValue?i.toISOString(!0):i.format("YYYY-MM-DD");this.fieldTarget.value=n,this.hiddenFieldTarget.value=l,window.$(this.fieldTarget).trigger("change",t),this.hiddenFieldTarget.dispatchEvent(new Event("change",{detail:t,bubbles:!0}))}initPluginInstance(){const e=this.pickerLocaleValue,t=this.isAmPmValue;e.format=this.includeTimeValue?this.timeFormatValue:this.dateFormatValue,window.$(this.fieldTarget).daterangepicker({singleDatePicker:!0,timePicker:this.includeTimeValue,timePickerIncrement:5,autoUpdateInput:!1,autoApply:!0,minDate:!!this.futureOnlyValue&&new Date,locale:e,parentEl:d.default(this.element),drops:this.dropsValue?this.dropsValue:"down",timePicker24Hour:!t}),window.$(this.fieldTarget).on("apply.daterangepicker",this.applyDateToField.bind(this)),window.$(this.fieldTarget).on("cancel.daterangepicker",this.clearDate.bind(this)),window.$(this.fieldTarget).on("showCalendar.daterangepicker",this.showCalendar.bind(this)),this.pluginMainEl=this.fieldTarget,this.plugin=d.default(this.pluginMainEl).data("daterangepicker"),this.inlineValue&&this.element.classList.add("date-input--inline")}teardownPluginInstance(){void 0!==this.plugin&&(d.default(this.pluginMainEl).off("apply.daterangepicker"),d.default(this.pluginMainEl).off("cancel.daterangepicker"),d.default(this.pluginMainEl).off("showCalendar.daterangepicker"),this.plugin.remove())}showCalendar(){this.dispatch("show-calendar")}}D.targets=["field","hiddenField","clearButton"],D.values={includeTime:Boolean,futureOnly:Boolean,drops:String,inline:Boolean,dateFormat:String,timeFormat:String,isAmPm:Boolean,locale:{type:String,default:"en"},datetimeFormat:{type:String,default:"MM/DD/YYYY h:mm A"},pickerLocale:{type:Object,default:{}}};const _=[[p,"refine/add-controller.js"],[m,"refine/criterion-form-controller.js"],[f,"refine/defaults-controller.js"],[g,"refine/delete-controller.js"],[b,"refine/filter-pills-controller.js"],[v,"refine/popup-controller.js"],[y,"refine/search-filter-controller.js"],[h,"refine/server-refresh-controller.js"],[I,"refine/state-controller.js"],[S,"refine/stored-filter-controller.js"],[T,"refine/submit-form-controller.js"],[V,"refine/toggle-controller.js"],[F,"refine/turbo-stream-form-controller.js"],[j,"refine/turbo-stream-link-controller.js"],[E,"./refine/typeahead-list-controller.js"],[P,"refine/update-controller.js"],[D,"refine/date-controller.js"]].map(function(e){const t=e[0];return{identifier:c(e[1]),controllerConstructor:t}});e.AddController=p,e.CriterionFormController=m,e.DateController=D,e.DefaultsController=f,e.DeleteController=g,e.FilterPillsController=b,e.PopupController=v,e.SearchFilterController=y,e.ServerRefreshController=h,e.StateController=I,e.StoredFilterController=S,e.SubmitForm=T,e.ToggleController=V,e.TurboStreamFormController=F,e.TurboStreamLinkController=j,e.TypeaheadListController=E,e.UpdateController=P,e.controllerDefinitions=_});
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@hotwired/stimulus"),require("@rails/request.js"),require("stimulus-use"),require("jquery-events-to-dom-events"),require("lodash"),require("moment"),require("jquery"),require("daterangepicker")):"function"==typeof define&&define.amd?define(["exports","@hotwired/stimulus","@rails/request.js","stimulus-use","jquery-events-to-dom-events","lodash","moment","jquery","daterangepicker"],t):t((e||self).refineStimulus={},e.Stimulus,e.request_js,e.stimulusUse,e.jqueryEventsToDomEvents,e.lodash,e.moment,e.jquery)}(this,function(e,t,r,i,n,l,o,s){function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(o),d=a(s);function c(e){const t=(e.match(/^(?:\.\/)?(.+)(?:[_-]controller\..+?)$/)||[])[1];if(t)return t.replace(/_/g,"-").replace(/\//g,"--")}class h extends t.Controller{connect(){this.state.finishUpdate()}get state(){let e=this.element;for(;e!==document.body;){if(e.matches('[data-controller~="refine--state"]'))return this.application.getControllerForElementAndIdentifier(e,"refine--state");e=e.parentNode}return null}refreshFromServer(e){void 0===e&&(e={});try{const t=this,{includeErrors:i}=e;t.state.startUpdate();const n=new r.FetchRequest("GET",t.state.refreshUrlValue,{responseKind:"turbo-stream",query:{"refine_filters_builder[filter_class]":t.state.filterName,"refine_filters_builder[blueprint_json]":JSON.stringify(t.state.blueprint),"refine_filters_builder[client_id]":t.state.clientIdValue,include_errors:!!i}});return Promise.resolve(n.perform()).then(function(){})}catch(e){return Promise.reject(e)}}}class p extends h{criterion(){try{const e=this;return Promise.resolve(e.validateBlueprint()).then(function(t){t&&e.state.addCriterion(e.previousCriterionIdValue),e.refreshFromServer({includeErrors:!t})})}catch(e){return Promise.reject(e)}}group(){try{const e=this;return Promise.resolve(e.validateBlueprint()).then(function(t){t&&e.state.addGroup(),e.refreshFromServer({includeErrors:!t})})}catch(e){return Promise.reject(e)}}validateBlueprint(e){try{const e=this,t=new r.FetchRequest("GET",e.state.validateBlueprintUrlValue,{query:{"refine_filters_builder[filter_class]":e.state.filterName,"refine_filters_builder[blueprint_json]":JSON.stringify(e.state.blueprint),"refine_filters_builder[client_id]":e.state.clientIdValue}});return Promise.resolve(t.perform()).then(function(e){return e.ok})}catch(e){return Promise.reject(e)}}}p.values={previousCriterionId:Number};class m extends t.Controller{refresh(e){try{const e=this,t=document.getElementById(e.formIdValue),i=new FormData(t);console.log("in criterion-form refresh event"),console.log(e),console.log(i);const n=new r.FetchRequest("GET",e.urlValue,{query:i,responseKind:"turbo-stream"});return Promise.resolve(n.perform()).then(function(){})}catch(e){return Promise.reject(e)}}}m.values={url:String,formId:String};class f extends t.Controller{connect(){this.state=this.getStateController(),this.state.updateInput(this.criterionIdValue,this.inputValue)}getStateController(){let e=this.element;for(;e!==document.body;){const t=this.application.getControllerForElementAndIdentifier(e,"refine--state");if(t)return t;e=e.parentNode}return null}}f.values={criterionId:Number,input:Object};class g extends h{criterion(){const{state:e,criterionIdValue:t}=this;e.deleteCriterion(t),this.refreshFromServer()}}g.values={criterionId:Number};class b extends t.Controller{connect(){const e=new URLSearchParams(window.location.search);this.existingParams=e,this.existingParams.delete("stable_id")}delete(e){const{criterionId:t}=e.currentTarget.dataset;var r=parseInt(t);this.stateController.deleteCriterion(r),this.reloadPage()}reloadPage(){try{const e=this,{blueprint:t}=e.stateController,i=new r.FetchRequest("POST",e.submitUrlValue,{responseKind:"turbo-stream",body:JSON.stringify({refine_filters_builder:{filter_class:e.stateController.filterName,blueprint_json:JSON.stringify(t),client_id:e.stateController.clientIdValue}})});return Promise.resolve(i.perform()).then(function(){})}catch(e){return Promise.reject(e)}}redirectToStableId(e){const t=new URLSearchParams;e&&t.append("stable_id",e);const r=new URLSearchParams({...Object.fromEntries(this.existingParams),...Object.fromEntries(t)}).toString(),i=window.location.pathname+"?"+r;history.pushState({},document.title,i),window.location.reload()}get stateController(){return this.element.refineStateController}get stabilizeFilterController(){return this.element.stabilizeFilterController}}b.values={submitUrl:String};class v extends t.Controller{connect(){i.useClickOutside(this),this.boundHandleKeyUp=this.handleKeyUp.bind(this),document.addEventListener("keyup",this.boundHandleKeyUp)}disconnect(){document.removeEventListener("keyup",this.boundHandleKeyUp)}show(e){console.log("In Popup Show"),e.preventDefault(),this.frameTarget.src=this.srcValue,this.isOpenValue=!0}hide(e){this.isOpenValue&&(null==e||e.preventDefault(),this.frameTarget.innerHTML="",this.isOpenValue=!1)}clickOutside(e){this.hide(e)}handleKeyUp(e){"Escape"!==e.key&&"Esc"!==e.key||this.hide(e)}}v.targets=["frame"],v.values={src:String,isOpen:{type:Boolean,default:!1}};class C extends t.Controller{search(e){e.preventDefault(),this.submitFilter(),document.activeElement.blur()}submitFilter(){try{const e=this,{blueprint:t}=e.stateController,i=new r.FetchRequest("POST",e.submitUrlValue,{responseKind:"turbo-stream",body:JSON.stringify({refine_filters_builder:{filter_class:e.stateController.filterName,blueprint_json:JSON.stringify(t),client_id:e.stateController.clientIdValue}})});return Promise.resolve(i.perform()).then(function(){})}catch(e){return Promise.reject(e)}}get stateController(){return this.element.querySelector('[data-controller~="refine--state"]').refineStateController}loadResults(e){let{detail:{url:t}}=e;console.log("filter submit success"),window.Turbo?window.Turbo.visit(t):window.location.href=t}}C.values={submitUrl:String},function(){if("function"==typeof window.CustomEvent)return!1;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r}e.prototype=window.Event.prototype,window.CustomEvent=e}();const y=(e,t)=>{let{blueprint:r,formId:i}=t;const n=new CustomEvent("blueprint-updated",{bubbles:!0,cancelable:!0,detail:{blueprint:r,formId:i}});e.dispatchEvent(n)},w=(e,t,r)=>{var i;const n=null==r?void 0:r.component,l=(null==r?void 0:r.meta)||{clauses:[],options:{}},o=(null==r?void 0:r.refinements)||[],{clauses:s,options:a}=l;let u;u="option-condition"===n?a[0]?[a[0].id]:[]:void 0;let d={clause:null==(i=s[0])?void 0:i.id,selected:u};return o.forEach(e=>{const{meta:t,component:r}=e,{clauses:i,options:n}=t;let l;l="option-condition"===r?n[0]?[n[0].id]:[]:void 0,d[e.id]={clause:i[0].id,selected:l}}),{depth:t,type:"criterion",condition_id:e,input:d}};class I extends t.Controller{connect(){this.element.refineStateController=this,this.changeDelegate=n.delegate("change",["event","picker"]),this.blueprint=this.blueprintValue,this.conditions=this.conditionsValue,this.filterName=this.classNameValue,this.conditionsLookup=this.conditions.reduce((e,t)=>(e[t.id]=t,e),{}),this.loadingTimeout=null,y(this.element,{blueprint:this.blueprint,formId:this.formIdValue})}disconnect(){n.abnegate("change",this.changeDelegate)}startUpdate(){this.loadingTimeout&&window.clearTimeout(this.loadingTimeout),this.loadingTimeout=window.setTimeout(()=>{this.loadingTarget.classList.remove("hidden")},1e3)}finishUpdate(){this.loadingTimeout&&window.clearTimeout(this.loadingTimeout),this.loadingTarget.classList.add("hidden")}conditionConfigFor(e){return this.conditionsLookup[e]}addGroup(){const{conditions:e}=this,t=e.find(e=>e.id==this.defaultConditionIdValue)||e[0];var r;this.blueprint.length>0&&this.blueprint.push({depth:r=void 0===r?0:r,type:"conjunction",word:"or"}),this.blueprint.push(w(t.id,1,t)),y(this.element,{blueprint:this.blueprint,formId:this.formIdValue})}addCriterion(e){console.log("Add criteria");const{blueprint:t,conditions:r}=this,i=r.find(e=>e.id==this.defaultConditionIdValue)||r[0];var n;t.splice(e+1,0,{depth:n=void 0===n?1:n,type:"conjunction",word:"and"},w(i.id,1,i)),y(this.element,{blueprint:this.blueprint,formId:this.formIdValue})}deleteCriterion(e){const{blueprint:t}=this,r=t[e-1],i=t[e+1],n=r&&"or"===r.word,l=i&&"or"===i.word||!i,o=n||!r,s=o&&l;r||i?t.splice(s&&n?e-1:s&&!r||o&&!l?e:e-1,2):this.blueprint=[],y(this.element,{blueprint:this.blueprint,formId:this.formIdValue})}replaceCriterion(e,t,r){const i=this.blueprint[e];if("criterion"!==i.type)throw new Error("You can't call updateConditionId on a non-criterion type. Trying to update "+JSON.stringify(w));const n=this.blueprint[e],o=w(t,i.depth,r);return!l.isEqual(n,o)&&(this.blueprint[e]=o,y(this.element,{blueprint:this.blueprint,formId:this.formIdValue}),!0)}updateInput(e,t,r){const{blueprint:i}=this,n=i[e],l=(r=r||"input").split(", ");l.length>1?n[l[0]][l[1]]={...n[l[0]][l[1]],...t}:n[r]={...n[r],...t},y(this.element,{blueprint:this.blueprint,formId:this.formIdValue})}clearCriteria(){console.log("In clearCriteria"),y(this.element,{blueprint:[],formId:this.formIdValue})}}I.values={blueprint:Array,conditions:Array,className:String,refreshUrl:String,clientId:String,validateBlueprintUrl:String,defaultConditionId:String},I.targets=["loading"];class S extends t.Controller{connect(){const e=document.getElementById(this.stateDomIdValue).refineStateController;this.blueprintFieldTarget.value=JSON.stringify(e.blueprint),console.log("connect",this.blueprintFieldTarget.value)}updateBlueprintField(e){if(e.detail.formId!=this.formIdValue)return null;const{detail:t}=e,{blueprint:r}=t;this.blueprintFieldTarget.value=JSON.stringify(r),console.log("update blueprint",this.blueprintFieldTarget.value)}}S.targets=["blueprintField"],S.values={formId:String,stateDomId:String};class T extends t.Controller{submit(e){e.preventDefault(),this.element.submit()}}class V extends t.Controller{toggle(e){this.contentTargets.forEach(e=>{e.toggleAttribute("hidden")})}}V.targets=["content"];class F extends t.Controller{submit(e){try{const t=this;e.preventDefault();const i=new r.FetchRequest(t.element.method||"POST",t.element.action,{responseKind:"turbo-stream",body:new FormData(t.element)});return Promise.resolve(i.perform()).then(function(){})}catch(e){return Promise.reject(e)}}}class j extends t.Controller{visit(e){try{const t=this;e.preventDefault();const i=new r.FetchRequest(t.element.dataset.turboMethod||"GET",t.element.href,{responseKind:"turbo-stream"});return Promise.resolve(i.perform()).then(function(){})}catch(e){return Promise.reject(e)}}}class E extends t.Controller{filter(e){const t=e.currentTarget.value.toLowerCase(),r=new Set;this.listItemTargets.forEach(e=>{e.dataset.listItemValue.toLowerCase().includes(t)?(e.hidden=!1,r.add(e.dataset.category)):e.hidden=!0}),this.categoryTargets.forEach(e=>{e.hidden=!r.has(e.innerHTML)})}}E.targets=["listItem","category"];class P extends h{initialize(){this.updateBlueprint=l.debounce((e,t,r)=>{this.value(e,t,r)},500)}refinedFilter(e){const{criterionIdValue:t,state:r}=this;r.updateInput(t,{id:e.target.value},e.target.dataset.inputId),this.refreshFromServer()}clause(e){const{criterionIdValue:t,state:r}=this;r.updateInput(t,{clause:e.target.value},e.target.dataset.inputId),this.refreshFromServer()}selected(e){const{target:t}=e,r=Array.prototype.slice.call(t.options).filter(e=>e.selected).map(e=>e.value);this.value(e,r,"selected")}value(e,t,r){const{criterionIdValue:i,state:n}=this,l=e.target.dataset;n.updateInput(i,{[r=r||l.inputKey||"value"]:t=t||e.target.value},l.inputId)}condition(e){const{criterionIdValue:t,state:r}=this,i=e.target;let n=i.value;n||(n=i.querySelector("select").value);const l=this.state.conditionConfigFor(n);r.replaceCriterion(t,n,l)&&this.refreshFromServer()}cancelEnter(e){"Enter"===e.code&&(e.preventDefault(),e.stopPropagation())}}P.values={criterionId:Number},require("daterangepicker/daterangepicker.css");class D extends t.Controller{connect(){this.initPluginInstance()}disconnect(){this.teardownPluginInstance()}clearDate(e){e.preventDefault(),window.$(this.fieldTarget).val(""),this.dispatch("value-cleared")}applyDateToField(e,t){const r=this.includeTimeValue?this.timeFormatValue:this.dateFormatValue,i=t?u.default(t.startDate.toISOString()):u.default(this.fieldTarget.value,"YYYY-MM-DDTHH:mm").format("YYYY-MM-DDTHH:mm"),n=i.format(r),l=this.includeTimeValue?i.toISOString(!0):i.format("YYYY-MM-DD");this.fieldTarget.value=n,this.hiddenFieldTarget.value=l,window.$(this.fieldTarget).trigger("change",t),this.hiddenFieldTarget.dispatchEvent(new Event("change",{detail:t,bubbles:!0}))}initPluginInstance(){const e=this.pickerLocaleValue,t=this.isAmPmValue;e.format=this.includeTimeValue?this.timeFormatValue:this.dateFormatValue,window.$(this.fieldTarget).daterangepicker({singleDatePicker:!0,timePicker:this.includeTimeValue,timePickerIncrement:5,autoUpdateInput:!1,autoApply:!0,minDate:!!this.futureOnlyValue&&new Date,locale:e,parentEl:d.default(this.element),drops:this.dropsValue?this.dropsValue:"down",timePicker24Hour:!t}),window.$(this.fieldTarget).on("apply.daterangepicker",this.applyDateToField.bind(this)),window.$(this.fieldTarget).on("cancel.daterangepicker",this.clearDate.bind(this)),window.$(this.fieldTarget).on("showCalendar.daterangepicker",this.showCalendar.bind(this)),this.pluginMainEl=this.fieldTarget,this.plugin=d.default(this.pluginMainEl).data("daterangepicker"),this.inlineValue&&this.element.classList.add("date-input--inline")}teardownPluginInstance(){void 0!==this.plugin&&(d.default(this.pluginMainEl).off("apply.daterangepicker"),d.default(this.pluginMainEl).off("cancel.daterangepicker"),d.default(this.pluginMainEl).off("showCalendar.daterangepicker"),this.plugin.remove())}showCalendar(){this.dispatch("show-calendar")}}D.targets=["field","hiddenField","clearButton"],D.values={includeTime:Boolean,futureOnly:Boolean,drops:String,inline:Boolean,dateFormat:String,timeFormat:String,isAmPm:Boolean,locale:{type:String,default:"en"},datetimeFormat:{type:String,default:"MM/DD/YYYY h:mm A"},pickerLocale:{type:Object,default:{}}};class _ extends t.Controller{clear(){console.log("Clearing criteria");const{state:e}=this;e.clearCriteria(),this.refreshFromServer()}}const q=[[p,"refine/add-controller.js"],[m,"refine/criterion-form-controller.js"],[f,"refine/defaults-controller.js"],[g,"refine/delete-controller.js"],[b,"refine/filter-pills-controller.js"],[v,"refine/popup-controller.js"],[C,"refine/search-filter-controller.js"],[h,"refine/server-refresh-controller.js"],[I,"refine/state-controller.js"],[S,"refine/stored-filter-controller.js"],[T,"refine/submit-form-controller.js"],[V,"refine/toggle-controller.js"],[F,"refine/turbo-stream-form-controller.js"],[j,"refine/turbo-stream-link-controller.js"],[E,"./refine/typeahead-list-controller.js"],[P,"refine/update-controller.js"],[D,"refine/date-controller.js"],[_,"refine/clear-criteria-controller.js"]].map(function(e){const t=e[0];return{identifier:c(e[1]),controllerConstructor:t}});e.AddController=p,e.ClearCriteriaController=_,e.CriterionFormController=m,e.DateController=D,e.DefaultsController=f,e.DeleteController=g,e.FilterPillsController=b,e.PopupController=v,e.SearchFilterController=C,e.ServerRefreshController=h,e.StateController=I,e.StoredFilterController=S,e.SubmitForm=T,e.ToggleController=V,e.TurboStreamFormController=F,e.TurboStreamLinkController=j,e.TypeaheadListController=E,e.UpdateController=P,e.controllerDefinitions=q});
|
2
2
|
//# sourceMappingURL=refine-stimulus.umd.js.map
|