iss-ctrl 0.0.16 → 0.0.18

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.
Files changed (25) hide show
  1. package/fesm2022/{iss-ctrl-iss-ctrl-CUlx5aua.mjs → iss-ctrl-iss-ctrl-C_ZiixeF.mjs} +60 -38
  2. package/fesm2022/iss-ctrl-iss-ctrl-C_ZiixeF.mjs.map +1 -0
  3. package/fesm2022/{iss-ctrl-load-event-B2HY44Lg.mjs → iss-ctrl-load-event-DIPikCdF.mjs} +3 -3
  4. package/fesm2022/{iss-ctrl-load-event-B2HY44Lg.mjs.map → iss-ctrl-load-event-DIPikCdF.mjs.map} +1 -1
  5. package/fesm2022/{iss-ctrl-load-options-event-Bvfi4PZq.mjs → iss-ctrl-load-options-event-DOlkFXz5.mjs} +3 -3
  6. package/fesm2022/{iss-ctrl-load-options-event-Bvfi4PZq.mjs.map → iss-ctrl-load-options-event-DOlkFXz5.mjs.map} +1 -1
  7. package/fesm2022/{iss-ctrl-load-value-event-Bq6nRj3K.mjs → iss-ctrl-load-value-event-BjsuFpPf.mjs} +3 -3
  8. package/fesm2022/{iss-ctrl-load-value-event-Bq6nRj3K.mjs.map → iss-ctrl-load-value-event-BjsuFpPf.mjs.map} +1 -1
  9. package/fesm2022/{iss-ctrl-note.field-DpXXdNd0.mjs → iss-ctrl-note.field-CakHrlcq.mjs} +2 -2
  10. package/fesm2022/{iss-ctrl-note.field-DpXXdNd0.mjs.map → iss-ctrl-note.field-CakHrlcq.mjs.map} +1 -1
  11. package/fesm2022/{iss-ctrl-replace-api-keys-Dbdwgl4g.mjs → iss-ctrl-replace-api-keys-C-G34VNS.mjs} +2 -2
  12. package/fesm2022/{iss-ctrl-replace-api-keys-Dbdwgl4g.mjs.map → iss-ctrl-replace-api-keys-C-G34VNS.mjs.map} +1 -1
  13. package/fesm2022/{iss-ctrl-set-value-event-CXVuywEr.mjs → iss-ctrl-set-value-event-C-uD228s.mjs} +2 -2
  14. package/fesm2022/{iss-ctrl-set-value-event-CXVuywEr.mjs.map → iss-ctrl-set-value-event-C-uD228s.mjs.map} +1 -1
  15. package/fesm2022/{iss-ctrl-table.field-C5SDeghW.mjs → iss-ctrl-table.field-Ce1KnlZO.mjs} +2 -2
  16. package/fesm2022/{iss-ctrl-table.field-C5SDeghW.mjs.map → iss-ctrl-table.field-Ce1KnlZO.mjs.map} +1 -1
  17. package/fesm2022/{iss-ctrl-trigger-based-on-json-value-Ck642ldN.mjs → iss-ctrl-trigger-based-on-json-value-D5S3shyl.mjs} +2 -2
  18. package/fesm2022/{iss-ctrl-trigger-based-on-json-value-Ck642ldN.mjs.map → iss-ctrl-trigger-based-on-json-value-D5S3shyl.mjs.map} +1 -1
  19. package/fesm2022/{iss-ctrl-user-picker.field-69Tqgu2G.mjs → iss-ctrl-user-picker.field-C7DZ3ck2.mjs} +2 -2
  20. package/fesm2022/{iss-ctrl-user-picker.field-69Tqgu2G.mjs.map → iss-ctrl-user-picker.field-C7DZ3ck2.mjs.map} +1 -1
  21. package/fesm2022/iss-ctrl.mjs +1 -1
  22. package/package.json +1 -1
  23. package/types/iss-ctrl.d.ts +11 -0
  24. package/upgrade.scss +108 -75
  25. package/fesm2022/iss-ctrl-iss-ctrl-CUlx5aua.mjs.map +0 -1
