@zeedhi/common 1.87.2 → 1.88.1

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.
@@ -4246,10 +4246,7 @@ class DateRange extends TextInput {
4246
4246
  * Toggles visibility of the week numbers in the body of the calendar.
4247
4247
  */
4248
4248
  this.showWeek = false;
4249
- /**
4250
- * Character that will separate the two dates
4251
- */
4252
- this.splitter = ' ~ ';
4249
+ this.internalSplitter = ' ~ ';
4253
4250
  /**
4254
4251
  * Width of the picker.
4255
4252
  */
@@ -4288,7 +4285,7 @@ class DateRange extends TextInput {
4288
4285
  this.scrollable = this.getInitValue('scrollable', props.scrollable, this.scrollable);
4289
4286
  this.showDatePicker = this.getInitValue('showDatePicker', props.showDatePicker, this.showDatePicker);
4290
4287
  this.showWeek = this.getInitValue('showWeek', props.showWeek, this.showWeek);
4291
- this.splitter = this.getInitValue('splitter', props.splitter, this.splitter);
4288
+ this.splitter = this.getInitValue('splitter', props.splitter, this.internalSplitter);
4292
4289
  this.width = this.getInitValue('width', props.width, this.width);
4293
4290
  this.mask = this.getInitValue('mask', props.mask, undefined);
4294
4291
  this.helperOptions = this.getInitValue('helperOptions', props.helperOptions, this.helperOptions);
@@ -4307,6 +4304,15 @@ class DateRange extends TextInput {
4307
4304
  }
4308
4305
  };
4309
4306
  }
