@aquera/ngx-smart-table 0.0.38 → 0.0.40

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aquera/ngx-smart-table",
3
- "version": "0.0.38",
3
+ "version": "0.0.40",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -2409,6 +2409,7 @@ interface OperatorDefinition {
2409
2409
  * Fields are consumer-provided via ConditionBuilderConfig.fields.
2410
2410
  * The library does not ship default fields.
2411
2411
  */
2412
+
2412
2413
  /**
2413
2414
  * Editor variant used to render a field's value input.
2414
2415
  * - 'text' : free-form text, single value
@@ -2441,13 +2442,45 @@ interface FieldDefinition {
2441
2442
  * builder config are allowed. Operator keys must match an OperatorDefinition.key.
2442
2443
  */
2443
2444
  operators?: string[];
2444
- /** Predefined options — required when valueEditor is 'select' or 'multi-select'. */
2445
+ /**
2446
+ * Predefined options for 'select' / 'multi-select'. Required for static
2447
+ * dropdowns. When `loadOptions` is also provided, this acts as the initial
2448
+ * (seed) list shown until the first async load resolves.
2449
+ */
2445
2450
  options?: FieldOption[];
2446
2451
  /**
2447
2452
  * Placeholder text shown in the value editor when nothing is selected.
2448
2453
  * Falls back to a sensible default per editor type when omitted.
2449
2454
  */
2450
2455
  valuePlaceholder?: string;
2456
+ /**
2457
+ * Show a search box inside the 'select' / 'multi-select' dropdown. Ignored
2458
+ * for 'text' and 'chip' editors.
2459
+ * @default true
2460
+ */
2461
+ searchable?: boolean;
2462
+ /**
2463
+ * Async options provider for 'select' / 'multi-select' editors. When set, the
2464
+ * editor switches to server-side search: the dropdown's built-in client-side
2465
+ * filtering is turned off and this is invoked with the current search term —
2466
+ * once with `''` when the dropdown first opens, then again (debounced) on each
2467
+ * search keystroke. Return the options to display, as an Observable or Promise.
2468
+ *
2469
+ * While a load is in flight the dropdown shows a loading indicator. The static
2470
+ * `options` array (if any) is shown until the first load resolves. If the
2471
+ * loader errors, the currently shown options are left unchanged.
2472
+ *
2473
+ * @example
2474
+ * loadOptions: (q) => this.api.searchGroups(q) // returns Observable<FieldOption[]>
2475
+ */
2476
+ loadOptions?: (search: string) => Observable<FieldOption[]> | Promise<FieldOption[]>;
2477
+ /**
2478
+ * Debounce (in ms) applied to search keystrokes before `loadOptions` fires.
2479
+ * The initial open-time load is not debounced. Only relevant when
2480
+ * `loadOptions` is set.
2481
+ * @default 300
2482
+ */
2483
+ searchDebounceMs?: number;
2451
2484
  }
2452
2485
  /**
2453
2486
  * Grouped fields shown as a submenu in the field picker. Matches the v1 admin-ui
@@ -6214,13 +6247,26 @@ declare class StConditionRuleComponent {
6214
6247
  * Value is always handled as `string[]`. Single-value editors use the first array
6215
6248
  * element; empty array means "no value".
6216
6249
  */
