native-document 1.0.166 → 1.0.168
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/.vitepress/config.js +166 -0
- package/CHANGELOG.md +153 -0
- package/components.js +2 -1
- package/dist/native-document.components.min.js +495 -228
- package/dist/native-document.dev.js +7 -0
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/docs/advanced-components.md +213 -608
- package/docs/anchor.md +173 -312
- package/docs/cache.md +95 -803
- package/docs/cli.md +179 -0
- package/docs/components/accordion.md +172 -0
- package/docs/components/alert.md +99 -0
- package/docs/components/avatar.md +160 -0
- package/docs/components/badge.md +102 -0
- package/docs/components/breadcrumb.md +89 -0
- package/docs/components/button.md +183 -0
- package/docs/components/card.md +69 -0
- package/docs/components/context-menu.md +118 -0
- package/docs/components/data-table.md +345 -0
- package/docs/components/dropdown.md +214 -0
- package/docs/components/form/autocomplete-field.md +81 -0
- package/docs/components/form/checkbox-field.md +41 -0
- package/docs/components/form/checkbox-group-field.md +54 -0
- package/docs/components/form/color-field.md +64 -0
- package/docs/components/form/date-field.md +92 -0
- package/docs/components/form/field-collection.md +63 -0
- package/docs/components/form/file-field.md +203 -0
- package/docs/components/form/form-control.md +87 -0
- package/docs/components/form/image-field.md +90 -0
- package/docs/components/form/index.md +115 -0
- package/docs/components/form/number-field.md +65 -0
- package/docs/components/form/radio-field.md +51 -0
- package/docs/components/form/select-field.md +123 -0
- package/docs/components/form/slider.md +136 -0
- package/docs/components/form/string-field.md +134 -0
- package/docs/components/form/textarea-field.md +65 -0
- package/docs/components/form-fields.md +372 -0
- package/docs/components/getting-started.md +264 -0
- package/docs/components/index.md +337 -0
- package/docs/components/layout.md +279 -0
- package/docs/components/list.md +73 -0
- package/docs/components/menu.md +215 -0
- package/docs/components/modal.md +156 -0
- package/docs/components/pagination.md +95 -0
- package/docs/components/popover.md +131 -0
- package/docs/components/progress.md +111 -0
- package/docs/components/shortcut-manager.md +221 -0
- package/docs/components/simple-table.md +107 -0
- package/docs/components/skeleton.md +155 -0
- package/docs/components/spinner.md +100 -0
- package/docs/components/splitter.md +133 -0
- package/docs/components/stepper.md +163 -0
- package/docs/components/switch.md +113 -0
- package/docs/components/tabs.md +153 -0
- package/docs/components/toast.md +119 -0
- package/docs/components/tooltip.md +151 -0
- package/docs/components/traits.md +261 -0
- package/docs/conditional-rendering.md +170 -588
- package/docs/contributing.md +300 -25
- package/docs/core-concepts.md +205 -374
- package/docs/elements.md +251 -367
- package/docs/extending-native-document-element.md +192 -207
- package/docs/filters.md +153 -1122
- package/docs/getting-started.md +193 -267
- package/docs/i18n.md +241 -0
- package/docs/index.md +76 -0
- package/docs/lifecycle-events.md +143 -75
- package/docs/list-rendering.md +227 -852
- package/docs/memory-management.md +134 -47
- package/docs/native-document-element.md +337 -186
- package/docs/native-fetch.md +99 -630
- package/docs/observable-resource.md +364 -0
- package/docs/observables.md +592 -526
- package/docs/routing.md +244 -653
- package/docs/state-management.md +134 -241
- package/docs/svg-elements.md +231 -0
- package/docs/theming.md +409 -0
- package/docs/tutorials/.gitkeep +0 -0
- package/docs/validation.md +95 -97
- package/docs/vitepress-conventions.md +219 -0
- package/package.json +34 -13
- package/readme.md +269 -89
- package/src/components/card/Card.js +93 -39
- package/src/components/card/index.js +1 -1
- package/src/components/list/HasListItem.js +171 -0
- package/src/components/list/List.js +41 -107
- package/src/components/list/ListDivider.js +39 -0
- package/src/components/list/ListGroup.js +76 -59
- package/src/components/list/ListItem.js +117 -69
- package/src/components/list/index.js +3 -1
- package/src/components/list/types/ListItem.d.ts +45 -34
- package/src/components/spacer/Spacer.js +1 -1
- package/src/core/data/ObservableResource.js +5 -0
- package/src/core/data/observable-helpers/observable.prototypes.js +2 -0
- package/src/ui/components/card/CardRender.js +133 -0
- package/src/ui/components/card/card.css +169 -0
- package/src/ui/components/contextmenu/ContextmenuRender.js +1 -1
- package/src/ui/components/list/ListRender.js +18 -0
- package/src/ui/components/list/divider/ListDividerRender.js +10 -0
- package/src/ui/components/list/divider/list-divider.css +12 -0
- package/src/ui/components/list/group/ListGroupRender.js +61 -0
- package/src/ui/components/list/group/list-group.css +62 -0
- package/src/ui/components/list/item/ListItemRender.js +238 -0
- package/src/ui/components/list/item/list-item.css +191 -0
- package/src/ui/components/list/list.css +24 -0
- package/src/ui/components/spacer/SpacerRender.js +10 -0
- package/src/ui/index.js +8 -0
|
@@ -2525,6 +2525,8 @@ var NativeComponents = (function (exports) {
|
|
|
2525
2525
|
* // Reacts to locale changes automatically
|
|
2526
2526
|
* Store.setLocale('en-US');
|
|
2527
2527
|
*/
|
|
2528
|
+
|
|
2529
|
+
|
|
2528
2530
|
ObservableItem.prototype.format = function(type, options = {}) {
|
|
2529
2531
|
const self = this;
|
|
2530
2532
|
|
|
@@ -2665,6 +2667,11 @@ var NativeComponents = (function (exports) {
|
|
|
2665
2667
|
});
|
|
2666
2668
|
};
|
|
2667
2669
|
|
|
2670
|
+
ObservableResource.prototype.into = function($observable) {
|
|
2671
|
+
this.data = $observable;
|
|
2672
|
+
return this;
|
|
2673
|
+
};
|
|
2674
|
+
|
|
2668
2675
|
ObservableResource.prototype.$run = function(isRefetch = false) {
|
|
2669
2676
|
const needsSignal = this.$fn.length > this.$dependencies.length;
|
|
2670
2677
|
if(needsSignal) {
|
|
@@ -6942,7 +6949,6 @@ var NativeComponents = (function (exports) {
|
|
|
6942
6949
|
/**
|
|
6943
6950
|
* Versatile content container with optional image, header, footer, actions. Supports clickable, hoverable, loading, and horizontal layouts.
|
|
6944
6951
|
*
|
|
6945
|
-
*
|
|
6946
6952
|
* @example
|
|
6947
6953
|
* const card = new Card()
|
|
6948
6954
|
* .title(Span('Card title'))
|
|
@@ -6958,42 +6964,80 @@ var NativeComponents = (function (exports) {
|
|
|
6958
6964
|
* });
|
|
6959
6965
|
*
|
|
6960
6966
|
* @constructor
|
|
6961
|
-
* @param {GlobalAttributes} [
|
|
6967
|
+
* @param {GlobalAttributes} [props={}]
|
|
6962
6968
|
*/
|
|
6963
|
-
function Card(
|
|
6964
|
-
if(!(this instanceof Card)) {
|
|
6965
|
-
return new Card(
|
|
6969
|
+
function Card(props = {}) {
|
|
6970
|
+
if (!(this instanceof Card)) {
|
|
6971
|
+
return new Card(props);
|
|
6966
6972
|
}
|
|
6973
|
+
|
|
6967
6974
|
this.$description = {
|
|
6968
|
-
|
|
6975
|
+
title: null,
|
|
6976
|
+
subtitle: null,
|
|
6977
|
+
image: null,
|
|
6978
|
+
imagePosition: 'top',
|
|
6979
|
+
content: null,
|
|
6980
|
+
variant: null,
|
|
6981
|
+
loading: null,
|
|
6982
|
+
horizontal: false,
|
|
6983
|
+
hoverable: false,
|
|
6984
|
+
actions: [],
|
|
6985
|
+
renderImage: null,
|
|
6986
|
+
renderHeader: null,
|
|
6987
|
+
renderContent: null,
|
|
6988
|
+
renderFooter: null,
|
|
6989
|
+
renderActions: null,
|
|
6990
|
+
layout: null,
|
|
6991
|
+
props,
|
|
6969
6992
|
};
|
|
6970
6993
|
}
|
|
6994
|
+
|
|
6971
6995
|
BaseComponent.extends(Card);
|
|
6996
|
+
BaseComponent.use(Card, HasEventEmitter);
|
|
6972
6997
|
|
|
6973
6998
|
Card.defaultTemplate = null;
|
|
6974
6999
|
|
|
6975
7000
|
/**
|
|
6976
7001
|
* Registers the render template for Card.
|
|
6977
7002
|
* @param {(description: {
|
|
6978
|
-
*
|
|
7003
|
+
* title: NdChild|null,
|
|
7004
|
+
* subtitle: NdChild|null,
|
|
7005
|
+
* image: string|null,
|
|
7006
|
+
* imagePosition: 'top'|'bottom'|'left'|'right',
|
|
7007
|
+
* content: NdChild|null,
|
|
7008
|
+
* variant: 'elevated'|'outlined'|'flat'|string|null,
|
|
7009
|
+
* loading: Observable<boolean>|null,
|
|
7010
|
+
* horizontal: boolean,
|
|
7011
|
+
* hoverable: boolean,
|
|
7012
|
+
* actions: { label: NdChild, callback: () => void }[],
|
|
7013
|
+
* renderImage: ((desc: *, instance: Card) => NdChild)|null,
|
|
7014
|
+
* renderHeader: ((desc: *, instance: Card) => NdChild)|null,
|
|
7015
|
+
* renderContent: ((desc: *, instance: Card) => NdChild)|null,
|
|
7016
|
+
* renderFooter: ((desc: *, instance: Card) => NdChild)|null,
|
|
7017
|
+
* renderActions: ((desc: *, instance: Card) => NdChild)|null,
|
|
7018
|
+
* layout: ((slots: { header: NdChild, content: NdChild, footer: NdChild, image: NdChild, actions: NdChild }, instance: Card) => NdChild)|null,
|
|
6979
7019
|
* props: GlobalAttributes,
|
|
6980
7020
|
* }, instance: Card) => NdChild} template
|
|
6981
7021
|
*/
|
|
6982
|
-
Card.use = function(template) {
|
|
7022
|
+
Card.use = function(template) {
|
|
7023
|
+
Card.defaultTemplate = template;
|
|
7024
|
+
};
|
|
6983
7025
|
|
|
6984
7026
|
/**
|
|
6985
7027
|
* @param {NdChild} title
|
|
6986
7028
|
* @returns {this}
|
|
6987
7029
|
*/
|
|
6988
7030
|
Card.prototype.title = function(title) {
|
|
7031
|
+
this.$description.title = title;
|
|
6989
7032
|
return this;
|
|
6990
7033
|
};
|
|
6991
7034
|
|
|
6992
7035
|
/**
|
|
6993
|
-
* @param {NdChild}
|
|
7036
|
+
* @param {NdChild} subtitle
|
|
6994
7037
|
* @returns {this}
|
|
6995
7038
|
*/
|
|
6996
|
-
Card.prototype.subtitle = function(
|
|
7039
|
+
Card.prototype.subtitle = function(subtitle) {
|
|
7040
|
+
this.$description.subtitle = subtitle;
|
|
6997
7041
|
return this;
|
|
6998
7042
|
};
|
|
6999
7043
|
|
|
@@ -7003,6 +7047,8 @@ var NativeComponents = (function (exports) {
|
|
|
7003
7047
|
* @returns {this}
|
|
7004
7048
|
*/
|
|
7005
7049
|
Card.prototype.image = function(src, position = 'top') {
|
|
7050
|
+
this.$description.image = src;
|
|
7051
|
+
this.$description.imagePosition = position;
|
|
7006
7052
|
return this;
|
|
7007
7053
|
};
|
|
7008
7054
|
|
|
@@ -7011,6 +7057,7 @@ var NativeComponents = (function (exports) {
|
|
|
7011
7057
|
* @returns {this}
|
|
7012
7058
|
*/
|
|
7013
7059
|
Card.prototype.content = function(content) {
|
|
7060
|
+
this.$description.content = content;
|
|
7014
7061
|
return this;
|
|
7015
7062
|
};
|
|
7016
7063
|
|
|
@@ -7021,51 +7068,55 @@ var NativeComponents = (function (exports) {
|
|
|
7021
7068
|
* @returns {this}
|
|
7022
7069
|
*/
|
|
7023
7070
|
Card.prototype.variant = function(name) {
|
|
7071
|
+
this.$description.variant = name;
|
|
7024
7072
|
return this;
|
|
7025
7073
|
};
|
|
7026
7074
|
|
|
7027
7075
|
/**
|
|
7028
7076
|
* @returns {this}
|
|
7029
7077
|
*/
|
|
7030
|
-
Card.prototype.
|
|
7031
|
-
return this;
|
|
7078
|
+
Card.prototype.elevated = function() {
|
|
7079
|
+
return this.variant('elevated');
|
|
7032
7080
|
};
|
|
7033
7081
|
|
|
7034
7082
|
/**
|
|
7035
7083
|
* @returns {this}
|
|
7036
7084
|
*/
|
|
7037
|
-
Card.prototype.
|
|
7038
|
-
return this;
|
|
7085
|
+
Card.prototype.outlined = function() {
|
|
7086
|
+
return this.variant('outlined');
|
|
7039
7087
|
};
|
|
7040
7088
|
|
|
7041
7089
|
/**
|
|
7042
7090
|
* @returns {this}
|
|
7043
7091
|
*/
|
|
7044
7092
|
Card.prototype.flat = function() {
|
|
7045
|
-
return this;
|
|
7093
|
+
return this.variant('flat');
|
|
7046
7094
|
};
|
|
7047
7095
|
|
|
7048
7096
|
// Behavior
|
|
7097
|
+
|
|
7049
7098
|
/**
|
|
7050
7099
|
* @param {Function} handler
|
|
7051
7100
|
* @returns {this}
|
|
7052
7101
|
*/
|
|
7053
7102
|
Card.prototype.clickable = function(handler) {
|
|
7054
|
-
return this;
|
|
7103
|
+
return this.onClick(handler);
|
|
7055
7104
|
};
|
|
7056
7105
|
|
|
7057
7106
|
/**
|
|
7058
7107
|
* @returns {this}
|
|
7059
7108
|
*/
|
|
7060
7109
|
Card.prototype.hoverable = function() {
|
|
7110
|
+
this.$description.hoverable = true;
|
|
7061
7111
|
return this;
|
|
7062
7112
|
};
|
|
7063
7113
|
|
|
7064
7114
|
/**
|
|
7065
|
-
* @param {boolean|Observable<boolean>} [isLoading]
|
|
7115
|
+
* @param {boolean|Observable<boolean>} [isLoading=true]
|
|
7066
7116
|
* @returns {this}
|
|
7067
7117
|
*/
|
|
7068
7118
|
Card.prototype.loading = function(isLoading = true) {
|
|
7119
|
+
this.$description.loading = BaseComponent.obs(isLoading);
|
|
7069
7120
|
return this;
|
|
7070
7121
|
};
|
|
7071
7122
|
|
|
@@ -7075,46 +7126,54 @@ var NativeComponents = (function (exports) {
|
|
|
7075
7126
|
* @returns {this}
|
|
7076
7127
|
*/
|
|
7077
7128
|
Card.prototype.horizontal = function() {
|
|
7129
|
+
this.$description.horizontal = true;
|
|
7078
7130
|
return this;
|
|
7079
7131
|
};
|
|
7080
7132
|
|
|
7081
|
-
//
|
|
7133
|
+
// Actions
|
|
7134
|
+
|
|
7082
7135
|
/**
|
|
7083
|
-
* @param {
|
|
7136
|
+
* @param {NdChild} label
|
|
7137
|
+
* @param {() => void} callback
|
|
7084
7138
|
* @returns {this}
|
|
7085
7139
|
*/
|
|
7086
|
-
Card.prototype.
|
|
7140
|
+
Card.prototype.action = function(label, callback) {
|
|
7141
|
+
this.$description.actions.push({ label, callback });
|
|
7087
7142
|
return this;
|
|
7088
7143
|
};
|
|
7089
7144
|
|
|
7090
7145
|
/**
|
|
7091
|
-
* @param {Function} handler
|
|
7092
7146
|
* @returns {this}
|
|
7093
7147
|
*/
|
|
7094
|
-
Card.prototype.
|
|
7148
|
+
Card.prototype.clearActions = function() {
|
|
7149
|
+
this.$description.actions = [];
|
|
7095
7150
|
return this;
|
|
7096
7151
|
};
|
|
7097
7152
|
|
|
7153
|
+
// Events
|
|
7154
|
+
|
|
7098
7155
|
/**
|
|
7156
|
+
* @param {Function} handler
|
|
7099
7157
|
* @returns {this}
|
|
7100
7158
|
*/
|
|
7101
|
-
Card.prototype.
|
|
7102
|
-
this
|
|
7159
|
+
Card.prototype.onClick = function(handler) {
|
|
7160
|
+
this.on('click', handler);
|
|
7103
7161
|
return this;
|
|
7104
7162
|
};
|
|
7105
7163
|
|
|
7106
7164
|
/**
|
|
7107
|
-
* @param {
|
|
7108
|
-
* @param {() => void} callback
|
|
7165
|
+
* @param {Function} handler
|
|
7109
7166
|
* @returns {this}
|
|
7110
7167
|
*/
|
|
7111
|
-
Card.prototype.
|
|
7112
|
-
this
|
|
7168
|
+
Card.prototype.onHover = function(handler) {
|
|
7169
|
+
this.on('hover', handler);
|
|
7113
7170
|
return this;
|
|
7114
7171
|
};
|
|
7115
7172
|
|
|
7173
|
+
// Custom renderers
|
|
7174
|
+
|
|
7116
7175
|
/**
|
|
7117
|
-
* @param {(desc: *, instance:
|
|
7176
|
+
* @param {(desc: *, instance: Card) => NdChild} renderFn
|
|
7118
7177
|
* @returns {this}
|
|
7119
7178
|
*/
|
|
7120
7179
|
Card.prototype.renderImage = function(renderFn) {
|
|
@@ -7123,7 +7182,7 @@ var NativeComponents = (function (exports) {
|
|
|
7123
7182
|
};
|
|
7124
7183
|
|
|
7125
7184
|
/**
|
|
7126
|
-
* @param {(desc: *, instance:
|
|
7185
|
+
* @param {(desc: *, instance: Card) => NdChild} renderFn
|
|
7127
7186
|
* @returns {this}
|
|
7128
7187
|
*/
|
|
7129
7188
|
Card.prototype.renderHeader = function(renderFn) {
|
|
@@ -7132,7 +7191,7 @@ var NativeComponents = (function (exports) {
|
|
|
7132
7191
|
};
|
|
7133
7192
|
|
|
7134
7193
|
/**
|
|
7135
|
-
* @param {(desc: *, instance:
|
|
7194
|
+
* @param {(desc: *, instance: Card) => NdChild} renderFn
|
|
7136
7195
|
* @returns {this}
|
|
7137
7196
|
*/
|
|
7138
7197
|
Card.prototype.renderContent = function(renderFn) {
|
|
@@ -7141,7 +7200,7 @@ var NativeComponents = (function (exports) {
|
|
|
7141
7200
|
};
|
|
7142
7201
|
|
|
7143
7202
|
/**
|
|
7144
|
-
* @param {(desc: *, instance:
|
|
7203
|
+
* @param {(desc: *, instance: Card) => NdChild} renderFn
|
|
7145
7204
|
* @returns {this}
|
|
7146
7205
|
*/
|
|
7147
7206
|
Card.prototype.renderFooter = function(renderFn) {
|
|
@@ -7150,18 +7209,20 @@ var NativeComponents = (function (exports) {
|
|
|
7150
7209
|
};
|
|
7151
7210
|
|
|
7152
7211
|
/**
|
|
7153
|
-
* @param {(desc: *, instance:
|
|
7212
|
+
* @param {(desc: *, instance: Card) => NdChild} renderFn
|
|
7154
7213
|
* @returns {this}
|
|
7155
7214
|
*/
|
|
7156
|
-
Card.prototype.
|
|
7157
|
-
this.$description.
|
|
7215
|
+
Card.prototype.renderActions = function(renderFn) {
|
|
7216
|
+
this.$description.renderActions = renderFn;
|
|
7158
7217
|
return this;
|
|
7159
7218
|
};
|
|
7160
7219
|
|
|
7161
7220
|
/**
|
|
7162
|
-
* @
|
|
7221
|
+
* @param {(slots: { header: NdChild, content: NdChild, footer: NdChild, image: NdChild, actions: NdChild }, instance: Card) => NdChild} layoutFn
|
|
7222
|
+
* @returns {this}
|
|
7163
7223
|
*/
|
|
7164
|
-
Card.prototype.
|
|
7224
|
+
Card.prototype.layout = function(layoutFn) {
|
|
7225
|
+
this.$description.layout = layoutFn;
|
|
7165
7226
|
return this;
|
|
7166
7227
|
};
|
|
7167
7228
|
|
|
@@ -15006,8 +15067,146 @@ var NativeComponents = (function (exports) {
|
|
|
15006
15067
|
};
|
|
15007
15068
|
|
|
15008
15069
|
/**
|
|
15009
|
-
*
|
|
15070
|
+
* Visual separator between items in a List.
|
|
15071
|
+
*
|
|
15072
|
+
* @example
|
|
15073
|
+
* List()
|
|
15074
|
+
* .item('Dashboard')
|
|
15075
|
+
* .divider()
|
|
15076
|
+
* .item('Settings')
|
|
15077
|
+
*
|
|
15078
|
+
* ListDivider.use((description, instance) => {
|
|
15079
|
+
* return Li({ class: 'list-divider', role: 'separator' });
|
|
15080
|
+
* });
|
|
15081
|
+
*
|
|
15082
|
+
* @constructor
|
|
15083
|
+
* @param {GlobalAttributes} [props={}]
|
|
15084
|
+
*/
|
|
15085
|
+
function ListDivider(props = {}) {
|
|
15086
|
+
if (!(this instanceof ListDivider)) {
|
|
15087
|
+
return new ListDivider(props);
|
|
15088
|
+
}
|
|
15089
|
+
|
|
15090
|
+
BaseComponent.call(this, props);
|
|
15091
|
+
|
|
15092
|
+
this.$description = { props };
|
|
15093
|
+
}
|
|
15094
|
+
|
|
15095
|
+
BaseComponent.extends(ListDivider);
|
|
15096
|
+
|
|
15097
|
+
ListDivider.defaultTemplate = null;
|
|
15098
|
+
|
|
15099
|
+
/**
|
|
15100
|
+
* Registers the render template for ListDivider.
|
|
15101
|
+
* @param {(description: { props: GlobalAttributes }, instance: ListDivider) => NdChild} template
|
|
15102
|
+
*/
|
|
15103
|
+
ListDivider.use = function(template) {
|
|
15104
|
+
ListDivider.defaultTemplate = template;
|
|
15105
|
+
};
|
|
15106
|
+
|
|
15107
|
+
/**
|
|
15108
|
+
* Trait that adds item/group/divider management to List and ListGroup.
|
|
15109
|
+
* Mirrors the HasMenuItem pattern.
|
|
15110
|
+
*
|
|
15111
|
+
* @constructor
|
|
15112
|
+
*/
|
|
15113
|
+
function HasListItem() {}
|
|
15114
|
+
|
|
15115
|
+
HasListItem.components = {
|
|
15116
|
+
ListItem: null,
|
|
15117
|
+
ListGroup: null,
|
|
15118
|
+
};
|
|
15119
|
+
|
|
15120
|
+
/**
|
|
15121
|
+
* @param {ListItem|ListGroup|ListDivider} item
|
|
15122
|
+
* @returns {this}
|
|
15123
|
+
*/
|
|
15124
|
+
HasListItem.prototype.add = function(item) {
|
|
15125
|
+
if (item === this) {
|
|
15126
|
+
return this;
|
|
15127
|
+
}
|
|
15128
|
+
item.$parent = this;
|
|
15129
|
+
this.$description.items.push(item);
|
|
15130
|
+
return this;
|
|
15131
|
+
};
|
|
15132
|
+
|
|
15133
|
+
/**
|
|
15134
|
+
* @param {NdChild} label
|
|
15135
|
+
* @param {NdChild|((item: ListItem) => void)} [iconOrBuilder]
|
|
15136
|
+
* @param {((item: ListItem) => void)} [builder]
|
|
15137
|
+
* @returns {this}
|
|
15138
|
+
*/
|
|
15139
|
+
HasListItem.prototype.item = function(label, iconOrBuilder, builder) {
|
|
15140
|
+
const ListItem = HasListItem.components.ListItem;
|
|
15141
|
+
const item = new ListItem();
|
|
15142
|
+
item.$parent = this;
|
|
15143
|
+
console.log(item.$parent);
|
|
15144
|
+
|
|
15145
|
+
item.label(label);
|
|
15146
|
+
|
|
15147
|
+
if (typeof iconOrBuilder === 'function') {
|
|
15148
|
+
iconOrBuilder(item);
|
|
15149
|
+
} else if (iconOrBuilder) {
|
|
15150
|
+
item.icon(iconOrBuilder);
|
|
15151
|
+
if (typeof builder === 'function') {
|
|
15152
|
+
builder(item);
|
|
15153
|
+
}
|
|
15154
|
+
}
|
|
15155
|
+
|
|
15156
|
+
this.$description.items.push(item);
|
|
15157
|
+
return this;
|
|
15158
|
+
};
|
|
15159
|
+
|
|
15160
|
+
/**
|
|
15161
|
+
* @param {NdChild} label
|
|
15162
|
+
* @param {NdChild|((group: ListGroup) => void)} [iconOrBuilder]
|
|
15163
|
+
* @param {((group: ListGroup) => void)} [builder]
|
|
15164
|
+
* @returns {this}
|
|
15165
|
+
*/
|
|
15166
|
+
HasListItem.prototype.group = function(label, iconOrBuilder, builder) {
|
|
15167
|
+
const ListGroup = HasListItem.components.ListGroup;
|
|
15168
|
+
const group = new ListGroup(label);
|
|
15169
|
+
group.$parent = this;
|
|
15170
|
+
|
|
15171
|
+
if (typeof iconOrBuilder === 'function') {
|
|
15172
|
+
iconOrBuilder(group);
|
|
15173
|
+
} else if (iconOrBuilder) {
|
|
15174
|
+
group.icon(iconOrBuilder);
|
|
15175
|
+
if (typeof builder === 'function') {
|
|
15176
|
+
builder(group);
|
|
15177
|
+
}
|
|
15178
|
+
}
|
|
15179
|
+
|
|
15180
|
+
this.$description.items.push(group);
|
|
15181
|
+
return this;
|
|
15182
|
+
};
|
|
15183
|
+
|
|
15184
|
+
/**
|
|
15185
|
+
* @returns {this}
|
|
15186
|
+
*/
|
|
15187
|
+
HasListItem.prototype.divider = function() {
|
|
15188
|
+
const divider = new ListDivider();
|
|
15189
|
+
divider.$parent = this;
|
|
15190
|
+
this.$description.items.push(divider);
|
|
15191
|
+
return this;
|
|
15192
|
+
};
|
|
15193
|
+
|
|
15194
|
+
/**
|
|
15195
|
+
* Populate items from a data source using a builder function.
|
|
15196
|
+
* The builder receives each data item and must return a ListItem or ListGroup.
|
|
15010
15197
|
*
|
|
15198
|
+
* @param {ObservableArray<*>|*[]} source
|
|
15199
|
+
* @param {(item: *) => ListItem|ListGroup} builder
|
|
15200
|
+
* @returns {this}
|
|
15201
|
+
*/
|
|
15202
|
+
HasListItem.prototype.from = function(source, builder) {
|
|
15203
|
+
this.$description.items = source;
|
|
15204
|
+
this.$description.itemBuilder = builder;
|
|
15205
|
+
return this;
|
|
15206
|
+
};
|
|
15207
|
+
|
|
15208
|
+
/**
|
|
15209
|
+
* Flexible list container supporting single/multi selection, checkbox or click-to-select modes, dividers, and inset styling.
|
|
15011
15210
|
*
|
|
15012
15211
|
* @example
|
|
15013
15212
|
* const list = new List()
|
|
@@ -15022,27 +15221,26 @@ var NativeComponents = (function (exports) {
|
|
|
15022
15221
|
* });
|
|
15023
15222
|
*
|
|
15024
15223
|
* @constructor
|
|
15025
|
-
* @param {GlobalAttributes} [
|
|
15224
|
+
* @param {GlobalAttributes} [props]
|
|
15026
15225
|
*/
|
|
15027
|
-
function List(
|
|
15028
|
-
if(!(this instanceof List)) {
|
|
15029
|
-
return new List(
|
|
15226
|
+
function List(props = {}) {
|
|
15227
|
+
if (!(this instanceof List)) {
|
|
15228
|
+
return new List(props);
|
|
15030
15229
|
}
|
|
15031
15230
|
|
|
15032
15231
|
this.$description = {
|
|
15033
|
-
selectable:
|
|
15034
|
-
multiSelect:
|
|
15035
|
-
selectedValues:
|
|
15036
|
-
inset:
|
|
15037
|
-
divider:
|
|
15038
|
-
|
|
15039
|
-
render:
|
|
15040
|
-
selectByCheckbox: false,
|
|
15041
|
-
selectByClick:
|
|
15042
|
-
loopOnKeyboard:
|
|
15043
|
-
|
|
15232
|
+
selectable: $(false),
|
|
15233
|
+
multiSelect: $(false),
|
|
15234
|
+
selectedValues: $.array(),
|
|
15235
|
+
inset: $(0),
|
|
15236
|
+
divider: false,
|
|
15237
|
+
items: $.array(),
|
|
15238
|
+
render: null,
|
|
15239
|
+
selectByCheckbox: $(false),
|
|
15240
|
+
selectByClick: $(false),
|
|
15241
|
+
loopOnKeyboard: $(false),
|
|
15242
|
+
props,
|
|
15044
15243
|
};
|
|
15045
|
-
|
|
15046
15244
|
}
|
|
15047
15245
|
|
|
15048
15246
|
List.defaultTemplate = null;
|
|
@@ -15050,71 +15248,77 @@ var NativeComponents = (function (exports) {
|
|
|
15050
15248
|
/**
|
|
15051
15249
|
* Registers the render template for List.
|
|
15052
15250
|
* @param {(description: {
|
|
15053
|
-
* selectable:
|
|
15054
|
-
* multiSelect:
|
|
15055
|
-
* selectedValues:
|
|
15056
|
-
* inset:
|
|
15057
|
-
* divider:
|
|
15058
|
-
* data:
|
|
15059
|
-
* render:
|
|
15060
|
-
* selectByCheckbox: boolean
|
|
15061
|
-
* selectByClick:
|
|
15062
|
-
* loopOnKeyboard:
|
|
15063
|
-
*
|
|
15251
|
+
* selectable: ObservableItem<boolean>,
|
|
15252
|
+
* multiSelect: ObservableItem<boolean>,
|
|
15253
|
+
* selectedValues: ObservableArray<*>,
|
|
15254
|
+
* inset: ObservableItem<number>,
|
|
15255
|
+
* divider: boolean,
|
|
15256
|
+
* data: *|null,
|
|
15257
|
+
* render: ((desc: *, instance: List) => NdChild)|null,
|
|
15258
|
+
* selectByCheckbox: ObservableItem<boolean>,
|
|
15259
|
+
* selectByClick: ObservableItem<boolean>,
|
|
15260
|
+
* loopOnKeyboard: ObservableItem<boolean>,
|
|
15261
|
+
* items: ObservableArray<*>,
|
|
15262
|
+
* props: GlobalAttributes,
|
|
15064
15263
|
* }, instance: List) => NdChild} template
|
|
15065
15264
|
*/
|
|
15066
15265
|
List.use = function(template) {
|
|
15067
|
-
List.defaultTemplate = template
|
|
15266
|
+
List.defaultTemplate = template;
|
|
15068
15267
|
};
|
|
15069
15268
|
|
|
15070
15269
|
BaseComponent.extends(List);
|
|
15071
|
-
BaseComponent.use(List, HasItems, HasEventEmitter);
|
|
15270
|
+
BaseComponent.use(List, HasItems, HasEventEmitter, HasListItem);
|
|
15072
15271
|
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
|
|
15272
|
+
/**
|
|
15273
|
+
* @param {ObservableArray<*>|*[]} list
|
|
15274
|
+
* @returns {this}
|
|
15275
|
+
*/
|
|
15276
|
+
List.prototype.selectInto = function(list) {
|
|
15277
|
+
this.$description.selectedValues = list;
|
|
15278
|
+
return this;
|
|
15077
15279
|
};
|
|
15078
15280
|
|
|
15079
15281
|
/**
|
|
15080
|
-
* @param {
|
|
15282
|
+
* @param {boolean|Observable<boolean>} [selectable=true]
|
|
15081
15283
|
* @returns {this}
|
|
15082
15284
|
*/
|
|
15083
15285
|
List.prototype.selectable = function(selectable = true) {
|
|
15084
|
-
this.$description.selectable = selectable;
|
|
15286
|
+
this.$description.selectable = BaseComponent.obs(selectable);
|
|
15085
15287
|
return this;
|
|
15086
15288
|
};
|
|
15087
15289
|
|
|
15088
15290
|
/**
|
|
15291
|
+
* Select items on click. Mutually exclusive with selectByCheckbox.
|
|
15089
15292
|
* @returns {this}
|
|
15090
15293
|
*/
|
|
15091
15294
|
List.prototype.selectByClick = function() {
|
|
15092
|
-
this.$description.selectByClick
|
|
15093
|
-
this.$description.selectByCheckbox
|
|
15295
|
+
this.$description.selectByClick.set(true);
|
|
15296
|
+
this.$description.selectByCheckbox.set(false);
|
|
15094
15297
|
return this;
|
|
15095
15298
|
};
|
|
15096
15299
|
|
|
15097
15300
|
/**
|
|
15301
|
+
* Select items via a checkbox. Mutually exclusive with selectByClick.
|
|
15098
15302
|
* @returns {this}
|
|
15099
15303
|
*/
|
|
15100
15304
|
List.prototype.selectByCheckbox = function() {
|
|
15101
|
-
this.$description.selectByClick
|
|
15102
|
-
this.$description.selectByCheckbox
|
|
15305
|
+
this.$description.selectByClick.set(false);
|
|
15306
|
+
this.$description.selectByCheckbox.set(true);
|
|
15103
15307
|
return this;
|
|
15104
15308
|
};
|
|
15105
15309
|
|
|
15106
15310
|
/**
|
|
15107
|
-
* @param {
|
|
15311
|
+
* @param {boolean|Observable<boolean>} [multi=true]
|
|
15108
15312
|
* @returns {this}
|
|
15109
15313
|
*/
|
|
15110
15314
|
List.prototype.multiSelect = function(multi = true) {
|
|
15111
|
-
this.$description.multiSelect = multi;
|
|
15112
|
-
this.$description.selectable
|
|
15315
|
+
this.$description.multiSelect = BaseComponent.obs(multi);
|
|
15316
|
+
this.$description.selectable.set(true);
|
|
15113
15317
|
return this;
|
|
15114
15318
|
};
|
|
15115
15319
|
|
|
15116
15320
|
/**
|
|
15117
|
-
* @param {Observable<*[]>} observable
|
|
15321
|
+
* @param {ObservableArray<*>|Observable<*[]>} observable
|
|
15118
15322
|
* @returns {this}
|
|
15119
15323
|
*/
|
|
15120
15324
|
List.prototype.selectedValuesModel = function(observable) {
|
|
@@ -15123,59 +15327,63 @@ var NativeComponents = (function (exports) {
|
|
|
15123
15327
|
};
|
|
15124
15328
|
|
|
15125
15329
|
/**
|
|
15126
|
-
*
|
|
15330
|
+
* Inset padding in px applied to all items.
|
|
15331
|
+
* @param {number} [inset=0]
|
|
15127
15332
|
* @returns {this}
|
|
15128
15333
|
*/
|
|
15129
|
-
List.prototype.inset = function(inset =
|
|
15130
|
-
this.$description.inset
|
|
15334
|
+
List.prototype.inset = function(inset = 0) {
|
|
15335
|
+
this.$description.inset.set(inset);
|
|
15131
15336
|
return this;
|
|
15132
15337
|
};
|
|
15133
15338
|
|
|
15134
15339
|
/**
|
|
15340
|
+
* @param {boolean} loopOnKeyboard
|
|
15135
15341
|
* @returns {this}
|
|
15136
15342
|
*/
|
|
15137
|
-
List.prototype.
|
|
15138
|
-
|
|
15343
|
+
List.prototype.loopOnKeyboard = function(loopOnKeyboard) {
|
|
15344
|
+
this.$description.loopOnKeyboard = loopOnKeyboard;
|
|
15139
15345
|
return this;
|
|
15140
15346
|
};
|
|
15141
15347
|
|
|
15142
15348
|
/**
|
|
15349
|
+
* @param {boolean} [divider=true]
|
|
15143
15350
|
* @returns {this}
|
|
15144
15351
|
*/
|
|
15145
|
-
List.prototype.
|
|
15146
|
-
|
|
15352
|
+
List.prototype.withDivider = function(divider = true) {
|
|
15353
|
+
this.$description.divider = divider;
|
|
15147
15354
|
return this;
|
|
15148
15355
|
};
|
|
15149
15356
|
|
|
15150
15357
|
/**
|
|
15151
|
-
* @param {*}
|
|
15358
|
+
* @param {*} data
|
|
15152
15359
|
* @returns {this}
|
|
15153
15360
|
*/
|
|
15154
|
-
List.prototype.
|
|
15155
|
-
this.$description.
|
|
15361
|
+
List.prototype.data = function(data) {
|
|
15362
|
+
this.$description.items = data;
|
|
15156
15363
|
return this;
|
|
15157
15364
|
};
|
|
15158
15365
|
|
|
15159
|
-
/**
|
|
15160
|
-
* @param {*} [divider]
|
|
15161
|
-
* @returns {this}
|
|
15162
|
-
*/
|
|
15163
|
-
List.prototype.withDivider = function(divider = true) {
|
|
15164
|
-
this.$description.divider = divider;
|
|
15165
|
-
return this;
|
|
15166
|
-
};
|
|
15167
15366
|
|
|
15168
15367
|
/**
|
|
15169
|
-
*
|
|
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
|
|
15170
15373
|
* @returns {this}
|
|
15171
15374
|
*/
|
|
15172
|
-
List.prototype.
|
|
15173
|
-
this.$description.
|
|
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
|
+
};
|
|
15174
15382
|
return this;
|
|
15175
15383
|
};
|
|
15176
15384
|
|
|
15177
15385
|
/**
|
|
15178
|
-
* @param {(item:
|
|
15386
|
+
* @param {(item: *, event: MouseEvent) => void} handler
|
|
15179
15387
|
* @returns {this}
|
|
15180
15388
|
*/
|
|
15181
15389
|
List.prototype.onItemClick = function(handler) {
|
|
@@ -15184,7 +15392,7 @@ var NativeComponents = (function (exports) {
|
|
|
15184
15392
|
};
|
|
15185
15393
|
|
|
15186
15394
|
/**
|
|
15187
|
-
* @param {(item:
|
|
15395
|
+
* @param {(item: *) => void} handler
|
|
15188
15396
|
* @returns {this}
|
|
15189
15397
|
*/
|
|
15190
15398
|
List.prototype.onItemSelect = function(handler) {
|
|
@@ -15193,62 +15401,72 @@ var NativeComponents = (function (exports) {
|
|
|
15193
15401
|
};
|
|
15194
15402
|
|
|
15195
15403
|
/**
|
|
15196
|
-
* A single
|
|
15197
|
-
*
|
|
15404
|
+
* A single item in a List. Supports icon, label, subtitle, trailing, disabled, selected states.
|
|
15198
15405
|
*
|
|
15199
15406
|
* @example
|
|
15200
|
-
*
|
|
15201
|
-
* .
|
|
15202
|
-
* .
|
|
15203
|
-
* .
|
|
15204
|
-
* .
|
|
15407
|
+
* ListItem()
|
|
15408
|
+
* .label('Dashboard')
|
|
15409
|
+
* .icon(DashboardIcon())
|
|
15410
|
+
* .subtitle('View your metrics')
|
|
15411
|
+
* .trailing(Badge('New').primary())
|
|
15412
|
+
* .value('dashboard')
|
|
15413
|
+
* .selected(isActive)
|
|
15414
|
+
* .onClick(() => navigate('/dashboard'));
|
|
15205
15415
|
*
|
|
15206
15416
|
* ListItem.use((description, instance) => {
|
|
15207
|
-
* return Li(
|
|
15417
|
+
* return Li({ class: 'list-item' }, [description.icon, description.label]);
|
|
15208
15418
|
* });
|
|
15209
15419
|
*
|
|
15210
15420
|
* @constructor
|
|
15211
|
-
* @param {
|
|
15212
|
-
* @param {GlobalAttributes} [config={}]
|
|
15421
|
+
* @param {GlobalAttributes} [props={}]
|
|
15213
15422
|
*/
|
|
15214
|
-
function ListItem(
|
|
15215
|
-
if(!(this instanceof ListItem)) {
|
|
15216
|
-
return new ListItem(
|
|
15423
|
+
function ListItem(props = {}) {
|
|
15424
|
+
if (!(this instanceof ListItem)) {
|
|
15425
|
+
return new ListItem(props);
|
|
15217
15426
|
}
|
|
15218
15427
|
|
|
15428
|
+
BaseComponent.call(this, props);
|
|
15429
|
+
|
|
15219
15430
|
this.$description = {
|
|
15220
|
-
|
|
15221
|
-
|
|
15222
|
-
|
|
15223
|
-
|
|
15224
|
-
|
|
15225
|
-
|
|
15226
|
-
|
|
15227
|
-
|
|
15228
|
-
|
|
15229
|
-
|
|
15230
|
-
|
|
15431
|
+
label: null,
|
|
15432
|
+
isSelectedIcon: null,
|
|
15433
|
+
subtitle: null,
|
|
15434
|
+
icon: null,
|
|
15435
|
+
trailing: null,
|
|
15436
|
+
value: null,
|
|
15437
|
+
data: null,
|
|
15438
|
+
key: null,
|
|
15439
|
+
disabled: null,
|
|
15440
|
+
selected: null,
|
|
15441
|
+
visibility: null,
|
|
15442
|
+
render: null,
|
|
15443
|
+
props,
|
|
15231
15444
|
};
|
|
15232
15445
|
}
|
|
15233
15446
|
|
|
15234
15447
|
BaseComponent.extends(ListItem);
|
|
15448
|
+
BaseComponent.use(ListItem, HasEventEmitter);
|
|
15449
|
+
|
|
15450
|
+
HasListItem.components.ListItem = ListItem;
|
|
15235
15451
|
|
|
15236
15452
|
ListItem.defaultTemplate = null;
|
|
15237
15453
|
|
|
15238
15454
|
/**
|
|
15239
15455
|
* Registers the render template for ListItem.
|
|
15240
15456
|
* @param {(description: {
|
|
15241
|
-
*
|
|
15242
|
-
*
|
|
15243
|
-
*
|
|
15244
|
-
*
|
|
15245
|
-
*
|
|
15246
|
-
*
|
|
15247
|
-
*
|
|
15248
|
-
*
|
|
15249
|
-
*
|
|
15250
|
-
*
|
|
15251
|
-
*
|
|
15457
|
+
* label: NdChild|null,
|
|
15458
|
+
* subtitle: NdChild|null,
|
|
15459
|
+
* isSelectedIcon: NdChild|null,
|
|
15460
|
+
* icon: NdChild|null,
|
|
15461
|
+
* trailing: NdChild|null,
|
|
15462
|
+
* value: *,
|
|
15463
|
+
* data: *|null,
|
|
15464
|
+
* key: string|null,
|
|
15465
|
+
* disabled: Observable<boolean>|boolean|null,
|
|
15466
|
+
* selected: Observable<boolean>|boolean|null,
|
|
15467
|
+
* visibility: Observable<boolean>|null,
|
|
15468
|
+
* render: ((desc: *, instance: ListItem) => NdChild)|null,
|
|
15469
|
+
* props: GlobalAttributes,
|
|
15252
15470
|
* }, instance: ListItem) => NdChild} template
|
|
15253
15471
|
*/
|
|
15254
15472
|
ListItem.use = function(template) {
|
|
@@ -15256,20 +15474,20 @@ var NativeComponents = (function (exports) {
|
|
|
15256
15474
|
};
|
|
15257
15475
|
|
|
15258
15476
|
/**
|
|
15259
|
-
* @param {NdChild}
|
|
15477
|
+
* @param {NdChild} label
|
|
15260
15478
|
* @returns {this}
|
|
15261
15479
|
*/
|
|
15262
|
-
ListItem.prototype.
|
|
15263
|
-
this.$description.
|
|
15480
|
+
ListItem.prototype.label = function(label) {
|
|
15481
|
+
this.$description.label = label;
|
|
15264
15482
|
return this;
|
|
15265
15483
|
};
|
|
15266
15484
|
|
|
15267
15485
|
/**
|
|
15268
|
-
* @param {NdChild}
|
|
15486
|
+
* @param {NdChild} subtitle
|
|
15269
15487
|
* @returns {this}
|
|
15270
15488
|
*/
|
|
15271
|
-
ListItem.prototype.
|
|
15272
|
-
this.$description.
|
|
15489
|
+
ListItem.prototype.subtitle = function(subtitle) {
|
|
15490
|
+
this.$description.subtitle = subtitle;
|
|
15273
15491
|
return this;
|
|
15274
15492
|
};
|
|
15275
15493
|
|
|
@@ -15283,11 +15501,11 @@ var NativeComponents = (function (exports) {
|
|
|
15283
15501
|
};
|
|
15284
15502
|
|
|
15285
15503
|
/**
|
|
15286
|
-
* @param {NdChild}
|
|
15504
|
+
* @param {NdChild} icon
|
|
15287
15505
|
* @returns {this}
|
|
15288
15506
|
*/
|
|
15289
|
-
ListItem.prototype.
|
|
15290
|
-
this.$description.
|
|
15507
|
+
ListItem.prototype.isSelectedIcon = function(icon) {
|
|
15508
|
+
this.$description.isSelectedIcon = icon;
|
|
15291
15509
|
return this;
|
|
15292
15510
|
};
|
|
15293
15511
|
|
|
@@ -15300,107 +15518,132 @@ var NativeComponents = (function (exports) {
|
|
|
15300
15518
|
return this;
|
|
15301
15519
|
};
|
|
15302
15520
|
|
|
15521
|
+
/**
|
|
15522
|
+
* @param {*} value
|
|
15523
|
+
* @returns {this}
|
|
15524
|
+
*/
|
|
15525
|
+
ListItem.prototype.value = function(value) {
|
|
15526
|
+
this.$description.value = value;
|
|
15527
|
+
return this;
|
|
15528
|
+
};
|
|
15303
15529
|
|
|
15304
15530
|
/**
|
|
15305
|
-
* @param {
|
|
15531
|
+
* @param {*} data
|
|
15306
15532
|
* @returns {this}
|
|
15307
15533
|
*/
|
|
15308
|
-
ListItem.prototype.
|
|
15309
|
-
this.$description.
|
|
15534
|
+
ListItem.prototype.data = function(data) {
|
|
15535
|
+
this.$description.data = data;
|
|
15310
15536
|
return this;
|
|
15311
15537
|
};
|
|
15312
15538
|
|
|
15313
15539
|
/**
|
|
15540
|
+
* @param {string} key
|
|
15314
15541
|
* @returns {this}
|
|
15315
15542
|
*/
|
|
15316
|
-
ListItem.prototype.
|
|
15317
|
-
this.$description.
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
|
|
15321
|
-
|
|
15543
|
+
ListItem.prototype.key = function(key) {
|
|
15544
|
+
this.$description.key = key;
|
|
15545
|
+
return this;
|
|
15546
|
+
};
|
|
15547
|
+
|
|
15548
|
+
/**
|
|
15549
|
+
* @param {boolean|Observable<boolean>} [disabled=true]
|
|
15550
|
+
* @returns {this}
|
|
15551
|
+
*/
|
|
15552
|
+
ListItem.prototype.disabled = function(disabled = true) {
|
|
15553
|
+
this.$description.disabled = BaseComponent.obs(disabled);
|
|
15322
15554
|
return this;
|
|
15323
15555
|
};
|
|
15324
15556
|
|
|
15325
15557
|
/**
|
|
15326
|
-
* @param {boolean|Observable<boolean>} [selected]
|
|
15558
|
+
* @param {boolean|Observable<boolean>} [selected=true]
|
|
15327
15559
|
* @returns {this}
|
|
15328
15560
|
*/
|
|
15329
15561
|
ListItem.prototype.selected = function(selected = true) {
|
|
15330
|
-
|
|
15331
|
-
this.$description.selected.set(selected);
|
|
15332
|
-
return this;
|
|
15333
|
-
}
|
|
15334
|
-
this.$description.selected = selected;
|
|
15562
|
+
this.$description.selected = BaseComponent.obs(selected);
|
|
15335
15563
|
return this;
|
|
15336
15564
|
};
|
|
15337
15565
|
|
|
15338
15566
|
/**
|
|
15339
|
-
* @param {
|
|
15567
|
+
* @param {boolean|Observable<boolean>} mode
|
|
15340
15568
|
* @returns {this}
|
|
15341
15569
|
*/
|
|
15342
|
-
ListItem.prototype.
|
|
15343
|
-
this.$description.
|
|
15570
|
+
ListItem.prototype.visibility = function(mode) {
|
|
15571
|
+
this.$description.visibility = BaseComponent.obs(mode);
|
|
15344
15572
|
return this;
|
|
15345
15573
|
};
|
|
15346
15574
|
|
|
15347
15575
|
/**
|
|
15348
|
-
* @param {
|
|
15576
|
+
* @param {Function} handler
|
|
15349
15577
|
* @returns {this}
|
|
15350
15578
|
*/
|
|
15351
|
-
ListItem.prototype.
|
|
15352
|
-
this
|
|
15579
|
+
ListItem.prototype.onClick = function(handler) {
|
|
15580
|
+
this.on('click', handler);
|
|
15353
15581
|
return this;
|
|
15354
15582
|
};
|
|
15355
15583
|
|
|
15356
15584
|
/**
|
|
15357
|
-
*
|
|
15358
|
-
*
|
|
15585
|
+
* A collapsible group of ListItems inside a List. Can hold items, dividers, and nested groups.
|
|
15359
15586
|
*
|
|
15360
15587
|
* @example
|
|
15361
|
-
*
|
|
15362
|
-
* .
|
|
15363
|
-
* .
|
|
15588
|
+
* ListGroup('Workspace')
|
|
15589
|
+
* .icon(FolderIcon())
|
|
15590
|
+
* .collapsable()
|
|
15591
|
+
* .item('Dashboard', DashboardIcon())
|
|
15592
|
+
* .item('Analytics', ChartIcon());
|
|
15593
|
+
*
|
|
15594
|
+
* // From data
|
|
15595
|
+
* ListGroup('Reports')
|
|
15596
|
+
* .from(reports, (report) =>
|
|
15597
|
+
* ListItem().label(report.name).value(report.id)
|
|
15598
|
+
* );
|
|
15599
|
+
*
|
|
15600
|
+
* ListGroup.use((description, instance) => {
|
|
15601
|
+
* return Div({ class: 'list-group' });
|
|
15602
|
+
* });
|
|
15364
15603
|
*
|
|
15365
15604
|
* @constructor
|
|
15366
|
-
* @param {NdChild}
|
|
15367
|
-
* @param {GlobalAttributes} [
|
|
15605
|
+
* @param {NdChild} label
|
|
15606
|
+
* @param {GlobalAttributes} [props={}]
|
|
15368
15607
|
*/
|
|
15369
|
-
function ListGroup(label,
|
|
15370
|
-
if(!(this instanceof ListGroup)) {
|
|
15371
|
-
return new ListGroup(label,
|
|
15608
|
+
function ListGroup(label, props = {}) {
|
|
15609
|
+
if (!(this instanceof ListGroup)) {
|
|
15610
|
+
return new ListGroup(label, props);
|
|
15372
15611
|
}
|
|
15373
15612
|
|
|
15613
|
+
BaseComponent.call(this, props);
|
|
15614
|
+
|
|
15374
15615
|
this.$description = {
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
items:
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
...config,
|
|
15616
|
+
label: label,
|
|
15617
|
+
icon: null,
|
|
15618
|
+
items: $.array(),
|
|
15619
|
+
render: null,
|
|
15620
|
+
collapsable: false,
|
|
15621
|
+
collapsed: null,
|
|
15622
|
+
visibility: $(true),
|
|
15623
|
+
props,
|
|
15384
15624
|
};
|
|
15385
15625
|
}
|
|
15386
15626
|
|
|
15387
15627
|
BaseComponent.extends(ListGroup);
|
|
15388
|
-
BaseComponent.use(ListGroup, HasItems);
|
|
15628
|
+
BaseComponent.use(ListGroup, HasItems, HasEventEmitter, HasListItem);
|
|
15629
|
+
|
|
15630
|
+
HasListItem.components.ListGroup = ListGroup;
|
|
15389
15631
|
|
|
15390
15632
|
ListGroup.defaultTemplate = null;
|
|
15391
15633
|
|
|
15392
15634
|
/**
|
|
15393
15635
|
* Registers the render template for ListGroup.
|
|
15394
15636
|
* @param {(description: {
|
|
15395
|
-
*
|
|
15396
|
-
*
|
|
15397
|
-
* items:
|
|
15398
|
-
*
|
|
15399
|
-
* data:
|
|
15400
|
-
*
|
|
15401
|
-
*
|
|
15402
|
-
*
|
|
15403
|
-
*
|
|
15637
|
+
* label: NdChild,
|
|
15638
|
+
* icon: NdChild|null,
|
|
15639
|
+
* items: ObservableArray<ListItem|ListGroup|ListDivider>,
|
|
15640
|
+
* itemBuilder: (item: *) => ListItem|ListGroup|ListDivider,
|
|
15641
|
+
* data: *|null,
|
|
15642
|
+
* render: ((desc: *, instance: ListGroup) => NdChild)|null,
|
|
15643
|
+
* collapsable: boolean,
|
|
15644
|
+
* collapsed: ObservableItem<boolean>|null,
|
|
15645
|
+
* visibility: ObservableItem<boolean>,
|
|
15646
|
+
* props: GlobalAttributes,
|
|
15404
15647
|
* }, instance: ListGroup) => NdChild} template
|
|
15405
15648
|
*/
|
|
15406
15649
|
ListGroup.use = function(template) {
|
|
@@ -15408,37 +15651,47 @@ var NativeComponents = (function (exports) {
|
|
|
15408
15651
|
};
|
|
15409
15652
|
|
|
15410
15653
|
/**
|
|
15411
|
-
* @param {NdChild}
|
|
15654
|
+
* @param {NdChild} icon
|
|
15412
15655
|
* @returns {this}
|
|
15413
15656
|
*/
|
|
15414
|
-
ListGroup.prototype.
|
|
15415
|
-
this.$description.
|
|
15657
|
+
ListGroup.prototype.icon = function(icon) {
|
|
15658
|
+
this.$description.icon = icon;
|
|
15416
15659
|
return this;
|
|
15417
15660
|
};
|
|
15418
15661
|
|
|
15419
15662
|
/**
|
|
15420
|
-
* @param {
|
|
15663
|
+
* @param {boolean} [mode=true]
|
|
15664
|
+
* @param {NdChild} [openedIcon]
|
|
15665
|
+
* @param {NdChild} [closedIcon]
|
|
15421
15666
|
* @returns {this}
|
|
15422
15667
|
*/
|
|
15423
|
-
ListGroup.prototype.
|
|
15424
|
-
|
|
15668
|
+
ListGroup.prototype.collapsable = function(mode = true, openedIcon, closedIcon) {
|
|
15669
|
+
this.$description.collapsable = mode;
|
|
15670
|
+
this.$description.collapsed = this.$description.collapsed || $(false);
|
|
15671
|
+
this.$description.collapsableOpenedIcon = openedIcon || null;
|
|
15672
|
+
this.$description.collapsableClosedIcon = closedIcon || null;
|
|
15673
|
+
return this;
|
|
15425
15674
|
};
|
|
15426
15675
|
|
|
15427
15676
|
/**
|
|
15428
|
-
* @param {
|
|
15677
|
+
* @param {boolean} [mode=true]
|
|
15429
15678
|
* @returns {this}
|
|
15430
15679
|
*/
|
|
15431
|
-
ListGroup.prototype.
|
|
15432
|
-
this.$description.
|
|
15680
|
+
ListGroup.prototype.collapsed = function(mode = true) {
|
|
15681
|
+
if (!this.$description.collapsed) {
|
|
15682
|
+
this.$description.collapsed = $(mode);
|
|
15683
|
+
} else {
|
|
15684
|
+
this.$description.collapsed.set(mode);
|
|
15685
|
+
}
|
|
15433
15686
|
return this;
|
|
15434
15687
|
};
|
|
15435
15688
|
|
|
15436
15689
|
/**
|
|
15437
|
-
* @param {
|
|
15690
|
+
* @param {boolean|Observable<boolean>} mode
|
|
15438
15691
|
* @returns {this}
|
|
15439
15692
|
*/
|
|
15440
|
-
ListGroup.prototype.
|
|
15441
|
-
this.$description.
|
|
15693
|
+
ListGroup.prototype.visibility = function(mode) {
|
|
15694
|
+
this.$description.visibility = BaseComponent.obs(mode);
|
|
15442
15695
|
return this;
|
|
15443
15696
|
};
|
|
15444
15697
|
|
|
@@ -15451,24 +15704,6 @@ var NativeComponents = (function (exports) {
|
|
|
15451
15704
|
return this;
|
|
15452
15705
|
};
|
|
15453
15706
|
|
|
15454
|
-
/**
|
|
15455
|
-
* @param {(desc: *, instance: *) => NdChild} renderFn
|
|
15456
|
-
* @returns {this}
|
|
15457
|
-
*/
|
|
15458
|
-
ListGroup.prototype.renderHeader = function(renderFn) {
|
|
15459
|
-
this.$description.renderHeader = renderFn;
|
|
15460
|
-
return this;
|
|
15461
|
-
};
|
|
15462
|
-
|
|
15463
|
-
/**
|
|
15464
|
-
* @param {(desc: *, instance: *) => NdChild} renderFn
|
|
15465
|
-
* @returns {this}
|
|
15466
|
-
*/
|
|
15467
|
-
ListGroup.prototype.renderFooter = function(renderFn) {
|
|
15468
|
-
this.$description.renderFooter = renderFn;
|
|
15469
|
-
return this;
|
|
15470
|
-
};
|
|
15471
|
-
|
|
15472
15707
|
/**
|
|
15473
15708
|
* A MenuItem that renders as an anchor (<a>). Inherits all MenuItem methods and adds target control.
|
|
15474
15709
|
*
|
|
@@ -23497,6 +23732,32 @@ var NativeComponents = (function (exports) {
|
|
|
23497
23732
|
const Row = HStack;
|
|
23498
23733
|
const Col = VStack;
|
|
23499
23734
|
|
|
23735
|
+
function Spacer(props = {}) {
|
|
23736
|
+
if (!(this instanceof Spacer)) {
|
|
23737
|
+
return new Spacer(props);
|
|
23738
|
+
}
|
|
23739
|
+
BaseComponent.call(this, props);
|
|
23740
|
+
this.$description = {
|
|
23741
|
+
type: 'spacer',
|
|
23742
|
+
props,
|
|
23743
|
+
};
|
|
23744
|
+
}
|
|
23745
|
+
BaseComponent.extends(Spacer);
|
|
23746
|
+
|
|
23747
|
+
Spacer.defaultTemplate = null;
|
|
23748
|
+
/**
|
|
23749
|
+
*
|
|
23750
|
+
*
|
|
23751
|
+
* Registers the render template for Spacer.
|
|
23752
|
+
* @param {(description: {
|
|
23753
|
+
* type: 'spacer',
|
|
23754
|
+
* props: GlobalAttributes,
|
|
23755
|
+
* }, instance: Spacer) => NdChild} template
|
|
23756
|
+
*/
|
|
23757
|
+
Spacer.use = function(template) {
|
|
23758
|
+
Spacer.defaultTemplate = template;
|
|
23759
|
+
};
|
|
23760
|
+
|
|
23500
23761
|
exports.AbsoluteStack = AbsoluteStack;
|
|
23501
23762
|
exports.Accordion = Accordion;
|
|
23502
23763
|
exports.AccordionItem = AccordionItem;
|
|
@@ -23507,6 +23768,7 @@ var NativeComponents = (function (exports) {
|
|
|
23507
23768
|
exports.Badge = Badge;
|
|
23508
23769
|
exports.Breadcrumb = Breadcrumb;
|
|
23509
23770
|
exports.Button = Button;
|
|
23771
|
+
exports.Card = Card;
|
|
23510
23772
|
exports.CheckboxField = CheckboxField;
|
|
23511
23773
|
exports.CheckboxGroupField = CheckboxGroupField;
|
|
23512
23774
|
exports.Col = Col;
|
|
@@ -23536,6 +23798,10 @@ var NativeComponents = (function (exports) {
|
|
|
23536
23798
|
exports.HStack = HStack;
|
|
23537
23799
|
exports.HiddenField = HiddenField;
|
|
23538
23800
|
exports.ImageField = ImageField;
|
|
23801
|
+
exports.List = List;
|
|
23802
|
+
exports.ListDivider = ListDivider;
|
|
23803
|
+
exports.ListGroup = ListGroup;
|
|
23804
|
+
exports.ListItem = ListItem;
|
|
23539
23805
|
exports.Menu = Menu;
|
|
23540
23806
|
exports.MenuDivider = MenuDivider;
|
|
23541
23807
|
exports.MenuGroup = MenuGroup;
|
|
@@ -23557,6 +23823,7 @@ var NativeComponents = (function (exports) {
|
|
|
23557
23823
|
exports.SimpleTable = SimpleTable;
|
|
23558
23824
|
exports.Skeleton = Skeleton;
|
|
23559
23825
|
exports.Slider = Slider;
|
|
23826
|
+
exports.Spacer = Spacer;
|
|
23560
23827
|
exports.Spinner = Spinner;
|
|
23561
23828
|
exports.Splitter = Splitter;
|
|
23562
23829
|
exports.SplitterGutter = SplitterGutter;
|