@@ -170,6 +170,21 @@ class ControlBase {
170
170
  validate(control) {
171
171
  return this.ctrl.errors;
172
172
  }
173
+ /**
174
+ * Whether the control currently holds no value.
175
+ *
176
+ * Reflected on the host as `iss-ctrl-empty`, which is what `upgrade.scss` uses to keep the
177
+ * resting outline of an empty field: Material's own `mat-form-field-hide-placeholder` drops
178
+ * off the moment the field is focused, so the border would change colour on focus alone.
179
+ * Override it in a control whose value does not live on {@link ControlBase.ctrl}.
180
+ */
181
+ isEmpty() {
182
+ const value = this.ctrl.getRawValue();
183
+ if (Array.isArray(value)) {
184
+ return value.length === 0;
185
+ }
186
+ return value === null || value === undefined || value === "";
187
+ }
173
188
  onTouch = () => { };
174
189
  onPropagateValue = (_) => { };
175
190
  emitValue(value) {
@@ -195,11 +210,14 @@ class ControlBase {
195
210
  this.onChange.emit(emissionValue);
196
211
  }
197
212
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ControlBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
198
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: ControlBase, isStandalone: true, selector: "ng-component", inputs: { formControlName: { classPropertyName: "formControlName", publicName: "formControlName", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, hints: { classPropertyName: "hints", publicName: "hints", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChange: "onChange" }, ngImport: i0, template: ``, isInline: true });
213
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: ControlBase, isStandalone: true, selector: "ng-component", inputs: { formControlName: { classPropertyName: "formControlName", publicName: "formControlName", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, hints: { classPropertyName: "hints", publicName: "hints", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChange: "onChange" }, host: { properties: { "class.iss-ctrl-empty": "isEmpty()" } }, ngImport: i0, template: ``, isInline: true });
199
214
  }
200
215
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ControlBase, decorators: [{
201
216
  type: Component,
202
- args: [{ template: `` }]
217
+ args: [{
218
+ template: ``,
219
+ host: { "[class.iss-ctrl-empty]": "isEmpty()" }
220
+ }]
203
221
  }], propDecorators: { formControlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "formControlName", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], minLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minLength", required: false }] }], maxLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLength", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], hints: [{ type: i0.Input, args: [{ isSignal: true, alias: "hints", required: false }] }], className: [{ type: i0.Input, args: [{ isSignal: true, alias: "className", required: false }] }], onChange: [{ type: i0.Output, args: ["onChange"] }] } });
204
222
 
