@litejs/ui 24.0.0-rc.4 → 24.5.0
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/README.md +8 -11
- package/binding/persist.js +8 -18
- package/binding/sticky.js +2 -4
- package/binding/svg.js +2 -2
- package/binding/topfloat.js +1 -2
- package/css/base.css +11 -15
- package/css/form.css +168 -28
- package/css/grid.css +1 -1
- package/css/hr-label.css +21 -0
- package/css/smooth-scroll.css +8 -0
- package/el/Slider.tpl +19 -17
- package/el/crop.ui +49 -0
- package/el/{confirm.tpl → dialog.ui} +54 -42
- package/el/{form1.tpl → form.ui} +99 -99
- package/el/material.tpl +11 -11
- package/index.js +573 -571
- package/load.js +6 -9
- package/package.json +6 -21
- package/{polyfill → shim}/index.js +17 -17
- package/binding/_default.js +0 -165
- package/binding/list.js +0 -86
- package/css/form2.css +0 -142
- package/polyfill/base64.js +0 -43
- package/polyfill/blob.js +0 -5
- package/polyfill/promise.js +0 -141
- package/polyfill/string.js +0 -98
- package/polyfill/typed.js +0 -31
- package/stat.js +0 -205
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
%css
|
|
3
|
-
.
|
|
3
|
+
.Modal {
|
|
4
4
|
z-index: 9;
|
|
5
5
|
}
|
|
6
|
-
.
|
|
6
|
+
.Modal-bg {
|
|
7
|
+
position: absolute;
|
|
8
|
+
position: static;
|
|
7
9
|
background-color: rgba(0, 0, 0, .6);
|
|
8
10
|
}
|
|
9
|
-
.
|
|
11
|
+
.Modal-content {
|
|
10
12
|
position: absolute;
|
|
11
13
|
left: 0;
|
|
12
14
|
right: 0;
|
|
@@ -16,10 +18,10 @@
|
|
|
16
18
|
background-color: #fff;
|
|
17
19
|
box-shadow: 0 2px 10px 2px rgba(255,255,255,.5);
|
|
18
20
|
}
|
|
19
|
-
.sm .
|
|
21
|
+
.sm .Modal-content {
|
|
20
22
|
width: 94%;
|
|
21
23
|
}
|
|
22
|
-
.
|
|
24
|
+
.Modal--blur {
|
|
23
25
|
filter: blur(5px);
|
|
24
26
|
transform: scale(.85);
|
|
25
27
|
transform-origin: 50% 100vh;
|
|
@@ -57,7 +59,7 @@
|
|
|
57
59
|
// { "action": "no", "title": "No", "icon": "images/no.png" }
|
|
58
60
|
// ]
|
|
59
61
|
%js
|
|
60
|
-
|
|
62
|
+
$ui.on("modal", function(title, opts, next) {
|
|
61
63
|
El.blur()
|
|
62
64
|
if (!next && typeof opts === "function") {
|
|
63
65
|
next = opts
|
|
@@ -65,12 +67,11 @@
|
|
|
65
67
|
}
|
|
66
68
|
var sound, vibrate
|
|
67
69
|
, code = ""
|
|
68
|
-
, el = El("
|
|
69
|
-
, scope = El.scope(el,
|
|
70
|
+
, el = El("Modal")
|
|
71
|
+
, scope = Object.assign(El.scope(el, el), opts)
|
|
70
72
|
, kbMap = {}
|
|
71
73
|
, body = document.body
|
|
72
|
-
, blurEl =
|
|
73
|
-
Object.assign(scope, opts)
|
|
74
|
+
, blurEl = $(scope.blur) || $ui.root.lastChild
|
|
74
75
|
scope.title = title || "Confirm?"
|
|
75
76
|
if (!scope.actions) scope.actions = [
|
|
76
77
|
{ action: "close", title: "Close", key: "esc" }
|
|
@@ -79,17 +80,17 @@
|
|
|
79
80
|
if (typeof a == "string") a = scope.actions[i-1] = {title:a,action:a}
|
|
80
81
|
if (a.key) kbMap[a.key] = resolve.bind(el, el, a.action)
|
|
81
82
|
}
|
|
82
|
-
El.cls(blurEl, "
|
|
83
|
-
El.cls(el.lastChild, "
|
|
83
|
+
El.cls(blurEl, "Modal--blur")
|
|
84
|
+
El.cls(el.lastChild, "Modal--blur", false, 1)
|
|
84
85
|
El.append(body, el)
|
|
85
86
|
El.render(el, scope)
|
|
86
87
|
if (scope.code) {
|
|
87
|
-
|
|
88
|
+
$$(".js-numpad", el).on("click", numpad)
|
|
88
89
|
kbMap.backspace = kbMap.del = kbMap.num = numpad
|
|
89
90
|
}
|
|
90
91
|
El.addKb(kbMap, el)
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
$$(".js-btn", el).on("click", resolve)
|
|
93
|
+
$ui.one("show", resolve)
|
|
93
94
|
if (scope.bgClose) El.on(el, "click", resolve)
|
|
94
95
|
El.on(el, "wheel", Event.stop)
|
|
95
96
|
El.on(el.lastChild, "click", Event.stop)
|
|
@@ -106,48 +107,67 @@
|
|
|
106
107
|
var num = _num == void 0 ? e.target[El.T] : _num
|
|
107
108
|
code += num
|
|
108
109
|
if (num == "CLEAR" || num == "del" || num == "backspace") code = ""
|
|
109
|
-
El.md(
|
|
110
|
+
El.md($(".js-body", el), code.replace(/./g, "•") || opts.body)
|
|
110
111
|
if (typeof scope.code == "number" && code.length == scope.code && id && !sent) next(sent = code, id, resolve, reject)
|
|
111
112
|
}
|
|
112
113
|
function resolve(e, key) {
|
|
113
114
|
if (el) {
|
|
114
|
-
var action = key || El.
|
|
115
|
+
var action = key || El.get(this, "data-action")
|
|
115
116
|
, result = {
|
|
116
117
|
code: code,
|
|
117
|
-
input: El.val(
|
|
118
|
-
inputMd: El.val(
|
|
119
|
-
select: El.val(
|
|
118
|
+
input: El.val($(".js-input", el)),
|
|
119
|
+
inputMd: El.val($(".js-inputMd", el)),
|
|
120
|
+
select: El.val($(".js-select", el))
|
|
120
121
|
}
|
|
121
122
|
El.kill(el, "transparent")
|
|
122
|
-
El.cls(blurEl, "
|
|
123
|
+
El.cls(blurEl, "Modal--blur", el = false)
|
|
123
124
|
if (action && next) {
|
|
124
125
|
if (typeof next === "function") next(action, result)
|
|
125
126
|
else if (typeof next[action] === "function") next[action](result)
|
|
126
|
-
else if (next[action])
|
|
127
|
+
else if (next[action]) $ui.emit(next[action], result)
|
|
127
128
|
}
|
|
128
129
|
if (vibrate) navigator.vibrate(0)
|
|
129
130
|
if (sound) sound.pause()
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
scope.resolve = resolve
|
|
133
|
-
|
|
134
|
+
$ui.emit("modal:open", scope)
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
%el Dialog-numpad
|
|
138
|
+
.row.js-numpad
|
|
139
|
+
@click ".btn", function(){}
|
|
140
|
+
;each: num in [1,2,3,4,5,6,7,8,9,"CLEAR",0]
|
|
141
|
+
.col.w4>.btn {num}
|
|
142
|
+
|
|
143
|
+
%js
|
|
144
|
+
$ui.on("showDialog", function(e, el, dialog) {
|
|
145
|
+
console.log("showDialog", El.scope(el), arguments)
|
|
146
|
+
El.kill(dialog)
|
|
134
147
|
})
|
|
135
148
|
|
|
136
|
-
%el
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
.
|
|
143
|
-
;
|
|
144
|
-
;
|
|
145
|
-
.
|
|
149
|
+
%el Dialog
|
|
150
|
+
.Dialog.grid.p2.anim Dialog
|
|
151
|
+
.col.ts3 ;txt!_(title, map)
|
|
152
|
+
.col.js-body ;md!_(body, map)
|
|
153
|
+
.col
|
|
154
|
+
.group ;each: action in actions
|
|
155
|
+
.btn.js-btn
|
|
156
|
+
;txt!_(action.title)
|
|
157
|
+
;class!"w" + (12/actions.length)
|
|
158
|
+
;nop: this.focus()
|
|
159
|
+
;set: "data-action", action.action
|
|
160
|
+
;class!"is-" + action.action, action.action
|
|
161
|
+
|
|
162
|
+
%el Modal
|
|
163
|
+
.Modal.max.fix.anim
|
|
164
|
+
.Modal-bg.max.abs
|
|
165
|
+
.Modal-content.Modal--blur.grid.p2.anim
|
|
146
166
|
.row
|
|
147
167
|
;if: input
|
|
148
168
|
.col>input.field.js-input
|
|
149
169
|
.row
|
|
150
|
-
;if:
|
|
170
|
+
;if: $d.inputMd!=null
|
|
151
171
|
.col
|
|
152
172
|
textarea.field.js-inputMd
|
|
153
173
|
@keyup [this.parentNode.nextSibling.nextSibling], "renderMd"
|
|
@@ -163,12 +183,4 @@
|
|
|
163
183
|
option
|
|
164
184
|
;val:: item.id
|
|
165
185
|
;txt:: _(item.name)
|
|
166
|
-
.col
|
|
167
|
-
.group ;each: action in actions
|
|
168
|
-
.btn.js-btn
|
|
169
|
-
;txt:: _(action.title)
|
|
170
|
-
;class:: "w" + (12/actions.length)
|
|
171
|
-
;nop: this.focus()
|
|
172
|
-
;attr: "data-action", action.action
|
|
173
|
-
;class:: "is-" + action.action, action.action
|
|
174
186
|
|
package/el/{form1.tpl → form.ui}
RENAMED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
border: 0;
|
|
4
4
|
padding: 0;
|
|
5
5
|
}
|
|
6
|
-
.
|
|
6
|
+
.Form-del.right {
|
|
7
7
|
display: block;
|
|
8
8
|
margin: -10px -10px 0 0;
|
|
9
9
|
opacity: .2;
|
|
10
10
|
}
|
|
11
|
-
.
|
|
11
|
+
.Form-del {
|
|
12
12
|
font-size: 20px;
|
|
13
13
|
font-weight: 700;
|
|
14
14
|
border: 1px solid transparent;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
text-align: center;
|
|
19
19
|
border-radius: 4px;
|
|
20
20
|
}
|
|
21
|
-
.
|
|
21
|
+
.Form-del:hover {
|
|
22
22
|
opacity: 1;
|
|
23
23
|
border: 1px solid #aaa;
|
|
24
24
|
background-image: linear-gradient(to bottom, #ddd, #888);
|
|
@@ -152,101 +152,101 @@
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
|
|
155
|
-
%el
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
%el Form-row
|
|
156
|
+
label.row
|
|
157
|
+
.col.md-w4.input__label
|
|
158
|
+
= _(title||name)
|
|
159
|
+
.col.md-w8
|
|
160
|
+
%child
|
|
161
|
+
.input__hint
|
|
162
|
+
= _(description)
|
|
163
|
+
;if: description
|
|
164
|
+
|
|
165
|
+
%el Form-subheader
|
|
166
|
+
.col
|
|
167
|
+
= _(title)
|
|
168
|
+
|
|
169
|
+
%el Form-fieldset
|
|
170
|
+
fieldset.grid.b2
|
|
171
|
+
legend
|
|
172
|
+
= _(schema.title || _link.title || "")
|
|
173
|
+
|
|
174
|
+
%el Form
|
|
175
|
+
Form-row
|
|
176
|
+
input.field
|
|
177
|
+
|
|
178
|
+
%el Form-ro
|
|
179
|
+
Form-row>span ;txt: value
|
|
180
|
+
|
|
181
|
+
%el Form-hidden
|
|
182
|
+
div>input.field[type=hidden]
|
|
183
|
+
|
|
184
|
+
%el Form-boolean
|
|
185
|
+
Form-row
|
|
186
|
+
input.field[type=checkbox] ;value: value
|
|
187
|
+
|
|
188
|
+
%el Form-boolean-ro
|
|
189
|
+
Form-row>span
|
|
190
|
+
= _(!!value)
|
|
191
|
+
|
|
192
|
+
%el Form-password
|
|
193
|
+
Form-row
|
|
194
|
+
input.field[type=password]
|
|
195
|
+
|
|
196
|
+
%el Form-new-password
|
|
197
|
+
Form-row
|
|
198
|
+
input.field[type=password][autocomplete=new-password]
|
|
199
|
+
|
|
200
|
+
%el Form-text
|
|
201
|
+
Form-row
|
|
202
|
+
textarea.field
|
|
203
|
+
|
|
204
|
+
%el Form-text-ro
|
|
205
|
+
Form-ro
|
|
206
|
+
|
|
207
|
+
%el Form-enum
|
|
208
|
+
Form-row
|
|
209
|
+
select.field ;each:val in $d["enum"]
|
|
210
|
+
option
|
|
211
|
+
;val:: val
|
|
212
|
+
= _("" + val)
|
|
213
|
+
|
|
214
|
+
%el Form-enum-ro
|
|
215
|
+
Form-ro
|
|
216
|
+
|
|
217
|
+
%el Form-list
|
|
218
|
+
Form-row
|
|
219
|
+
select.field
|
|
220
|
+
;list: api(resourceCollection.format(params, $d)), required ? 0 : [""], value
|
|
221
|
+
option
|
|
222
|
+
;val:: item.id
|
|
223
|
+
;txt:: _(item.name)
|
|
224
|
+
|
|
225
|
+
%el Form-list-ro
|
|
226
|
+
Form-row>span
|
|
227
|
+
= _(item.name)
|
|
228
|
+
|
|
229
|
+
%el Form-array
|
|
230
|
+
.col
|
|
231
|
+
.input.p13.cf
|
|
232
|
+
.left
|
|
158
233
|
= _(title||name)
|
|
159
|
-
.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
%el form1-ro
|
|
179
|
-
form1-row>span ;txt: value
|
|
180
|
-
|
|
181
|
-
%el form1-hidden
|
|
182
|
-
div>input.field[type=hidden]
|
|
183
|
-
|
|
184
|
-
%el form1-boolean
|
|
185
|
-
form1-row
|
|
186
|
-
input.field[type=checkbox] ;value: value
|
|
187
|
-
|
|
188
|
-
%el form1-boolean-ro
|
|
189
|
-
form1-row>span
|
|
190
|
-
= _(!!value)
|
|
191
|
-
|
|
192
|
-
%el form1-password
|
|
193
|
-
form1-row
|
|
194
|
-
input.field[type=password]
|
|
195
|
-
|
|
196
|
-
%el form1-new-password
|
|
197
|
-
form1-row
|
|
198
|
-
input.field[type=password][autocomplete=new-password]
|
|
199
|
-
|
|
200
|
-
%el form1-text
|
|
201
|
-
form1-row
|
|
202
|
-
textarea.field
|
|
203
|
-
|
|
204
|
-
%el form1-text-ro
|
|
205
|
-
form1-ro
|
|
206
|
-
|
|
207
|
-
%el form1-enum
|
|
208
|
-
form1-row
|
|
209
|
-
select.field ;each:val in data["enum"]
|
|
210
|
-
option
|
|
211
|
-
;val:: val
|
|
212
|
-
= _("" + val)
|
|
213
|
-
|
|
214
|
-
%el form1-enum-ro
|
|
215
|
-
form1-ro
|
|
216
|
-
|
|
217
|
-
%el form1-list
|
|
218
|
-
form1-row
|
|
219
|
-
select.field
|
|
220
|
-
;list: api(resourceCollection.format(data.params, data)), required ? 0 : [""], value
|
|
221
|
-
option
|
|
222
|
-
;val:: item.id
|
|
223
|
-
;txt:: _(item.name)
|
|
224
|
-
|
|
225
|
-
%el form1-list-ro
|
|
226
|
-
form1-row>span
|
|
227
|
-
= _(item.name)
|
|
228
|
-
|
|
229
|
-
%el form1-array
|
|
230
|
-
.col
|
|
231
|
-
.input.p13.cf
|
|
232
|
-
.left
|
|
233
|
-
= _(title||name)
|
|
234
|
-
.input__hint
|
|
235
|
-
= _(description)
|
|
236
|
-
.js-items.cf
|
|
237
|
-
a.btn.right
|
|
238
|
-
;if: !data.noAdd
|
|
239
|
-
;txt: _(data.name + ".Add")
|
|
240
|
-
@click: data.add
|
|
241
|
-
|
|
242
|
-
%el form1-array-item
|
|
243
|
-
.input.p3.m2b.cf.js-del
|
|
244
|
-
a.right.Form1-del.hand ×
|
|
245
|
-
;if: !data.noAdd
|
|
246
|
-
;attr:: "data-tooltip", _("Delete")
|
|
247
|
-
@click: data.del
|
|
248
|
-
b
|
|
249
|
-
;if: title
|
|
250
|
-
;txt: title
|
|
251
|
-
.grid.b2.js-item
|
|
234
|
+
.input__hint
|
|
235
|
+
= _(description)
|
|
236
|
+
.js-items.cf
|
|
237
|
+
a.btn.right
|
|
238
|
+
;if: !$d.noAdd
|
|
239
|
+
;txt: _($d.name + ".Add")
|
|
240
|
+
@click: $d.add
|
|
241
|
+
|
|
242
|
+
%el Form-array-item
|
|
243
|
+
.input.p3.m2b.cf.js-del
|
|
244
|
+
a.right.Form-del.hand ×
|
|
245
|
+
;if !$d.noAdd
|
|
246
|
+
;set "data-tooltip", _("Delete")
|
|
247
|
+
@click $d.del
|
|
248
|
+
b
|
|
249
|
+
;if: title
|
|
250
|
+
;txt: title
|
|
251
|
+
.grid.b2.js-item
|
|
252
252
|
|
package/el/material.tpl
CHANGED
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
%js
|
|
197
|
-
!function(
|
|
197
|
+
!function($ui) {
|
|
198
198
|
var menuTarget, menuEl, tipTarget, tipEl, tick, wait
|
|
199
199
|
, ripple = El(".waves-ripple")
|
|
200
200
|
El.near = near
|
|
@@ -244,11 +244,11 @@
|
|
|
244
244
|
}
|
|
245
245
|
El.on(document.body, "mouseover", onOver)
|
|
246
246
|
El.on(window, "focusin", onOver)
|
|
247
|
-
|
|
247
|
+
$ui.on("show", closeTooltip)
|
|
248
248
|
function onOver(e) {
|
|
249
249
|
var x, y, pos
|
|
250
250
|
, target = e.target
|
|
251
|
-
, text = El.
|
|
251
|
+
, text = El.get(target, "data-tooltip")
|
|
252
252
|
, relTarg = e.relatedTarget || e.fromElement
|
|
253
253
|
// without relTarg is event on click
|
|
254
254
|
if (!relTarg && e.type !== "focusin" || target === tipTarget) return
|
|
@@ -260,19 +260,19 @@
|
|
|
260
260
|
closeTooltip()
|
|
261
261
|
if (!text) return
|
|
262
262
|
tipEl = openVisible("pre.tooltip", tipTarget = target)
|
|
263
|
-
pos = El.
|
|
263
|
+
pos = El.get(target, "data-tooltip-pos") || "top"
|
|
264
264
|
El.txt(tipEl, text)
|
|
265
265
|
if (pos === "left" || pos === "right") {
|
|
266
266
|
x = pos
|
|
267
267
|
} else {
|
|
268
268
|
y = pos
|
|
269
269
|
}
|
|
270
|
-
El.
|
|
270
|
+
El.set(tipEl, "data-pos", pos)
|
|
271
271
|
near(tipEl, target, x, y, 6)
|
|
272
272
|
}
|
|
273
273
|
function openVisible(tag, target) {
|
|
274
274
|
var el = typeof tag == "string" ? El(tag) : tag
|
|
275
|
-
, scope = El.scope(el,
|
|
275
|
+
, scope = El.scope(el, target)
|
|
276
276
|
scope.openTarget = target
|
|
277
277
|
El.render(el)
|
|
278
278
|
El.append(document.body, el)
|
|
@@ -298,9 +298,9 @@
|
|
|
298
298
|
El.cls(menuTarget, "is-active", menuEl = menuTarget = null)
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
301
|
+
$ui.on("ping", closeMenu)
|
|
302
|
+
$ui.on("closeMenu", closeMenu)
|
|
303
|
+
$ui.on("showMenu", function(e, target, menu, x, y, margin) {
|
|
304
304
|
Event.stop(e)
|
|
305
305
|
var close = menuEl && menuTarget == target
|
|
306
306
|
closeMenu()
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
})
|
|
314
314
|
} else {
|
|
315
315
|
El.cls(menuTarget = target, "is-active")
|
|
316
|
-
near(menuEl, target, x, y,
|
|
316
|
+
near(menuEl, target, x, y, margin)
|
|
317
317
|
}
|
|
318
318
|
if (menuEl.style.transform !== void 0) {
|
|
319
319
|
El.cls(menuEl, "no-events")
|
|
@@ -355,7 +355,7 @@
|
|
|
355
355
|
El.cls(ripple, "waves-ripple--play", 0)
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
}(
|
|
358
|
+
}($ui)
|
|
359
359
|
|
|
360
360
|
|
|
361
361
|
%el Checkbox
|