@zeedhi/common 1.51.0 → 1.52.0

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.
@@ -2317,7 +2317,12 @@ class Container extends ComponentRender {
2317
2317
  * Removes viewport maximum-width size breakpoints.
2318
2318
  */
2319
2319
  this.fluid = true;
2320
+ /**
2321
+ * Define if the container is a scroll view
2322
+ */
2323
+ this.scrollView = false;
2320
2324
  this.fluid = this.getInitValue('fluid', props.fluid, this.fluid);
2325
+ this.scrollView = this.getInitValue('scrollView', props.scrollView, this.scrollView);
2321
2326
  this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
2322
2327
  this.height = this.getInitValue('height', props.height, this.height);
2323
2328
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
@@ -4797,6 +4802,23 @@ class ColumnNotFoundError extends Error {
4797
4802
  }
4798
4803
  }
4799
4804
 
4805
+ class IterableController {
4806
+ constructor(iterable) {
4807
+ this.searchInValue = undefined;
4808
+ this.columns = iterable.columns;
4809
+ }
4810
+ get searchIn() {
4811
+ return this.searchInValue || this.columns.reduce((result, column) => {
4812
+ if (column.type !== 'action' && column.isVisible)
4813
+ result.push(column.name);
4814
+ return result;
4815
+ }, []);
4816
+ }
4817
+ set searchIn(value) {
4818
+ this.searchInValue = value;
4819
+ }
4820
+ }
4821
+
4800
4822
  /**
4801
4823
  * Base class for Iterable components.
4802
4824
  */
@@ -4832,16 +4854,14 @@ class Iterable extends ComponentRender {
4832
4854
  */
4833
4855
  this.actionsApplied = {};
4834
4856
  this.columns = this.getColumns(props.columns || this.columns);
4835
- this.datasource = DatasourceFactory.factory(Object.assign(Object.assign({}, props.datasource), { searchIn: ((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.searchIn) || this.getSearchColumns() }));
4857
+ this.createController();
4858
+ this.datasource = DatasourceFactory.factory(Object.assign(Object.assign({}, props.datasource), { searchIn: ((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.searchIn) || `{{IterableController_${this.name}.searchIn}}` }));
4836
4859
  this.pageSizes = this.getInitValue('pageSizes', props.pageSizes, this.pageSizes);
4837
4860
  this.virtualScroll = this.getInitValue('virtualScroll', props.virtualScroll, this.virtualScroll);
4838
4861
  }
4839
- getSearchColumns() {
4840
- return this.columns.reduce((result, column) => {
4841
- if (column.type !== 'action')
4842
- result.push(column.name);
4843
- return result;
4844
- }, []);
4862
+ createController() {
4863
+ const controller = new IterableController(this);
4864
+ Loader.addController(`IterableController_${this.name}`, controller);
4845
4865
  }
4846
4866
  /**
4847
4867
  * Retrieves columns instances
@@ -2324,7 +2324,12 @@
2324
2324
  * Removes viewport maximum-width size breakpoints.
2325
2325
  */
2326
2326
  this.fluid = true;
2327
+ /**
2328
+ * Define if the container is a scroll view
2329
+ */
2330
+ this.scrollView = false;
2327
2331
  this.fluid = this.getInitValue('fluid', props.fluid, this.fluid);
2332
+ this.scrollView = this.getInitValue('scrollView', props.scrollView, this.scrollView);
2328
2333
  this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
2329
2334
  this.height = this.getInitValue('height', props.height, this.height);
2330
2335
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
@@ -4804,6 +4809,23 @@
4804
4809
  }
4805
4810
  }
4806
4811
 
4812
+ class IterableController {
4813
+ constructor(iterable) {
4814
+ this.searchInValue = undefined;
4815
+ this.columns = iterable.columns;
4816
+ }
4817
+ get searchIn() {
4818
+ return this.searchInValue || this.columns.reduce((result, column) => {
4819
+ if (column.type !== 'action' && column.isVisible)
4820
+ result.push(column.name);
4821
+ return result;
4822
+ }, []);
4823
+ }
4824
+ set searchIn(value) {
4825
+ this.searchInValue = value;
4826
+ }
4827
+ }
4828
+
4807
4829
  /**
4808
4830
  * Base class for Iterable components.
4809
4831
  */
@@ -4839,16 +4861,14 @@
4839
4861
  */
4840
4862
  this.actionsApplied = {};
4841
4863
  this.columns = this.getColumns(props.columns || this.columns);
4842
- this.datasource = core.DatasourceFactory.factory(Object.assign(Object.assign({}, props.datasource), { searchIn: ((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.searchIn) || this.getSearchColumns() }));
4864
+ this.createController();
4865
+ this.datasource = core.DatasourceFactory.factory(Object.assign(Object.assign({}, props.datasource), { searchIn: ((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.searchIn) || `{{IterableController_${this.name}.searchIn}}` }));
4843
4866
  this.pageSizes = this.getInitValue('pageSizes', props.pageSizes, this.pageSizes);
4844
4867
  this.virtualScroll = this.getInitValue('virtualScroll', props.virtualScroll, this.virtualScroll);
4845
4868
  }
4846
- getSearchColumns() {
4847
- return this.columns.reduce((result, column) => {
4848
- if (column.type !== 'action')
4849
- result.push(column.name);
4850
- return result;
4851
- }, []);
4869
+ createController() {
4870
+ const controller = new IterableController(this);
4871
+ core.Loader.addController(`IterableController_${this.name}`, controller);
4852
4872
  }
4853
4873
  /**
4854
4874
  * Retrieves columns instances
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.51.0",
3
+ "version": "1.52.0",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -37,5 +37,5 @@
37
37
  "lodash.times": "^4.3.2",
38
38
  "mockdate": "^3.0.2"
39
39
  },
40
- "gitHead": "be07d7f99d3351043e08a98b52a5736ab686dd30"
40
+ "gitHead": "7831436c706ebc6f781d756f5f80f393bf053b9b"
41
41
  }
@@ -24,6 +24,10 @@ export declare class Container extends ComponentRender implements IContainer {
24
24
  * Removes viewport maximum-width size breakpoints.
25
25
  */
26
26
  fluid: boolean;
27
+ /**
28
+ * Define if the container is a scroll view
29
+ */
30
+ scrollView: boolean;
27
31
  /**
28
32
  * Creates a new Container.
29
33
  * @param props Container properties
@@ -5,4 +5,5 @@ export interface IContainer extends IComponentRender {
5
5
  height?: number | string;
6
6
  maxHeight?: number | string;
7
7
  minHeight?: number | string;
8
+ scrollView?: boolean;
8
9
  }
@@ -0,0 +1,8 @@
1
+ import { Iterable } from './iterable';
2
+ export declare class IterableController {
3
+ private columns;
4
+ private searchInValue?;
5
+ constructor(iterable: Iterable);
6
+ get searchIn(): string[] | undefined;
7
+ set searchIn(value: string[] | undefined);
8
+ }
@@ -41,7 +41,7 @@ export declare class Iterable extends ComponentRender implements IIterable {
41
41
  * @param props Iterable properties
42
42
  */
43
43
  constructor(props: IIterable);
44
- protected getSearchColumns(): string[];
44
+ protected createController(): void;
45
45
  /**
46
46
  * Retrieves columns instances
47
47
  * @param columns Columns property