205
223
  /**
@@ -390,6 +408,10 @@ class ChipsControl extends ControlBase {
390
408
  event.chipInput.clear();
391
409
  this.emitValue(this.#stringifyValues());
392
410
  }
411
+ // the chips are the value here; `ctrl` stays untouched
412
+ isEmpty() {
413
+ return this.keywords().length === 0;
414
+ }
393
415
  #stringifyValues() {
394
416
  return this.keywords().map((s) => s.trim()).join();
395
417
  }
@@ -1133,6 +1155,11 @@ class DateRangePickerControl extends ControlBase {
1133
1155
  ngOnDestroy() {
1134
1156
  this.#sub.unsubscribe();
1135
1157
  }
1158
+ // the endpoints live on `range`; `ctrl` only holds the emitted value of a complete range
1159
+ isEmpty() {
1160
+ const { start, end } = this.range.getRawValue();
1161
+ return !start && !end;
1162
+ }
1136
1163
  openPicker(picker) {
1137
1164
  if (this.readonly()) {
1138
1165
  return;
@@ -6356,22 +6383,22 @@ const COMPONENTS = {
6356
6383
  datetime: () => Promise.resolve().then(function () { return datetimePicker_field; }).then((c) => c.DatetimePickerField),
6357
6384
  date_range: () => Promise.resolve().then(function () { return dateRangePicker_field; }).then((c) => c.DateRangePickerField),
6358
6385
  attachment: () => Promise.resolve().then(function () { return filePicker_field; }).then((c) => c.FilePickerField),
6359
- userPicker: () => import('./iss-ctrl-user-picker.field-69Tqgu2G.mjs').then((c) => c.UserPickerField),
6386
+ userPicker: () => import('./iss-ctrl-user-picker.field-C7DZ3ck2.mjs').then((c) => c.UserPickerField),
6360
6387
  vehicle_plate: () => Promise.resolve().then(function () { return plate_field; }).then((c) => c.PlateField),
6361
- enrichment: () => import('./iss-ctrl-note.field-DpXXdNd0.mjs').then((c) => c.NoteField),
6388
+ enrichment: () => import('./iss-ctrl-note.field-CakHrlcq.mjs').then((c) => c.NoteField),
6362
6389
  mobile: () => Promise.resolve().then(function () { return mobile_field; }).then((c) => c.MobileField),
6363
- table: () => import('./iss-ctrl-table.field-C5SDeghW.mjs').then((c) => c.TableField),
6390
+ table: () => import('./iss-ctrl-table.field-Ce1KnlZO.mjs').then((c) => c.TableField),
6364
6391
  chips: () => Promise.resolve().then(function () { return chips_field; }).then((c) => c.ChipsField),
6365
6392
  switch: () => Promise.resolve().then(function () { return slideToggle_field; }).then((c) => c.SlideToggleField),
6366
6393
  };
6367
6394
 
6368
6395
  const SERVICES = {
6369
- setValue: () => import('./iss-ctrl-set-value-event-CXVuywEr.mjs').then((s) => s.SetValueEvent),
6396
+ setValue: () => import('./iss-ctrl-set-value-event-C-uD228s.mjs').then((s) => s.SetValueEvent),
6370
6397
  show: () => import('./iss-ctrl-show-event-BcRCwAfo.mjs').then((s) => s.ShowEvent),
6371
- load: () => import('./iss-ctrl-load-value-event-Bq6nRj3K.mjs').then((s) => s.LoadValueEvent),
6372
- loadOptions: () => import('./iss-ctrl-load-options-event-Bvfi4PZq.mjs').then((s) => s.LoadOptionsEvent),
6373
- triggerBasedOnJsonValue: () => import('./iss-ctrl-trigger-based-on-json-value-Ck642ldN.mjs').then((s) => s.TriggerBasedOnJsonValue),
6374
- replaceApiKeyDefaultImpl: () => import('./iss-ctrl-replace-api-keys-Dbdwgl4g.mjs').then((s) => s.ReplaceApiKeys),
6398
+ load: () => import('./iss-ctrl-load-value-event-BjsuFpPf.mjs').then((s) => s.LoadValueEvent),
6399
+ loadOptions: () => import('./iss-ctrl-load-options-event-DOlkFXz5.mjs').then((s) => s.LoadOptionsEvent),
6400
+ triggerBasedOnJsonValue: () => import('./iss-ctrl-trigger-based-on-json-value-D5S3shyl.mjs').then((s) => s.TriggerBasedOnJsonValue),
6401
+ replaceApiKeyDefaultImpl: () => import('./iss-ctrl-replace-api-keys-C-G34VNS.mjs').then((s) => s.ReplaceApiKeys),
6375
6402
  };
6376
6403
 
6377
6404
  // Read-only counterpart of COMPONENTS: the component used to render a field's value
@@ -6594,19 +6621,15 @@ class Outlet {
6594
6621
  />
6595
6622
  }
6596
6623
  }
6597
- `, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "pipe", type: FieldDataInjector, name: "FieldDataInjector" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6624
+ `, isInline: true, styles: [":host{display:flex;flex-direction:column;gap:2rem}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "pipe", type: FieldDataInjector, name: "FieldDataInjector" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6598
6625
  }
6599
6626
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: Outlet, decorators: [{
6600
6627
  type: Component,
6601
- args: [{
6602
- selector: "iss-form-outlet",
6603
- imports: [
6628
+ args: [{ selector: "iss-form-outlet", imports: [
6604
6629
  NgComponentOutlet,
6605
6630
  FieldDataInjector,
6606
6631
  AsyncPipe,
6607
- ],
6608
- changeDetection: ChangeDetectionStrategy.OnPush,
6609
- template: `
6632
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: `
6610
6633
  @if (components() && components()?.length) {
6611
6634
  @for (component of components(); track $index) {
6612
6635
  <ng-container
@@ -6616,8 +6639,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
6616
6639
  />
6617
6640
  }
6618
6641
  }
6619
- `
6620
- }]
6642
+ `, styles: [":host{display:flex;flex-direction:column;gap:2rem}\n"] }]
6621
6643
  }], propDecorators: { ready: [{ type: i0.Output, args: ["ready"] }], fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: true }] }] } });
6622
6644
 
6623
6645
  const VIEW_PROVIDER = {
@@ -6771,33 +6793,33 @@ class ValidationMessageComponent {
6771
6793
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ValidationMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
6772
6794
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: ValidationMessageComponent, isStandalone: true, selector: "iss-validation-message-viewer", inputs: { errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: true, transformFunction: null }, showMessage: { classPropertyName: "showMessage", publicName: "showMessage", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
6773
6795
  @if (errors() !== null && showMessage()) {
6774
- @for (error of errors() ?? {} | keyvalue; track error) {
6775
- <p>
6776
- <mat-error>{{ getValidationMessage(error) | translate }}</mat-error>
6777
- </p>
6778
- }
6796
+ <div class="messages">
6797
+ @for (error of errors() ?? {} | keyvalue; track error) {
6798
+ <p>
6799
+ <mat-error>{{ getValidationMessage(error) | translate }}</mat-error>
6800
+ </p>
6801
+ }
6802
+ </div>
6779
6803
  }
6780
- `, isInline: true, dependencies: [{ kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
6804
+ `, isInline: true, styles: [":host{display:block;position:relative}.messages{position:absolute;inset-inline:0;top:0;z-index:1}p{margin:0}\n"], dependencies: [{ kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
6781
6805
  }
6782
6806
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ValidationMessageComponent, decorators: [{
6783
6807
  type: Component,
6784
- args: [{
6785
- selector: "iss-validation-message-viewer",
6786
- imports: [
6808
+ args: [{ selector: "iss-validation-message-viewer", imports: [
6787
6809
  KeyValuePipe,
6788
6810
  TranslatePipe,
6789
6811
  MatError
6790
- ],
6791
- template: `
6812
+ ], template: `
6792
6813
  @if (errors() !== null && showMessage()) {
6793
- @for (error of errors() ?? {} | keyvalue; track error) {
6794
- <p>
6795
- <mat-error>{{ getValidationMessage(error) | translate }}</mat-error>
6796
- </p>
6797
- }
6814
+ <div class="messages">
6815
+ @for (error of errors() ?? {} | keyvalue; track error) {
6816
+ <p>
6817
+ <mat-error>{{ getValidationMessage(error) | translate }}</mat-error>
6818
+ </p>
6819
+ }
6820
+ </div>
6798
6821
  }
6799
- `,
6800
- }]
6822
+ `, styles: [":host{display:block;position:relative}.messages{position:absolute;inset-inline:0;top:0;z-index:1}p{margin:0}\n"] }]
6801
6823
  }], propDecorators: { errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: true }] }], showMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "showMessage", required: true }] }] } });
6802
6824
 
6803
6825
  class EventTrigger {
@@ -9416,4 +9438,4 @@ var time_validator = /*#__PURE__*/Object.freeze({
9416
9438
  */
9417
9439
 
9418
9440
  export { PlateViewer as $, TimePickerField as A, DatePickerField as B, ControlBase as C, DatePickerControl as D, Employee as E, FieldBase as F, DatetimePickerField as G, HOST as H, IssField as I, DateRangePickerField as J, InputViewer as K, Loader as L, MobileControl as M, TextareaViewer as N, Outlet as O, PLACEHOLDER_REGEX as P, ChipsViewer as Q, RadioControl as R, SelectControl as S, TextareaControl as T, RadioViewer as U, VIEW_PROVIDER as V, SelectViewer as W, MobileViewer as X, CheckboxViewer as Y, ToggleButtonViewer as Z, SlideToggleViewer as _, ValidationMessageComponent as a, AttachmentViewer as a0, TimePickerViewer as a1, DatePickerViewer as a2, DatePickerTimeViewer as a3, DateRangePickerViewer as a4, DEFAULT_COUNTRY as a5, COUNTRIES as a6, DATE_FORMAT_ADAPTER as a7, DATETIME_FORMAT as a8, PLATE_LETTERS as a9, startOfHijriMonth as aA, getHijriDaysInMonth as aB, createHijriDate as aC, formatHijriDate as aD, parseHijriDate as aE, toHijriDisplay as aF, IssValidators as aG, FileValidators as aH, TimeValidator as aI, VALIDATION_MESSAGES as aa, COMPONENTS as ab, SERVICES as ac, VALIDATORS as ad, FIELD_DATA as ae, UI_LANGUAGE as af, ATTACHMENT_UPLOAD_URL as ag, ATTACHMENT_UPLOAD_RESPONSE_MAPPER as ah, ATTACHMENT_DOWNLOAD_URL as ai, USER_SEARCH_API as aj, HintsComponent as ak, Droppable as al, ArabicNumberPipe as am, FieldDataInjector as an, PlateLetterPipe as ao, SelectStatusPipe as ap, TranslatePipe as aq, FileHandler as ar, IssDateAdapter as as, provideIssDateAdapter as at, Phone as au, arrayFrom as av, formatFileSize as aw, HIJRI_LOCALE as ax, HIJRI_MONTH_NAMES as ay, getHijriParts as az, ViewerBase as b, FormEngine as c, CheckboxControl as d, ChipsControl as e, DateRangePickerControl as f, getPropertyByPath as g, DatetimePickerControl as h, FilePickerControl as i, InputControl as j, PlateControl as k, SlideToggleControl as l, TimePickerControl as m, ToggleButtonControl as n, InputField as o, TextareaField as p, ChipsField as q, replacePlaceholders as r, RadioField as s, SelectField as t, MobileField as u, CheckboxField as v, ToggleButtonField as w, SlideToggleField as x, PlateField as y, FilePickerField as z };
9419
- //# sourceMappingURL=iss-ctrl-iss-ctrl-CUlx5aua.mjs.map
9441
+ //# sourceMappingURL=iss-ctrl-iss-ctrl-C_ZiixeF.mjs.map