@etsoo/appscript 1.0.92 → 1.0.93

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.
@@ -5,6 +5,13 @@ import { ProductUnit } from './ProductUnit';
5
5
  * Business utils
6
6
  */
7
7
  export declare namespace BusinessUtils {
8
+ /**
9
+ * Add blank item to id/label data array
10
+ * @param input Input array
11
+ * @param copy Copy or change the current inpu
12
+ * @returns Items with blank item
13
+ */
14
+ function addIdLabelBlankItem(input: IdLabelDto[], copy?: boolean): IdLabelDto[];
8
15
  /**
9
16
  * Get product unit's label
10
17
  * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
@@ -8,6 +8,20 @@ const ProductUnit_1 = require("./ProductUnit");
8
8
  */
9
9
  var BusinessUtils;
10
10
  (function (BusinessUtils) {
11
+ /**
12
+ * Add blank item to id/label data array
13
+ * @param input Input array
14
+ * @param copy Copy or change the current inpu
15
+ * @returns Items with blank item
16
+ */
17
+ function addIdLabelBlankItem(input, copy = false) {
18
+ const blankItem = { id: '', label: '---' };
19
+ if (copy)
20
+ return [blankItem, ...input];
21
+ input.unshift(blankItem);
22
+ return input;
23
+ }
24
+ BusinessUtils.addIdLabelBlankItem = addIdLabelBlankItem;
11
25
  // Get unit label by key
12
26
  function getUnitLabelByKey(func, key) {
13
27
  var _a;
@@ -5,6 +5,13 @@ import { ProductUnit } from './ProductUnit';
5
5
  * Business utils
6
6
  */
7
7
  export declare namespace BusinessUtils {
8
+ /**
9
+ * Add blank item to id/label data array
10
+ * @param input Input array
11
+ * @param copy Copy or change the current inpu
12
+ * @returns Items with blank item
13
+ */
14
+ function addIdLabelBlankItem(input: IdLabelDto[], copy?: boolean): IdLabelDto[];
8
15
  /**
9
16
  * Get product unit's label
10
17
  * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
@@ -5,6 +5,20 @@ import { ProductUnit } from './ProductUnit';
5
5
  */
6
6
  export var BusinessUtils;
7
7
  (function (BusinessUtils) {
8
+ /**
9
+ * Add blank item to id/label data array
10
+ * @param input Input array
11
+ * @param copy Copy or change the current inpu
12
+ * @returns Items with blank item
13
+ */
14
+ function addIdLabelBlankItem(input, copy = false) {
15
+ const blankItem = { id: '', label: '---' };
16
+ if (copy)
17
+ return [blankItem, ...input];
18
+ input.unshift(blankItem);
19
+ return input;
20
+ }
21
+ BusinessUtils.addIdLabelBlankItem = addIdLabelBlankItem;
8
22
  // Get unit label by key
9
23
  function getUnitLabelByKey(func, key) {
10
24
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.0.92",
3
+ "version": "1.0.93",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -7,6 +7,23 @@ import { ProductUnit } from './ProductUnit';
7
7
  * Business utils
8
8
  */
9
9
  export namespace BusinessUtils {
10
+ /**
11
+ * Add blank item to id/label data array
12
+ * @param input Input array
13
+ * @param copy Copy or change the current inpu
14
+ * @returns Items with blank item
15
+ */
16
+ export function addIdLabelBlankItem(
17
+ input: IdLabelDto[],
18
+ copy: boolean = false
19
+ ) {
20
+ const blankItem: IdLabelDto = { id: '', label: '---' };
21
+ if (copy) return [blankItem, ...input];
22
+
23
+ input.unshift(blankItem);
24
+ return input;
25
+ }
26
+
10
27
  // Get unit label by key
11
28
  function getUnitLabelByKey(func: ICultureGet, key: string) {
12
29
  return func('unit' + key) ?? key;