zek 19.0.1 → 19.0.2
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/fesm2022/zek.mjs
CHANGED
|
@@ -4225,6 +4225,205 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
4225
4225
|
}]
|
|
4226
4226
|
}] });
|
|
4227
4227
|
|
|
4228
|
+
const ZEK_DROPDOWN_CONTROL_VALUE_ACCESSOR = {
|
|
4229
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4230
|
+
useExisting: forwardRef(() => ZekDropdown),
|
|
4231
|
+
multi: true,
|
|
4232
|
+
};
|
|
4233
|
+
class ZekDropdown extends CoreUiComponent {
|
|
4234
|
+
constructor(renderer, elementRef) {
|
|
4235
|
+
super(renderer, elementRef);
|
|
4236
|
+
}
|
|
4237
|
+
_uniqueId = `zek-dropdown-${this.uniqueId}`;
|
|
4238
|
+
/** The unique ID for the radio button. */
|
|
4239
|
+
id = this._uniqueId;
|
|
4240
|
+
get inputId() {
|
|
4241
|
+
return `${this.id || this._uniqueId}-input`;
|
|
4242
|
+
}
|
|
4243
|
+
_multiple = false;
|
|
4244
|
+
get multiple() {
|
|
4245
|
+
return this._multiple;
|
|
4246
|
+
}
|
|
4247
|
+
set multiple(value) {
|
|
4248
|
+
this._multiple = Convert.toBooleanProperty(value);
|
|
4249
|
+
}
|
|
4250
|
+
valueField;
|
|
4251
|
+
textField;
|
|
4252
|
+
checkedTextField;
|
|
4253
|
+
css = 'primary';
|
|
4254
|
+
searchText = '';
|
|
4255
|
+
get label() {
|
|
4256
|
+
return this._label;
|
|
4257
|
+
}
|
|
4258
|
+
set label(value) {
|
|
4259
|
+
if (value)
|
|
4260
|
+
this._label = value;
|
|
4261
|
+
else
|
|
4262
|
+
this._label = '';
|
|
4263
|
+
}
|
|
4264
|
+
_label = '';
|
|
4265
|
+
_data = [];
|
|
4266
|
+
get data() {
|
|
4267
|
+
return this._data;
|
|
4268
|
+
}
|
|
4269
|
+
set data(value) {
|
|
4270
|
+
if (this._data !== value) {
|
|
4271
|
+
this._data = value ? value : [];
|
|
4272
|
+
this._onDataChanged();
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
_onDataChanged() {
|
|
4276
|
+
this._normalizeData();
|
|
4277
|
+
this._filterData();
|
|
4278
|
+
}
|
|
4279
|
+
normalizedItems = [];
|
|
4280
|
+
filteredItems = [];
|
|
4281
|
+
selectedItems = [];
|
|
4282
|
+
selectedItemsText = '';
|
|
4283
|
+
onTextChange() {
|
|
4284
|
+
this._filterData();
|
|
4285
|
+
}
|
|
4286
|
+
_filterData() {
|
|
4287
|
+
if (this.searchText) {
|
|
4288
|
+
const normalized = StringHelper.trimStart(this.searchText.toUpperCase(), ' ');
|
|
4289
|
+
this.filteredItems = this.normalizedItems.filter(item => item.normalized.indexOf(normalized) !== -1);
|
|
4290
|
+
}
|
|
4291
|
+
else {
|
|
4292
|
+
this.filteredItems = this.normalizedItems;
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4295
|
+
_normalizeData() {
|
|
4296
|
+
this.normalizedItems = [];
|
|
4297
|
+
if (this.valueField && this.textField) {
|
|
4298
|
+
for (const item of this._data) {
|
|
4299
|
+
this.normalizedItems.push({
|
|
4300
|
+
key: item[this.valueField],
|
|
4301
|
+
value: item[this.textField],
|
|
4302
|
+
normalized: (item[this.textField] || '').toUpperCase(),
|
|
4303
|
+
checked: this.selectedItems.includes(item),
|
|
4304
|
+
item: item
|
|
4305
|
+
});
|
|
4306
|
+
}
|
|
4307
|
+
}
|
|
4308
|
+
else {
|
|
4309
|
+
for (const item of this._data) {
|
|
4310
|
+
this.normalizedItems.push({ key: item, value: item, checked: this.selectedItems.includes(item), item });
|
|
4311
|
+
}
|
|
4312
|
+
}
|
|
4313
|
+
}
|
|
4314
|
+
checkAll(checked, ngModelChange = true) {
|
|
4315
|
+
if (this.disabled || this.readonly)
|
|
4316
|
+
return;
|
|
4317
|
+
for (const item of this.normalizedItems) {
|
|
4318
|
+
item.checked = checked;
|
|
4319
|
+
}
|
|
4320
|
+
this.selectedItems = [];
|
|
4321
|
+
if (checked) {
|
|
4322
|
+
if (this.multiple) {
|
|
4323
|
+
const tmp = [];
|
|
4324
|
+
for (const normalized of this.normalizedItems) {
|
|
4325
|
+
this.selectedItems.push(normalized.item);
|
|
4326
|
+
tmp.push(normalized.key);
|
|
4327
|
+
}
|
|
4328
|
+
if (ngModelChange)
|
|
4329
|
+
this.setNgModel(tmp);
|
|
4330
|
+
}
|
|
4331
|
+
}
|
|
4332
|
+
else if (ngModelChange)
|
|
4333
|
+
this.setNgModel(null);
|
|
4334
|
+
}
|
|
4335
|
+
toggleChecked(normalized) {
|
|
4336
|
+
if (!normalized || this.disabled || this.readonly)
|
|
4337
|
+
return;
|
|
4338
|
+
const checked = normalized.checked || false;
|
|
4339
|
+
if (!this.multiple) {
|
|
4340
|
+
for (const item of this.normalizedItems) {
|
|
4341
|
+
item.checked = false;
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
//on check item
|
|
4345
|
+
if (!checked) {
|
|
4346
|
+
normalized.checked = true;
|
|
4347
|
+
if (this.multiple) {
|
|
4348
|
+
if (!this.selectedItems.includes(normalized.item)) {
|
|
4349
|
+
this.selectedItems.push(normalized.item);
|
|
4350
|
+
}
|
|
4351
|
+
//todo optimize
|
|
4352
|
+
const tmp = [];
|
|
4353
|
+
for (const item of this.normalizedItems) {
|
|
4354
|
+
if (item.checked) {
|
|
4355
|
+
tmp.push(item.key);
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
this.setNgModel(tmp);
|
|
4359
|
+
}
|
|
4360
|
+
else {
|
|
4361
|
+
this.selectedItems = [normalized.item];
|
|
4362
|
+
this.setNgModel(normalized.key);
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4365
|
+
else {
|
|
4366
|
+
//on uncheck
|
|
4367
|
+
normalized.checked = false;
|
|
4368
|
+
if (this.multiple) {
|
|
4369
|
+
const index = this.selectedItems.indexOf(normalized.item);
|
|
4370
|
+
if (index !== -1) {
|
|
4371
|
+
this.selectedItems.splice(index, 1);
|
|
4372
|
+
}
|
|
4373
|
+
//todo optimize
|
|
4374
|
+
const tmp = [];
|
|
4375
|
+
for (const item of this.normalizedItems) {
|
|
4376
|
+
if (item.checked) {
|
|
4377
|
+
tmp.push(item.key);
|
|
4378
|
+
}
|
|
4379
|
+
}
|
|
4380
|
+
this.setNgModel(tmp);
|
|
4381
|
+
}
|
|
4382
|
+
else {
|
|
4383
|
+
this.selectedItems = [];
|
|
4384
|
+
this.setNgModel(null);
|
|
4385
|
+
}
|
|
4386
|
+
}
|
|
4387
|
+
this._initText();
|
|
4388
|
+
}
|
|
4389
|
+
_initText() {
|
|
4390
|
+
const field = this.checkedTextField || this.textField || '';
|
|
4391
|
+
if (field) {
|
|
4392
|
+
this.selectedItemsText = this.selectedItems.map(x => x[field]).join(', ');
|
|
4393
|
+
}
|
|
4394
|
+
else {
|
|
4395
|
+
this.selectedItemsText = this.selectedItems.join(', ');
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ZekDropdown, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
4399
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ZekDropdown, isStandalone: true, selector: "zek-dropdown,[zek-dropdown]", inputs: { id: "id", multiple: "multiple", valueField: "valueField", textField: "textField", checkedTextField: "checkedTextField", css: "css", label: "label", data: "data" }, host: { properties: { "attr.id": "id" } }, providers: [ZEK_DROPDOWN_CONTROL_VALUE_ACCESSOR], usesInheritance: true, ngImport: i0, template: "<div class=\"btn-group\" id=\"dropdown-{{id}}\">\r\n <button class=\"btn btn-{{css}} dropdown-toggle\" type=\"button\" data-bs-toggle=\"dropdown\" data-bs-auto-close=\"outside\" aria-expanded=\"false\">\r\n <!-- <ng-container *ngIf=\"!_text\">{{placeholder}}</ng-container> {{_text}} -->\r\n {{label}}\r\n </button>\r\n <ul class=\"dropdown-menu dropdown-menu-scrollable\">\r\n <li class=\"px-2 py-1\">\r\n <input type=\"text\" class=\"form-control\"\r\n [id]=\"inputId\"\r\n [name]=\"inputId\"\r\n [(ngModel)]=\"searchText\"\r\n (ngModelChange)=\"onTextChange()\">\r\n </li>\r\n <ng-container *ngIf=\"normalizedItems\">\r\n <li>\r\n <a class=\"dropdown-item\" href=\"javascript:void(0)\" *ngFor=\"let item of filteredItems\" (click)=\"toggleChecked(item)\">\r\n <span *ngIf=\"item.checked\"><i class=\"fa-regular fa-square-check\"></i></span>\r\n <span *ngIf=\"!item.checked\"><i class=\"fa-regular fa-square\"></i></span>\r\n {{item.value}}\r\n </a>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n</div>", styles: [":host{display:inline-block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
4400
|
+
}
|
|
4401
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ZekDropdown, decorators: [{
|
|
4402
|
+
type: Component,
|
|
4403
|
+
args: [{ standalone: true, selector: 'zek-dropdown,[zek-dropdown]', providers: [ZEK_DROPDOWN_CONTROL_VALUE_ACCESSOR], host: {
|
|
4404
|
+
'[attr.id]': 'id',
|
|
4405
|
+
}, imports: [
|
|
4406
|
+
CommonModule,
|
|
4407
|
+
FormsModule
|
|
4408
|
+
], template: "<div class=\"btn-group\" id=\"dropdown-{{id}}\">\r\n <button class=\"btn btn-{{css}} dropdown-toggle\" type=\"button\" data-bs-toggle=\"dropdown\" data-bs-auto-close=\"outside\" aria-expanded=\"false\">\r\n <!-- <ng-container *ngIf=\"!_text\">{{placeholder}}</ng-container> {{_text}} -->\r\n {{label}}\r\n </button>\r\n <ul class=\"dropdown-menu dropdown-menu-scrollable\">\r\n <li class=\"px-2 py-1\">\r\n <input type=\"text\" class=\"form-control\"\r\n [id]=\"inputId\"\r\n [name]=\"inputId\"\r\n [(ngModel)]=\"searchText\"\r\n (ngModelChange)=\"onTextChange()\">\r\n </li>\r\n <ng-container *ngIf=\"normalizedItems\">\r\n <li>\r\n <a class=\"dropdown-item\" href=\"javascript:void(0)\" *ngFor=\"let item of filteredItems\" (click)=\"toggleChecked(item)\">\r\n <span *ngIf=\"item.checked\"><i class=\"fa-regular fa-square-check\"></i></span>\r\n <span *ngIf=\"!item.checked\"><i class=\"fa-regular fa-square\"></i></span>\r\n {{item.value}}\r\n </a>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n</div>", styles: [":host{display:inline-block}\n"] }]
|
|
4409
|
+
}], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }], propDecorators: { id: [{
|
|
4410
|
+
type: Input
|
|
4411
|
+
}], multiple: [{
|
|
4412
|
+
type: Input
|
|
4413
|
+
}], valueField: [{
|
|
4414
|
+
type: Input
|
|
4415
|
+
}], textField: [{
|
|
4416
|
+
type: Input
|
|
4417
|
+
}], checkedTextField: [{
|
|
4418
|
+
type: Input
|
|
4419
|
+
}], css: [{
|
|
4420
|
+
type: Input
|
|
4421
|
+
}], label: [{
|
|
4422
|
+
type: Input
|
|
4423
|
+
}], data: [{
|
|
4424
|
+
type: Input
|
|
4425
|
+
}] } });
|
|
4426
|
+
|
|
4228
4427
|
class ZekEditToolbar {
|
|
4229
4428
|
_showSave = true;
|
|
4230
4429
|
get showSave() {
|
|
@@ -7532,5 +7731,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
7532
7731
|
* Generated bundle index. Do not edit.
|
|
7533
7732
|
*/
|
|
7534
7733
|
|
|
7535
|
-
export { API_BASE_URL, AgePipe, Alert, AlertService, ArrayHelper, AuthService, Base64Helper, BaseAlert, BaseComponent, BaseService, BitwiseHelper, BootstrapHelper, CacheHelper, Color, ComponentType, Convert, CoreComponent, CoreUiComponent, CrudService, CssHelper, CustomHttpParamEncoder, DATE_FORMAT, DateHelper, DateValueAccessor, DatepickerModule, EditBase, EditBaseComponent, EditComponent, EditFormComponent, ErrorHelper, ExcelHelper, FileHelper, FileService, FilterBase, FilterHelper, GOOGLE_CLIENT_ID, Gender, HtmlHelper, HttpErrorHandler, IntervalHelper, JwtHelper, KeyPair, KeyPairChecked, KeyPairEx, KeyPairRequired, LANGUAGE, ListBase, ListBaseComponent, MATCH_VALIDATOR, MatchValidator, MathHelper, Month, ObjectHelper, OverlapHelper, PagedList, Pager, PagerHelper, PeriodRelation, PrintType, RANGE_VALIDATOR, RECAPTCHA_SITE_KEY, RandomHelper, RangeValidator, ReCaptchaService, RecaptchaModule, StorageHelper, StringHelper, TimeHelper, TimeModule, TimePipe, TimerService, TmpHelper, Toast, Tree, UrlHelper, ValidEventArgs, ValidationHelper, Validators, ValidatorsModule, WebApiClient, WebApiModule, ZekAlert, ZekApproveModal, ZekAutoComplete, ZekButtonBrowse, ZekButtonBrowseModalBase, ZekButtonBrowseModalToolbar, ZekButtonBrowseModule, ZekCallbackPipe, ZekCard, ZekCountdown, ZekDateAgoPipe, ZekDelayedInputDirective, ZekDeleteModal, ZekDisapproveModal, ZekEditToolbar, ZekFieldValidator, ZekFileInput, ZekFileSizePipe, ZekFileViewer, ZekFilterModal, ZekGoogleLoginButton, ZekGoogleLoginModule, ZekGridToolbar, ZekGridToolbarBar, ZekListToolbar, ZekLoading, ZekLoadingModule, ZekLocalToUtcModule, ZekLocalToUtcPipe, ZekModal, ZekModalModule, ZekNumericDirective, ZekPageTitle, ZekPager, ZekPassword, ZekProgress, ZekRadio, ZekReadOnlyDirective, ZekRestoreModal, ZekSafePipe, ZekSelect2, ZekSelect2Multiple, ZekSelectMultiple, ZekSort, ZekSortButtonGroup, ZekSubmitModal, ZekSumModal, ZekTag, ZekToast, ZekTooltip, ZekUtcToLocalModule, ZekUtcToLocalPipe, ZekValidation, ZekWizard, ZekWizard2, firstBy, handler, matchValidator, nullValidator, rangeValidator, zekAuthGuard };
|
|
7734
|
+
export { API_BASE_URL, AgePipe, Alert, AlertService, ArrayHelper, AuthService, Base64Helper, BaseAlert, BaseComponent, BaseService, BitwiseHelper, BootstrapHelper, CacheHelper, Color, ComponentType, Convert, CoreComponent, CoreUiComponent, CrudService, CssHelper, CustomHttpParamEncoder, DATE_FORMAT, DateHelper, DateValueAccessor, DatepickerModule, EditBase, EditBaseComponent, EditComponent, EditFormComponent, ErrorHelper, ExcelHelper, FileHelper, FileService, FilterBase, FilterHelper, GOOGLE_CLIENT_ID, Gender, HtmlHelper, HttpErrorHandler, IntervalHelper, JwtHelper, KeyPair, KeyPairChecked, KeyPairEx, KeyPairRequired, LANGUAGE, ListBase, ListBaseComponent, MATCH_VALIDATOR, MatchValidator, MathHelper, Month, ObjectHelper, OverlapHelper, PagedList, Pager, PagerHelper, PeriodRelation, PrintType, RANGE_VALIDATOR, RECAPTCHA_SITE_KEY, RandomHelper, RangeValidator, ReCaptchaService, RecaptchaModule, StorageHelper, StringHelper, TimeHelper, TimeModule, TimePipe, TimerService, TmpHelper, Toast, Tree, UrlHelper, ValidEventArgs, ValidationHelper, Validators, ValidatorsModule, WebApiClient, WebApiModule, ZekAlert, ZekApproveModal, ZekAutoComplete, ZekButtonBrowse, ZekButtonBrowseModalBase, ZekButtonBrowseModalToolbar, ZekButtonBrowseModule, ZekCallbackPipe, ZekCard, ZekCountdown, ZekDateAgoPipe, ZekDelayedInputDirective, ZekDeleteModal, ZekDisapproveModal, ZekDropdown, ZekEditToolbar, ZekFieldValidator, ZekFileInput, ZekFileSizePipe, ZekFileViewer, ZekFilterModal, ZekGoogleLoginButton, ZekGoogleLoginModule, ZekGridToolbar, ZekGridToolbarBar, ZekListToolbar, ZekLoading, ZekLoadingModule, ZekLocalToUtcModule, ZekLocalToUtcPipe, ZekModal, ZekModalModule, ZekNumericDirective, ZekPageTitle, ZekPager, ZekPassword, ZekProgress, ZekRadio, ZekReadOnlyDirective, ZekRestoreModal, ZekSafePipe, ZekSelect2, ZekSelect2Multiple, ZekSelectMultiple, ZekSort, ZekSortButtonGroup, ZekSubmitModal, ZekSumModal, ZekTag, ZekToast, ZekTooltip, ZekUtcToLocalModule, ZekUtcToLocalPipe, ZekValidation, ZekWizard, ZekWizard2, firstBy, handler, matchValidator, nullValidator, rangeValidator, zekAuthGuard };
|
|
7536
7735
|
//# sourceMappingURL=zek.mjs.map
|