wj-elements 0.1.129 → 0.1.130
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 -4
- package/dist/assets/tags.json +3252 -22012
- package/dist/dark.css +213 -210
- package/dist/{infinite-scroll.element-R3y_ZQj6.js → infinite-scroll.element-BmojLp3Z.js} +16 -34
- package/dist/light.css +511 -501
- package/dist/{list.element-syl98NWS.js → list.element-Ce1vIm1O.js} +2 -11
- package/dist/localize.js +1 -2
- package/dist/{popup.element-C0a1z1y2.js → popup.element-4DNn6DjX.js} +102 -224
- package/dist/{router-links-I2vcmVCs.js → router-links-CJnOdbas.js} +30 -77
- package/dist/styles.css +485 -473
- package/dist/wje-accordion-item.js +12 -10
- package/dist/wje-accordion.js +51 -14
- package/dist/wje-animation.js +9 -13
- package/dist/wje-aside.js +6 -11
- package/dist/wje-avatar.js +7 -10
- package/dist/wje-badge.js +23 -18
- package/dist/wje-breadcrumb.js +30 -48
- package/dist/wje-breadcrumbs.js +80 -23
- package/dist/wje-button-group.js +15 -21
- package/dist/wje-button.js +64 -71
- package/dist/wje-card-content.js +9 -12
- package/dist/wje-card-controls.js +9 -12
- package/dist/wje-card-header.js +4 -8
- package/dist/wje-card-subtitle.js +4 -7
- package/dist/wje-card-title.js +4 -7
- package/dist/wje-card.js +13 -14
- package/dist/wje-carousel-item.js +25 -0
- package/dist/wje-carousel.js +140 -23
- package/dist/wje-checkbox.js +294 -48
- package/dist/wje-chip.js +30 -11
- package/dist/wje-col.js +7 -17
- package/dist/wje-color-picker.js +32 -34
- package/dist/wje-container.js +5 -9
- package/dist/wje-copy-button.js +11 -15
- package/dist/wje-dialog.js +12 -17
- package/dist/wje-divider.js +1 -4
- package/dist/wje-dropdown.js +41 -23
- package/dist/wje-element.js +214 -196
- package/dist/wje-file-upload-item.js +11 -21
- package/dist/wje-file-upload.js +64 -59
- package/dist/wje-footer.js +2 -9
- package/dist/wje-form.js +22 -0
- package/dist/wje-format-digital.js +4 -12
- package/dist/wje-grid.js +23 -2
- package/dist/wje-header.js +2 -9
- package/dist/wje-icon-picker.js +14 -33
- package/dist/wje-icon.js +9 -12
- package/dist/wje-img-comparer.js +7 -15
- package/dist/wje-img.js +3 -12
- package/dist/wje-infinite-scroll.js +1 -1
- package/dist/wje-input-file.js +19 -19
- package/dist/wje-input.js +50 -66
- package/dist/wje-item.js +11 -15
- package/dist/wje-kanban.js +22 -23
- package/dist/wje-label.js +3 -11
- package/dist/wje-list.js +1 -1
- package/dist/wje-main.js +3 -10
- package/dist/wje-masonry.js +16 -21
- package/dist/wje-master.js +197 -236
- package/dist/wje-menu-button.js +4 -15
- package/dist/wje-menu-item.js +209 -37
- package/dist/wje-menu-label.js +3 -10
- package/dist/wje-menu.js +5 -17
- package/dist/wje-option.js +18 -29
- package/dist/wje-options.js +141 -55
- package/dist/wje-orgchart-group.js +8 -15
- package/dist/wje-orgchart-item.js +10 -157
- package/dist/wje-orgchart.js +3 -9
- package/dist/wje-popup.js +1 -1
- package/dist/wje-progress-bar.js +11 -25
- package/dist/wje-qr-code.js +27 -11
- package/dist/wje-radio-group.js +20 -45
- package/dist/wje-radio.js +45 -7
- package/dist/wje-rate.js +35 -58
- package/dist/wje-relative-time.js +19 -29
- package/dist/wje-reorder-dropzone.js +20 -2
- package/dist/wje-reorder-handle.js +62 -3
- package/dist/wje-reorder-item.js +20 -2
- package/dist/wje-reorder.js +43 -49
- package/dist/wje-route.js +2 -8
- package/dist/wje-router-link.js +9 -12
- package/dist/wje-router-outlet.js +35 -37
- package/dist/wje-routerx.js +231 -340
- package/dist/wje-row.js +7 -9
- package/dist/wje-select.js +72 -99
- package/dist/wje-slider.js +13 -32
- package/dist/wje-sliding-container.js +3 -7
- package/dist/wje-split-view.js +8 -22
- package/dist/wje-status.js +8 -12
- package/dist/wje-step.js +18 -0
- package/dist/wje-stepper.js +41 -4823
- package/dist/wje-store.js +178 -74
- package/dist/wje-tab-group.js +7 -19
- package/dist/wje-tab-panel.js +3 -12
- package/dist/wje-tab.js +5 -16
- package/dist/wje-textarea.js +127 -47
- package/dist/wje-thumbnail.js +9 -14
- package/dist/wje-toast.js +27 -64
- package/dist/wje-toggle.js +21 -32
- package/dist/wje-toolbar-action.js +10 -14
- package/dist/wje-toolbar.js +10 -15
- package/dist/wje-tooltip.js +33 -25
- package/dist/wje-visually-hidden.js +9 -13
- package/package.json +15 -8
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
const routerLinksData = Symbol("routerLinksData");
|
|
2
|
-
const unbindRouterLinks = Symbol("unbindRouterLinks");
|
|
3
|
-
const resolved = Promise.resolve();
|
|
4
2
|
const linkContainers = /* @__PURE__ */ new Set();
|
|
5
3
|
let router;
|
|
6
4
|
const delegate = function(el, eventName, selector, listener, context) {
|
|
7
5
|
const handler = function(e) {
|
|
8
|
-
|
|
9
|
-
for (; node; node = node.parentNode) {
|
|
6
|
+
let node = e.target;
|
|
7
|
+
for (; node && node !== el; node = node.parentNode) {
|
|
10
8
|
if (node.matches && node.matches(selector)) {
|
|
11
9
|
e.selectorTarget = node;
|
|
12
10
|
listener.call(context, e);
|
|
@@ -39,13 +37,13 @@ function mutationHandler(mutations, observer) {
|
|
|
39
37
|
if (mutation.type === "attributes") {
|
|
40
38
|
const attr = mutation.attributeName;
|
|
41
39
|
if (attr.indexOf("param-") === 0 || attr.indexOf("query-") === 0) {
|
|
42
|
-
updateLink(mutation.target, observer.
|
|
40
|
+
updateLink(mutation.target, observer.rootEl);
|
|
43
41
|
}
|
|
44
42
|
} else {
|
|
45
43
|
mutation.addedNodes.forEach((node) => {
|
|
46
44
|
if (node.nodeType === 1) {
|
|
47
|
-
if (node.getAttribute("route")) updateLink(node, observer.
|
|
48
|
-
createLinks(observer.
|
|
45
|
+
if (node.getAttribute("route")) updateLink(node, observer.rootEl);
|
|
46
|
+
createLinks(observer.rootEl);
|
|
49
47
|
}
|
|
50
48
|
});
|
|
51
49
|
}
|
|
@@ -63,18 +61,15 @@ function getAttributeValues(el, prefix, result) {
|
|
|
63
61
|
}
|
|
64
62
|
return result;
|
|
65
63
|
}
|
|
66
|
-
function getDefaults(
|
|
64
|
+
function getDefaults(rootEl, routeName, propName, routeEl, options) {
|
|
67
65
|
let result = options[propName];
|
|
68
|
-
if (typeof result === "function") result = result.call(
|
|
66
|
+
if (typeof result === "function") result = result.call(rootEl, routeName, routeEl);
|
|
69
67
|
return result || {};
|
|
70
68
|
}
|
|
71
|
-
function getRouteProp(
|
|
72
|
-
const options =
|
|
73
|
-
const defaults = getDefaults(
|
|
74
|
-
|
|
75
|
-
if (rootEl) {
|
|
76
|
-
getAttributeValues(rootEl, attrPrefix, defaults);
|
|
77
|
-
}
|
|
69
|
+
function getRouteProp(rootEl, routeName, routeEl, propName, attrPrefix) {
|
|
70
|
+
const options = rootEl[routerLinksData].options;
|
|
71
|
+
const defaults = getDefaults(rootEl, routeName, propName, routeEl, options);
|
|
72
|
+
getAttributeValues(rootEl, attrPrefix, defaults);
|
|
78
73
|
return getAttributeValues(routeEl, attrPrefix, defaults);
|
|
79
74
|
}
|
|
80
75
|
function updateActiveClass(el, routeName, params, query) {
|
|
@@ -84,11 +79,11 @@ function updateActiveClass(el, routeName, params, query) {
|
|
|
84
79
|
el.classList.toggle(activeClass, isActive);
|
|
85
80
|
}
|
|
86
81
|
}
|
|
87
|
-
function updateLink(el,
|
|
82
|
+
function updateLink(el, rootEl) {
|
|
88
83
|
const routeName = el.getAttribute("route");
|
|
89
84
|
if (!routeName) return;
|
|
90
|
-
const params = getRouteProp(
|
|
91
|
-
const query = getRouteProp(
|
|
85
|
+
const params = getRouteProp(rootEl, routeName, el, "params", "param-");
|
|
86
|
+
const query = getRouteProp(rootEl, routeName, el, "query", "query-");
|
|
92
87
|
try {
|
|
93
88
|
const href = router.generate(routeName, params, query);
|
|
94
89
|
const anchorEl = el.tagName === "A" ? el : el.querySelector("a");
|
|
@@ -100,10 +95,10 @@ function updateLink(el, ownerEl) {
|
|
|
100
95
|
console.warn(`Error generating link for "${routeName}": ${error}`);
|
|
101
96
|
}
|
|
102
97
|
}
|
|
103
|
-
function createLinks(
|
|
98
|
+
function createLinks(rootEl) {
|
|
104
99
|
const routeEls = rootEl.querySelectorAll("[route]");
|
|
105
100
|
routeEls.forEach((el) => {
|
|
106
|
-
updateLink(el,
|
|
101
|
+
updateLink(el, rootEl);
|
|
107
102
|
});
|
|
108
103
|
}
|
|
109
104
|
function linkClickHandler(e) {
|
|
@@ -117,70 +112,29 @@ function linkClickHandler(e) {
|
|
|
117
112
|
const method = el.hasAttribute("replace") ? "replaceWith" : "transitionTo";
|
|
118
113
|
router[method](routeName, params, query);
|
|
119
114
|
}
|
|
120
|
-
function bindRouterLinks(
|
|
121
|
-
const { selector = "[routerlinks]" } = options;
|
|
122
|
-
const rootEls = selector ? ownerEl.querySelectorAll(selector) : [ownerEl];
|
|
115
|
+
function bindRouterLinks(rootEl, options = {}) {
|
|
123
116
|
const observer = new MutationObserver(mutationHandler);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
observer.observe(rootEl, elementsObserverConfig);
|
|
131
|
-
});
|
|
132
|
-
linkContainers.add(ownerEl);
|
|
117
|
+
observer.rootEl = rootEl;
|
|
118
|
+
rootEl[routerLinksData] = { options, observer };
|
|
119
|
+
const eventHandler = delegate(rootEl, "click", "[route]", linkClickHandler, rootEl);
|
|
120
|
+
createLinks(rootEl);
|
|
121
|
+
observer.observe(rootEl, elementsObserverConfig);
|
|
122
|
+
linkContainers.add(rootEl);
|
|
133
123
|
return function() {
|
|
134
|
-
linkContainers.delete(
|
|
135
|
-
|
|
124
|
+
linkContainers.delete(rootEl);
|
|
125
|
+
undelegate(rootEl, eventHandler);
|
|
136
126
|
};
|
|
137
127
|
}
|
|
138
|
-
const createClass = (ctor, options = {}) => {
|
|
139
|
-
return class extends ctor {
|
|
140
|
-
connectedCallback() {
|
|
141
|
-
super.connectedCallback && super.connectedCallback();
|
|
142
|
-
const renderWait = this.updateComplete || resolved;
|
|
143
|
-
renderWait.then(() => {
|
|
144
|
-
this[unbindRouterLinks] = bindRouterLinks(this, options);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
disconnectedCallback() {
|
|
148
|
-
super.disconnectedCallback && super.disconnectedCallback();
|
|
149
|
-
if (this[unbindRouterLinks]) {
|
|
150
|
-
this[unbindRouterLinks]();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
const withRouterLinks = (optionsOrCtorOrDescriptor, options) => {
|
|
156
|
-
if (typeof optionsOrCtorOrDescriptor === "function") {
|
|
157
|
-
return createClass(optionsOrCtorOrDescriptor, options);
|
|
158
|
-
}
|
|
159
|
-
if (optionsOrCtorOrDescriptor.kind === "class") {
|
|
160
|
-
const { kind, elements } = optionsOrCtorOrDescriptor;
|
|
161
|
-
return {
|
|
162
|
-
kind,
|
|
163
|
-
elements,
|
|
164
|
-
finisher(ctor) {
|
|
165
|
-
return createClass(ctor, options);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
return (ctorOrDescriptor) => {
|
|
170
|
-
return withRouterLinks(ctorOrDescriptor, optionsOrCtorOrDescriptor);
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
128
|
function create(instance) {
|
|
174
129
|
router = instance;
|
|
175
130
|
}
|
|
176
131
|
function done() {
|
|
177
|
-
linkContainers.forEach((
|
|
178
|
-
|
|
179
|
-
data.rootEls.forEach((el) => {
|
|
132
|
+
linkContainers.forEach((rootEl) => {
|
|
133
|
+
rootEl.querySelectorAll("[route]").forEach((el) => {
|
|
180
134
|
const routeName = el.getAttribute("route");
|
|
181
135
|
if (!routeName) return;
|
|
182
|
-
const params = getRouteProp(
|
|
183
|
-
const query = getRouteProp(
|
|
136
|
+
const params = getRouteProp(rootEl, routeName, el, "params", "param-");
|
|
137
|
+
const query = getRouteProp(rootEl, routeName, el, "query", "query-");
|
|
184
138
|
updateActiveClass(el, routeName, params, query);
|
|
185
139
|
});
|
|
186
140
|
});
|
|
@@ -191,6 +145,5 @@ const routerLinks = {
|
|
|
191
145
|
};
|
|
192
146
|
export {
|
|
193
147
|
bindRouterLinks as b,
|
|
194
|
-
routerLinks as r
|
|
195
|
-
withRouterLinks as w
|
|
148
|
+
routerLinks as r
|
|
196
149
|
};
|