semanticdb-core 1.0.39 → 1.0.41

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.
@@ -16,4 +16,4 @@ export declare function isDateForm(dateValue: any): boolean;
16
16
  * @param {Boolean} flag 本函数是否在yoymomsplysplm.ts获得最小粒度时被调用
17
17
  * @return {String}
18
18
  */
19
- export declare function getMinGran(date: any, flag?: boolean): "year" | "quarter" | "month" | "week" | "day" | "hour" | "minute" | "second" | "date" | "w" | "y" | "years" | "months" | "M" | "weeks" | "days" | "d" | "hours" | "h" | "minutes" | "m" | "seconds" | "s" | "millisecond" | "milliseconds" | "ms" | "quarters" | "Q" | "isoWeek" | "isoWeeks" | "W" | "dates" | "D" | null;
19
+ export declare function getMinGran(date: any, flag?: boolean): unitOfTime.Base | unitOfTime._quarter | unitOfTime._isoWeek | unitOfTime._date | null;
@@ -127,6 +127,9 @@ function getMinGran(date, flag = false) {
127
127
  for (const tw of [...exports.grans].reverse()) {
128
128
  if (gte.isSame((0, moment_1.default)(gte).startOf(tw), 'second') &&
129
129
  lte.isSame((0, moment_1.default)(lte).endOf(tw), 'second')) {
130
+ if (tw === 'isoWeek') {
131
+ return 'week';
132
+ }
130
133
  return tw;
131
134
  }
132
135
  }
@@ -146,6 +146,7 @@ const isDimensionInLogicform = (logicform, dimension, strictMode = true) => {
146
146
  }
147
147
  }
148
148
  }
149
+ // dailyavg', '$monthlyavg', '$yearlyavg', '$weeklyavg, to be deprecated
149
150
  {
150
151
  const avgPreds = logicform.preds
151
152
  .filter((pred) => pred.operator &&
@@ -170,6 +171,18 @@ const isDimensionInLogicform = (logicform, dimension, strictMode = true) => {
170
171
  return tws.indexOf(minTWGranInLogicform) >= tws.indexOf(dimension.level);
171
172
  }
172
173
  }
174
+ // by timewindow:这个可能是未来唯一的表达方式
175
+ {
176
+ const twPreds = logicform.preds.filter((pred) => pred.by && typeof pred.by === 'string' && pred.by.startsWith('$'));
177
+ if (twPreds.length > 0) {
178
+ const minTWGranInLogicform = underscore_1.default.min(twPreds, (i) => tws.indexOf(i.by.slice(1)));
179
+ // 如果粒度没到,那么就返回false
180
+ if (minTWGranInLogicform && typeof minTWGranInLogicform === 'object') {
181
+ return (tws.indexOf(minTWGranInLogicform.by.slice(1)) >=
182
+ tws.indexOf(dimension.level));
183
+ }
184
+ }
185
+ }
173
186
  }
174
187
  const dimInLFIgnoreLevel = isDimensionInLogicformIgnoreLevel(logicform, dimension, strictMode);
175
188
  if (!dimInLFIgnoreLevel)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semanticdb-core",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [