@things-factory/biz-ui 4.3.113-alpha.0 → 4.3.114

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.
@@ -4,7 +4,6 @@ import _ from 'lodash'
4
4
 
5
5
  import gql from 'graphql-tag'
6
6
  import { css, html } from 'lit'
7
- import isEmpty from 'lodash-es/isEmpty'
8
7
 
9
8
  import { getCodeByName } from '@things-factory/code-base'
10
9
  import { i18next, localize } from '@things-factory/i18n-base'
@@ -88,11 +87,11 @@ export class ContactPointList extends localize(i18next)(PageView) {
88
87
 
89
88
  return patch
90
89
  })
91
- await this._validateImport(patches)
90
+ this._validateImport(patches)
92
91
  await this._saveContactPoints(patches)
93
92
  history.back()
94
93
  } catch (e) {
95
- this.showToast(e.message)
94
+ this.showToast(e)
96
95
  }
97
96
  })
98
97
  }
@@ -139,7 +138,6 @@ export class ContactPointList extends localize(i18next)(PageView) {
139
138
  ]
140
139
 
141
140
  this.config = {
142
- pagination: { limit: 50, pages: [50, 100, 200, 500] },
143
141
  rows: {
144
142
  selectable: {
145
143
  multiple: true
@@ -159,7 +157,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
159
157
  width: 40,
160
158
  type: 'string'
161
159
  },
162
- header: `*${i18next.t('field.contact_point_customer_name')}`,
160
+ header: i18next.t('field.contact_point_customer_name'),
163
161
  width: 250
164
162
  },
165
163
  {
@@ -194,7 +192,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
194
192
  name: 'companyName',
195
193
  record: { editable: true },
196
194
  imex: {
197
- header: i18next.t('field.contact_point_other_company_name'),
195
+ header: '*' + i18next.t('field.contact_point_other_company_name'),
198
196
  key: 'companyName',
199
197
  width: 40,
200
198
  type: 'string'
@@ -219,7 +217,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
219
217
  type: 'string',
220
218
  name: 'email',
221
219
  record: { editable: true },
222
- imex: { header: i18next.t('field.contact_point_email'), key: 'email', width: 40, type: 'string' },
220
+ imex: { header: '*' + i18next.t('field.contact_point_email'), key: 'email', width: 40, type: 'string' },
223
221
  header: i18next.t('field.contact_point_email'),
224
222
  width: 120
225
223
  },
@@ -236,7 +234,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
236
234
  name: 'phone',
237
235
  record: { editable: true },
238
236
  imex: { header: '*' + i18next.t('field.contact_point_phone'), key: 'phone', width: 40, type: 'string' },
239
- header: '*' + i18next.t('field.contact_point_phone'),
237
+ header: i18next.t('field.contact_point_phone'),
240
238
  width: 120
241
239
  },
242
240
  {
@@ -244,7 +242,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
244
242
  name: 'accountNo',
245
243
  record: { editable: true },
246
244
  imex: {
247
- header: i18next.t('field.contact_point_account_no'),
245
+ header: '*' + i18next.t('field.contact_point_account_no'),
248
246
  key: 'accountNo',
249
247
  width: 40,
250
248
  type: 'string'
@@ -256,13 +254,8 @@ export class ContactPointList extends localize(i18next)(PageView) {
256
254
  type: 'string',
257
255
  name: 'address',
258
256
  record: { editable: true },
259
- imex: {
260
- header: '*' + i18next.t('field.contact_point_company_address'),
261
- key: 'address',
262
- width: 40,
263
- type: 'string'
264
- },
265
- header: '*' + i18next.t('field.contact_point_company_address'),
257
+ imex: { header: i18next.t('field.contact_point_company_address'), key: 'address', width: 40, type: 'string' },
258
+ header: i18next.t('field.contact_point_company_address'),
266
259
  width: 300
267
260
  },
268
261
  {
@@ -307,7 +300,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
307
300
  name: 'billingAddress',
308
301
  record: { editable: true },
309
302
  imex: {
310
- header: i18next.t('field.contact_point_billing_address'),
303
+ header: '*' + i18next.t('field.contact_point_billing_address'),
311
304
  key: 'billingAddress',
312
305
  width: 40,
313
306
  type: 'string'
@@ -318,7 +311,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
318
311
  {
319
312
  name: 'type',
320
313
  record: { editable: true },
321
- header: '*' + i18next.t('field.contact_point_type'),
314
+ header: i18next.t('field.contact_point_type'),
322
315
  type: 'code',
323
316
  imex: {
324
317
  header: '*' + i18next.t('field.contact_point_type'),
@@ -438,8 +431,6 @@ export class ContactPointList extends localize(i18next)(PageView) {
438
431
  return this.showToast(i18next.t('text.nothing_changed'))
439
432
  }
440
433
 
441
- this._validate()
442
-
443
434
  const response = await client.mutate({
444
435
  mutation: gql`
445
436
  mutation updateMultipleContactPoint($patches: [ContactPointPatch!]!) {
@@ -457,32 +448,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
457
448
  this.dataGrist.fetch()
458
449
  }
459
450
  } catch (error) {
460
- this.showToast(error.message)
461
- }
462
- }
463
-
464
- _validate() {
465
- let errors = []
466
-
467
- let data = this.dataGrist._data.records.map(itm => {
468
- itm.error = false
469
- z
470
-
471
- if (isEmpty(itm.name) || '') {
472
- itm.error = true
473
- if (!errors.find(err => err.type == 'customerName'))
474
- errors.push({ type: 'customerName', value: 'customer name is required' })
475
- }
476
- return itm
477
- })
478
-
479
- if (errors.length > 0) {
480
- this._data = {
481
- ...this.dataGrist.dirtyData,
482
- records: data
483
- }
484
-
485
- throw new Error(errors.map(itm => itm.value).join(', '))
451
+ this.showToast(error)
486
452
  }
487
453
  }
488
454
 
@@ -523,8 +489,7 @@ export class ContactPointList extends localize(i18next)(PageView) {
523
489
  }
524
490
  }
525
491
 
526
- async _validateImport(data) {
527
- const contactTypes = await getCodeByName('CONTACT_TYPES')
492
+ _validateImport(data) {
528
493
  let errors = []
529
494
 
530
495
  data = data.map(item => {
@@ -558,11 +523,6 @@ export class ContactPointList extends localize(i18next)(PageView) {
558
523
  }
559
524
  }
560
525
 
561
- let foundContactTypes = contactTypes.find(exist => exist.name == item.type)
562
- if (!foundContactTypes) {
563
- throw new Error(i18next.t('text.contact_type_does_not_exist'))
564
- }
565
-
566
526
  return item
567
527
  })
568
528
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/biz-ui",
3
- "version": "4.3.113-alpha.0",
3
+ "version": "4.3.114",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,14 +24,14 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/biz-base": "^4.3.113-alpha.0",
28
- "@things-factory/code-base": "^4.3.113-alpha.0",
29
- "@things-factory/form-ui": "^4.3.113-alpha.0",
30
- "@things-factory/grist-ui": "^4.3.113-alpha.0",
31
- "@things-factory/i18n-base": "^4.3.113-alpha.0",
32
- "@things-factory/import-ui": "^4.3.113-alpha.0",
33
- "@things-factory/layout-base": "^4.3.113-alpha.0",
34
- "@things-factory/shell": "^4.3.113-alpha.0"
27
+ "@things-factory/biz-base": "^4.3.114",
28
+ "@things-factory/code-base": "^4.3.114",
29
+ "@things-factory/form-ui": "^4.3.114",
30
+ "@things-factory/grist-ui": "^4.3.114",
31
+ "@things-factory/i18n-base": "^4.3.114",
32
+ "@things-factory/import-ui": "^4.3.114",
33
+ "@things-factory/layout-base": "^4.3.114",
34
+ "@things-factory/shell": "^4.3.114"
35
35
  },
36
- "gitHead": "3dd2e6f58cc2828ab5e2658d3fa47120165c802b"
36
+ "gitHead": "6f16bd9dfb3210e848e5118d894424972ed83773"
37
37
  }