native-document 1.0.168 → 1.0.169
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/CHANGELOG.md +38 -4
- package/components.js +3 -1
- package/dist/native-document.components.min.js +197 -171
- package/dist/native-document.dev.js +92 -75
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/docs/components/icons.md +321 -0
- package/package.json +1 -1
- package/src/components/form/field/types/FileField.js +3 -3
- package/src/components/icon/Icon.js +107 -0
- package/src/components/icon/icon-getters.js +142 -0
- package/src/components/icon/icons.js +171 -0
- package/src/components/icon/index.js +17 -0
- package/src/components/icon/types/Icon.d.ts +191 -0
- package/src/components/index.d.ts +6 -1
- package/src/components/list/types/List.d.ts +45 -32
- package/src/components/list/types/ListDivider.ts +16 -0
- package/src/components/list/types/ListGroup.d.ts +51 -29
- package/src/components/list/types/ListItem.d.ts +20 -21
- package/src/core/elements/content-formatter.js +16 -2
- package/src/core/elements/form.js +1 -1
- package/src/core/elements/img.js +1 -1
- package/src/core/elements/medias.js +2 -2
- package/src/core/elements/meta-data.js +1 -1
- package/src/core/wrappers/AttributesWrapper.js +37 -22
- package/src/core/wrappers/ElementCreator.js +9 -16
- package/src/core/wrappers/HtmlElementWrapper.js +26 -7
- package/src/core/wrappers/NDElement.js +12 -1
- package/src/core/wrappers/prototypes/attributes-extensions.js +24 -24
- package/src/core/wrappers/prototypes/nd-element-extensions.js +1 -8
- package/src/ui/components/icon/material/MaterialIconRender.js +71 -0
- package/src/ui/components/icon/material/material.css +15 -0
- package/src/ui/components/icon/material/material.map.js +170 -0
- package/src/ui/components/icon/phosphor/PhosphorIconRender.js +71 -0
- package/src/ui/components/icon/phosphor/phosphor.css +17 -0
- package/src/ui/components/icon/phosphor/phosphor.map.js +165 -0
- package/src/ui/components/icon/tabler/TablerIconRender.js +59 -0
- package/src/ui/components/icon/tabler/tabler.css +14 -0
- package/src/ui/components/icon/tabler/tabler.map.js +165 -0
- package/src/ui/index.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,13 +9,45 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## [1.0.169] - 2026-06-06
|
|
15
|
+
|
|
12
16
|
### Added
|
|
13
17
|
|
|
14
|
-
- `
|
|
15
|
-
|
|
18
|
+
- `Icon` - adapter-based icon system with chainable API (`Icon.search.fill().large()`),
|
|
19
|
+
`Icon.use(renderer, defaultConfigs)`, and 120+ semantic icon names accessible
|
|
20
|
+
via `Icon.{name}` getters
|
|
21
|
+
- `TablerIconRender` - Tabler Icons adapter (outline + fill)
|
|
22
|
+
- `PhosphorIconRender` - Phosphor Icons adapter (thin/light/regular/bold/fill/duotone)
|
|
23
|
+
- `MaterialIconRender` - Google Material Icons adapter (fill/outline/round/sharp/twoTone)
|
|
16
24
|
|
|
17
25
|
---
|
|
18
26
|
|
|
27
|
+
## [1.0.167] - 2026-06-06
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
#### Components
|
|
32
|
+
- `Card` - content container with image, header, footer, actions, variants (elevated, outlined, flat), clickable, hoverable, loading state, horizontal layout, custom renderers (`renderImage`, `renderHeader`, `renderContent`, `renderFooter`, `renderActions`), and fully custom `layout(slots, instance)` function
|
|
33
|
+
- `List` - flexible list with `HasListItem` trait, `from(source, builder)` reactive data binding, `withDivider`, `inset`, `selectable`, `multiSelect`, `selectByClick`, `selectByCheckbox`, `selectInto`
|
|
34
|
+
- `ListItem` - list item with icon, label, subtitle, trailing, disabled, selected, visibility, `isSelectedIcon`, `swipeLeading`, `swipeTrailing` for mobile swipe actions with auto-close on outside click and `stopPropagation` on swipe action clicks
|
|
35
|
+
- `ListGroup` - collapsible group of items with icon, `collapsable(mode, openedIcon, closedIcon)`, `collapsed()`, visibility, and full `HasListItem` API (`.item()`, `.group()`, `.divider()`, `.add()`, `.from()`)
|
|
36
|
+
- `ListDivider` - visual separator between list items
|
|
37
|
+
- `HasListItem` - trait adding `.item()`, `.group()`, `.divider()`, `.add()`, `.from()` to `List` and `ListGroup`
|
|
38
|
+
- `SpacerRender` - render for `Spacer` component (`flex: 1` layout utility)
|
|
39
|
+
|
|
40
|
+
#### UI (renders)
|
|
41
|
+
- `CardRender` + `card.css` - Card renderer with 5 build slots and `layout(slots)` support
|
|
42
|
+
- `ListRender` + `list.css` - `ForEachArray($desc.items)` — items self-render
|
|
43
|
+
- `ListItemRender` + `list-item.css` - reactive checkbox, select indicator, swipe gesture with pointer events, auto-close and stopPropagation
|
|
44
|
+
- `ListGroupRender` + `list-group.css` - collapsible group with reactive chevron via `Switch`
|
|
45
|
+
- `ListDividerRender` + `list-divider.css`
|
|
46
|
+
- `SpacerRender`
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
- `Card.use()` was a no-op (empty body) - now correctly assigns `Card.defaultTemplate`
|
|
50
|
+
|
|
19
51
|
## [1.0.166] - 2026-06-03
|
|
20
52
|
|
|
21
53
|
### Added
|
|
@@ -149,5 +181,7 @@ Entries use the following categories:
|
|
|
149
181
|
|
|
150
182
|
---
|
|
151
183
|
|
|
152
|
-
[Unreleased]: https://github.com/afrocodeur/native-document/compare/v1.0.
|
|
153
|
-
[1.0.
|
|
184
|
+
[Unreleased]: https://github.com/afrocodeur/native-document/compare/v1.0.169...HEAD
|
|
185
|
+
[1.0.169]: https://github.com/afrocodeur/native-document/compare/v1.0.167...v1.0.169
|
|
186
|
+
[1.0.167]: https://github.com/afrocodeur/native-document/compare/v1.0.166...v1.0.167
|
|
187
|
+
[1.0.166]: https://github.com/afrocodeur/native-document/releases/tag/v1.0.166
|
package/components.js
CHANGED
|
@@ -27,4 +27,6 @@ export * from './src/components/tabs/index';
|
|
|
27
27
|
export * from './src/components/toast/index';
|
|
28
28
|
export * from './src/components/tooltip/index';
|
|
29
29
|
export * from './src/components/stacks/index';
|
|
30
|
-
export * from './src/components/spacer/index';
|
|
30
|
+
export * from './src/components/spacer/index';
|
|
31
|
+
|
|
32
|
+
export * from './src/components/icon/index';
|
|
@@ -3143,27 +3143,31 @@ var NativeComponents = (function (exports) {
|
|
|
3143
3143
|
const bindClassAttribute = (element, data) => {
|
|
3144
3144
|
for(const className in data) {
|
|
3145
3145
|
const value = data[className];
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
}
|
|
3146
|
+
|
|
3147
|
+
if (value.__$isObservableChecker) {
|
|
3148
|
+
let lastClass = value.val();
|
|
3149
|
+
if (typeof lastClass === 'string') {
|
|
3150
|
+
element.classes.toggle(lastClass, true);
|
|
3151
|
+
value.subscribe((currentValue) => {
|
|
3152
|
+
element.classes.remove(lastClass);
|
|
3153
|
+
element.classes.toggle(currentValue, true);
|
|
3154
|
+
lastClass = currentValue;
|
|
3155
|
+
});
|
|
3156
|
+
continue;
|
|
3158
3157
|
}
|
|
3158
|
+
}
|
|
3159
|
+
|
|
3160
|
+
if (value.__$Observable) {
|
|
3159
3161
|
element.classes.toggle(className, value.val());
|
|
3160
3162
|
value.subscribe((shouldAdd) => element.classes.toggle(className, shouldAdd));
|
|
3161
3163
|
continue;
|
|
3162
3164
|
}
|
|
3163
|
-
|
|
3165
|
+
|
|
3166
|
+
if (value.$hydrate) {
|
|
3164
3167
|
value.$hydrate(element, className);
|
|
3165
3168
|
continue;
|
|
3166
3169
|
}
|
|
3170
|
+
|
|
3167
3171
|
element.classes.toggle(className, value);
|
|
3168
3172
|
}
|
|
3169
3173
|
};
|
|
@@ -3221,12 +3225,12 @@ var NativeComponents = (function (exports) {
|
|
|
3221
3225
|
* @param {boolean|number|Observable} value
|
|
3222
3226
|
*/
|
|
3223
3227
|
const bindBooleanAttribute = (element, attributeName, value) => {
|
|
3224
|
-
const isObservable = value.__$
|
|
3228
|
+
const isObservable = value.__$Observable;
|
|
3225
3229
|
const defaultValue = isObservable? value.val() : value;
|
|
3226
3230
|
|
|
3227
3231
|
const attributeRealName = BOOL_ATTRIBUTES_NAME[attributeName];
|
|
3228
3232
|
|
|
3229
|
-
if(
|
|
3233
|
+
if(typeof defaultValue === 'boolean') {
|
|
3230
3234
|
element[attributeRealName] = defaultValue;
|
|
3231
3235
|
}
|
|
3232
3236
|
else {
|
|
@@ -3255,15 +3259,14 @@ var NativeComponents = (function (exports) {
|
|
|
3255
3259
|
* @param {Observable} value
|
|
3256
3260
|
*/
|
|
3257
3261
|
const bindAttributeWithObservable = (element, attributeName, value) => {
|
|
3258
|
-
const applyValue = attributeName === 'value' ? (newValue) => element.value = newValue : (newValue) => element.setAttribute(attributeName, newValue);
|
|
3259
|
-
value.subscribe(applyValue);
|
|
3260
|
-
|
|
3261
3262
|
if(attributeName === 'value') {
|
|
3262
3263
|
element.value = value.val();
|
|
3263
3264
|
element.addEventListener('input', () => value.set(element.value));
|
|
3265
|
+
value.subscribe((newValue) => element.value = newValue);
|
|
3264
3266
|
return;
|
|
3265
3267
|
}
|
|
3266
3268
|
element.setAttribute(attributeName, value.val());
|
|
3269
|
+
value.subscribe((newValue) => element.setAttribute(attributeName, newValue));
|
|
3267
3270
|
};
|
|
3268
3271
|
|
|
3269
3272
|
/**
|
|
@@ -3274,16 +3277,25 @@ var NativeComponents = (function (exports) {
|
|
|
3274
3277
|
const AttributesWrapper = (element, attributes) => {
|
|
3275
3278
|
|
|
3276
3279
|
for(const originalAttributeName in attributes) {
|
|
3277
|
-
const attributeName = originalAttributeName.toLowerCase();
|
|
3278
3280
|
const value = attributes[originalAttributeName];
|
|
3279
3281
|
if(value == null) {
|
|
3280
3282
|
continue;
|
|
3281
3283
|
}
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
+
const type = typeof value;
|
|
3285
|
+
if(type === 'string' || type === 'number') {
|
|
3286
|
+
element.setAttribute(originalAttributeName, value);
|
|
3287
|
+
continue;
|
|
3288
|
+
}
|
|
3289
|
+
const attributeName = originalAttributeName.toLowerCase();
|
|
3290
|
+
if(value.__$Observable) {
|
|
3291
|
+
if(BOOLEAN_ATTRIBUTES.has(attributeName)) {
|
|
3292
|
+
bindBooleanAttribute(element, attributeName, value);
|
|
3293
|
+
continue;
|
|
3294
|
+
}
|
|
3295
|
+
bindAttributeWithObservable(element, originalAttributeName, value);
|
|
3284
3296
|
continue;
|
|
3285
3297
|
}
|
|
3286
|
-
if(
|
|
3298
|
+
if(type === 'object') {
|
|
3287
3299
|
if(attributeName === 'class') {
|
|
3288
3300
|
bindClassAttribute(element, value);
|
|
3289
3301
|
continue;
|
|
@@ -3297,6 +3309,9 @@ var NativeComponents = (function (exports) {
|
|
|
3297
3309
|
bindBooleanAttribute(element, attributeName, value);
|
|
3298
3310
|
continue;
|
|
3299
3311
|
}
|
|
3312
|
+
if(value.__$isTemplateBinding) {
|
|
3313
|
+
value.$hydrate(element, attributeName);
|
|
3314
|
+
}
|
|
3300
3315
|
|
|
3301
3316
|
element.setAttribute(attributeName, value);
|
|
3302
3317
|
}
|
|
@@ -3384,30 +3399,23 @@ var NativeComponents = (function (exports) {
|
|
|
3384
3399
|
|
|
3385
3400
|
},
|
|
3386
3401
|
getChild: (child) => {
|
|
3387
|
-
if(child == null)
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
if(child
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
return child;
|
|
3395
|
-
}
|
|
3396
|
-
} while (child.toNdElement);
|
|
3402
|
+
if (child == null) return null;
|
|
3403
|
+
|
|
3404
|
+
child = child.toNdElement();
|
|
3405
|
+
if (child instanceof Node) return child;
|
|
3406
|
+
|
|
3407
|
+
while (child != null && !(child instanceof Node)) {
|
|
3408
|
+
child = child.toNdElement?.();
|
|
3397
3409
|
}
|
|
3398
3410
|
|
|
3399
|
-
return
|
|
3411
|
+
return child instanceof Node ? child : null;
|
|
3400
3412
|
},
|
|
3401
3413
|
/**
|
|
3402
3414
|
*
|
|
3403
3415
|
* @param {HTMLElement} element
|
|
3404
3416
|
* @param {Object} attributes
|
|
3405
3417
|
*/
|
|
3406
|
-
processAttributes:
|
|
3407
|
-
if (attributes) {
|
|
3408
|
-
AttributesWrapper(element, attributes);
|
|
3409
|
-
}
|
|
3410
|
-
},
|
|
3418
|
+
processAttributes: AttributesWrapper,
|
|
3411
3419
|
/**
|
|
3412
3420
|
*
|
|
3413
3421
|
* @param {HTMLElement} element
|
|
@@ -3999,8 +4007,19 @@ var NativeComponents = (function (exports) {
|
|
|
3999
4007
|
NDElement.prototype.ghostDom = function(element) {
|
|
4000
4008
|
if(!this.$attachements) {
|
|
4001
4009
|
this.$attachements = document.createDocumentFragment();
|
|
4010
|
+
this.toNdElement = () => {
|
|
4011
|
+
const fragment = document.createDocumentFragment();
|
|
4012
|
+
if(!this.$attachements.contains(this.$element)) {
|
|
4013
|
+
fragment.appendChild(this.$element);
|
|
4014
|
+
}
|
|
4015
|
+
fragment.appendChild(this.$attachements);
|
|
4016
|
+
return fragment;
|
|
4017
|
+
};
|
|
4018
|
+
}
|
|
4019
|
+
const child = NDElement.$getChild(element);
|
|
4020
|
+
if(child) {
|
|
4021
|
+
this.$attachements.appendChild(child);
|
|
4002
4022
|
}
|
|
4003
|
-
this.$attachements.appendChild(NDElement.$getChild(element));
|
|
4004
4023
|
return this;
|
|
4005
4024
|
};
|
|
4006
4025
|
|
|
@@ -15117,6 +15136,64 @@ var NativeComponents = (function (exports) {
|
|
|
15117
15136
|
ListGroup: null,
|
|
15118
15137
|
};
|
|
15119
15138
|
|
|
15139
|
+
|
|
15140
|
+
/**
|
|
15141
|
+
* @param {ObservableArray<*>|*[]} list
|
|
15142
|
+
* @returns {this}
|
|
15143
|
+
*/
|
|
15144
|
+
HasListItem.prototype.selectInto = function(list) {
|
|
15145
|
+
this.$description.selectedValues = list;
|
|
15146
|
+
return this;
|
|
15147
|
+
};
|
|
15148
|
+
|
|
15149
|
+
/**
|
|
15150
|
+
* @param {boolean|Observable<boolean>} [selectable=true]
|
|
15151
|
+
* @returns {this}
|
|
15152
|
+
*/
|
|
15153
|
+
HasListItem.prototype.selectable = function(selectable = true) {
|
|
15154
|
+
this.$description.selectable = BaseComponent.obs(selectable);
|
|
15155
|
+
return this;
|
|
15156
|
+
};
|
|
15157
|
+
|
|
15158
|
+
/**
|
|
15159
|
+
* Select items on click. Mutually exclusive with selectByCheckbox.
|
|
15160
|
+
* @returns {this}
|
|
15161
|
+
*/
|
|
15162
|
+
HasListItem.prototype.selectByClick = function() {
|
|
15163
|
+
this.$description.selectByClick.set(true);
|
|
15164
|
+
this.$description.selectByCheckbox.set(false);
|
|
15165
|
+
return this;
|
|
15166
|
+
};
|
|
15167
|
+
|
|
15168
|
+
/**
|
|
15169
|
+
* Select items via a checkbox. Mutually exclusive with selectByClick.
|
|
15170
|
+
* @returns {this}
|
|
15171
|
+
*/
|
|
15172
|
+
HasListItem.prototype.selectByCheckbox = function() {
|
|
15173
|
+
this.$description.selectByClick.set(false);
|
|
15174
|
+
this.$description.selectByCheckbox.set(true);
|
|
15175
|
+
return this;
|
|
15176
|
+
};
|
|
15177
|
+
|
|
15178
|
+
/**
|
|
15179
|
+
* @param {boolean|Observable<boolean>} [multi=true]
|
|
15180
|
+
* @returns {this}
|
|
15181
|
+
*/
|
|
15182
|
+
HasListItem.prototype.multiSelect = function(multi = true) {
|
|
15183
|
+
this.$description.multiSelect = BaseComponent.obs(multi);
|
|
15184
|
+
this.$description.selectable.set(true);
|
|
15185
|
+
return this;
|
|
15186
|
+
};
|
|
15187
|
+
|
|
15188
|
+
/**
|
|
15189
|
+
* @param {boolean} loopOnKeyboard
|
|
15190
|
+
* @returns {this}
|
|
15191
|
+
*/
|
|
15192
|
+
HasListItem.prototype.loopOnKeyboard = function(loopOnKeyboard) {
|
|
15193
|
+
this.$description.loopOnKeyboard = loopOnKeyboard;
|
|
15194
|
+
return this;
|
|
15195
|
+
};
|
|
15196
|
+
|
|
15120
15197
|
/**
|
|
15121
15198
|
* @param {ListItem|ListGroup|ListDivider} item
|
|
15122
15199
|
* @returns {this}
|
|
@@ -15140,7 +15217,6 @@ var NativeComponents = (function (exports) {
|
|
|
15140
15217
|
const ListItem = HasListItem.components.ListItem;
|
|
15141
15218
|
const item = new ListItem();
|
|
15142
15219
|
item.$parent = this;
|
|
15143
|
-
console.log(item.$parent);
|
|
15144
15220
|
|
|
15145
15221
|
item.label(label);
|
|
15146
15222
|
|
|
@@ -15191,6 +15267,7 @@ var NativeComponents = (function (exports) {
|
|
|
15191
15267
|
return this;
|
|
15192
15268
|
};
|
|
15193
15269
|
|
|
15270
|
+
|
|
15194
15271
|
/**
|
|
15195
15272
|
* Populate items from a data source using a builder function.
|
|
15196
15273
|
* The builder receives each data item and must return a ListItem or ListGroup.
|
|
@@ -15201,7 +15278,14 @@ var NativeComponents = (function (exports) {
|
|
|
15201
15278
|
*/
|
|
15202
15279
|
HasListItem.prototype.from = function(source, builder) {
|
|
15203
15280
|
this.$description.items = source;
|
|
15204
|
-
this.$description.itemBuilder =
|
|
15281
|
+
this.$description.itemBuilder = (...args) => {
|
|
15282
|
+
if(args[0].__$ListInstance) {
|
|
15283
|
+
return args[0];
|
|
15284
|
+
}
|
|
15285
|
+
const item = builder(...args);
|
|
15286
|
+
item.$parent = this;
|
|
15287
|
+
return item;
|
|
15288
|
+
};
|
|
15205
15289
|
return this;
|
|
15206
15290
|
};
|
|
15207
15291
|
|
|
@@ -15269,53 +15353,6 @@ var NativeComponents = (function (exports) {
|
|
|
15269
15353
|
BaseComponent.extends(List);
|
|
15270
15354
|
BaseComponent.use(List, HasItems, HasEventEmitter, HasListItem);
|
|
15271
15355
|
|
|
15272
|
-
/**
|
|
15273
|
-
* @param {ObservableArray<*>|*[]} list
|
|
15274
|
-
* @returns {this}
|
|
15275
|
-
*/
|
|
15276
|
-
List.prototype.selectInto = function(list) {
|
|
15277
|
-
this.$description.selectedValues = list;
|
|
15278
|
-
return this;
|
|
15279
|
-
};
|
|
15280
|
-
|
|
15281
|
-
/**
|
|
15282
|
-
* @param {boolean|Observable<boolean>} [selectable=true]
|
|
15283
|
-
* @returns {this}
|
|
15284
|
-
*/
|
|
15285
|
-
List.prototype.selectable = function(selectable = true) {
|
|
15286
|
-
this.$description.selectable = BaseComponent.obs(selectable);
|
|
15287
|
-
return this;
|
|
15288
|
-
};
|
|
15289
|
-
|
|
15290
|
-
/**
|
|
15291
|
-
* Select items on click. Mutually exclusive with selectByCheckbox.
|
|
15292
|
-
* @returns {this}
|
|
15293
|
-
*/
|
|
15294
|
-
List.prototype.selectByClick = function() {
|
|
15295
|
-
this.$description.selectByClick.set(true);
|
|
15296
|
-
this.$description.selectByCheckbox.set(false);
|
|
15297
|
-
return this;
|
|
15298
|
-
};
|
|
15299
|
-
|
|
15300
|
-
/**
|
|
15301
|
-
* Select items via a checkbox. Mutually exclusive with selectByClick.
|
|
15302
|
-
* @returns {this}
|
|
15303
|
-
*/
|
|
15304
|
-
List.prototype.selectByCheckbox = function() {
|
|
15305
|
-
this.$description.selectByClick.set(false);
|
|
15306
|
-
this.$description.selectByCheckbox.set(true);
|
|
15307
|
-
return this;
|
|
15308
|
-
};
|
|
15309
|
-
|
|
15310
|
-
/**
|
|
15311
|
-
* @param {boolean|Observable<boolean>} [multi=true]
|
|
15312
|
-
* @returns {this}
|
|
15313
|
-
*/
|
|
15314
|
-
List.prototype.multiSelect = function(multi = true) {
|
|
15315
|
-
this.$description.multiSelect = BaseComponent.obs(multi);
|
|
15316
|
-
this.$description.selectable.set(true);
|
|
15317
|
-
return this;
|
|
15318
|
-
};
|
|
15319
15356
|
|
|
15320
15357
|
/**
|
|
15321
15358
|
* @param {ObservableArray<*>|Observable<*[]>} observable
|
|
@@ -15336,15 +15373,6 @@ var NativeComponents = (function (exports) {
|
|
|
15336
15373
|
return this;
|
|
15337
15374
|
};
|
|
15338
15375
|
|
|
15339
|
-
/**
|
|
15340
|
-
* @param {boolean} loopOnKeyboard
|
|
15341
|
-
* @returns {this}
|
|
15342
|
-
*/
|
|
15343
|
-
List.prototype.loopOnKeyboard = function(loopOnKeyboard) {
|
|
15344
|
-
this.$description.loopOnKeyboard = loopOnKeyboard;
|
|
15345
|
-
return this;
|
|
15346
|
-
};
|
|
15347
|
-
|
|
15348
15376
|
/**
|
|
15349
15377
|
* @param {boolean} [divider=true]
|
|
15350
15378
|
* @returns {this}
|
|
@@ -15363,25 +15391,6 @@ var NativeComponents = (function (exports) {
|
|
|
15363
15391
|
return this;
|
|
15364
15392
|
};
|
|
15365
15393
|
|
|
15366
|
-
|
|
15367
|
-
/**
|
|
15368
|
-
* Populate items from a data source using a builder function.
|
|
15369
|
-
* The builder receives each data item and must return a ListItem or ListGroup.
|
|
15370
|
-
*
|
|
15371
|
-
* @param {ObservableArray<*>|*[]} source
|
|
15372
|
-
* @param {(item: *) => ListItem|ListGroup} builder
|
|
15373
|
-
* @returns {this}
|
|
15374
|
-
*/
|
|
15375
|
-
List.prototype.from = function(source, builder) {
|
|
15376
|
-
this.$description.items = source;
|
|
15377
|
-
this.$description.itemBuilder = (...args) => {
|
|
15378
|
-
const item = builder(...args);
|
|
15379
|
-
item.$parent = this;
|
|
15380
|
-
return item;
|
|
15381
|
-
};
|
|
15382
|
-
return this;
|
|
15383
|
-
};
|
|
15384
|
-
|
|
15385
15394
|
/**
|
|
15386
15395
|
* @param {(item: *, event: MouseEvent) => void} handler
|
|
15387
15396
|
* @returns {this}
|
|
@@ -15401,7 +15410,8 @@ var NativeComponents = (function (exports) {
|
|
|
15401
15410
|
};
|
|
15402
15411
|
|
|
15403
15412
|
/**
|
|
15404
|
-
* A single item in a List. Supports icon, label, subtitle, trailing
|
|
15413
|
+
* A single item in a List. Supports icon, label, subtitle, trailing slot,
|
|
15414
|
+
* disabled/selected states, swipe actions (mobile), and custom render.
|
|
15405
15415
|
*
|
|
15406
15416
|
* @example
|
|
15407
15417
|
* ListItem()
|
|
@@ -15411,10 +15421,12 @@ var NativeComponents = (function (exports) {
|
|
|
15411
15421
|
* .trailing(Badge('New').primary())
|
|
15412
15422
|
* .value('dashboard')
|
|
15413
15423
|
* .selected(isActive)
|
|
15424
|
+
* .swipeLeading([Button('Archive').success()])
|
|
15425
|
+
* .swipeTrailing([Button('Delete').danger()])
|
|
15414
15426
|
* .onClick(() => navigate('/dashboard'));
|
|
15415
15427
|
*
|
|
15416
15428
|
* ListItem.use((description, instance) => {
|
|
15417
|
-
* return Li({ class: 'list-item' },
|
|
15429
|
+
* return Li({ class: 'list-item' }, description.label);
|
|
15418
15430
|
* });
|
|
15419
15431
|
*
|
|
15420
15432
|
* @constructor
|
|
@@ -15428,18 +15440,20 @@ var NativeComponents = (function (exports) {
|
|
|
15428
15440
|
BaseComponent.call(this, props);
|
|
15429
15441
|
|
|
15430
15442
|
this.$description = {
|
|
15431
|
-
label:
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
|
|
15438
|
-
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
+
label: null,
|
|
15444
|
+
subtitle: null,
|
|
15445
|
+
icon: null,
|
|
15446
|
+
trailing: null,
|
|
15447
|
+
value: null,
|
|
15448
|
+
data: null,
|
|
15449
|
+
key: null,
|
|
15450
|
+
disabled: null,
|
|
15451
|
+
selected: null,
|
|
15452
|
+
visibility: null,
|
|
15453
|
+
isSelectedIcon: null,
|
|
15454
|
+
swipeLeading: [],
|
|
15455
|
+
swipeTrailing: [],
|
|
15456
|
+
render: null,
|
|
15443
15457
|
props,
|
|
15444
15458
|
};
|
|
15445
15459
|
}
|
|
@@ -15454,19 +15468,21 @@ var NativeComponents = (function (exports) {
|
|
|
15454
15468
|
/**
|
|
15455
15469
|
* Registers the render template for ListItem.
|
|
15456
15470
|
* @param {(description: {
|
|
15457
|
-
* label:
|
|
15458
|
-
* subtitle:
|
|
15459
|
-
*
|
|
15460
|
-
*
|
|
15461
|
-
*
|
|
15462
|
-
*
|
|
15463
|
-
*
|
|
15464
|
-
*
|
|
15465
|
-
*
|
|
15466
|
-
*
|
|
15467
|
-
*
|
|
15468
|
-
*
|
|
15469
|
-
*
|
|
15471
|
+
* label: NdChild|null,
|
|
15472
|
+
* subtitle: NdChild|null,
|
|
15473
|
+
* icon: NdChild|null,
|
|
15474
|
+
* trailing: NdChild|null,
|
|
15475
|
+
* value: *,
|
|
15476
|
+
* data: *|null,
|
|
15477
|
+
* key: string|null,
|
|
15478
|
+
* disabled: Observable<boolean>|null,
|
|
15479
|
+
* selected: Observable<boolean>|null,
|
|
15480
|
+
* visibility: Observable<boolean>|null,
|
|
15481
|
+
* isSelectedIcon: NdChild|null,
|
|
15482
|
+
* swipeLeading: NdChild[],
|
|
15483
|
+
* swipeTrailing: NdChild[],
|
|
15484
|
+
* render: ((desc: *, instance: ListItem) => NdChild)|null,
|
|
15485
|
+
* props: GlobalAttributes,
|
|
15470
15486
|
* }, instance: ListItem) => NdChild} template
|
|
15471
15487
|
*/
|
|
15472
15488
|
ListItem.use = function(template) {
|
|
@@ -15500,15 +15516,6 @@ var NativeComponents = (function (exports) {
|
|
|
15500
15516
|
return this;
|
|
15501
15517
|
};
|
|
15502
15518
|
|
|
15503
|
-
/**
|
|
15504
|
-
* @param {NdChild} icon
|
|
15505
|
-
* @returns {this}
|
|
15506
|
-
*/
|
|
15507
|
-
ListItem.prototype.isSelectedIcon = function(icon) {
|
|
15508
|
-
this.$description.isSelectedIcon = icon;
|
|
15509
|
-
return this;
|
|
15510
|
-
};
|
|
15511
|
-
|
|
15512
15519
|
/**
|
|
15513
15520
|
* @param {NdChild} trailing
|
|
15514
15521
|
* @returns {this}
|
|
@@ -15572,6 +15579,36 @@ var NativeComponents = (function (exports) {
|
|
|
15572
15579
|
return this;
|
|
15573
15580
|
};
|
|
15574
15581
|
|
|
15582
|
+
/**
|
|
15583
|
+
* Icon displayed when the item is selected (selectByClick mode).
|
|
15584
|
+
* @param {NdChild} icon
|
|
15585
|
+
* @returns {this}
|
|
15586
|
+
*/
|
|
15587
|
+
ListItem.prototype.isSelectedIcon = function(icon) {
|
|
15588
|
+
this.$description.isSelectedIcon = icon;
|
|
15589
|
+
return this;
|
|
15590
|
+
};
|
|
15591
|
+
|
|
15592
|
+
/**
|
|
15593
|
+
* Swipe actions revealed on the leading (left) side — mobile swipe gesture.
|
|
15594
|
+
* @param {NdChild[]} actions
|
|
15595
|
+
* @returns {this}
|
|
15596
|
+
*/
|
|
15597
|
+
ListItem.prototype.swipeLeading = function(actions) {
|
|
15598
|
+
this.$description.swipeLeading = Array.isArray(actions) ? actions : [actions];
|
|
15599
|
+
return this;
|
|
15600
|
+
};
|
|
15601
|
+
|
|
15602
|
+
/**
|
|
15603
|
+
* Swipe actions revealed on the trailing (right) side — mobile swipe gesture.
|
|
15604
|
+
* @param {NdChild[]} actions
|
|
15605
|
+
* @returns {this}
|
|
15606
|
+
*/
|
|
15607
|
+
ListItem.prototype.swipeTrailing = function(actions) {
|
|
15608
|
+
this.$description.swipeTrailing = Array.isArray(actions) ? actions : [actions];
|
|
15609
|
+
return this;
|
|
15610
|
+
};
|
|
15611
|
+
|
|
15575
15612
|
/**
|
|
15576
15613
|
* @param {Function} handler
|
|
15577
15614
|
* @returns {this}
|
|
@@ -15613,6 +15650,9 @@ var NativeComponents = (function (exports) {
|
|
|
15613
15650
|
BaseComponent.call(this, props);
|
|
15614
15651
|
|
|
15615
15652
|
this.$description = {
|
|
15653
|
+
selectable: $(false),
|
|
15654
|
+
multiSelect: $(false),
|
|
15655
|
+
selectedValues: $.array(),
|
|
15616
15656
|
label: label,
|
|
15617
15657
|
icon: null,
|
|
15618
15658
|
items: $.array(),
|
|
@@ -15620,6 +15660,9 @@ var NativeComponents = (function (exports) {
|
|
|
15620
15660
|
collapsable: false,
|
|
15621
15661
|
collapsed: null,
|
|
15622
15662
|
visibility: $(true),
|
|
15663
|
+
selectByCheckbox: $(false),
|
|
15664
|
+
selectByClick: $(false),
|
|
15665
|
+
loopOnKeyboard: $(false),
|
|
15623
15666
|
props,
|
|
15624
15667
|
};
|
|
15625
15668
|
}
|
|
@@ -15630,6 +15673,7 @@ var NativeComponents = (function (exports) {
|
|
|
15630
15673
|
HasListItem.components.ListGroup = ListGroup;
|
|
15631
15674
|
|
|
15632
15675
|
ListGroup.defaultTemplate = null;
|
|
15676
|
+
ListGroup.prototype.__$ListInstance = true;
|
|
15633
15677
|
|
|
15634
15678
|
/**
|
|
15635
15679
|
* Registers the render template for ListGroup.
|
|
@@ -20945,14 +20989,7 @@ var NativeComponents = (function (exports) {
|
|
|
20945
20989
|
* @returns {HTMLElement|DocumentFragment} The underlying DOM node
|
|
20946
20990
|
*/
|
|
20947
20991
|
NDElement.prototype.toNdElement = function () {
|
|
20948
|
-
|
|
20949
|
-
if(this.$attachements) {
|
|
20950
|
-
if(!this.$attachements.contains(this.$element)) {
|
|
20951
|
-
this.$attachements.append(this.$element);
|
|
20952
|
-
}
|
|
20953
|
-
return this.$attachements;
|
|
20954
|
-
}
|
|
20955
|
-
return element;
|
|
20992
|
+
return this.$element;
|
|
20956
20993
|
};
|
|
20957
20994
|
|
|
20958
20995
|
/**
|
|
@@ -21108,17 +21145,6 @@ var NativeComponents = (function (exports) {
|
|
|
21108
21145
|
return this;
|
|
21109
21146
|
};
|
|
21110
21147
|
|
|
21111
|
-
ObservableItem.prototype.handleNdAttribute = function(element, attributeName) {
|
|
21112
|
-
if(BOOLEAN_ATTRIBUTES.has(attributeName)) {
|
|
21113
|
-
bindBooleanAttribute(element, attributeName, this);
|
|
21114
|
-
return;
|
|
21115
|
-
}
|
|
21116
|
-
|
|
21117
|
-
bindAttributeWithObservable(element, attributeName, this);
|
|
21118
|
-
};
|
|
21119
|
-
|
|
21120
|
-
ObservableChecker.prototype.handleNdAttribute = ObservableItem.prototype.handleNdAttribute;
|
|
21121
|
-
|
|
21122
21148
|
/**
|
|
21123
21149
|
* Groups multiple columns under a shared header in SimpleTable/DataTable.
|
|
21124
21150
|
*
|