@things-factory/id-rule-base 6.2.115 → 6.2.121

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.
@@ -115,16 +115,14 @@ export class GristCodeInputPopup extends LitElement {
115
115
  }
116
116
 
117
117
  updated(changed) {
118
- if (changed.has('value')) {
119
- if (this.value && typeof this.value === 'string') {
120
- this.getRule(this.value)
121
- }
118
+ if (changed.has('record') && !this.value) {
119
+ this.record.name && this.getRule(this.record.name)
122
120
  }
123
121
  }
124
122
 
125
- async getRule() {
123
+ async getRule(type) {
126
124
  var response = await client.query({
127
- query: FETCH_ID_RULE_GQL(this.value),
125
+ query: FETCH_ID_RULE_GQL(type),
128
126
  context: gqlContext()
129
127
  })
130
128
 
@@ -139,22 +137,24 @@ export class GristCodeInputPopup extends LitElement {
139
137
 
140
138
  async createIdRule() {
141
139
  var idRule = {
142
- type: this.value,
140
+ type: this.record.name,
143
141
  rule: `return ''`
144
142
  }
145
143
 
146
- return await client.mutate({
147
- mutation: gql`
148
- mutation createIdRule($idRule: NewIdRule!) {
149
- createIdRule(idRule: $idRule) {
150
- type
151
- rule
144
+ return (
145
+ await client.mutate({
146
+ mutation: gql`
147
+ mutation createIdRule($idRule: NewIdRule!) {
148
+ createIdRule(idRule: $idRule) {
149
+ type
150
+ rule
151
+ }
152
152
  }
153
- }
154
- `,
155
- variables: { idRule },
156
- context: gqlContext()
157
- })
153
+ `,
154
+ variables: { idRule },
155
+ context: gqlContext()
156
+ })
157
+ ).data?.createIdRule
158
158
  }
159
159
 
160
160
  async updateIdRule() {