6217
- declare class StConditionValueEditorComponent implements OnInit, OnDestroy {
6250
+ declare class StConditionValueEditorComponent implements OnInit, OnChanges, OnDestroy {
6218
6251
  field?: FieldDefinition;
6219
6252
  operator?: OperatorDefinition;
6220
6253
  value: ConditionValue;
6221
6254
  disabled: boolean;
6222
6255
  readonly valueChange: EventEmitter<ConditionValue>;
6223
6256
  private elementRef;
6257
+ private cdr;
6258
+ /**
6259
+ * Async-search state (only used when the field declares `loadOptions`).
6260
+ * - `asyncOptions` holds the latest server-fetched list; null means "not
6261
+ * loaded yet" and we fall back to the field's static `options`.
6262
+ * - `optionsLoading` drives nile-select's loading indicator.
6263
+ * - `loadedForAttribute` guards the one-time open-time load per field.
6264
+ */
6265
+ asyncOptions: FieldOption[] | null;
6266
+ optionsLoading: boolean;
6267
+ private loadedForAttribute?;
6268
+ private searchTimer;
6269
+ private inFlight;
6224
6270
  /** Open/close + highlighted-option state for the slotted-trigger select. */
6225
6271
  private dropdownOpen;
6226
6272
  private highlightedIndex;
@@ -6231,6 +6277,14 @@ declare class StConditionValueEditorComponent implements OnInit, OnDestroy {
6231
6277
  private activeHost;
6232
6278
  constructor();
6233
6279
  ngOnInit(): void;
6280
+ /**
6281
+ * Reset the async-search state whenever the bound field switches to a
6282
+ * different attribute. The component instance is reused across rule edits
6283
+ * (Angular rebinds `[field]`), so stale fetched options / loading flags from
6284
+ * the previous field must be cleared, and the next open re-triggers the
6285
+ * initial load.
6286
+ */
6287
+ ngOnChanges(changes: SimpleChanges): void;
6234
6288
  /**
6235
6289
  * Host class flag — when true, the value editor host stretches to take the
6236
6290
  * remaining flex space in the rule (so the chip can grow up to the row's
@@ -6242,6 +6296,21 @@ declare class StConditionValueEditorComponent implements OnInit, OnDestroy {
6242
6296
  get hidden(): boolean;
6243
6297
  /** Placeholder for the current editor — field override wins, else a sensible default per editor type. */
6244
6298
  get placeholder(): string;
6299
+ /**
6300
+ * Whether the select / multi-select dropdown shows its search box. Defaults
6301
+ * to true (the field opts out with `searchable: false`). Server-side search
6302
+ * always needs the box, so a field that declares `loadOptions` keeps it on
6303
+ * regardless of the flag.
6304
+ */
6305
+ get searchEnabled(): boolean;
6306
+ /** True when the field provides an async `loadOptions` callback. */
6307
+ get serverSearch(): boolean;
6308
+ /**
6309
+ * Options rendered into the dropdown. For server-side search this is the
6310
+ * latest fetched list (falling back to the field's static seed list until
6311
+ * the first load resolves); otherwise it's just the static `options`.
6312
+ */
6313
+ get displayOptions(): FieldOption[];
6245
6314
  /** Convenience: first element for single-value editors. */
6246
6315
  get singleValue(): string;
6247
6316
  /**
@@ -6283,6 +6352,22 @@ declare class StConditionValueEditorComponent implements OnInit, OnDestroy {
6283
6352
  * (it lives for the component's lifetime).
6284
6353
  */
6285
6354
  onSelectShow(event: Event): void;
6355
+ /**
6356
+ * nile-select fires `nile-search` (with `detail.query`) on every keystroke in
6357
+ * its search box. For server-side search we debounce and re-fetch; when the
6358
+ * field has no `loadOptions` callback the dropdown's built-in client-side
6359
+ * filter handles it and this is a no-op.
6360
+ */
6361
+ onSelectSearch(event: Event): void;
6362
+ /**
6363
+ * Invoke the field's `loadOptions(query)` and adopt the result. Normalises
6364
+ * the Observable-or-Promise return via `from()`, cancels any in-flight
6365
+ * request (latest-wins), and shows nile-select's loading indicator while the
6366
+ * fetch runs. A failed load leaves the current options untouched.
6367
+ */
6368
+ private fetchOptions;
6369
+ /** Cancel any pending debounce timer and in-flight options request. */
6370
+ private cancelLoad;
6286
6371
  /**
6287
6372
  * Nile emits `nile-hide` when its dropdown closes — for any reason (Esc,
6288
6373
  * click-outside, single-select pick, programmatic .hide()). Returning focus