4307
+ /**
4308
+ * Character that will separate the two dates
4309
+ */
4310
+ get splitter() {
4311
+ return I18n.translate(this.internalSplitter);
4312
+ }
4313
+ set splitter(splitter) {
4314
+ this.internalSplitter = splitter;
4315
+ }
4310
4316
  getInitialMask() {
4311
4317
  if (isUndefined(this.mask)) {
4312
4318
  this.unitMask = this.inputFormat && this.maskFormat(this.inputFormat);
@@ -4344,7 +4350,7 @@ class DateRange extends TextInput {
4344
4350
  * Gets the updated masked, based on displayFormat if the initial mask is undefined
4345
4351
  */
4346
4352
  getUpdatedMask() {
4347
- if (isUndefined(this.initialMask)) {
4353
+ if (isUndefined(this.getInitialMask())) {
4348
4354
  return this.maskFormat(`${this.displayFormat}${this.splitter}${this.displayFormat}`);
4349
4355
  }
4350
4356
  return this.mask;
@@ -4475,10 +4481,10 @@ class DateRange extends TextInput {
4475
4481
  * Add date mask
4476
4482
  */
4477
4483
  addDateMask() {
4478
- if (isUndefined(this.initialMask) || !this.value)
4484
+ if (isUndefined(this.getInitialMask()) || !this.value)
4479
4485
  return;
4480
4486
  setTimeout(() => {
4481
- this.mask = this.initialMask;
4487
+ this.mask = this.getInitialMask();
4482
4488
  const firstDate = this.value[0]
4483
4489
  ? dayjs(this.value[0], this.dateFormat).format(this.inputFormat || this.displayFormat)
4484
4490
  : '';
@@ -4492,7 +4498,7 @@ class DateRange extends TextInput {
4492
4498
  * Removes the component mask if value is valid
4493
4499
  */
4494
4500
  removeDateMask() {
4495
- if (isUndefined(this.initialMask) || !this.value || this.dateError
4501
+ if (isUndefined(this.getInitialMask()) || !this.value || this.dateError
4496
4502
  || !this.isValidDateArray(this.dateFormat, this.value)) {
4497
4503
  return;
4498
4504
  }
@@ -7470,10 +7476,21 @@ class Select extends TextInput {
7470
7476
  const oldGet = this.datasource.get;
7471
7477
  this.datasource.get = () => __awaiter(this, void 0, void 0, function* () {
7472
7478
  const response = yield oldGet.call(this.datasource);
7479
+ if (!this.datasource.search && !this.manualMode) {
7480
+ this.cachedData = [...this.datasource.data];
7481
+ this.cachedTotal = this.datasource.total;
7482
+ }
7473
7483
  if (this.indexOf(this.value) === -1 && !this.datasource.search && !this.isFocused) {
7474
7484
  yield this.setValue(this.value, false);
7475
7485
  this.removePushedValue();
7476
7486
  }
7487
+ if (this.pushedValue && this.indexOf(this.pushedValue) === -1) {
7488
+ const filterValue = this.pushedValue[this.dataValue];
7489
+ const foundInData = this.datasource.data.find(this.getCondition(filterValue));
7490
+ if (!foundInData) {
7491
+ this.datasource.data.unshift(this.pushedValue);
7492
+ }
7493
+ }
7477
7494
  return response;
7478
7495
  });
7479
7496
  }
@@ -4253,10 +4253,7 @@
4253
4253
  * Toggles visibility of the week numbers in the body of the calendar.
4254
4254
  */
4255
4255
  this.showWeek = false;
4256
- /**
4257
- * Character that will separate the two dates
4258
- */
4259
- this.splitter = ' ~ ';
4256
+ this.internalSplitter = ' ~ ';
4260
4257
  /**
4261
4258
  * Width of the picker.
4262
4259
  */
@@ -4295,7 +4292,7 @@
4295
4292
  this.scrollable = this.getInitValue('scrollable', props.scrollable, this.scrollable);
4296
4293
  this.showDatePicker = this.getInitValue('showDatePicker', props.showDatePicker, this.showDatePicker);
4297
4294
  this.showWeek = this.getInitValue('showWeek', props.showWeek, this.showWeek);
4298
- this.splitter = this.getInitValue('splitter', props.splitter, this.splitter);
4295
+ this.splitter = this.getInitValue('splitter', props.splitter, this.internalSplitter);
4299
4296
  this.width = this.getInitValue('width', props.width, this.width);
4300
4297
  this.mask = this.getInitValue('mask', props.mask, undefined);
4301
4298
  this.helperOptions = this.getInitValue('helperOptions', props.helperOptions, this.helperOptions);
@@ -4314,6 +4311,15 @@
4314
4311
  }
4315
4312
  };
4316
4313
  }
4314
+ /**
4315
+ * Character that will separate the two dates
4316
+ */
4317
+ get splitter() {
4318
+ return core.I18n.translate(this.internalSplitter);
4319
+ }
4320
+ set splitter(splitter) {
4321
+ this.internalSplitter = splitter;
4322
+ }
4317
4323
  getInitialMask() {
4318
4324
  if (isUndefined__default["default"](this.mask)) {
4319
4325
  this.unitMask = this.inputFormat && this.maskFormat(this.inputFormat);
@@ -4351,7 +4357,7 @@
4351
4357
  * Gets the updated masked, based on displayFormat if the initial mask is undefined
4352
4358
  */
4353
4359
  getUpdatedMask() {
4354
- if (isUndefined__default["default"](this.initialMask)) {
4360
+ if (isUndefined__default["default"](this.getInitialMask())) {
4355
4361
  return this.maskFormat(`${this.displayFormat}${this.splitter}${this.displayFormat}`);
4356
4362
  }
4357
4363
  return this.mask;
@@ -4482,10 +4488,10 @@
4482
4488
  * Add date mask
4483
4489
  */
4484
4490
  addDateMask() {
4485
- if (isUndefined__default["default"](this.initialMask) || !this.value)
4491
+ if (isUndefined__default["default"](this.getInitialMask()) || !this.value)
4486
4492
  return;
4487
4493
  setTimeout(() => {
4488
- this.mask = this.initialMask;
4494
+ this.mask = this.getInitialMask();
4489
4495
  const firstDate = this.value[0]
4490
4496
  ? core.dayjs(this.value[0], this.dateFormat).format(this.inputFormat || this.displayFormat)
4491
4497
  : '';
@@ -4499,7 +4505,7 @@
4499
4505
  * Removes the component mask if value is valid
4500
4506
  */
4501
4507
  removeDateMask() {
4502
- if (isUndefined__default["default"](this.initialMask) || !this.value || this.dateError
4508
+ if (isUndefined__default["default"](this.getInitialMask()) || !this.value || this.dateError
4503
4509
  || !this.isValidDateArray(this.dateFormat, this.value)) {
4504
4510
  return;
4505
4511
  }
@@ -7477,10 +7483,21 @@
7477
7483
  const oldGet = this.datasource.get;
7478
7484
  this.datasource.get = () => __awaiter(this, void 0, void 0, function* () {
7479
7485
  const response = yield oldGet.call(this.datasource);
7486
+ if (!this.datasource.search && !this.manualMode) {
7487
+ this.cachedData = [...this.datasource.data];
7488
+ this.cachedTotal = this.datasource.total;
7489
+ }
7480
7490
  if (this.indexOf(this.value) === -1 && !this.datasource.search && !this.isFocused) {
7481
7491
  yield this.setValue(this.value, false);
7482
7492
  this.removePushedValue();
7483
7493
  }
7494
+ if (this.pushedValue && this.indexOf(this.pushedValue) === -1) {
7495
+ const filterValue = this.pushedValue[this.dataValue];
7496
+ const foundInData = this.datasource.data.find(this.getCondition(filterValue));
7497
+ if (!foundInData) {
7498
+ this.datasource.data.unshift(this.pushedValue);
7499
+ }
7500
+ }
7484
7501
  return response;
7485
7502
  });
7486
7503
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.87.2",
3
+ "version": "1.88.1",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -42,6 +42,5 @@
42
42
  "@types/lodash.times": "4.3.*",
43
43
  "lodash.times": "4.3.*",
44
44
  "mockdate": "3.0.*"
45
- },
46
- "gitHead": "ba49509e8854ec02eb5615c7197e7cad12d1cabe"
45
+ }
47
46
  }
@@ -48,7 +48,9 @@ export declare class DateRange extends TextInput implements IDateRange {
48
48
  /**
49
49
  * Character that will separate the two dates
50
50
  */
51
- splitter: string;
51
+ get splitter(): string;
52
+ set splitter(splitter: string);
53
+ private internalSplitter;
52
54
  /**
53
55
  * Width of the picker.
54
56
  */
package/LICENSE DELETED
@@ -1,24 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 Zeedhi
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
-
23
- This repository includes one file originally copied from https://github.com/vuetifyjs/vuetify/
24
- under /blob/v1.5.16/packages/vuetify/src/util/, mask.ts.
@@ -1,12 +0,0 @@
1
- export interface IJSONObject {
2
- path: string;
3
- }
4
- export declare class JsonCacheService {
5
- /**
6
- * jsons collection
7
- */
8
- static jsonCollection: IJSONObject[];
9
- static saveJSONCache(jsonCollection: IJSONObject[]): Promise<void>;
10
- static getJSONCache(path: string): any;
11
- static clearJSONCache(jsonCollection: IJSONObject[]): void;
12
- }