PageSourceSearch

https://tencate1952.com/theme/717bc1d0529abab170daeb1334965972/js/…e-plugin.form-field-toggle.plugin.627e3d.js

js tencate1952.com collected 2026-10-04 11:10:10 UTC 10,108 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[18009],{857:t=>{var e=function(t){var e;return!!t&&"object"==typeof t&&"[object RegExp]"!==(e=Object.prototype.toString.call(t))&&"[object Date]"!==e&&t.$$typeof!==i},i="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(t,e){return!1!==e.clone&&e.isMergeableObject(t)?o(Array.isArray(t)?[]:{},t,e):t}function s(t,e,i){return t.concat(e).map(function(t){return r(t,i)})}function n(t){return Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[])}function a(t,e){try{return e in t}catch(t){return!1}}function o(t,i,l){(l=l||{}).arrayMerge=l.arrayMerge||s,l.isMergeableObject=l.isMergeableObject||e,l.cloneUnlessOtherwiseSpecified=r;var c,u,h=Array.isArray(i);return h!==Array.isArray(t)?r(i,l):h?l.arrayMerge(t,i,l):(u={},(c=l).isMergeableObject(t)&&n(t).forEach(function(e){u[e]=r(t[e],c)}),n(i).forEach(function(e){(!a(t,e)||Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))&&(a(t,e)&&c.isMergeableObject(i[e])?u[e]=(function(t,e){if(!e.customMerge)return o;var i=e.customMerge(t);return"function"==typeof i?i:o})(e,c)(t[e],i[e],c):u[e]=r(i[e],c))}),u)}o.all=function(t,e){if(!Array.isArray(t))throw Error("first argument should be an array");return t.reduce(function(t,i){return o(t,i,e)},{})},t.exports=o},49:(t,e,i)=>{i.d(e,{Z:()=>s});var r=i(140);class s{static isNode(t){return"object"==typeof t&&null!==t&&(t===document||t===window||t instanceof Node)}static hasAttribute(t,e){if(!s.isNode(t))throw Error("The element must be a valid HTML Node!");return"function"==typeof t.hasAttribute&&t.hasAttribute(e)}static getAttribute(t,e){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(i&&!1===s.hasAttribute(t,e))throw Error('The required property "'.concat(e,'" does not exist!'));if("function"!=typeof t.getAttribute){if(i)throw Error("This node doesn't support the getAttribute function!");return}return t.getAttribute(e)}static getDataAttribute(t,e){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=e.replace(/^data(|-)/,""),a=r.Z.toLowerCamelCase(n,"-");if(!s.isNode(t)){if(i)throw Error("The passed node is not a valid HTML Node!");return}if(void 0===t.dataset){if(i)throw Error("This node doesn't support the dataset attribute!");return}let o=t.dataset[a];if(void 0===o){if(i)throw Error('The required data attribute "'.concat(e,'" does not exist on ').concat(t,"!"));return o}return r.Z.parsePrimitive(o)}static querySelector(t,e){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(i&&!s.isNode(t))throw Error("The parent node is not a valid HTML Node!");let r=t.querySelector(e)||!1;if(i&&!1===r)throw Error('The required element "'.concat(e,'" does not exist in parent node!'));return r}static querySelectorAll(t,e){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(i&&!s.isNode(t))throw Error("The parent node is not a valid HTML Node!");let r=t.querySelectorAll(e);if(0===r.length&&(r=!1),i&&!1===r)throw Error('At least one item of "'.concat(e,'" must exist in parent node!'));return r}static getFocusableElements(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return t.querySelectorAll('\n            input:not([tabindex^="-"]):not([disabled]):not([type="hidden"]),\n            select:not([tabindex^="-"]):not([disabled]),\n            textarea:not([tabindex^="-"]):not([disabled]),\n            button:not([tabindex^="-"]):not([disabled]),\n            a[href]:not([tabindex^="-"]):not([disabled]),\n            [tabindex]:not([tabindex^="-"]):not([disabled])\n        ')}static getFirstFocusableElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return this.getFocusableElements(t)[0]}static getLastFocusableElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=this.getFocusableElements(t);return e[e.length-1]}}},266:(t,e,i)=>{i.d(e,{Z:()=>r});class r{static iterate(t,e){if(t instanceof Map||Array.isArray(t))return t.forEach(e);if(t instanceof FormData){for(var i of t.entries())e(i[1],i[0]);return}if(t instanceof NodeList)return t.forEach(e);if(t instanceof HTMLCollection)return Array.from(t).forEach(e);if(t instanceof Object)return Object.keys(t).forEach(i=>
1{e(t[i],i)});throw Error("The element type ".concat(typeof t," is not iterable!"))}}},140:(t,e,i)=>{i.d(e,{Z:()=>r});class r{static ucFirst(t){return t.charAt(0).toUpperCase()+t.slice(1)}static lcFirst(t){return t.charAt(0).toLowerCase()+t.slice(1)}static toDashCase(t){return t.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(t,e){let i=r.toUpperCamelCase(t,e);return r.lcFirst(i)}static toUpperCamelCase(t,e){return e?t.split(e).map(t=>r.ucFirst(t.toLowerCase())).join(""):r.ucFirst(t.toLowerCase())}static parsePrimitive(t){try{return/^\d+(.|,)\d+$/.test(t)&&(t=t.replace(",",".")),JSON.parse(t)}catch(e){return t.toString()}}}},9:(t,e,i)=>{i.r(e),i.d(e,{default:()=>h,extendPluginName:()=>d});var r=i(857),s=i.n(r),n=i(49),a=i(140);class o{publish(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=new CustomEvent(t,{detail:e,cancelable:i});return this.el.dispatchEvent(r),r}subscribe(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this,s=t.split("."),n=i.scope?e.bind(i.scope):e;if(i.once&&!0===i.once){let e=n;n=function(i){r.unsubscribe(t),e(i)}}return this.el.addEventListener(s[0],n),this.listeners.push({splitEventName:s,opts:i,cb:n}),!0}unsubscribe(t){let e=t.split(".");return this.listeners=this.listeners.reduce((t,i)=>([...i.splitEventName].sort().toString()===e.sort().toString()?this.el.removeEventListener(i.splitEventName[0],i.cb):t.push(i),t),[]),!0}reset(){return this.listeners.forEach(t=>{this.el.removeEventListener(t.splitEventName[0],t.cb)}),this.listeners=[],!0}get el(){return this._el}set el(t){this._el=t}get listeners(){return this._listeners}set listeners(t){this._listeners=t}constructor(t=document){this._el=t,t.$emitter=this,this._listeners=[]}}class l{init(){throw Error('The "init" method for the plugin "'.concat(this._pluginName,'" is not defined.'))}update(){}_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(t){let e=a.Z.toDashCase(this._pluginName),i=n.Z.getDataAttribute(this.el,"data-".concat(e,"-config"),!1),r=n.Z.getAttribute(this.el,"data-".concat(e,"-options"),!1),o=[this.constructor.options,this.options,t];i&&o.push(window.PluginConfigManager.get(this._pluginName,i));try{r&&o.push(JSON.parse(r))}catch(t){throw console.error(this.el),Error('The data attribute "data-'.concat(e,'-options" could not be parsed to json: ').concat(t.message))}return s().all(o.filter(t=>t instanceof Object&&!(t instanceof Array)).map(t=>t||{}))}_registerInstance(){window.PluginManager.getPluginInstancesFromElement(this.el).set(this._pluginName,this),window.PluginManager.getPlugin(this._pluginName,!1).get("instances").push(this)}_getPluginName(t){return t||(t=this.constructor.name),t}constructor(t,e={},i=!1){if(!n.Z.isNode(t))throw Error("There is no valid element given.");this.el=t,this.$emitter=new o(this.el),this._pluginName=this._getPluginName(i),this.options=this._mergeOptions(e),this._initialized=!1,this._registerInstance(),this._init()}}var c=i(266);class u extends l{init(){this._getTargets(),this._getControlValue(),this._registerEvents(),this._onChange(),this._triggerNested=n.Z.getDataAttribute(this.el,this.options.triggerNestedDataAttribute,!1)}_getTargets(){let t=n.Z.getDataAttribute(this.el,this.options.targetDataAttribute);if((n.Z.getDataAttribute(this.el,this.options.scopeDataAttribute,!1)||this.options.scopeAll)===this.options.scopeAll){this._targets=n.Z.querySelectorAll(document,t);return}let e=this.el.closest(n.Z.getDataAttribute(this.el,this.options.parentSelectorDataAttribute));this._targets=n.Z.querySelectorAll(e,t)}_getControlValue(){this._value=n.Z.getDataAttribute(this.el,this.options.valueDataAttribute)}_registerEvents(){this.el.removeEventListener("change",this._onChange.bind(this)),this.el.addEventListener("change",this._onChange.bind(this))}_onChange(){let t=this._shouldShowTarget();c.Z.iterate(this._targets,e=>{t?this._showTarget(e):this._hideTarget(e)}),this.$emitter.publish("onChange")}_shouldShowTarget(){let t=this.el.type;return"checkbox"===t||"radio"===t?this.el.checked===this._value:this.el.value===this._value}_hideTarget(t){let e=this._getFields(t);c.Z.iterate(e,t=>{n.Z.hasAttribute(t,"required")&&(t.classList.add(this.options.wasRequiredCls),t.removeAttribute("required")),t.setAttribute("disabled","disabled"),n.Z.hasAttribute(t,"disabled")&&t.classList.remove(this.options.wasDisabledCls)}),t.classList.remove(this.options.showCls),t.classList.add(this.options.hiddenCls)}_showTarget(t){let e=this._getFields(t);c.Z.iterate(e,t=>{t.classList.contains(this.options.wasRequiredCls)&&(t.classList.remove(this.options.wasRequiredCls),t.setAttribute("required","required")),n.Z.hasAttribute(t,"disabled")&&(t.removeAttribute("disabled"),t.classList.add(this.options.wasDisabledCls))}),this._triggerNested&&c.Z.iterate(e,t=>{if(t.matches('[data-form-field-toggle="true"]')){let e=window.PluginManager.getPluginInstanceFromElement(t,"FormFieldToggle");e&&e._onChange()}}),t.classList.remove(this.options.hiddenCls),t.classList.add(this.options.showCls)}_getFields(t){return n.Z.querySelectorAll(t,"input, select, textarea",!1)}}u.options={hiddenCls:"d-none",showCls:"d-block",scopeAll:"all",targetDataAttribute:"data-form-field-toggle-target",valueDataAttribute:"data-form-field-toggle-value",wasRequiredCls:"js-field-toggle-was-required",wasDisabledCls:"js-field-toggle-was-disabled",scopeDataAttribute:"data-form-field-toggle-scope",parentSelectorDataAttribute:"data-form-field-toggle-parent-selector",triggerNestedDataAttribute:"data-form-field-toggle-trigger-nested"};class h extends u{update(){this._onChange()}}let d="FormFieldToggle"}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.