@teipublisher/pb-components 2.25.3 → 2.26.0-next-3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.js.yml +1 -0
- package/.releaserc.json +8 -1
- package/CHANGELOG.md +23 -0
- package/css/leaflet/images/layers.png +0 -0
- package/dist/demo/components.css +37 -0
- package/dist/demo/demos.json +3 -0
- package/dist/demo/pb-dialog.html +27 -0
- package/dist/demo/pb-i18n.html +29 -29
- package/dist/iron-form-b76df6d4.js +113 -0
- package/dist/{paper-listbox-5f42cff5.js → paper-listbox-9b2edde9.js} +40 -130
- package/dist/pb-component-docs.js +12 -12
- package/dist/pb-components-bundle.js +68 -84
- package/dist/pb-edit-app.js +1 -1
- package/dist/pb-elements.json +141 -15
- package/dist/pb-leaflet-map.js +1 -1
- package/dist/pb-odd-editor.js +1 -1
- package/dist/{vaadin-element-mixin-859a0132.js → vaadin-element-mixin-87f431bd.js} +39 -29
- package/package.json +1 -1
- package/pb-elements.json +141 -15
- package/src/pb-components.js +1 -0
- package/src/pb-dialog.js +83 -0
- package/src/pb-download.js +6 -3
- package/src/pb-lang.js +51 -36
- package/src/pb-leaflet-map.js +1 -1
- package/src/pb-login.js +59 -71
- package/src/pb-message.js +41 -34
- package/src/pb-page.js +3 -4
- package/src/theming.js +15 -8
- package/dist/iron-form-7b5c5d03.js +0 -23
package/.releaserc.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
# [2.26.0-next-3.1](https://github.com/eeditiones/tei-publisher-components/compare/v2.25.4...v2.26.0-next-3.1) (2025-06-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **pb-dialog:** move dialog default CSS to components.css ([ece99c9](https://github.com/eeditiones/tei-publisher-components/commit/ece99c9bdb37cd70c81bbe54691d3263043e19a2))
|
|
7
|
+
* **pb-download:** use pb-dialog instead of paper-dialog ([ddc4879](https://github.com/eeditiones/tei-publisher-components/commit/ddc48793d66c126df3ae023f15a4342c5b6f6661))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **pb-dialog:** add pb-dialog component to replace paper-dialog ([c05b760](https://github.com/eeditiones/tei-publisher-components/commit/c05b760ce6b63fc8d4893c354ad4731a1b619fff))
|
|
13
|
+
* **pb-lang:** switch to standard select ([9a4a01a](https://github.com/eeditiones/tei-publisher-components/commit/9a4a01abcb87dbe0cde5e4a4deeb5ba0a94c0a61))
|
|
14
|
+
* **pb-login:** drop polymer, use pb-dialog ([ffee19f](https://github.com/eeditiones/tei-publisher-components/commit/ffee19fa27f1e8520c8c3e9a877100b981e38ddf))
|
|
15
|
+
* **pb-message:** replace paper-dialog with pb-dialog ([e60c401](https://github.com/eeditiones/tei-publisher-components/commit/e60c401153bd2756c0d081a09e70f2be31ab2526))
|
|
16
|
+
|
|
17
|
+
## [2.25.4](https://github.com/eeditiones/tei-publisher-components/compare/v2.25.3...v2.25.4) (2025-06-04)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **pb-leaflet-map:** collapse the layer control by default, so it doesn't use too much space ([78f160f](https://github.com/eeditiones/tei-publisher-components/commit/78f160fa9e87799453354b19b6186c1c53d2b48b))
|
|
23
|
+
|
|
1
24
|
## [2.25.3](https://github.com/eeditiones/tei-publisher-components/compare/v2.25.2...v2.25.3) (2025-05-30)
|
|
2
25
|
|
|
3
26
|
|
|
Binary file
|
package/dist/demo/components.css
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
dialog {
|
|
2
|
+
min-width: var(--pb-dialog-min-width, 300px);
|
|
3
|
+
max-width: 100vw;
|
|
4
|
+
max-height: 100vh;
|
|
5
|
+
border-radius: var(--pb-dialog-border-radius, 6px);
|
|
6
|
+
box-shadow: var(--pb-dialog-box-shadow, 0 2px 16px rgba(0, 0, 0, 0.3));
|
|
7
|
+
border: var(--pb-dialog-border, none);
|
|
8
|
+
padding: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
dialog::backdrop {
|
|
12
|
+
background: var(--pb-dialog-backdrop-color, rgba(0, 0, 0, 0.4));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
dialog>article>*,
|
|
16
|
+
dialog>article>::slotted(*) {
|
|
17
|
+
padding-left: var(--pb-dialog-padding-horizontal, 1rem);
|
|
18
|
+
padding-right: var(--pb-dialog-padding-horizontal, 1rem);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
dialog>article>header {
|
|
22
|
+
border-bottom: 1px solid var(--pb-dialog-border-color, #e0e0e0);
|
|
23
|
+
display: flex;
|
|
24
|
+
margin-bottom: var(--pb-dialog-padding-vertical, 1rem);
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
align-items: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
dialog>article>footer {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: flex-end;
|
|
32
|
+
gap: 0.5rem;
|
|
33
|
+
padding-top: var(--pb-dialog-padding-vertical, 1rem);
|
|
34
|
+
padding-bottom: var(--pb-dialog-padding-vertical, 1rem);
|
|
35
|
+
border-top: 1px solid var(--pb-dialog-border-color, #e0e0e0);
|
|
36
|
+
}
|
|
37
|
+
|
|
1
38
|
.table-grid thead th.gridjs-th {
|
|
2
39
|
color: #CC9900;
|
|
3
40
|
text-align: center;
|
package/dist/demo/demos.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes" />
|
|
6
|
+
|
|
7
|
+
<title>pb-dialog Demo</title>
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script><script type="module" src="../pb-components-bundle.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<pb-demo-snippet>
|
|
13
|
+
<template>
|
|
14
|
+
<pb-page>
|
|
15
|
+
<main>
|
|
16
|
+
<button onclick="document.getElementById('dialog1').openDialog()">Open Dialog</button>
|
|
17
|
+
<pb-dialog id="dialog1">
|
|
18
|
+
<h1 slot="title">Dialog 1</h1>
|
|
19
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
|
|
20
|
+
</pb-dialog>
|
|
21
|
+
</main>
|
|
22
|
+
</pb-page>
|
|
23
|
+
</template>
|
|
24
|
+
</pb-demo-snippet>
|
|
25
|
+
</body>
|
|
26
|
+
|
|
27
|
+
</html>
|
package/dist/demo/pb-i18n.html
CHANGED
|
@@ -16,27 +16,27 @@
|
|
|
16
16
|
</style>
|
|
17
17
|
<pb-page locales="./i18n/{{ns}}_{{lng}}.json" locale-fallback-ns="app custom">
|
|
18
18
|
<pb-lang label="language" selected="en">
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
<
|
|
19
|
+
<option value="bg">Български</option>
|
|
20
|
+
<option value="cs">český</option>
|
|
21
|
+
<option value="zh_CN">简体中文</option>
|
|
22
|
+
<option value="zh_TW">繁體中文</option>
|
|
23
|
+
<option value="de">Deutsch</option>
|
|
24
|
+
<option value="en">English</option>
|
|
25
|
+
<option value="es">Español</option>
|
|
26
|
+
<option value="el">ελληνικά</option>
|
|
27
|
+
<option value="fr">Français</option>
|
|
28
|
+
<option value="it">Italiano</option>
|
|
29
|
+
<option value="ka">ქართული</option>
|
|
30
|
+
<option value="nl">Nederlands</option>
|
|
31
|
+
<option value="no">Norsk</option>
|
|
32
|
+
<option value="pl">Polski</option>
|
|
33
|
+
<option value="pt">Português</option>
|
|
34
|
+
<option value="ro">Română</option>
|
|
35
|
+
<option value="ru">русский</option>
|
|
36
|
+
<option value="sl">Slovenščina</option>
|
|
37
|
+
<option value="sv">Svenska</option>
|
|
38
|
+
<option value="tr">Türkçe</option>
|
|
39
|
+
<option value="uk">Українська</option>
|
|
40
40
|
</pb-lang>
|
|
41
41
|
<ul>
|
|
42
42
|
<li data-i18n="document.contents">Contents</li>
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
|
|
54
54
|
<h2>without a label</h2>
|
|
55
55
|
<pb-lang label="language" selected="en" nolabel="nolabel">
|
|
56
|
-
<
|
|
57
|
-
<
|
|
58
|
-
<
|
|
59
|
-
<
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
<
|
|
63
|
-
<
|
|
56
|
+
<option value="de">German</option>
|
|
57
|
+
<option value="en">English</option>
|
|
58
|
+
<option value="es">Spanish</option>
|
|
59
|
+
<option value="fr">French</option>
|
|
60
|
+
<option value="it">Italian</option>
|
|
61
|
+
<option value="gr">Greek</option>
|
|
62
|
+
<option value="pl">Polish</option>
|
|
63
|
+
<option value="nl">Dutch</option>
|
|
64
64
|
</pb-lang>
|
|
65
65
|
|
|
66
66
|
</pb-page>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import{d as e,P as t,h as i}from"./paper-checkbox-4f410b1f.js";import{g as s,N as n}from"./paper-listbox-9b2edde9.js";
|
|
2
|
+
/**
|
|
3
|
+
@license
|
|
4
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
5
|
+
This code may only be used under the BSD style license found at
|
|
6
|
+
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
|
|
7
|
+
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
|
|
8
|
+
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
9
|
+
part of the polymer project is also subject to an additional IP rights grant
|
|
10
|
+
found at http://polymer.github.io/PATENTS.txt
|
|
11
|
+
*/const o=document.createElement("template");o.setAttribute("style","display: none;"),o.innerHTML='<dom-module id="paper-dialog-shared-styles">\n <template>\n <style>\n :host {\n display: block;\n margin: 24px 40px;\n\n background: var(--paper-dialog-background-color, var(--primary-background-color));\n color: var(--paper-dialog-color, var(--primary-text-color));\n\n @apply --paper-font-body1;\n @apply --shadow-elevation-16dp;\n @apply --paper-dialog;\n }\n\n :host > ::slotted(*) {\n margin-top: 20px;\n padding: 0 24px;\n }\n\n :host > ::slotted(.no-padding) {\n padding: 0;\n }\n\n \n :host > ::slotted(*:first-child) {\n margin-top: 24px;\n }\n\n :host > ::slotted(*:last-child) {\n margin-bottom: 24px;\n }\n\n /* In 1.x, this selector was `:host > ::content h2`. In 2.x <slot> allows\n to select direct children only, which increases the weight of this\n selector, so we have to re-define first-child/last-child margins below. */\n :host > ::slotted(h2) {\n position: relative;\n margin: 0;\n\n @apply --paper-font-title;\n @apply --paper-dialog-title;\n }\n\n /* Apply mixin again, in case it sets margin-top. */\n :host > ::slotted(h2:first-child) {\n margin-top: 24px;\n @apply --paper-dialog-title;\n }\n\n /* Apply mixin again, in case it sets margin-bottom. */\n :host > ::slotted(h2:last-child) {\n margin-bottom: 24px;\n @apply --paper-dialog-title;\n }\n\n :host > ::slotted(.paper-dialog-buttons),\n :host > ::slotted(.buttons) {\n position: relative;\n padding: 8px 8px 8px 24px;\n margin: 0;\n\n color: var(--paper-dialog-button-color, var(--primary-color));\n\n @apply --layout-horizontal;\n @apply --layout-end-justified;\n }\n </style>\n </template>\n</dom-module>',document.head.appendChild(o.content);
|
|
12
|
+
/**
|
|
13
|
+
@license
|
|
14
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
15
|
+
This code may only be used under the BSD style license found at
|
|
16
|
+
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
|
|
17
|
+
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
|
|
18
|
+
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
19
|
+
part of the polymer project is also subject to an additional IP rights grant
|
|
20
|
+
found at http://polymer.github.io/PATENTS.txt
|
|
21
|
+
*/
|
|
22
|
+
const a={hostAttributes:{role:"dialog",tabindex:"-1"},properties:{modal:{type:Boolean,value:!1},__readied:{type:Boolean,value:!1}},observers:["_modalChanged(modal, __readied)"],listeners:{tap:"_onDialogClick"},ready:function(){this.__prevNoCancelOnOutsideClick=this.noCancelOnOutsideClick,this.__prevNoCancelOnEscKey=this.noCancelOnEscKey,this.__prevWithBackdrop=this.withBackdrop,this.__readied=!0},_modalChanged:function(e,t){t&&(e?(this.__prevNoCancelOnOutsideClick=this.noCancelOnOutsideClick,this.__prevNoCancelOnEscKey=this.noCancelOnEscKey,this.__prevWithBackdrop=this.withBackdrop,this.noCancelOnOutsideClick=!0,this.noCancelOnEscKey=!0,this.withBackdrop=!0):(this.noCancelOnOutsideClick=this.noCancelOnOutsideClick&&this.__prevNoCancelOnOutsideClick,this.noCancelOnEscKey=this.noCancelOnEscKey&&this.__prevNoCancelOnEscKey,this.withBackdrop=this.withBackdrop&&this.__prevWithBackdrop))},_updateClosingReasonConfirmed:function(e){this.closingReason=this.closingReason||{},this.closingReason.confirmed=e},_onDialogClick:function(t){for(var i=e(t).path,s=0,n=i.indexOf(this);s<n;s++){var o=i[s];if(o.hasAttribute&&(o.hasAttribute("dialog-dismiss")||o.hasAttribute("dialog-confirm"))){this._updateClosingReasonConfirmed(o.hasAttribute("dialog-confirm")),this.close(),t.stopPropagation();break}}}};
|
|
23
|
+
/**
|
|
24
|
+
@license
|
|
25
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
26
|
+
This code may only be used under the BSD style license found at
|
|
27
|
+
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
|
|
28
|
+
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
|
|
29
|
+
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
30
|
+
part of the polymer project is also subject to an additional IP rights grant
|
|
31
|
+
found at http://polymer.github.io/PATENTS.txt
|
|
32
|
+
*/
|
|
33
|
+
t({_template:i`
|
|
34
|
+
<style include="paper-dialog-shared-styles"></style>
|
|
35
|
+
<slot></slot>
|
|
36
|
+
`,is:"paper-dialog",behaviors:[[s,a],n],listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},_renderOpened:function(){this.cancelAnimation(),this.playAnimation("entry")},_renderClosed:function(){this.cancelAnimation(),this.playAnimation("exit")},_onNeonAnimationFinish:function(){this.opened?this._finishRenderOpened():this._finishRenderClosed()}}),
|
|
37
|
+
/**
|
|
38
|
+
@license
|
|
39
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
40
|
+
This code may only be used under the BSD style license found at
|
|
41
|
+
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
|
|
42
|
+
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
|
|
43
|
+
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
44
|
+
part of the polymer project is also subject to an additional IP rights grant
|
|
45
|
+
found at http://polymer.github.io/PATENTS.txt
|
|
46
|
+
*/
|
|
47
|
+
t({_template:i`
|
|
48
|
+
<style>
|
|
49
|
+
|
|
50
|
+
:host {
|
|
51
|
+
display: block;
|
|
52
|
+
@apply --layout-relative;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:host(.is-scrolled:not(:first-child))::before {
|
|
56
|
+
content: '';
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 0;
|
|
59
|
+
left: 0;
|
|
60
|
+
right: 0;
|
|
61
|
+
height: 1px;
|
|
62
|
+
background: var(--divider-color);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:host(.can-scroll:not(.scrolled-to-bottom):not(:last-child))::after {
|
|
66
|
+
content: '';
|
|
67
|
+
position: absolute;
|
|
68
|
+
bottom: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
right: 0;
|
|
71
|
+
height: 1px;
|
|
72
|
+
background: var(--divider-color);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.scrollable {
|
|
76
|
+
padding: 0 24px;
|
|
77
|
+
|
|
78
|
+
@apply --layout-scroll;
|
|
79
|
+
@apply --paper-dialog-scrollable;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.fit {
|
|
83
|
+
@apply --layout-fit;
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
86
|
+
|
|
87
|
+
<div id="scrollable" class="scrollable" on-scroll="updateScrollState">
|
|
88
|
+
<slot></slot>
|
|
89
|
+
</div>
|
|
90
|
+
`,is:"paper-dialog-scrollable",properties:{dialogElement:{type:Object}},get scrollTarget(){return this.$.scrollable},ready:function(){this._ensureTarget(),this.classList.add("no-padding")},attached:function(){this._ensureTarget(),requestAnimationFrame(this.updateScrollState.bind(this))},updateScrollState:function(){this.toggleClass("is-scrolled",this.scrollTarget.scrollTop>0),this.toggleClass("can-scroll",this.scrollTarget.offsetHeight<this.scrollTarget.scrollHeight),this.toggleClass("scrolled-to-bottom",this.scrollTarget.scrollTop+this.scrollTarget.offsetHeight>=this.scrollTarget.scrollHeight)},_ensureTarget:function(){this.dialogElement=this.dialogElement||this.parentElement,this.dialogElement&&this.dialogElement.behaviors&&this.dialogElement.behaviors.indexOf(a)>=0?(this.dialogElement.sizingTarget=this.scrollTarget,this.scrollTarget.classList.remove("fit")):this.dialogElement&&this.scrollTarget.classList.add("fit")}}),
|
|
91
|
+
/**
|
|
92
|
+
@license
|
|
93
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
94
|
+
This code may only be used under the BSD style license found at
|
|
95
|
+
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
|
|
96
|
+
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
|
|
97
|
+
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
98
|
+
part of the polymer project is also subject to an additional IP rights grant
|
|
99
|
+
found at http://polymer.github.io/PATENTS.txt
|
|
100
|
+
*/
|
|
101
|
+
t({_template:i`
|
|
102
|
+
<style>
|
|
103
|
+
:host {
|
|
104
|
+
display: block;
|
|
105
|
+
}
|
|
106
|
+
</style>
|
|
107
|
+
|
|
108
|
+
<!-- This form is used to collect the elements that should be submitted -->
|
|
109
|
+
<slot></slot>
|
|
110
|
+
|
|
111
|
+
<!-- This form is used for submission -->
|
|
112
|
+
<form id="helper" action\$="[[action]]" method\$="[[method]]" enctype\$="[[enctype]]"></form>
|
|
113
|
+
`,is:"iron-form",properties:{allowRedirect:{type:Boolean,value:!1},headers:{type:Object,value:function(){return{}}},withCredentials:{type:Boolean,value:!1}},attached:function(){this._form||(this._form=e(this).querySelector("form"),this._form?(this._init(),this.async(this._saveInitialValues.bind(this),1)):this._nodeObserver=e(this).observeNodes(function(t){for(var i=0;i<t.addedNodes.length;i++)"FORM"===t.addedNodes[i].tagName&&(this._form=t.addedNodes[i],this._init(),e(this).unobserveNodes(this._nodeObserver),this._nodeObserver=null)}.bind(this)))},detached:function(){this._nodeObserver&&(e(this).unobserveNodes(this._nodeObserver),this._nodeObserver=null)},_init:function(){this._form.addEventListener("submit",this.submit.bind(this)),this._form.addEventListener("reset",this.reset.bind(this)),this._defaults=this._defaults||new WeakMap,this._saveInitialValues()},saveResetValues:function(){this._saveInitialValues(!0)},_saveInitialValues:function(e){for(var t=this._getValidatableElements(),i=0;i<t.length;i++){var s=t[i];if(!this._defaults.has(s)||e){var n={value:s.value};"checked"in s&&(n.checked=s.checked),"invalid"in s&&(n.invalid=s.invalid),this._defaults.set(s,n)}}},validate:function(){if(!this._form)return!1;if(""===this._form.getAttribute("novalidate"))return!0;for(var e,t=this._form.checkValidity(),i=this._getValidatableElements(),s=0;e=i[s],s<i.length;s++){var n=e;n.validate&&(t=!!n.validate()&&t)}return t},submit:function(e){if(e&&e.preventDefault(),this._form)if(this.validate()){this.$.helper.textContent="";var t=this.serializeForm();if(this.allowRedirect){for(var i in t)this.$.helper.appendChild(this._createHiddenElement(i,t[i]));this.$.helper.action=this._form.getAttribute("action"),this.$.helper.method=this._form.getAttribute("method")||"GET",this.$.helper.contentType=this._form.getAttribute("enctype")||"application/x-www-form-urlencoded",this.$.helper.submit(),this.fire("iron-form-submit")}else this._makeAjaxRequest(t)}else this.fire("iron-form-invalid")},reset:function(e){if(e&&e.preventDefault(),this._form)if(e&&"reset"===e.type&&e.target===this._form){for(var t=this._getValidatableElements(),i=0;i<t.length;i++){var s=t[i];if(this._defaults.has(s)){var n=this._defaults.get(s);for(var o in n)s[o]=n[o]}}this.fire("iron-form-reset")}else this._form.reset()},serializeForm:function(){for(var e=this._getSubmittableElements(),t={},i=0;i<e.length;i++)for(var s=this._serializeElementValues(e[i]),n=0;n<s.length;n++)this._addSerializedElement(t,e[i].name,s[n]);return t},_handleFormResponse:function(e){this.fire("iron-form-response",e.detail)},_handleFormError:function(e){this.fire("iron-form-error",e.detail)},_makeAjaxRequest:function(e){this.request||(this.request=document.createElement("iron-ajax"),this.request.addEventListener("response",this._handleFormResponse.bind(this)),this.request.addEventListener("error",this._handleFormError.bind(this))),this.request.url=this._form.getAttribute("action"),this.request.method=this._form.getAttribute("method")||"GET",this.request.contentType=this._form.getAttribute("enctype")||"application/x-www-form-urlencoded",this.request.withCredentials=this.withCredentials,this.request.headers=this.headers,"POST"===this._form.method.toUpperCase()?this.request.body=e:this.request.params=e,this.fire("iron-form-presubmit",{},{cancelable:!0}).defaultPrevented||(this.request.generateRequest(),this.fire("iron-form-submit",e))},_getValidatableElements:function(){return this._findElements(this._form,!0,!1)},_getSubmittableElements:function(){return this._findElements(this._form,!1,!1)},_findElements:function(t,i,s,n){n=n||[];for(var o=e(t).querySelectorAll("*"),a=0;a<o.length;a++)s||"slot"!==o[a].localName&&"content"!==o[a].localName?this._searchSubmittable(n,o[a],i):this._searchSubmittableInSlot(n,o[a],i);return n},_searchSubmittableInSlot:function(t,i,s){for(var n=e(i).getDistributedNodes(),o=0;o<n.length;o++)if(n[o].nodeType!==Node.TEXT_NODE){this._searchSubmittable(t,n[o],s);for(var a=e(n[o]).querySelectorAll("*"),r=0;r<a.length;r++)this._searchSubmittable(t,a[r],s)}},_searchSubmittable:function(e,t,i){this._isSubmittable(t,i)?e.push(t):t.root&&this._findElements(t.root,i,!0,e)},_isSubmittable:function(e,t){return!e.disabled&&(t?e.name||"function"==typeof e.validate:e.name)},_serializeElementValues:function(e){var t=e.tagName.toLowerCase();return"button"===t||"input"===t&&("submit"===e.type||"reset"===e.type)?[]:"select"===t?this._serializeSelectValues(e):"input"===t?this._serializeInputValues(e):e._hasIronCheckedElementBehavior&&!e.checked?[]:[e.value]},_serializeSelectValues:function(e){for(var t=[],i=0;i<e.options.length;i++)e.options[i].selected&&t.push(e.options[i].value);return t},_serializeInputValues:function(e){var t=e.type.toLowerCase();return("checkbox"!==t&&"radio"!==t||e.checked)&&"file"!==t?[e.value]:[]},_createHiddenElement:function(e,t){var i=document.createElement("input");return i.setAttribute("type","hidden"),i.setAttribute("name",e),i.setAttribute("value",t),i},_addSerializedElement:function(e,t,i){void 0===e[t]?e[t]=i:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(i))}});
|